PowerShell Script to Create Input for CreateAndStartPerfmonLogs.vbs

Aug 30, 2009 at 5:26 AM

Thought I'd share this little sample. I needed to generate the text files that the aforementioned VBS takes. The little PowerShell piece below parses that XML and writes out each unique counter.

$data = [xml](Get-Content "Exchange2007-HUB.xml")

$hash = New-Object System.Collections.Hashtable

foreach ($entry in $data.PAL.Analysis)
{
 if (!$hash.ContainsKey($entry.AnalyzeCounter))
 {
  $entry.AnalyzeCounter | Out-File "PerfmonLogScripts\Exchange2007-Hub.txt" -Append
  $hash.Add($entry.AnalyzeCounter, 0)
 }
}

Thanks,

Brian Desmond

Active Directory MVP

Coordinator
Sep 9, 2009 at 6:02 AM

Very nice! And you even accounted for duplicates! :-) This is a keeper. Thanks!

Jan 19, 2010 at 5:12 PM

Is this script going to be added to the trunk for v2? 

Coordinator
Jan 20, 2010 at 7:10 AM

This functionality would be best served in the user interface of the PAL Wizard which is VB.NET, so the script would not be in it, but I will consider adding the export to text feature to the PAL Wizard UI.