Get started with Configuration Manager cmdlets

Applies to: Configuration Manager (current branch)

Use Windows PowerShell to manage your Configuration Manager hierarchy. You can use PowerShell scripts to automate or extend Configuration Manager similar to other documented approaches using WMI and C#. For more information, see Configuration Manager SDK.

Run Configuration Manager cmdlets and scripts in PowerShell from the Configuration Manager console or from a Windows PowerShell session. When you run Configuration Manager cmdlets by using the Configuration Manager console, your session automatically runs in the context of the site.


All currently supported versions of Configuration Manager current branch support Windows PowerShell version 5.1. If you've already installed PowerShell version 7, you can still use PowerShell version 5.1. For more information, see Using PowerShell 7 side-by-side with Windows PowerShell 5.1.

The Configuration Manager PowerShell cmdlet library supports PowerShell 7. For more information, see Support for PowerShell version 7.

Starting in version 2103, the ConfigurationManager PowerShell module requires Microsoft .NET version 4.7.2 or later.

PowerShell from the Configuration Manager console

The easiest method to open PowerShell is directly from the Configuration Manager console.

  1. 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.

  2. After Windows PowerShell loads, you'll see a prompt that contains your site code. For example, if the site code is "ABC", the prompt looks like: PS ABC:\>

  3. To verify it works, use 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, installation director, site name, and version.


When you start PowerShell or the PowerShell ISE from the Configuration Manager console, it uses the AllSigned execution policy for the Process scope. If this default secure configuration is too much for your environment, there are two options to work around it:

Import the Configuration Manager PowerShell module

Connect to Configuration Manager from an existing Windows PowerShell session by manually loading the Configuration Manager module.

  1. Open a Windows PowerShell session from the Start menu.

  2. Import the Configuration Manager module by using the Import-Module cmdlet. Specify the path to the Configuration Manager module, or change to the directory that contains the module. By default, the module is at the following path: C:\Program Files (x86)\Microsoft Endpoint Manager\AdminConsole\bin\ConfigurationManager.psd1

    Starting in version 2111, when you install the Configuration Manager console, the path to the module is now added to the system environment variable, PSModulePath. For more information, see about_PSModulePath. With this change, you can import the module just by its name: Import-Module ConfigurationManager


    Make sure you don't import an older version of the module that might exist in another folder. After you import the module, use the following commands to check the module version and path:

    (Get-Module -Name ConfigurationManager).Version
    (Get-Module -Name ConfigurationManager).Path

    The following example changes to the module's directory and then imports it:

    Set-Location 'C:\Program Files (x86)\Microsoft Endpoint Manager\AdminConsole\bin'
    Import-Module .\ConfigurationManager.psd1


    You can also use the SMS_ADMIN_UI_PATH environment variable. For example:

    Set-Location "$env:SMS_ADMIN_UI_PATH\..\"

    Also, you can use the cd alias to change directories instead of the Set-Location cmdlet.

  3. If it's the first time importing the Configuration Manager module on this computer, you may need to create the site drive. For example:

    New-PSDrive -Name "ABC" -PSProvider "CMSite" -Root "" -Description "Primary site"


    When you start PowerShell from the console, it automatically creates the PSDrive as a convenience for the currently connected site. If you're in a hierarchy, use New-PSDrive to create drives for each site.

  4. To run the Configuration Manager cmdlets, you need to switch the path to the Configuration Manager site. In the following example, the site code is ABC:

    Set-Location ABC:
  5. Confirm that PowerShell properly loaded the Configuration Manager module by using the Get-CMSite cmdlet.

Update help

To get the latest information for the Configuration Manager PowerShell module, use the Update-Help cmdlet. This content is the same as what's published on Microsoft Learn for the ConfigurationManager module.


Because of a change in how the updateable content is structured and published with the release of version 2103, don't use Update-Help on a version 2010 site. Update the site to version 2103 or later, and then update the local help content.

For more information, see PowerShell version 2103 release notes.

The computer on which you run this cmdlet needs internet access, specifically Then run the following command from an elevated PowerShell session:

Update-Help -Module ConfigurationManager

After you update the Configuration Manager cmdlet help, you can get help about the cmdlets by using the Get-Help cmdlet. For example:

Get-Help Get-CMDevice
Get-Help Get-CMDevice -Examples
Get-Help Get-CMDevice -Parameter *

For more information, see the following PowerShell blog post: You've got Help!.

Common parameters

All Configuration Manager cmdlets support the common PowerShell parameters:

  • Debug
  • ErrorAction
  • ErrorVariable
  • InformationAction
  • InformationVariable
  • OutVariable
  • OutBuffer
  • PipelineVariable
  • Verbose
  • WarningAction
  • WarningVariable

For more information, see about_CommonParameters.

Support for PowerShell version 7

The Configuration Manager PowerShell cmdlet library supports PowerShell version 7. For more information on PowerShell 7, including directions on how to download and install it, see Install PowerShell on Windows.


PowerShell 7 runs as pwsh.exe. Earlier versions of PowerShell run as powershell.exe.

Cmdlets that don't support PowerShell version 7

The following cmdlets don't support PowerShell 7:

  • Import-CMPackage
  • Import-CMDriverPackage
  • Import-CMTaskSequence
  • Export-CMPackage
  • Export-CMDriverPackage
  • Export-CMTaskSequence
  • Add-CMReportingServicePoint
  • Get-CMReportingServicePoint
  • Remove-CMReportingServicePoint
  • Set-CMReportingServicePoint

They require the .NET Framework instead of .NET Core that's used with PowerShell version 7.

Starting in version 2103, if you try to use these cmdlets in a PowerShell version 7 session, they fail with the following error: This cmdlet only supports the ".NET Framework" runtime.

Known issues with PowerShell version 7

  • You can't launch PowerShell 7 directly from the Configuration Manager console. Manually start PowerShell 7, and then import the Configuration Manager module.

  • Current support is only for the Configuration Manager cmdlets. Other features of Configuration Manager that rely on PowerShell may not support version 7. For example, Run Scripts, CMPivot, or the Run PowerShell Script task sequence step.

Feedback for PowerShell

If you have feedback on the Configuration Manager PowerShell cmdlets, use the same options in the Configuration Manager console to send feedback. For more information, see Product feedback.

When you send a frown, include the following additional information specific to PowerShell:

  • The exact script or command syntax that you used so that Microsoft can try to reproduce the issue.

  • What behavior you expected compared to the actual behavior.

  • The full output when you run it with the Verbose common parameter.

  • The version and path of the ConfigurationManager module. For example, include the output of the following commands:

    (Get-Module -Name ConfigurationManager).Version
    (Get-Module -Name ConfigurationManager).Path
  • If a cmdlet returns an error, use the following command to get exception details:

    $Error[0].Exception | Format-List * -Force

Preview release notes

The technical preview features article in the core documentation library includes release notes for PowerShell. For example, see Technical preview version 2202.

Next steps

For more information about what's changed in the most recent release of Configuration Manager, select the latest Release Notes from the table of contents.

For more information on individual cmdlets, see the Configuration Manager cmdlet reference.

For more information on learning and getting started with Windows PowerShell, see PowerShell 101.