98 lines
3.2 KiB
PowerShell
98 lines
3.2 KiB
PowerShell
<#
|
|
|
|
Import-Module 'C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1'
|
|
New-PSDrive -Name SCCM-Drive -PSProvider "AdminUI.PS.Provider\CMSite" -Root "PNCRASCCM001.ccx.carecentrix.com" -Description "SCCM Site"
|
|
|
|
#>
|
|
|
|
|
|
|
|
|
|
# $DeviceCollection_Name = "Nabil - Test Collection"
|
|
|
|
|
|
<#
|
|
|
|
|
|
$DeviceCollection_Name = "All - Inventory - Supporting Infrastructure"
|
|
|
|
$DeviceCollection_Name = "Stage 2. ADR - QA Servers"
|
|
|
|
$DeviceCollection_Name = "Stage 3. ADR - PRD Servers - Set 2"
|
|
$DeviceCollection_Name = "Stage 3. ADR - PRD Servers - Set 1"
|
|
|
|
$DeviceCollection_Name = "Stage 1. ADR - DEV Servers - Set 1"
|
|
|
|
#### $DeviceCollection_Name_ALL = "All - Inventory - Infrastructure Servers",
|
|
"All - Inventory - Supporting Infrastructure",
|
|
"All - Inventory - Database",
|
|
"All - Inventory - Application Servers"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#>
|
|
<#
|
|
CD sccm-drive:
|
|
|
|
$DeviceCollection_MemberCount = Get-CMDeviceCollection -Name $DeviceCollection_Name | select Name,MemberCount
|
|
$DeviceCollection_ServerNames = Get-CMCollectionMember -CollectionName $DeviceCollection_Name | select Name,IsClient #| Export-Csv "E:\SCCM-Files\SCCM-Scripts\Files\$DeviceCollection_Name.csv" -NoTypeInformation
|
|
$ServerName = $DeviceCollection_ServerNames.Name
|
|
$ServerName.count
|
|
|
|
Set-Location c:
|
|
|
|
#>
|
|
#$DeviceCollection_Name = ""
|
|
|
|
CD sccm-drive:
|
|
|
|
$DeviceCollection_MemberCount = Get-CMDeviceCollection -Name $DeviceCollection_Name | select Name,MemberCount
|
|
$DeviceCollection_ServerNames = Get-CMCollectionMember -CollectionName $DeviceCollection_Name | select Name,IsClient #| Export-Csv "E:\SCCM-Files\SCCM-Scripts\Files\$DeviceCollection_Name.csv" -NoTypeInformation
|
|
$ServerName = $DeviceCollection_ServerNames.Name
|
|
$ServerName.count
|
|
|
|
Set-Location c:
|
|
|
|
|
|
|
|
#$No_Client = $DeviceCollection_ServerNames | ? { $_.IsClient -eq $false }
|
|
#$No_Client.count
|
|
|
|
# Test-Connection -ComputerName $No_Client.name -Count 1
|
|
|
|
|
|
$Script:ALL_Patch_Servers = @()
|
|
$Script:Temp = @()
|
|
|
|
Function ALL_Patching_Servers {
|
|
Param($Coll_Name)
|
|
CD sccm-drive:
|
|
|
|
|
|
$Script:Temp = Get-CMCollectionMember -CollectionName $Coll_Name #| select Name,IsClient
|
|
|
|
$Temp | % {
|
|
$Obj = New-Object -TypeName PSObject
|
|
$Obj | Add-Member -MemberType NoteProperty -Name Server -Value $_.Name
|
|
$Obj | Add-Member -MemberType NoteProperty -Name ClientInstalled -Value $_.IsClient
|
|
$Obj | Add-Member -MemberType NoteProperty -Name CollectionName -Value $Coll_Name
|
|
#$Obj | Add-Member -MemberType NoteProperty -Name CollectionMemberCount -Value {(Get-CMCollectionMember -Name $Coll_Name).MemberCount}
|
|
|
|
$Obj
|
|
$Script:ALL_Patch_Servers += $Obj
|
|
}#end%
|
|
|
|
}#endFunction
|
|
|
|
#$DeviceCollection_Name_ALL | % { ALL_Patching_Servers -Coll_Name $_ }
|
|
|
|
$DeviceCollection_Name | % { ALL_Patching_Servers -Coll_Name $_ | sort Server}
|
|
|
|
Set-Location c:
|
|
|
|
|
|
|