93 lines
3.4 KiB
PowerShell
93 lines
3.4 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"
|
|
|
|
#>
|
|
|
|
|
|
<#
|
|
|
|
$Count = 0
|
|
|
|
# $D_ID = "16777912","16777914","16777916"
|
|
# $D_ID = "16777913","16777915","16777917"
|
|
|
|
# $D_ID = "16778068"
|
|
|
|
$Patching_Collections = "All - Inventory - Supporting Infrastructure", #------------------------0
|
|
"All - Inventory - Database", #------------------------1
|
|
"All - Inventory - Application Servers" #----------2
|
|
|
|
|
|
|
|
|
|
<#
|
|
$Patching_Collections = "All - Inventory - Infrastructure Servers", #------------------------0
|
|
"All - Inventory - Supporting Infrastructure", #------------------------1
|
|
"All - Inventory - Database", #------------------------2
|
|
"All - Inventory - Application Servers" #----------3
|
|
|
|
$D_ID = @("16777850"),"16777851")
|
|
$Patching_Collections = @("_6PM - Production Patching - Group 1"),
|
|
"_6PM - Production Patching - Group 2"
|
|
|
|
#>
|
|
|
|
|
|
|
|
|
|
#>
|
|
$Run_Collections = "0","1","2"
|
|
# $Run_Collections = "0"
|
|
|
|
$Script:Temp = @()
|
|
|
|
|
|
$Global:General = @()
|
|
|
|
Function Patch_Report {
|
|
Param($ID,$Name)
|
|
$ID
|
|
$T = Get-SCCMSoftwareUpdateStatus -DeploymentID $ID
|
|
|
|
write-host ""
|
|
write-host "------------------------------------------------------------------------------------"
|
|
write-host "$Name" -foregroundcolor white -backgroundcolor black
|
|
write-host "Total Servers: $($T.DeviceName.Count)" -foregroundcolor Black -Backgroundcolor white
|
|
$S = $T | ? { $_.Status -eq "InProgress" }
|
|
$Err = $T | ? { $_.Status -eq 'error' } | Select DeviceName
|
|
$Success = $T | ? { $_.Status -eq 'Success' } | Select DeviceName
|
|
$Un = $T | ? { $_.Status -eq 'Unknown' } | Select DeviceName
|
|
Write-Host "Unknown: $($Un.count)" -ForegroundColor Gray
|
|
Write-Host "Success: $($Success.Devicename.count)" -ForegroundColor Green
|
|
write-host "InProgress: $($S.DeviceName.count)" -foregroundcolor Cyan
|
|
write-host "Error Count: $($err.DeviceName.count)" -foregroundcolor red
|
|
|
|
#Write-Host "Error: $($Err.count)"
|
|
$Temp = $Err
|
|
$Global:General = $Err
|
|
}#endFunction
|
|
|
|
Write-Host "#####################################################################################" -BackgroundColor green -ForegroundColor black
|
|
$Run_Collections | % { Patch_Report -ID $D_ID[$_] -Name $Patching_Collections[$_] }
|
|
|
|
|
|
|
|
<#
|
|
|
|
|
|
|
|
$DeviceCollection_ServerNames.Name | % { $T = Test-Connection -ComputerName $_ -Count 1 -ErrorAction SilentlyContinue
|
|
If($T) { Write-Host "Server $_ -- Responding" -ForegroundColor Green } Else { Write-Host "Server $_ -- Not Responding" -ForegroundColor Red }
|
|
}
|
|
|
|
|
|
# $DeviceCollection_ServerNames.Name | % { gwmi win32_operatingsystem -ComputerName $_ | select @{n="Server";e={$_.PSComputername}},@{n="LastBootup";e={$_.Converttodatetime($_.LastBootUpTime)}}} | sort server| ft -autosize
|
|
|
|
|
|
# gwmi win32_operatingsystem -ComputerName $Temp.DeviceName | select @{n="Server";e={$_.PSComputername}},@{n="LastBootup";e={$_.Converttodatetime($_.LastBootUpTime)}} | ft -autosize
|
|
|
|
|
|
|
|
#> |