Tuesday, January 15, 2013

System Center Configuration Manager (SCCM) 2012 SP1 & PowerShell


Post installing or upgrading to System Center Configuration Manager (SCCM) 2012 SP1, PowerShell is one of the features you will be excited to try. Though needless to introduce you to the benefits of PowerShell in general, but in short introduction of PowerShell cmdlets (~470) in SCCM 2012 SP1 release, helps to automate otherwise repetitive administrative tasks in SP1 environment. Also it helps to systematic passion to execute of tasks thru such automation, as ruling out manual efforts may eliminate errors.

Though Integrating PowerShell module (importing.. precisely) in SCCM is easier there are few points that helps you to know in advance to save your time, as it sounded little confusing especially when you have Windows Server 64 bit, as PowerShell module that will be loaded is 32 bit.

Prerequisites:
SCCM 2012 SP1, which has prerequisite for its successful install/upgrade i.e. Windows Management Framework 3.0 which in turn brings in PowerShell 3.0. SP1 install or upgrade copies necessary PowerShell Models for SCCM 2012 SP1 sites administration, this file is located under C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ ConfigurationManager.psd1. Either this modules needs to imported manually or it will be loaded automatically based on how you connect to PowerShell for SCCM 2012 SP1 administration. So in a way all if you install SP1 successfully PowerShell cmdlets are almost there on your SCCM server but just needs to be imported to use in your PowerShell session  

 How to connect to PowerShell:  
1)  You can use SCCM console to connect to PowerShell, which will import automatically ready to use cmdlets of SCCM 2012 SP1 administration. Connecting to PowerShell this way, takes you to PowerShell context that is ready to use cmdlets of Configuration Manager  

                                                                Or
2)  If you are on 64bit OS, Launch x86 flavor of PowerShell and import SCCM 2012 SP1 module into that session

a.       Start > Run > “%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe”

Or Start > PowerShell > Select PowerShell (X86)
b.       Import module below way and you will be connected

                                                               i.      cd ‘.\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin’

                                                              ii.      Import-Module .\ConfigurationManager.psd1

                                                            iii.      Set-Location <3 letter sitecode>:    (Example: Set-location CEN if you site code is CEN)


 
How to get started:  
Once you are successfully connected to PowerShell module of ConfigurationManager, context of PowerShell displayes 3 letter site code of your SCCM site. Configuration Manager cmdlets are available for execution in this context only. If you change context to C: drive or so cmdlets of SCCM won’t be available

            PS JAN:\> Get-Command -Module ConfigurationManager   (This gives list of cmdlets available for configuration manager administration)
         
How to get help:
Default cmdlets of help to an extent like get-help, get-help –examples etc but “get-help –online” doesn’t seem to provide much help as online links aren’t going to specific cmdlets but opens up SC tech resources page. Hope MS will fix it shortly

What to try:
Like newbee to SQL or Scripting, it is wise to try all cmdlets that retrieve information from site but not make any changes. They are start with Get, like Get-cmmanagementpoint, for example provides info on MP of that site. Once you are more comfortable then rest of the categories like set, add, remove J etc

You may find below sources help you take your learning’s to next to level get stronger grip on this module. Microsoft has taken great amount efforts to make the job easier as approximately 470 cmdlets should be more than suffice and ideally allow us to automate literally any action on You onfiguration manager administration. I am sure you will enjoy these features as they allows us to focus more on even better and value added tasks for organization… Enjoy !!!



 

 

No comments:

Post a Comment