PerfMon – Import User Defined Data Collector Set via CI/CD (PowerShell)
Sometime you need to import User Defined Data Collector Set via CI/CD via pipeline – this one do the job:
$datacollectorset = New-Object -COM Pla.DataCollectorSet
$xml = Get-Content C:\ExportTemplatPerfmonFiles\pal.xml
$datacollectorset.SetXml($xml)
$datacollectorset.Commit(“PAL002” , $null , 0x0003)
Especially helpful for analyses to be done via Performance Analysis of Logs (PAL) Tool.
Please remember that PerfMon can be run only when Task Scheduler is enabled – https://mohammaddarab.com/perfmon-create-new-data-collector-set-grayed-out-fix/.