Checking Printer Drivers installed on a Server
- From: adamcort@xxxxxxxxx
- Date: 24 Apr 2006 07:50:36 -0700
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
.
- Follow-Ups:
- RE: Checking Printer Drivers installed on a Server
- From: Shinbaum
- RE: Checking Printer Drivers installed on a Server
- Prev by Date: Re: ntDSConnection Schedule
- Next by Date: Software installed on servers
- Previous by thread: Re: ntDSConnection Schedule
- Next by thread: RE: Checking Printer Drivers installed on a Server
- Index(es):
Relevant Pages
|