【问题标题】:Set performance counter value with PowerShell使用 PowerShell 设置性能计数器值
【发布时间】:2020-05-17 23:41:33
【问题描述】:

有没有办法使用 PowerShell设置性能计数器的值?

【问题讨论】:

    标签: powershell performancecounter


    【解决方案1】:

    是的。

    $counter = (New-Object -TypeName System.Diagnostics.PerformanceCounter -ArgumentList ("CategoryName", "CounterName", "InstanceName", $false))    
    $counter.RawValue = 0
    

    【讨论】:

    • 很好,尽管您可以简化第一条语句:括号和引号都不需要:$counter = New-Object System.Diagnostics.PerformanceCounter CategoryName, CounterName, InstanceName, $false
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-22
    • 1970-01-01
    相关资源
    最近更新 更多