Have you ever wanted to know which scripts are being using in a Management Pack? I did ;-)

You would normally use the MPViewer from Boris Yanushpolsky to have a look into the MP. But the MPViewer does not show you a list of all the scripts being used in the MP.

Suppose you want to know which scripts are being used in the Exchange 2003 MP. You could go through all monitors, rules or tasks and look at the Raw XML to find if a script is used.
image

 

But this would take quite some time. An easier way is to use PowerShell with an Xpath query. You first need to convert the MP to XML.

PowerShell Commands:

$xml = New-Object "System.Xml.XmlDocument"
$xml.Load("C:\temp\Microsoft.Exchange.Server.2003.Monitoring.xml")
$scripts = $xml.SelectNodes("descendant::ScriptName")
$scripts | group "#text"|select name|sort name

Result:

Name                                                                                      
----                                                                                      
Check_services_to_monitor_registrykey.js                                                  
CheckDC.vbs                                                                               
Collect_database_size_per_server.vbs                                                      
Collect_number_of_mailboxes_per_server.vbs                                                
Collect_Operating_System_Server_Information.vbs                                           
Collect_Server_Information.vbs                                                            
EXBPAInstall.vbs                                                                          
EXBPARunLocal.vbs                                                                         
EXBPARunOrg.vbs                                                                           
Publish_ExMP_Data.js                                                                      
QuerySMTPQueues.vbs                                                                       
Verify_IIS_Lockdown_was_run.vbs                                                           
Verify_Message_Tracking_Log_shares_are_locked_down.vbs                                    
Verify_Test_Mailboxes.vbs                                                                 
VerifyMFR.js                                                                              
VerifyMFS.js

 

I need to thank Marco Shaw for his help on the formatting of the result ;-)