ConfigMgr and PowerShell ISE (x86)

I typically run the PowerShell ISE (x86) (instead of the PowerShell command prompt) when running commands and writing scripts for ConfigMgr. It provides the flexibility to highlight portions of your script and execute just that section. You can also echo out the contents of a variable on the command line below at any time to see if it matches up with your expected results – very handy for troubleshooting.

My friend Greg Ramsey wrote a great article (ConfigMgr and PowerShell-Preparing Your Environment – Part II/) on how to create a shortcut to a script that will automatically load the ConfigMgr module.  If you save your file as Microsoft.PowerShell_profile.ps1 and copy the it into C:\Windows\SysWOW64\WindowsPowerShell\v1.0\, the next time any user on that system runs PowerShell ISE (x86) it will automatically load the ConfigMgr module and set the psdrive to your preferred site.

Remember, this requires PowerShell 3 or later and the ConfigMgr 2012 Admin SP1 (with SP1 CU2 or later for best results) Console in order to work.  Since the ConfigMgr PowerShell module is 32-bit, it needs to be run in 32-bit PowerShell in order to work.

Hopefully you find this trick useful and it gets you using PowerShell with ConfigMgr more often.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.