Answered by:

Script to disable 64-bit file system redirection

Question

I am trying to run some scripts through SCCM 2007 on Windows 7 x64 machines.

When I test the scripts using psexec -s cmd to start a command prompt with the system account they work fine. If I start a command prompt through SCCM then they don't work. The reason is that the SCCM client is a 32bit application, so file system redirection
is automatically changing the paths from %Windir%/system32 to %Windir%/syswow64.

I have been able to make the scripts work through SCCM by running them as a task sequence, and checking "Disable 64-bit file system redirection", but I would prefer to do this directly in the script.

If I start a command prompt through SCCM then they don't work. The reason is that the SCCM client is a 32bit application, so file system redirection is automatically changing the paths from %Windir%/system32 to %Windir%/syswow64.

I am trying to run some scripts through SCCM 2007 on Windows 7 x64 machines.

When I test the scripts using psexec -s cmd to start a command prompt with the system account they work fine. If I start a command prompt through SCCM then they don't work. The reason is that the SCCM client is a 32bit application, so file system redirection
is automatically changing the paths from %Windir%/system32 to %Windir%/syswow64.

I have been able to make the scripts work through SCCM by running them as a task sequence, and checking "Disable 64-bit file system redirection", but I would prefer to do this directly in the script.

Anyone know a way of doing this?

It does not make sense to run a remote script and use PsExec inside the script. PsExec is a remoting utility.

Why would you want to start a remote command prompt? Do you mean you want to execute a remote batch file? Just call the batch file without PsExec.

To obtain the script session properties reference the SCCM object that is habded into the script. See the SCCM scripting samples in teh installation folder or on the SCCM web site.

If you are executing the script on the SCCM computer then you cannot likely change teh session architecture from within the script session. This would not make any sense.

I recommend starting here to get a better understanding of how SCCM works and how it is intended to be used. It will save you a lot of wasted time.

One of the things I am trying to do is to backup Bitlocker recovery keys to AD through SCCM using the command manage-bde.exe. This is a 64 bit application and is found under %Windir%/system32.

A method I have used to test scripts before publishing them in SCCM is to start a command prompt with the local system account using psexec.exe -s cmd Running the manage-bde command works fine like this. However, if I try and run manage-bde.exe command through
SCCM it fails, as it doesn't find the manage-bde.exe file.

This is because its a 64bit app and resides at %Windir%/system32. The SCCM client is a 32bit application, so when it tries to run an .exe file under %Windir%/system32 it is automatically redirected to %Windir%/syswow64, and the manage-bde.exe file doesn't
exist in this location. I understand this and expect it to happen, but it doesn't help me when backing up Bitlocker keys.