Run 64-bit PowerShell via SCCM 2007 Advertisement

Written by Tao Yang

A colleague came across a problem today. He could run a SCDPM PowerShell script from PowerShell console successfully but could not run it when packaged it in SCCM.

We soon found out it’s because SCCM 2007 is a 32-bit app and DPM PowerShell snapin is only available for 64-bit PowerShell because we could not run the script from a 32-bit PowerShell console.

When a 32-bit application tries to access %WinDir%\system32, Windows redirects it to %WinDir%\SysWOW64. In order for the 32-bit app to access %WinDir%\System32 folder, we have to use %Windir%\sysnative.

So, we set the command line of the program in SCCM package to “%WinDir%\Sysnative\WindowsPowerShell\V1.0\Powershell.exe” –noprofile .\PowerShellScript.ps1 as that’s where the 64-bit version of PowerShell is and the SCCM advertisement ran successfully on the client.

More reading regarding to file system redirection here: http://support.microsoft.com/kb/942589

4 comments on “Run 64-bit PowerShell via SCCM 2007 Advertisement

  1. Yep came across this again the other day when running reg.exe inside a batch file on a 64-bit OS. Same solution, needed to reference the reg.exe in SysNative…

  2. Pingback: Always start powershell.exe process in 64-bits mode

  3. Pingback: Episode 241 – PowerScripting Podcast – Microsoft PFE Matthew Reynolds on the Windows Performance Toolkit | PowerShell.org

  4. Thanks for this, was just what I needed

Leave a Reply