Or using ServerManager module
Get-ADComputer -SearchBase "OU=Windows Servers V2,OU=Servere,DC=ocean,DC=com" -filter * | format-table Name >> server_list.txt
$comp = gc "server_list.txt"
foreach ($entry in $comp) {
write-host $entry
Get-WindowsFeature -ComputerName $entry -Name "Web-Server" -ErrorAction SilentlyContinue
}
This one below gets events from event log (from each computer
from iis2003.txt file generated in the previous script)
$comp = gc "iis2003.txt"
$path = "c:\temp\logs"
$Oct16 = get-date 10/16/2014
$Oct15 = get-date 10/15/2014
foreach ($entry in $comp) {
$fullname = $path + "\" + $entry + ".txt"
Get-EventLog -LogName system -ComputerName $entry -after $Oct15
-before $Oct16 | Where-Object {$_.eventID -eq '19'} | format-table -wrap
>> $fullname
Get-EventLog -LogName system -ComputerName $entry -after $Oct15
-before $Oct16 | Where-Object {$_.eventID -eq '7036' -AND $_.Message -like
"The World Wide Web Publishing Service service entered the stopped
state."} | format-table -wrap >> $fullname
}
Brak komentarzy:
Prześlij komentarz