Learn about Windows PowerShell
Summary: Publish Windows PowerShell data to the Orchestrator data bus.
Can I access data in my Windows PowerShell script from within Orchestrator?
Select Published Data in the Run .NET Script activity, click Add, and fill in the details for the object you want to publish:
“Name” Name you wish to use on the Databus“Type” Type of .NET Object, Date/Time, String or Integer“Variable Name” PowerShell Object Name without the “$”
Orchestrator Published Data option in “Run .NET Script”
The hard part, of course, is running your PowerShell script on a remote server in a PowerShell 3.0 window with elevated privileges and then capturing and returning the results to Orchestrator, writing them out to the Event Log and picking them up with SCOM. Then don't look at it until something goes wrong.
What you COULD do for that (Just a thought) is add some more traps in the PowerShell script you could monitor with SCOM. Possibly a Custom Event to indicate "Good thing Happened" and one for "Bad thing" (to over simplify it) within the actual PowerShell script. You could then have SCOM trap for those events within Windows PowerShell by monitoring the EventLog.
Letting the car drive itself is really cool, but you're right. You still need to be able to monitor if things do go bad.
None of us want to work for "Mr. Murphy" ;)
I use the good event and bad event combo myself. SCOM alerts if it doesn't see the good event every x timespan and alerts anytime it finds the bad event.
The PSRemoting invoke-command cmdlet can do everything you're looking for. It's usually, at least for me, a pain to get powershell remoting working with SCORCH but once it works it does most of what you need.
Awesome tip btw, I was trying to figure out exactly how this worked!
For anyone looking for more details on a best practice method of using PowerShell in Orchestrator runbooks, I've created a reference with a downloadable template runbook and script file here: