如何在输出中包含computername

时间:2013-09-05 15:43:08

标签: powershell wmi wmi-query

PS newbe在这里......

如何让远程计算机名称显示在输出中?

$computer = "PC3090-121","APCD02" 
Get-WmiObject Win32_Printer -ComputerName $computer |
  Select-Object SystemName,Name,Local |
  Format-Table -AutoSize

我尝试在Select和format-table -properties中包含-computername,computername,%computername% - 没有快乐......

我的搜索空洞,或者我无法理解。

------------------------------回答:

$computer = "PC3090-121","APCD02" 
Get-WmiObject Win32_Printer -ComputerName $computer |
  Select-Object  __Server, Name, Local |
  Format-Table -AutoSize

1 个答案:

答案 0 :(得分:3)

如何简单地

Get-WmiObject Win32_Printer -ComputerName $computer |
  Select-Object SystemName,Name,Local |
  Format-Table -AutoSize

结果对象上没有computername属性,也没有%computername%属性。存在的是SystemName