Locating and Installing ConfigMgr Cmdlets
By Jesse Walter
Published November 27, 2014
Estimated Reading Time: < 1 minute

EDIT: This function has been updated to operate more efficiently. – JW, 02/25/2015

EDIT 2: We all grow. We all change. We update our scripts to make more sense out of stuff and things. -JW, 10/05/2015

 Function Import-CMModule {
Try {
Import-Module -Name "$(split-path $Env:SMS_ADMIN_UI_PATH)\ConfigurationManager.psd1"
$global:Site = Get-PSDrive -PSProvider CMSite
CD "$($Site):"
Set-Variable -Name Site -Value $Site.Name
}
Catch {
Write-Output $_.Exception.Message
}
}
Import-CMModule 
Article By Jesse Walter
Jesse Walter is a Partner with Model Technology Solutions and the Vice President of Research and Development. He has an extensive background in Microsoft endpoint management tools, such as Microsoft Endpoint Configuration Manager and Intune, as well as a strong foundation in the Microsoft 365 Defender stack. Additionally, he enjoys automating repeatable operational tasks using PowerShell, and has developed several security tools using C#.

Related Posts