Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (41 sloc) 1.6 KB
PowerShell SCCM Connection
This script will connect to the SCCM server and return a list of all systems in SCCM. It is a demo on how to accomplish this task.
UNC path including file name of the configuration manager module
A description of the SCCMServer parameter.
.PARAMETER SCCMSiteDescription
Description of the SCCM Server
Three letter SCCM Site Code
Fully Qualified Domain Name of the SCCM server
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.142
Created on: 4/24/2019 9:56 AM
Created by: Mick Pletcher
Filename: SCCMCleanup.ps1
[string]$SCCMModule = '<UNCPath>\ConfigurationManager.psd1',
[string]$SCCMServer = '<FQDN of SCCM Server>',
[string]$SCCMSiteDescription = '<SCCM Server Description>',
[string]$SiteCode = '<Three letter SCCM Site Code>'
Import-Module -Name $SCCMModule -Force
New-PSDrive -Name $SiteCode -PSProvider 'AdminUI.PS.Provider\CMSite' -Root $SCCMServer -Description $SCCMSiteDescription | Out-Null
Set-Location -Path ($SiteCode + ':')
$List = Get-CMCollectionMember -CollectionName 'All Systems'
Remove-PSDrive -Name $SiteCode -Force
Write-Output $List.Name
You can’t perform that action at this time.