SCCM PowerShell: Connect to SCCM Function



Today’s post is another time-saver function I wrote to connect to SCCM. Again, it is designed to eliminate the need to hard code the module path and/or the SCCM primary site. It allows me to just type Connect-SCCM to import the module then enter to the SCCM PSdrive.

Like my MDT function this one locates the install path from the registry to help discover the module location. It will then detect the SCCM PS drive automagically and set the location to it.

I’ve uploaded it to the Technet script repository here and again below is the simplified version.

Function Connect-SCCM { 

    If (!(Get-Module ConfigurationManager)) { 

        [String]$SCCMInstall = ((Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\ConfigMgr10\Setup').'UI Installation Directory') 

            Import-Module ($SCCMInstall +'bin\ConfigurationManager.psd1') -Scope Global 


    Set-Location ((get-psdrive -PSProvider CMSite).Name+":") 


About Andrew Barnes

A Scripting and Deployment Specialist.
This entry was posted in MDT 2010, MDT 2012, MDT 2013, PowerShell and tagged , , . Bookmark the permalink.

2 Responses to SCCM PowerShell: Connect to SCCM Function

  1. davidjohnson529424291 says:

    again an extraneous | in the last line of the code on codeplex if you select the code and then copy to a new blank page… download is fine just the displayed code as the extra }


  2. you are a god amnong the helpfull people in the internets!!!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s