There are two ways to connect to Configuration Manager site:
- From Configuration Manager console
- From PowerShell
To connect from PowerShell, you can just click on the top-left arrow icon pointing downward to expand the menu and then select Connect via Windows PowerShell or Connect via Windows PowerShell ISE.
Alternatively, you can also just launch PowerShell as the currently logged-in user and then run the following script, which, you can get when click on Connect via Windows PowerShell ISE from SCCM console above.
# Site configuration
$SiteCode = "CON" # <-- Site code. Replace CON with the actual site code.
$ProviderMachineName = "contoso.test.com" # <-- Replace contoso.test.com with the actual FQDN of the machine name
# Customizations
$initParams = @{}
# Do not change anything below this line
# Import the ConfigurationManager.psd1 module
if((Get-Module ConfigurationManager) -eq $null) {
Import-Module "$($ENV:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1" @initParams
}
# Connect to the site's drive if it is not already present
if((Get-PSDrive -Name $SiteCode -PSProvider CMSite -ErrorAction SilentlyContinue) -eq $null) {
New-PSDrive -Name $SiteCode -PSProvider CMSite -Root $ProviderMachineName @initParams
}
# Set the current location to be the site code.
Set-Location "$($SiteCode):\" @initParams