mercredi 8 avril 2009

Get a List of Management Pack Rules with PowerShell

Did you know you can use PowerShell to create an Excel list of all of the rules in your imported Management Packs? It's pretty easy -- just follow these steps:

  1. On your Management Server, open the Command Shell by clicking Programs->System Center->Command Shell.
  2. In the command window, type:
    get-rule | select-object @{Name="MP";Expression={ foreach-object {$_.GetManagementPack().DisplayName }}},DisplayName |

    sort-object -property MP | export-csv "c:\rules.csv"

Open the file C:\rules.csv in Excel and expand out the first column to get a view like this (click for larger picture):

The export-csv cmdlet that the output is piped into is a handy one to know about. You can use it to use to put information extracted with PowerShell into a comma separated format that can be read by Excel.


Works with get-monitor, to have all monitors on a excel sheet.

Aucun commentaire:

Enregistrer un commentaire