I am trying to show the printers mapped to a computer. I only want the network printers to show up not the local ones. This script will show them but it also shows the document writers and other misc crap i dont want. Any ideas would help.
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=Impersonate}!\\" & RemoteMachine & "\root\cimv2")
Set ColInstalledPrinters = objWMIService.ExecQuery ("Select * From Win32_Printer")
For Each objPrinter in ColInstalledPrinters
Select Case objPrinter.PrinterStatus
Case 1
StrPrinterStatus = "Other"
Case 2
StrPrinterStatus = "Unknown"
Case 3
StrPrinterStatus = "Idle"
Case 4
StrPrinterStatus = "Printing"
Case 5
StrPrinterStatus = "Warmup"
End Select
StrPrintStatus = StrPrintStatus & "Name: " & objPrinter.Name & VbCrLf
StrPrintStatus = StrPrintStatus & "Location: " & objPrinter.Location & VbCrLf
StrPrintStatus = StrPrintStatus & "Printer Status: " & StrPrinterStatus & VbCrLf
StrPrintStatus = StrPrintStatus & "Server Name: " & objPrinter.ServerName & VbCrLf
StrPrintStatus = StrPrintStatus & "Share Name: " & objPrinter.ShareName & VbCrLf
StrPrintStatus = StrPrintStatus & VbCrLf
If objPrinter.Name = "Microsoft Office Document Image Writer" Then
Else
End If
next
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=Impersonate}!\\" & RemoteMachine & "\root\cimv2")
Set ColInstalledPrinters = objWMIService.ExecQuery ("Select * From Win32_Printer")
For Each objPrinter in ColInstalledPrinters
Select Case objPrinter.PrinterStatus
Case 1
StrPrinterStatus = "Other"
Case 2
StrPrinterStatus = "Unknown"
Case 3
StrPrinterStatus = "Idle"
Case 4
StrPrinterStatus = "Printing"
Case 5
StrPrinterStatus = "Warmup"
End Select
StrPrintStatus = StrPrintStatus & "Name: " & objPrinter.Name & VbCrLf
StrPrintStatus = StrPrintStatus & "Location: " & objPrinter.Location & VbCrLf
StrPrintStatus = StrPrintStatus & "Printer Status: " & StrPrinterStatus & VbCrLf
StrPrintStatus = StrPrintStatus & "Server Name: " & objPrinter.ServerName & VbCrLf
StrPrintStatus = StrPrintStatus & "Share Name: " & objPrinter.ShareName & VbCrLf
StrPrintStatus = StrPrintStatus & VbCrLf
If objPrinter.Name = "Microsoft Office Document Image Writer" Then
Else
End If
next