-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathPowerShellSCCMConnect1.ps1
More file actions
49 lines (41 loc) · 1.6 KB
/
PowerShellSCCMConnect1.ps1
File metadata and controls
49 lines (41 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<#
.SYNOPSIS
PowerShell SCCM Connection
.DESCRIPTION
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.
.PARAMETER SCCMModule
UNC path including file name of the configuration manager module
.PARAMETER SCCMServer
A description of the SCCMServer parameter.
.PARAMETER SCCMSiteDescription
Description of the SCCM Server
.PARAMETER SiteCode
Three letter SCCM Site Code
.PARAMETER SCCMFQDN
Fully Qualified Domain Name of the SCCM server
.NOTES
===========================================================================
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
===========================================================================
#>
[CmdletBinding()]
param
(
[ValidateNotNullOrEmpty()]
[string]$SCCMModule = '<UNCPath>\ConfigurationManager.psd1',
[ValidateNotNullOrEmpty()]
[string]$SCCMServer = '<FQDN of SCCM Server>',
[ValidateNotNullOrEmpty()]
[string]$SCCMSiteDescription = '<SCCM Server Description>',
[ValidateNotNullOrEmpty()]
[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