I need to be alerted if a website is up, and not if it's down. It's a backup site that shouldn't be running if the primary site is functioning. So I've setup a sensor with a PowerShell script on a remote probe which checks if that IIS site is up. However, when I run the sensor the log on the remote server says, "Process should have elevated status to access IIS configuration data."
UAC is enabled on the server. Any ideas how I can run a powershell script with elevated privileges? Or is there a better way to accomplish this?
Here's the script (minus try/catch):
$script:Exception = $null; Import-Module WebAdministration $site = Get-Website -Name "*BackupSite*" if ($site.state = "Stopped") { $x=[string]"0:OK" write-host $x exit 0 } else { $x=[string]"1:WARNING" write-host $x exit 1 }
Add comment