gpt4 book ai didi

PowerShell Get-Counter 命令,-ComputerName 与 -Counter

转载 作者:行者123 更新时间:2023-12-04 06:38:13 24 4
gpt4 key购买 nike

调用Get-Counter时使用-Co​​mputerName参数和使用-Co​​unter参数中的路径有区别吗?

Get-Counter -Counter "\Memory\Available MBytes" -ComputerName \\serv01 
Get-Counter -Counter "\\serv01\Memory\Available MBytes"

选择一个而不是另一个的原因是什么?

最佳答案

看起来通过使用 -ComputerName 参数,您可以在一条命令中从多台计算机的性能计数器获取数据,而通过在您需要使用的计数器路径中指定服务器名称一个循环或多个不同的命令。

示例5:从多台计算机获取特定的计数器数据

The first command saves the **Disk Reads/sec** counter path in the $DiskReads variable.
PS C:\> $DiskReads = "\LogicalDisk(C:)\Disk Reads/sec"

The second command uses a pipeline operator (|) to send the counter path in the $DiskReads variable to the **Get-Counter** cmdlet. The command uses the **MaxSamples** parameter to limit the output to 10 samples.
PS C:\> $DiskReads | Get-Counter -Computer Server01, Server02 -MaxSamples 10

关于PowerShell Get-Counter 命令,-ComputerName 与 -Counter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44727780/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com