$printersWMI = Get-WMIObject -Class "Win32_Printer" -NameSpace "root\cimv2" -computername "."
$portsWMI = Get-WMIObject -Class "Win32_TCPIPPrinterPort" -NameSpace "root\cimv2" -computername "."
$ports = @{}
ForEach($port in $portsWMI){
$ports[$port.name] = $port.HostAddress
}
ForEach($printer in $printersWMI){
$printer.Comment = $printer.PortName + "`r`n" + $ports[$printer.PortName]
$printer.Put()
}
No comments:
Post a Comment