# Import-Module E:\SCCM-Files\SCCM-Scripts\CMClient.psm1 ######### From _Get-SCCMSoftwareUpdateStatus.ps1 ####### #Get-SCCMSoftwareUpdateStatus -DeploymentIDFromGUI # $Status = Get-SCCMSoftwareUpdateStatus -DeploymentID 16777359 | select DeviceName <# $status | ? { $_.status -eq "InProgress" } $Status | ? { $_.status -eq "unknown" } $Status | ? { $_.status -eq "Error" } $Status | ? { $_.status -eq "unknown" } | Measure | Select Count #> #################################################################################### ###### From CCMClient.psm1 #### <# #################################################################################### #################################################################################### Invoke-CMClientUpdateScan -ComputerName Invoke-CMClientUpdateDeploymentEvaluation -ComputerName Invoke-CMClientMachinePolicyDownload -ComputerName $comps | % { Invoke-CMClientUpdateScan -ComputerName $_ Invoke-CMClientUpdateDeploymentEvaluation -ComputerName $_ Invoke-CMClientMachinePolicyDownload -ComputerName $_ } #################################################################################### #################################################################################### $comps = "" <# $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 } } #################################################################################### ### $Responding = @() $NotResponding = @() $DeviceCollection_ServerNames.Name | % { If (Test-Connection $_ -Count 1 -ErrorAction SilentlyContinue ) { Write-Host "Responding:---- $_ " -ForegroundColor Green $Responding += $_ }#endIf Else { $NotResponding += $_ } }#end% write-host "-------------------------------------------------------" Write-host "$($Responding.count) / $($DeviceCollection_ServerNames.Name.count) -- Responding" -foregroundcolor Green Write-host "$($NotResponding.count) / $($DeviceCollection_ServerNames.Name.count) -- NOT Responding" -foregroundcolor Red Write-Host "Servers NOT Responding: $NotResponding " -ForegroundColor Red $Responding | % { gwmi win32_operatingsystem -ComputerName $_ -ErrorAction SilentlyContinue | select @{n="Server";e={$_.PSComputername}},@{n="LastBootup";e={$_.Converttodatetime($_.LastBootUpTime)}}} | sort LastBootup -descending | ft -autosize #################################################################################### gwmi win32_operatingsystem -ComputerName $DeviceCollection_ServerNames.Name | select @{n="Server";e={$_.PSComputername}},@{n="LastBootup";e={$_.Converttodatetime($_.LastBootUpTime)}} | ft -autosize #> <# #################################################################################### #################################################################################### $Downloaded_Updates = @() $NOT_Downloaded_Updates = @() $Count = 0 [INT]$Last_Writetime = "90" $comps = $DeviceCollection_ServerNames.name $comps | % { $Computer = $_ $Check_Contents = gci "\\$Computer\c$\Windows\ccmcache" | ? { $_.lastwritetime -gt ((Get-Date).ADDDays((-$Last_Writetime))) } If ($Check_Contents) { $Downloaded_Updates += $Computer } Else { $NOT_Downloaded_Updates += $Computer } } If($Downloaded_Updates) { $Downloaded_Updates | % { $Updates_Downloaded = gci "\\$_\c$\Windows\ccmcache" | ? { $_.lastwritetime -gt ((Get-Date).ADDDays((-$Last_Writetime))) } $Obj = New-Object -TypeName PSObject $Obj | Add-Member -MemberType NoteProperty -Name Computer -Value $_ $Obj | Add-Member -MemberType NoteProperty -Name LastWriteTime -Value $Updates_Downloaded[-1].LastWriteTime $Obj | Add-Member -MemberType NoteProperty -Name FileName -Value $Updates_Downloaded[-1].Name $Obj | Add-Member -MemberType NoteProperty -Name UpdatesCount -Value ($Updates_Downloaded.count) $Obj }#end% }#endIf Write-Host "" Write-Host "Nothing Downloaded for: $NOT_Downloaded_Updates" -ForegroundColor Yellow Write-Host "" Write-Host "Servers Downloaded patches count: $($Downloaded_Updates.count)" -ForegroundColor Green Write-Host "" #################################################################################### #################################################################################### #> #> ######################## Check Installed Updates ########################### # $DeviceCollection_ServerNames.Name | % { Get-HotFix -ComputerName $_ | sort installedon -Descending | Select -First 1} # Get-HotFix -ComputerName pfnp013 | sort installedon -Descending | Select -First 10 # $DeviceCollection_Name