[英]How to run this PowerShell command with Invoke-Command?
我想在远程站点上运行以下PowerShell命令
Get-CimInstance -ClassName Win32_OperatingSystem | select csname, lastbootuptime
和
Get-Counter -Counter "\memory\available mbytes" -MaxSamples 10 -SampleInterval 1
这样的调用命令格式吗?
Invoke-Command -ComputerName server01 {
Get-CimInstance -ClassName Win32_OperatingSystem | select csname, lastbootuptime
}
如果在目标服务器上设置了winRM,则可以从头开始在Get-CimInstance中传递ComputerName参数:
Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName server01| select csname, lastbootuptime
与Get-Counter相同:
Get-Counter -ComputerName server01 -Counter "\memory\available mbytes" -MaxSamples 10 -SampleInterval 1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.