Process monitoring and reporting

#from now on i am testing if the server is up, so the script runs a little bit faster
#i also add a timer on every single script i make , because efficiency is important
$StartTime = (Get-Date)

$servername = Get-ADComputer -SearchBase “ou=domain controllers,dc=test,dc=com” -filter * | ForEach-Object { Get-ADDomainController -Identity $_.DNSHostname}
foreach ($server in $servername){
if (Test-Connection $server -count 1 -quiet){
write-host “whazzzzzzzzzaaaaa “$server” ?” -BackgroundColor yellow -ForegroundColor Black
Get-Process -ComputerName $server | Where-Object {$_.WorkingSet -gt 500000000} #my limit is 100mb of usage
write-host “===================================================================”}
else {
write-host $server “is down !” -BackgroundColor Red

Leave a Reply

Your email address will not be published.