简体   繁体   English

通过PowerShell启动性能监视器数据收集器集?

[英]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 monitors a condition on the system and when it detects that condition, it begins the Data Collector Set. 我将要编写一个PowerShell脚本,该脚本监视系统上的状况,并在检测到该状况时启动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). 您还可以通过引用%windir%\\ System32 \\ PLA.dll(Vista或更高版本)中的PLA.dll程序集以编程方式访问收集器集。 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 :) 随意将其转换为powershell :)

There may be a .NET way to do this but I do know you can use logman.exe to start/stop these eg: 可能有.NET方式可以做到这一点,但我知道您可以使用logman.exe来启动/停止这些程序,例如:

logman start "My DataCollectorSet"
logman stop "My DataCollectorSet"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM