SCOM Export-SCOMKnowledge Report



Export-SCOMKnowledge

Available here: SCOMHelper PowerShell Module



This function will get all rule and monitor knowledge article content and output the information to separate files (Rules.html and Monitors.html) in the output folder path specified.

# Example
(Get-SCOMManagementPack -Name *.AD.*) | Export-SCOMKnowledge -OutFolder 'C:\MyReports' -Topic "AD_" -ShowResult

In the example above the variable will be assigned a collection of all management pack objects with “.AD.” in the name.
That subset/collection of management pack objects will be passed into the script. The script will output workflow details for all Rules and Monitors contained in ALL management packs within that set.
The output file names will be: “AD_Rules.html” and “AD_Monitors.html”. Finally the script will open Windows File Explorer to the location of the output directory.


Sample Reports Here

Examples
    -------------------------- EXAMPLE 1 --------------------------
    PS C:\>(Get-SCOMManagementPack -Name *.AD.*) | Export-SCOMKnowledge -OutFolder 'C:\MyReports' -Topic "AD_" -ShowResult
    
    In the example above the variable will be assigned a collection of all management pack objects with ".AD." in the name.
That subset/collection of management pack objects will be passed into the script. The script will output workflow details for all Rules and Monitors contained in ALL management packs within that set.
The output file names will be: "AD_Rules.html" and "AD_Monitors.html". Finally the script will open Windows File Explorer to the location of the output directory.




    -------------------------- EXAMPLE 2 --------------------------
    PS C:\>Export-SCOMKnowledge -OutFolder 'C:\Export' -ManagementPack (Get-SCOMManagementPack -Name "*ad.*") -Filter '201[0-6]'
    
    The command above will output all rules/monitors from management packs which contain 'ad.' in the Name and which contain '201x' in the Name or DisplayName of the workflow where 'x' represents any single digit 0-6 .




    -------------------------- EXAMPLE 3 --------------------------
    PS C:\>Export-SCOMKnowledge -OutFolder "C:\Temp" -ManagementPack (Get-SCOMManagementPack -Name *SQL*) -Topic "SQL_Packs_"
    
    The command above will output workflow details for all Rules and Monitors contained in ALL management packs with "SQL" in the management pack Name.
The output file names will be: "SQL_Packs_Rules.html" and "SQL_Packs_Monitors.html"




    -------------------------- EXAMPLE 4 --------------------------
    PS C:\>Export-SCOMKnowledge -OutFolder "C:\MyReports" -ManagementServer "ms01.contoso.com" -NoKnowledgeExclude
    
    In the example above, the command will connect to management server: "ms01.contoso.com", will output workflow details for all Rules and Monitors (only if they contain a Knowledge Article) to two separate files in the specified folder. The output file names will be: "Rules.html" and "Monitors.html"




    -------------------------- EXAMPLE 5 --------------------------
    PS C:\>Export-SCOMKnowledge -OutFolder 'C:\Export' -ManagementPack (Get-SCOMManagementPack -Name "*ad.*") -Filter '(?=200[0-8])((?!Monitoring).)*$'
    
    The command above will output all rules/monitors from management packs which contain 'ad' in the Name and which contain '200x' in the Name or DisplayName of the workflow where 'x' is numbers 1-8 but excluding workflows that contain 'monitoring'.




    -------------------------- EXAMPLE 6 --------------------------
    PS C:\>#Export SCOM Knowledge for rules/monitors
    
    Get-SCOMManagementGroupConnection | Remove-SCOMManagementGroupConnection -Verbose
New-SCOMManagementGroupConnection -ComputerName YOUR_SERVERNAME
$SQLMPs = Get-SCOMManagementPack -Name *sql*
$Outfolder = 'D:\SCOMReports'

# Workflows to separate files
ForEach ($MP in $SQLMPs){
$rules = $MP.GetRules().Count
$mons = $MP.GetMonitors().Count
If (($rules + $mons) -gt 0){
Export-SCOMKnowledge -OutFolder $Outfolder -ManagementPack $MP -Topic "$($MP.Name)_"
}
Else{
Write-Host "No monitor/rule workflows found: " -NoNewline;
Write-Host "$($MP.DisplayName)" -f Yellow
}
}

#All MPs combined
Export-SCOMKnowledge -OutFolder $Outfolder -ManagementPack $SQLMPs -Topic "ALL_SQL_"

Leave a Reply

Your email address will not be published. Required fields are marked *