Kicking off a Performance Monitor Data Collector Set via PowerShell?
I have a need to kick off a Data Collector Set that I've predefined. I'm going to be writing a PowerShell script that开发者_StackOverflow中文版 monitors a condition on the system and when it detects that condition, it begins the Data Collector Set. How can I start this Data Collector Set?
You can also access the collector sets programmatically by referencing the PLA.dll assembly in %windir%\System32\PLA.dll (Vista or later). You can then start a collection with code similar to:
IDataCollectorSet cs = new DataCollectorSet();
cs.Query("Collector set name", null);
cs.start(false);
Feel free to translate that to powershell :)
There may be a .NET way to do this but I do know you can use logman.exe to start/stop these e.g.:
logman start "My DataCollectorSet"
logman stop "My DataCollectorSet"
精彩评论