locked
Deployment of Powershell Scripts in a 64-bit Environment via SCCM RRS feed

  • Question

  • Hello,

    I've come across a problem whilst deploying Powershell scripts to 64-bit Windows.

    When a script is deployed by SCCM the Powershell environment is 32-bit, even on 64-bit windows.

    Is there anyway to force the script to run in a 64-bit environment?

    Thanks,

    George


    Wednesday, July 17, 2013 12:10 PM

Answers

  • Assuming that you are using a package and program to do this, this is a known consequence of the program execution environment being 32-bit in ConfigMgr.

    The work-around is to run your script from a batch file and call powershell.exe from system32 if on a 32-bit OS or from %windir%\sysnative if on a 64-bit OS (you need a hotfix for sysnative to be valid on WinXP though, it's fine on Vista and up).


    Jason | http://blog.configmgrftw.com

    Wednesday, July 17, 2013 6:10 PM

All replies

  • Assuming that you are using a package and program to do this, this is a known consequence of the program execution environment being 32-bit in ConfigMgr.

    The work-around is to run your script from a batch file and call powershell.exe from system32 if on a 32-bit OS or from %windir%\sysnative if on a 64-bit OS (you need a hotfix for sysnative to be valid on WinXP though, it's fine on Vista and up).


    Jason | http://blog.configmgrftw.com

    Wednesday, July 17, 2013 6:10 PM
  • This is what I do in my batch file:

    If "%PROCESSOR_ARCHITEW6432%"=="" GOTO Native

    %windir%\Sysnative\windowsPowershell\V1.0\PowerShell.exe -NoProfile -ExecutionPolicy Bypass -file %~dp0MyScript.ps1

    GOTO END

    :Native
    PowerShell.exe -NoProfile -ExecutionPolicy Bypass -file %~dp0MyScript.ps1

    :END


    Wednesday, November 6, 2013 2:04 PM