Asked by:
Monitor with Power Shell scripy Recovery

Question
-
Hi,
I created a Windows Service Unit Monitor to monitor my audio services. if the service is stopped it will generate an alert.
In the recovery wizard, i added a recovery task of type script and in the editor i used a power shell command to start the service. it was not working. i used the name as example.ps1 and the ps script is start-service -displayname 'Windows Audio'
i tested this on PowerShell directly and it is working fine.
please help meTuesday, January 17, 2012 10:35 AM
All replies
-
What is the execution policy for powershell on the target machine (Get-ExecutionPolicy)? If its not set to unrestricted this powershell script will not run on the target machine.
Hope this helps!
Scott Moss MVP (Operations Manager) President - System Center Virtual Users Group |Vice President - Atlanta Southeast Management Users Group (ATL SMUG)
Please remember to click “Mark as Answer” on the post that helps you!
my new blog om2012.wordpress.comTuesday, January 17, 2012 5:17 PM -
Hi Scott,
If we ran the script on the Power Shell window it is working fine
If we try to run the script in a recovery task, it is not executing
Wednesday, January 18, 2012 4:01 AM -
can you post your powershell script?
Scott Moss MVP (Operations Manager) President - System Center Virtual Users Group |Vice President - Atlanta Southeast Management Users Group (ATL SMUG)
Please remember to click “Mark as Answer” on the post that helps you!
my new blog om2012.wordpress.comWednesday, January 25, 2012 4:23 PM -
Pretty sure PowerShell isn't supported from within the console UI.
You could just use a recovery task of type command and use:
Full path to file: %windir%\System32\sc.exe
Parameters: Start AudioSrv
or
Full path to file: %windir%\System32\net.exe
Parameters: start AudioSrv
- Proposed as answer by Nicholas Li Friday, January 27, 2012 9:10 AM
Thursday, January 26, 2012 2:50 PM -
Hi,
Actually i tried with script option instead of command
And i tried the script is a powershell script which just start the service...
As i observed that it was expecting VB script here.please correct me if i am wrong
Monday, January 30, 2012 7:00 AM -
Hi,
Regarding using PowerShell script as recovery task, please also see:
SCOM 2007 R2 - Monitor recovery task - powershell script does not execute
To create a recovery task against a service, I would like to suggest you try the following method:
Using a recovery in OpsMgr - Basic
http://blogs.technet.com/b/kevinholman/archive/2008/03/26/using-a-recovery-in-opsmgr-basic.aspx
Hope this helps.
Nicholas Li
TechNet Community Support
- Proposed as answer by Nicholas Li Monday, February 6, 2012 2:34 AM
Thursday, February 2, 2012 3:22 AM