Checking Printer Drivers installed on a Server

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I have created a script that looks up a text file and installs the
relevant printer, based on the computername and the printer assigned.

The only problem I am having is, if the driver is not installed on the
server, it fails with an error "unknown printer or driver".

I was hoping to get all the servers running with the same drivers and
wanted to run a script to interrogate the servers and find what drivers
were loaded.

I have been using Microsoft Printmig to replicate the drivers, but this
doesn't list them out to a text file so I can compare between servers.

Has anybody done anything like this before?

I have listed my script below incase anybody wants it! The .csv file
referenced just holds a list of printers and machine ids (example:
\\kgbbwp01\bwqalan4,ANG916).

*********** Script Below *************
Option Explicit
'Define all variables below
Dim objNetwork, fso, inFile, inFileName, Pos, Pos2,strClientName,
strUNCPrinter, strComputer, strClient, line, sh

'Set variables below
Set fso = CreateObject("Scripting.FileSystemObject")
Set objNetwork = WScript.CreateObject("WScript.Network")
Set Sh = CreateObject("WScript.Shell")

'Define Location and file name of Printers list below
inFileName = "\\kuk-data\environ\NewScripts\Printers.csv"
strComputer = objNetwork.ComputerName
strClient = Sh.ExpandEnvironmentStrings("%CLIENTNAME%")

' Open the file
Set inFile = fso.OpenTextFile(inFileName, 1)

' Read the file, seperate string each side of the comma and process
While not inFile.AtEndOfStream
line = inFile.ReadLine
Pos=Instr(line,",")-1
Pos2=(len(line)-1)-Pos
strUNCPrinter = (left(line,Pos))
if (right(line,Pos2)) = strClient then
objNetwork.AddWindowsPrinterConnection strUNCPrinter
objNetwork.SetDefaultPrinter strUNCPrinter
Sh.LogEvent 4, "Printer " & strUNCPrinter & " Successfully Added for :
" & strClient
End if
Wend

'WScript.Echo "Printer(s) Successfully Added for : " & strClient &vbcr&
"on Server : " & strComputer

' close file
inFile.Close

'Quit Wscript Processing
WScript.Quit

.



Relevant Pages

  • Re: vbs to configure printer to remote machine
    ... Microsoft Windows Script Host Version 5.6 ... Copyright Microsoft Corporation 1996-2001. ... drivers on a remote machines, I have to copy the drivers locally to the ... Make sure you can install the driver on the local machine before attempting ...
    (microsoft.public.windowsxp.print_fax)
  • Re: 2009 pool
    ... The script I use "learns" as it ... Also kept all the drivers as numbers, ... getentries - given a round number, ... looking for entries, ...
    (rec.autos.sport.f1)
  • Re: [opensuse] wireless doesnt work in suse 11 RC1
    ... Offering a script to INSTALL proprietary drivers fetched ... A script can get non-GPL components from third party sites, ... Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org ...
    (SuSE)
  • Re: Was that a $3.00 kitchen broom that I saw the corner worker with?
    ... Its a very simple script. ... In GP Manager Pro, You play the plucky manager of a brand new Formula 1 ... Grand Prix team! ... Build your team up, negotiate with drivers, suppliers ...
    (rec.autos.sport.f1)
  • Re: VBS Logon Script Help
    ... script would error saying printer does not exist. ... ' VBScript to - Network Printer ... Dim objNetwork, strUNCPrinter ...
    (microsoft.public.scripting.vbscript)