Hi guys,
I have one vb script for local printers:
Option Explicit
Const HKEY_LOCAL_MACHINE = &H80000002
Dim oReg : Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
Dim oShell : Set oShell = CreateObject("WScript.Shell")
Dim sPath, aSub, sKey, aSubToo, sKeyToo, StringValue, StringValue1
' Get all keys within sPath
sPath = "SYSTEM\CurrentControlSet\Control\Print\Printers"
oReg.EnumKey HKEY_LOCAL_MACHINE, sPath, aSub
' Loop through each key
For Each sKey In aSub
' Get all subkeys within the key 'sKey'
oReg.GetStringValue HKEY_LOCAL_MACHINE, sPath & "\" & sKey , "Printer Driver", StringValue
If StringValue = "MyOwnPrinterDriverName" Then
Wscript.Echo "Test of " & sPath & "\" & sKey & "\" & sKeyToo & " = " & StringValue
Wscript.Echo StringValue
End IF
NextFor local printers there will be one reg value name "Printer Driver" and the value is my goal. This will work for local printers, but not for network printers, because network printer are located in another regkey "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider\Servers\"PrinterName"\Printers\"ID"
The problem is, "Printer Name" and "ID" is unknown, so I need one script update, which will search all subkeys after "ID".
The main goal is to search for the printer name, and all what I have is his driver name :)
Thx for u help :)