Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [string]$serverList
- [string]$serverNames
- $serverList = Get-ADComputer -LDAPFilter "(&(ObjectCategory=Computer)(OperatingSystem=*10*))" -Property * #| Select-Object Name | Sort-Object Name
- #$serverNames = $serverList.Name
- #$CVE20200601= Get-Hotfix | Where-Object {$_.HotfixID -like "KB4534306" -or $_.HotfixID -like "KB4534271" -or $_.HotfixID -like "KB4534276" -or $_.HotfixID -like "KB4534293" -or $_.HotfixID -like "KB4534273" -or $_.HotfixID -like "KB4528760"}
- ForEach ($server in $serverList)
- {
- Write-Host ""
- $server.Name
- $server.OperatingSystem
- $isAlive = Test-Connection $server.Name -Count 4 -Quiet
- If($isAlive -eq $true)
- {
- [console]::ForegroundColor = "Green"
- Write-Host "PC is on"
- $CVE20200601= Get-Hotfix | Where-Object {$_.HotfixID -like "KB4534306" -or $_.HotfixID -like "KB4534271" -or $_.HotfixID -like "KB4534276" -or $_.HotfixID -like "KB4534293" -or $_.HotfixID -like "KB4534273" -or $_.HotfixID -like "KB4528760"}
- If($CVE20200601 -eq $true)
- {
- Write-Host "Hotfix installed"
- }
- Else
- {
- Write-Host "Hotfix not installed"
- }
- [console]::ForegroundColor = "White"
- }
- Else
- {
- [console]::ForegroundColor = "Red"
- Write-Host "PC is off"
- [console]::ForegroundColor = "White"
- }
- Write-Host ""
- }
- Write-Host "Total number of Windows 10 PCs is" $serverList.Count
Advertisement
Add Comment
Please, Sign In to add comment