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