get-wmiobject -filter为什么不能查询网络打印机信息


PowerShell交流中心分类: Powershell基础get-wmiobject -filter为什么不能查询网络打印机信息
0
TAO_Powershell asked 8 年 ago

PS C:\> Get-WmiObject -class win32_printer -Filter name= ‘\\server\printername'”
Get-WmiObject : 无效查询 “select \\server\printername’from win32_printer where name=”
所在位置 行:1 字符: 1
+ Get-WmiObject -class win32_printer -Filter name= ‘\\server\printername’…
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-WmiObject],ManagementException
    + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
查询本地计算机信息没有问题,只要输入\\带网络打印机的都会出现错误

1 Answers
0
Best Answer
Mooser Lee 管理员 answered 8 年 ago
Get-WmiObject -class win32_printer -ComputerName "你自己的机器名"