Hi,
This time a short post. But I think this could be useful for SCOM admins.
The challenge.
We all know that one of the big powers of SCOM is the self maintaining of the monitor targets. SCOM uses discovery’s for this that run at regular intervals. Lets say you install a new SQL database instance on a server that has already a SCOM agent on it. Normally you have to wait for 4 hours before the new database instance is discovered. Yes you can speed this up to restart the SCOM agent but now we have a better way.
Analyze
First, all the credits go to the SCOM product team it self’s. It seems the feature was already build in but making it globally known was somehow left behind. There is a agent task called ‘Trigger On Demand Discovery’ that can help you out. But how to operate this task can be painful.
The solution
I have written a PowerShell script that does the hard work for you. Running this script and supplying the correct Discovery and target will result in a instantly run of that discovery. So now you don’t have to wait for the discovery interval of 4 hours to trigger.
How it works:
1) You fill in the $OMserver with the SCOM SDK server FQDN.
2) You fill in the $discoveryname with the display name of the discovery rule you want to trigger. Just copy and paste the displayname from your author pane in the scom console. See picture below.
3) You fill in the $targetdisplayname with the name of the main target where this discovery should run. You can find this name by looking at the target from the discovery rule you got from step 2.
And fill this in the inventory view.
The name “servicemanager.systemcenter.local” is the target display name to use.
btw. of course you can use PowerShell to do this for you…
Below the script:
It triggers the discovery task and then waits for the results and displays it. Be sure to look at the output results property because it only is okay when it contains :
The script.
## ======================================================= Import-Module operationsmanager ## —————————————————- # get task to execute # wait for result ## —————————————————- |
The End.
I already did some more investigation on this topic because I think when you can do it for a discovery you can also do it for every workflow that contains a timed interval trigger module. Can you imagine that you can now trigger every rule or monitor at your demand… so cool and so handy while debugging. When I have it working I will of course share it with you “the community”.
Happy SCOMMING
Michel Kamp