troubleshooting Question

How do I run SCOM 2007 R2 Powershee (not Windows Powershell) using VBScript

Avatar of wka13
wka13 asked on
VB ScriptPowershell
9 Comments1 Solution1341 ViewsLast Modified:
Hi, I have SCOM 2007 R2 installed and would like to disable a certain rule at 10PM and enable it at 11:59PM- in an automatic way. In order to do so, I am going to use the Powershell associated to SCOM 2007 R2 (not Windows Powershell), using "Get - Rule | Disable" or "Get - Rule | Enable". As I am going to create a rule on SCOM to run this, I also need a VBS code, although I am not getting it right, My problem resides when I run the line"objShell.Run", as the parameters are not correct. I have been fiddeling aroung with this, and the errors I get when I run this VBS code are the following:

C:\Program Files\System Center Operations Manager 2007>powershell.exe -PSConsole
File Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Console.psc1 .
Get-Rule : The 'Path' parameter is empty or the required provider location is n
ot set."
At C:\Program Files\System Center Operations Manager 2007\teste.ps1:1 char:17
Get-Rule  <<<< | where {$_.DisplayName -match "MAN - TESTE3"}

I would appreciate a lot if somebody could help me or give suggestion on how to complete the 4th line of the code, presented on the field below, please.
Thank you and best regards,
Dim sCurPath
sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
Set objShell = CreateObject("Wscript.Shell")
objShell.Run("powershell.exe ...")

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros