SCCM 2012 - .cmd commands executed on remote 64 bit client

If you need to create a .cmd that need to copy files in c:\windows\system32 there is an important thing to consider:

Remote pcs 32 or 64 bit O.S. version

Infact you need to consider this commands on 32 bits or 64 bits


if %PROCESSOR_ARCHITECTURE%==x86 (
copy file.dat %systemroot%\system32
) else (
copy file.dat %systemroot%\sysnative
)

infact, on 64 bit system command is interpreted like follow:

%systemroot%\system32  --> C:\Windows\SysWOW64

And check if you are using the 64 or 32 bit cmd.exe. (You did know there are two?) 

The 32 bit one redirects system32 to SYSWOW64  - read the Wiki about wow64 at http://en.wikipedia.org/wiki/WoW64

64 bit... %windir%\system32\cmd.exe
32 bit... %windir%\syswow64\cmd.exe

in SCCM 2012 if cmd is executed like 32 bits you need to take care about this two options:

copy file_name %systemroot%\system32 (32 bit)

copy file_name %systemroot%\sysnative (64 bit)


Further details:

http://www.computerhope.com/forum/index.php?topic=127548.0