Running powershell script via Notification channel
Hi, I have installed SCOM 2007 R2 on machine named "Ops.scom.com" and my RMS is on another machine (in same domain) "ms.scom.com". I am using an MP and have created its Run As Account in more secure mode. The target computer for my mp is "ms.scom.com". Now I have created Notification channel to run a powershell script which notify me when i change the resolution state of the alerts. My script is on SCOM machine. But everytime it gives me the error: ----------------------------------------------------------------------------------------------------------------------- Workflow Initialization: Failed to start a process or script Alert Description Source: MS.scom.com Failed to create process due to error '0x8007010b : The directory name is invalid. ', this workflow will be unloaded. Command executed: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -command "& C:\progra~1\Script\MyScript.ps1" "47495751" Working Directory: C:\progra~1\Script One or more workflows were affected by this. Workflow name: Subscription649c90ba_efca_4266_b154_53be1fca3298 Instance name: Alert Notification Subscription Server Instance ID: {E07E3FAB-53BC-BC14-1634-5A6E949F9230} Management group: SCOMUCS ----------------------------------------------------------------------------------------------------------------------- I am not able to fine the possible cause. Should I have to place my script on the RMS system but doing so gives me no notification.Regards, Ravi
July 4th, 2011 6:28am

Hi There is a good example here of running a powershell script via a notification channel: http://blogs.msdn.com/b/steverac/archive/2010/08/17/updating-custom-alert-fields-using-subscriptions-and-powershell.aspx The error you get is "directory name is invalid" so take care over the command executed and working direction options - the mixture of & ' and " can be troublesome but the above blog article should help. Cheers GrahamView OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/
Free Windows Admin Tool Kit Click here and download it now
July 4th, 2011 7:07am

Thanks, I got this page and found it really useful. But I wanna know that should I lace the script on my rms machine or on local machine? How SCOM works when it is targeted to come other computer, like in the present scenario? Regards, Ravi
July 4th, 2011 7:50am

Hi It should be on the RMS - perhaps you can post your script here if you are having problems getting it to fire on the RMS or this might help: http://www.pavleck.net/2008/07/using-resolution-states-to-fine-tune-alert-notifications/ If you are just looking to get an email notification on a resolution state change then you can do so in the subscription criteria without any need for scripting. The bottom left box in the Alert criteria window of the subscription wizard asks for the resolution states to fire the subscription. Cheers GrahamView OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/
Free Windows Admin Tool Kit Click here and download it now
July 4th, 2011 7:54am

Hi, The script is just a test to see notification it is working. Here it is: EventCreate /ID 1 /L APPLICATION /T WARNING /SO RAVI_EVENTSOURCE /D "Script Started" I had created the same setup earlier when I have installed everything on one single system(SCOM, SQL, RMS everything) and the script which I wanted to run was working fine. But now I am working in the distributed environment so I have everything separated and now I am confused how to do things. Regards, Ravi
July 4th, 2011 8:14am

Check this blog post: http://scug.be/blogs/dieter/archive/2011/05/11/scom-setup-command-notification-channel-subscriber.aspx Please make sure to use the full path of the file eventcreate and specify the working directory. The script will be run on the RMS so if you have a clustered RMS make sure that the script resides on both nodes. The event should be logged in the eventlog of the RMS server. It's doing common things uncommonly well that brings succes.
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2011 10:20am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics