如何在输出中包含计算机名 [英] How do I include computername in output

查看:32
本文介绍了如何在输出中包含计算机名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PS 新手在这里...

PS newbe here...

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

How do I get the remote computer name to appear in the output?

$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% - 不高兴...

I've tried including -computername, computername, %computername% in the Select and format-table -properties - no joy...

我的搜索结果是空的,或者我无法理解.

My searches have come up empty, or I couldn't understand them.

------------------------------ 答案:

------------------------------ answer:

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

推荐答案

简单的怎么样

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

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

There is no computername property on the resulting object, nor is there a %computername% property. What exists is SystemName.

这篇关于如何在输出中包含计算机名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆