I added the ability to read the printer names and driver names on a remote
machine to an HTA that my desktop team uses. The misreprentation that I
noticed is that the driver name retrieved by the HTA in two particular
examples is Lexmark T634 (with a
single-space in the middle) and the driver that is actually installed is the
Lexmark T634 (with a double-space in the middle).
Has anyone seen this inconsistency or know why it is doing this?
Below is my method from the HTA.
Thanks,
Bart Perrier
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub GetInstalledPrinters
On Error Resume Next
strComputer = GetStrComputer
If Trim(strComputer) <> "" Then
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
If ErrorConnecting(strComputer) = False Then
Set colInstalledPrinters = objWMIService.ExecQuery _
("SELECT * FROM Win32_Printer")
For Each objInstalledPrinter in colInstalledPrinters
strHTML = strHTML & "Printer Name -- " & objInstalledPrinter.Name &
"<br>" & _
"Driver Name -- " & objInstalledPrinter.driverName & "<br>"
' this actually does not work remotely
If objInstalledPrinter.Default = "True" Then
strHTML = strHTML & "-- DEFAULT PRINTER --" & "<br>"
End If
strHTML = strHTML & "<br>"
Next
End If
DataArea1.InnerHTML = strHTML
End If
End Sub ' End GetPrinterPorts