Quantcast
Channel: Operations Manager - General forum
Viewing all articles
Browse latest Browse all 11941

PowerShell script execution through Channel command doesn't work

$
0
0

Hi mates,

I want to execute this PowerShell command when the subscription catches the alert but it doesn't work through the Channel command and there isn't any entry in the log file temp.txt:


$A = Get-Date; Add-Content E:\Scripts\temp.txt " $A - Started"    

Write-Eventlog -Logname "Operations Manager" -Source 'Health Service Script' -EventID 0 -EntryType Information -Message "My test message" -Category 1 -ComputerName "OTHERSERVER.MYDOMAIN.LOCAL"

$A = Get-Date; Add-Content E:\Scripts\temp.txt "$A - Finished" 

If a execute this script manually works fine. 

I have configured a channel command with the following parameters:

Full Path of the command file: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Command line parameters: E:\Scripts\Add-NTEventSCOM.ps1

Startup folder for the command line: E:\Scripts

BTW, In both servers PowerShell ExecutionPolicy has been configured to unrestricted.

Thanks in advance.


Viewing all articles
Browse latest Browse all 11941

Trending Articles