Hey All
i am having trouble with this script that i wrote, it works correctly in Powershell ISE, but for some reason i can get it to work in powershell cmd line or scheduled task, it returns no errors, and the script looks like it has run successfully but it has
not
i am still new to powershell scripting but i have not had this happen before, any help would be appreciated
here is my script that i wrote
#
# AppAssure Protected Server Monitor Script,
#
# This script will list all Protected servers in appassure and send a pushover notification to the System
# Administrator if any of the servers come back unreachable
Import-Module AppAssurePowerShellModule
Import-Module "C:\Scripts\PS-Pushover.psm1" # Imports Pushover Module
$POUserID="USERTOKEN"
$POAppAssureGJI="APPTOKEN"
foreach ($Agent in $Agents)
{
$Servers = Get-ProtectedServers
}
foreach($Server in $Servers)
{
$SrvStatus = $Server.Status
$SrvName = $Server.DisplayName
$SSPaused = $Server.IsPaused
if($SrvStatus -eq 'Unreachable' -and $SSPaused -eq $False)
{
Send-PushoverMessage -Title "Warning Action Required" -user $POUserID -token $POAppAssureGJI -message "Server $SrvName is not being Backed Up, Due to AppAssure Agent Being $SrvStatus" #Sends Pushover message
}
}