How to Launch PowerShell from the ConfigMgr Console

Prajwal Desai
Posted by Prajwal Desai
Launch PowerShell from the ConfigMgr Console

In this post, you’ll learn how to launch PowerShell from the ConfigMgr console. Once you connect to PowerShell from the SCCM console, you can run ConfigMgr PowerShell cmdlets.

The easiest method to open PowerShell session is directly from the Configuration Manager console, which allows running cmdlets. The Configuration Manager PowerShell cmdlet library supports PowerShell 7 on the latest current branch versions.

Most of you might be aware that you can use Windows PowerShell to manage your Configuration Manager hierarchy. You can use PowerShell scripts to automate or extend Configuration Manager.

You can run the Configuration Manager cmdlets and scripts in PowerShell from the ConfigMgr console or from a Windows PowerShell session. When you use the Configuration Manager console to run cmdlets, your session automatically runs in the site’s context.

Note that starting in SCCM version 2103, the Configuration Manager PowerShell module requires Microsoft .NET version 4.7.2 or later. Make sure the.NET Framework on the SCCM server is updated to 4.7.2 before running ConfigMgr PowerShell cmdlets.

How to Launch PowerShell from the ConfigMgr Console

Perform the following steps to launch PowerShell from the SCCM console:

  • Launch the Configuration Manager console.
  • In the upper-left corner, there’s a blue rectangle. Select the white arrow in the blue rectangle, and choose Connect via Windows PowerShell.
Launch PowerShell from the ConfigMgr Console
Launch PowerShell from the ConfigMgr Console

After Windows PowerShell loads, you’ll see a prompt that contains your site code. For example, if the site code is “MCM“, the prompt looks like: PS MCM:> This confirms that you have successfully launched the PowerShell from the SCCM console.

Launch PowerShell from the ConfigMgr Console
Launch PowerShell from the ConfigMgr Console

Run Get-CMSite PowerShell Command

To verify if you have successfully connected to PowerShell from the ConfigMgr console, run the Get-CMSite cmdlet. This cmdlet returns information about the Configuration Manager site you’re currently connected to and any child sites. For example, the site server name, SCCM build number, installation directory, site name, and version.

SmsProviderObjectPath       : SMS_Site.SiteCode="MCM"
BuildNumber                 : 9096
ContentLibraryLocation      :
ContentLibraryMoveProgress  : 100
ContentLibraryStatus        : 3
Features                    : 0000000000000000000000000000000000000000000000000000000000000000
InstallDir                  : C:\Program Files\Microsoft Configuration Manager
Mode                        : 0
ReportingSiteCode           :
RequestedStatus             : 110
SecondarySiteCMUpdateStatus : 2
ServerName                  : corpcm.prajwal.local
SiteCode                    : MCM
SiteName                    : Microsoft Configuration Manager Primary Site
Status                      : 1
TimeZoneInfo                : FFFFFEB6 0000 0000 0000 0000 0000 0000 0000 0000 00000000 0000 0000 0000 0000 0000 0000
                              0000 0000 FFFFFFC4
Type                        : 2
Version                     : 5.00.9096.1000
Run ConfigMgr PowerShell cmdlets
Run ConfigMgr PowerShell cmdlets

Note: When you start PowerShell or the PowerShell ISE from the Configuration Manager console, it uses the “AllSigned” execution policy for the Process scope.

Import the Configuration Manager PowerShell module

You can connect to Configuration Manager from an existing Windows PowerShell session by manually loading the Configuration Manager module.

  • Open a Windows PowerShell session from the Start menu.
  • Import the Configuration Manager module by using the Import-Module ConfigurationManager cmdlet.
Import the Configuration Manager PowerShell module
Import the Configuration Manager PowerShell module

Note: Starting in ConfigMgr version 2111, when you install the Configuration Manager console, the path to the module is now added to the system environment variable, PSModulePath.

Share This Article
Prajwal Desai
Posted by Prajwal Desai
Follow:
Prajwal Desai is a Microsoft MVP in Intune and SCCM. He writes articles on SCCM, Intune, Windows 365, Windows Server, Windows 11, WordPress and other topics, with the goal of providing people with useful information.
Leave a comment