J
jonathan.wilson
Guest
lol... I got one for Windows to! Me and Agents are old nemesis. This is a Powershell script, the PROENV needs to be all configured first... but again quick script; Also there is a password hard coded / plain text login; not very good... but just leave out the emails if that's an issue. ----------- $CHKAS="MYWTB_live" $ALERTLIMIT=3 $CHKSTR="AVAILABLE" $BC=(wtbman -name $CHKAS -query | findstr $CHKSTR | Measure-Object -line).lines #write-host $BC if ( $BC -lt $ALERTLIMIT ) { $TimeStam=$CHKAS + "_" + (get-date).Tostring("yyyyMMdd_HHmmss") + ".txt" #Not needed for your stuff#wtbman -name $CHKAS -query | ?{$_ -cmatch $CHKSTR} | %{ ($_ -split " ")[0] } | %{wtbman -name $CHKAS -agentdetail $_ } | Out-File $TimeStam $tHostname = hostname $SendToEmail = "Me@myAddrees", "Me@myAddrees2" $Username = "ExchangeLoginID@Domain" ## a normal user AD account will do here $Password = ConvertTo-SecureString 'myPasswordHere' -AsPlainText -Force ## FYI this might be an issue security issue $Livecred = New-Object System.Management.Automation.PSCredential $Username, $Password $Subject="Issue with XXXXX: " + $tHostname + " Agents Blocked issue!! " + $BC $OutputStatus = "Hi fix the issue please" $ExchangeHostname="my.exchange.com" send-mailmessage -to $SendToEmail -from $Username -subject $Subject -smtpserver "$ExchangeHostname" -body "$OutputStatus" -credential $Livecred -Attachment $TimeStam }
Continue reading...
Continue reading...