KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

PowerShell execution issue

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
bmekler



Joined: 17 Apr 2012
Posts: 32

PostPosted: Thu Jun 07, 2012 9:23 am    Post subject: PowerShell execution issue Reply with quote

HostMonitor 9.18 on Windows Server 2008 R2, RMA 4.48 on Windows Server 2008 R2 running as service with domain admin credentials, execution policy set to unrestricted for both x64 and x86 powershell.

I'm trying to run the following script to monitor the state of Windows Server backup:

Code:
$statusAlive       = "ScriptRes:Host is alive:"
$statusDead        = "ScriptRes:No answer:"
$statusUnknown     = "ScriptRes:Unknown:"
$statusNotResolved = "ScriptRes:Unknown host:"
$statusOk          = "ScriptRes:Ok:"
$statusBad         = "ScriptRes:Bad:"
$statusBadContents = "ScriptRes:Bad contents:"

if (!$args[0])
{
  echo  $statusUnknown"Threshold parameter is not specified"
  exit
}

$TargetSystem = $args[0]
$DaysToLook = $args[1] * 86400000
$JobCount = 0

$JobCount = (get-winevent -ComputerName "$TargetSystem" -LogName "Microsoft-Windows-Backup" -FilterXPath "*[System[TimeCreated[timediff(@SystemTime) <= $daystolook]]]" | where {$_.id -eq 4}).count

if ($JobCount -gt 0)
{
   echo $statusOk
}
else
{
   echo $statusBad
}


When I save it to a local .ps1 file and run it, either from powershell, or from cmd using powershell.exe with parameters, it runs fine. However, when RMA runs it, I get the following:

[17:54:19] Agent: X is going to execute "PowerShell: Windows Server Backup check" script ...
[17:54:20] Script started, invalid result received:
----------
S

The "" is actually displayed as a square in HostMonitor/RCC UI.

Restarting the agent service or rebooting the server does not help. I have two RMAs installed on two servers in the same network (primary and backup), and the problem occurs on both. However, I haven't run into this issue on any other network yet.
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Thu Jun 07, 2012 10:12 am    Post subject: Reply with quote

Could you please check [Misc] section of rma.ini file ?
Is there option like SScript_UseWindowsPipe=0 ?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bmekler



Joined: 17 Apr 2012
Posts: 32

PostPosted: Thu Jun 07, 2012 12:21 pm    Post subject: Reply with quote

Yes there is, precisely that.

Edit: I set it to 1, restarted the RMA and now it's working.
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Thu Jun 07, 2012 12:34 pm    Post subject: Reply with quote

This means, that Windows Pipes mechanism is not used by RMA.
By default HostMonitor/RMA should use Windows Pipes.
However you disabled it for some reason.
You may enable it by setting value 1, like:
SScript_UseWindowsPipe=1
and restart RMA agent !
However, you should check if other shell script test items work well on this RMA agent with enabled Windows Pipes.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bmekler



Joined: 17 Apr 2012
Posts: 32

PostPosted: Thu Jun 07, 2012 2:05 pm    Post subject: Reply with quote

Oh, now I remember - you suggested modifying this value here, and I forgot all about it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index