I’m not sure where I read it, but I’m pretty sure someone once said “Learn PowerShell or become obsolete”. It’s pretty much a key skills requirement for most roles in infrastructure these days and besides System Center 2012 is basically all PowerShell under the hood, so at least understanding it puts the odds in your favour.
But lets keep things in perspective, there are lots of “very important” I.T professionals who really push the PowerShell envelope. I’m not one of them, I do agree its a key skill that’s needed. Will you become obsolete? No. Probably not. Lets face it, if you “Google” hard enough you can find out how to do just about anything. Including PowerShell.
I have to do loads of hand-overs and document configurations etc for SCCM, so doing certain jobs via PowerShell actually makes the mundane documentation process a little easier. I’ve also been asked to handover the basics of how PowerShell and SCCM fit together. So, I decided to put together a series of posts that will give you the basics of PowerShell in SCCM. This is part 1.
So lets begin!
1: You will need to have PowerShell 3.0 installed … believe me, I’ve not always there … just encase you don’t have it grab it here https://www.microsoft.com/en-us/download/details.aspx?id=34595
2: Lets import the configuration manager module, to do this run PowerShell as administrator. We can now use the built in PowerShell cmdlet that allows you to import modules, in our case it will be the SCCM modules.
To do this go to the following location via PowerShell,
C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin
Then type import-module .\ConfigurationManager.psd1 -verbose the entire command will look like this
PS C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin> import-module .\ConfigurationManager.psd1 -verbose
You will notice that PowerShell starts to list everything it’s busy importing!
To make sure your import worked, connect to your site and type the following
PS C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin>cd XXX:
(Where XXX is your site code)
Then Type Get-CMSite
3: To access PowerShell cmdlet for SCCM open the SCCM console and open the PowerShell functions via the top left and select “Connect via Windows PowerShell”
Good, so here is a list of the basics you can start using as well as their functions.
3.1: Get-CMSite You’ll be presented information about your site
3.2: Get-CMManagementPoint You’ll see information about your Management Point
3.3: Get-CMDistributionPoint You’ll see information about your Distribution Point
In the second part of this series, I will cover some more of the basics you can use to help yourself using PowerShell.
Enjoy – Heinrich Pelser