Share This Post

CM12 SP1 and Powershell

Hi All,

as you may be aware, CM12 SP1 brings support for powershell and it is really easy to play…once you have the console installed, you can click Connect via Powershell

and voila..powershell is open and you can start using powershell…

however, i was trying to use powershell without the console, i had it installed, but i did not wanted to open it to start the powershell..but how?!?!?!?!

the 1st thing i did was to open powershell and import the correct modules…

CM12 have a file called psd1 inside the <cm12 admincolsole installation folder>\bin

doesnt matter how many times i was trying to import, it never worked…

**note: 001 is my site code

and today, after reading an e-mail from David Randall, he showed me the light..you need to use Powershell 32bits…

it seems obvious as the console is a 32bits application, but it is not that obvious as the default powershell on Windows 2008 R2 is 64bits…

anyway…these are the steps you should take..

1- open powershell (32 bits version)…but if you're not sure, couple of clues

2- type [IntPtr]::size it should be 4 for 32bits and 8 for 64bits

3- import the psd1 file

4- use get-psdrive and you'll your sitecode and provider CMSite listed

5- you can see that the module was imported using the get-command

6- you can see all commands with get-command -module configurationmanager

7- when you change the drive to the cm12 provider, you won't receive any error. It is really easy, like navigating on msdos using cd…CD <SITECODE>: (do not forget the ":" at the end)

8-and you can now start using the powershell commands, like get-cmsite

the only think you need to be aware is when you're not on the "CM Drive"…it is not obvious at the 1st time and the error says: This command can not execute from the current drive.

i was getting this error and i spend lots of time trying to find the drive and try to run from every single cm12 drive…i also tought that the installation should only work on c drive and i rebuild my lab couple of times as my default installation is on d drive…

once i gave up trying to figure out myself and asked help…everything started working…

i've been trying to use it for a while and i was not able…

Share This Post

Leave a Reply