Dim name As String = args(0)
Dim scope As new System.Management.ManagementScope("\\root\\cimv2")
scope.Connect()
Dim searcher As new System.Management.ManagementObjectSearcher("SELECT * FROM Win32_Printer")
Dim hasPrint As Boolean
For Each printer As System.Management.ManagementObject In searcher.Get()
Dim printerName = printer("Name").ToString().ToLower()
\'Output.Show(printerName)
If printerName = name
If printer("WorkOffline").ToString().ToLower() = "true"
Return ("打印机【" & name & "】无法连接!")
Else
Return ("打印机正常!")
End If
End If
Next
Return "无此打印机"
调用
msgbox(Functions.Execute("CheckedPrinter","fax"))