Home

PowerShell Monitor to monitor number of folders in a folder with diagnostic and recovery

PowerShell Monitor to monitor number of folders in a folder with diagnostic and recovery

Part 1 – The PowerShell – https://www.f1point2.com/the-script/ Part 2 – The Data Source and Probe – https://www.f1point2.com/part-2-powershell-monitors-the-modules/ Part 3 – The Monitor Type – https://www.f1point2.com/part-3-powershell-monitors-monitor-type/ Part 4 – The Monitor – https://www.f1point2.com/part-4-the-monitor/ Part 5 – A diagnostic task to view all the folders in the top level folder – https://www.f1point2.com/part-5-the-diagnostic/ […]

Part 6 – The Recovery

Part 6 – The Recovery

And finally we have a recovery which will allow the operator to delete the folders in the top level folder. This is the PowerShell code And this is the recovery code This shows the key piece of passing data from the monitor to the recovery.

Part 5 – The diagnostic

Part 5 – The diagnostic

As a quick value add; we can do a diagnostic that we can run manually to list the folders in the top level folder. The PowerShell code is here And the diagnostic here This is how we pass property bag data from our monitor to our diagnostic

Part 4 – The Monitor

Part 4 – The Monitor

And now we can finally author our monitor. Right click on the folder FolderMonitoringCountFoldersInFolder and select Add, New Item, Empty Management Pack Fragment and call it 5_Monitor. Copy and paste the following code between the tags.

Part 3 – PowerShell Monitors – Monitor Type

Part 3 – PowerShell Monitors – Monitor Type

The monitor type is where we define the workflows. I’ll run through creating a 2 state monitor where we have a workflow for “over threshold” and a workflow for “under threshold” as well as look at on-demand monitors \ workflows. When you target a single instance class, be aware that […]

Part 2 – PowerShell Monitors – The Modules

Part 2 – PowerShell Monitors – The Modules

Now that we have our script and we are confident that it works, we need to start the process of getting this into SCOM. There are 4 modules types that we will need to put together which are discussed here. They are: A probe action which will be our script […]

Part 1 – PowerShell Monitors – The Script

Part 1 – PowerShell Monitors – The Script

This question came up on the TechNet forums and it raised some interesting questions about using PowerShell in a monitor. Some standard best practice I would look to follow would be: 1. The script should always have some level of error checking along the lines of Try \ Catch \ […]

Part 1 – Background

Part 1 – Background

I never imagined as a young engineer at NetIQ that I would, some 20 years later, have built a career on SCOM and the System Center suite. I’ve been fortunate to ride the System Center dream (and occasional nightmare) at Microsoft partners, as a Senior Premier Field Engineer at Microsoft […]

Create a Windows Service and SCOM Service Monitor

Create a Windows Service and SCOM Service Monitor

This is a quick digression from the main set of articles to create a windows service and then a SCOM service monitor to monitor that service. The solution for this C# windows service is here. The article “behind” this is here. And how to install the service is here. To […]