Skip to content

Instantly share code, notes, and snippets.

@kmhuglen
Created April 5, 2017 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmhuglen/648fd2b4bacd8a6861420fe65afe84ee to your computer and use it in GitHub Desktop.
Save kmhuglen/648fd2b4bacd8a6861420fe65afe84ee to your computer and use it in GitHub Desktop.
strComputer = "."
quote= chr(34)
XMLtag="<?xml version=” + quote + "1.0" + quote + " encoding=" + quote + "UTF-8" + quote + " standalone=" + quote + "yes" + quote + "?>"
drvold="<DRV old=" +quote
newdrv=quote + " new=" +quote +"Generic / Text Only" + quote + "/>"
Set objWMIService = GetObject("winmgmts:" & strComputer & "rootCIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_PrinterDriver",,48)
Wscript.Echo XMLtag
Wscript.Echo "<BrmConfig>"
Wscript.Echo "<DriverMap>"
For Each objItem in colItems
'Wscript.Echo "<DRV old=" &quote & ExtractDriverName(objitem.Name) &quote & " new=" &quote & "Generic / Text Only" &quote & "/>"
Wscript.Echo drvold & ExtractDriverName(objitem.Name) &newdrv
Next
Wscript.Echo "</DriverMap>"
Wscript.Echo "</BrmConfig>"
Wscript.Quit
Function ExtractDriverName(dName)
ExtractDriverName = Left(dName,(InStr(dName,",")-1))
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment