Thursday, August 18, 2011

Running 64-bit Powershell scripts via SCCM

It kind off started worrying me a bit when i was deploying SCCM 2007 R3 and i wanted to run several power shell scripts that needed to install some Windows Features. I just didn't want to work. Finally after several days, several reinstallations of my test VM, etc, etc i got it working and this is how to do it:



When i started my project, i thought (as probably every newbie with SCCM) i just needed to create my scripts and then make a package and a program to run it in SCCM. It should work you think. The problem is unfortunately that SCCM is not 64-bit. Therefore if you advertise a program/script via the normal routine, it starts a 32-bit process. This however creates problems when you want a script to install windows features or anything else via powershell that requires the 64-bit version of powershell.

The solution to this is quitte simple actually. You just need to create a task sequence and add a "Run Command line" task and put the following command in:

powershell.exe <path to script>

Note: If the path to your script is on a central network repository you need to fill in the complete networkpath.

After adding the command select "Disable 64-bit file system redirection". This option allows 64-bit applications to run as 64-bit applications instead of redirecting it to the 32-bit version.

This is it actually.

Pretty frusty to see that i needed to spent so many hours on this :S. This is also because the logging in SCCM is pretty poor. But that's my opinion ;)

No comments:

Post a Comment