I know you are going to laugh why did I write this post, this is not new, but once again I forgot it and spent few hours wonder why my SCCM package didn’t work.
(Maybe shouldn’t do any SCCM stuff after vacation. I was on one week holiday trip in Tenerife. :D)
The job was simply, copy one file to C:\Windows\System32 folder use SCCM package, not application.
What…it didn’t work ?!?! 👿
Why?!?! Well, because client machine is 64-bit Windows, the file has copied to C:\Windows\SysWOW64 folder, instead of C:\Windows\System32
Here is another blog about the virtual folder Sysnative https://scottiestech.info/2009/06/20/calling-a-32-bit-system-command-from-a-script-in-x64-windows/
So in the end, I use this and it works. Create a bat, example copy.bat, and put this in it, so it will work on both 32 bit and 64 bit.
@echo off cd /d %~dp0 :CheckOS IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT) :64BIT "%windir%\Sysnative\cmd.exe" /c xcopy /Y testfile.txt "%windir%\system32" GOTO END :32BIT cmd.exe /c xcopy /Y testfile.txt "%windir%\system32" GOTO END :END