Skip to content

Instantly share code, notes, and snippets.

@kism
Created August 16, 2021 01:22
Show Gist options
  • Save kism/b1c965a992b129e069e7226e9d5bee4d to your computer and use it in GitHub Desktop.
Save kism/b1c965a992b129e069e7226e9d5bee4d to your computer and use it in GitHub Desktop.
$Hosts = @(
#("host1"),
#("host2"),
#("host3"),
("dpshub.kg.lan")
)
$hoststatusscript = {
$avstatus = Get-MpComputerStatus
write-host -NoNewline "Anti-Virus System: "
if ($avstatus.AntivirusEnabled) {
write-host "Age:" $avstatus.AntispywareSignatureAge "Version:" $avstatus.AntispywareSignatureVersion
} else {
write-host -ForegroundColor Red "Disabled!"
}
write-host -NoNewline "Anti-Spyware System: "
if ($avstatus.NISEnabled) {
write-host "Age:" $avstatus.NISSignatureAge "Version:" $avstatus.NISEngineVersion
} else {
write-host -ForegroundColor Red "Disabled!"
}
write-host -NoNewline "Network Inspection System: "
if ($avstatus.AntispywareEnabled) {
write-host "Age:" $avstatus.AntispywareSignatureAge "Version:" $avstatus.AntispywareSignatureVersion
} else {
write-host -ForegroundColor Red "Disabled!"
}
}
ForEach ($inHost in $Hosts) {
Write-Host "Host: $inHost"
Invoke-Command -ComputerName $Host -ScriptBlock $hoststatusscript
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment