Good Afternoon Guys,
I'm working on setting up a custom tool in HP SIM (7.4.0). When I use CMS tool and uses a batch script to run, it completes successfully and triggers the script sitting on the CMS server. But If I change the script to a powershell script, the task gets stuck in 'Running' state and the script doesn't get initiated.
I created a custom CMS tool, and then attached the tool with an Automatic Event handling task (run tools only when critical event triggers).
If I use the below batch script, the task completes, and updates the output file.
(
echo %DATE% - %TIME%
echo ------------------------------------
echo NoticeLabel: %NoticeLabel%
echo NoticeState: %NoticeState%
echo NoticeSeverityStr: %NoticeSeverityStr%
echo DeviceName: %DeviceName%
echo -----------------------------------
) >> C:\Tools\Scripts\output.txt
Following is a similar PowerShell script. When the task triggers, the status of task gets stuck at 'Running', and the output file doesn't get created/updated.
$NoticeLabel = $ENV:NoticeLabel
$NoticeSeverityStr = $ENV:NoticeSeverityStr
$DeviceName = $ENV:DeviceName
$NoticeState = $ENV:NoticeState
"Time: " + (Date) | Out-File C:\Tools\Scripts\output.txt -Append
"-----------------------------------------" | Out-File C:\Tools\Scripts\output.txt -Append
"NoticeLabel: " + $NoticeLabel | Out-File C:\Tools\Scripts\output.txt -Append
"NoticeSeverityStr: " + $NoticeSeverityStr | Out-File C:\Tools\Scripts\output.txt -Append
"DeviceName: " + $DeviceName | Out-File C:\Tools\Scripts\output.txt -Append
"NoticeState: " + $NoticeState | Out-File C:\Tools\Scripts\output.txt -Append
"-----------------------------------------" | Out-File C:\Tools\Scripts\output.txt -Append
I checked and confirmed the powershell execution policy is configured as 'Unrestricted'
I also checked the access permissions, and everything looked fine.
I checked on servers with powershell version 2.0 and 3.0
Just wondering if someone can shade some light, as to why the script isn't executing. Could it be because of the PS version, or perhaps CMS tool doesn't support PS script at all.
Thanks in advance.
↧
Using powershell script as a CMS custol tool fails
↧