computing
  • 5

Solved Script To Check Computer And Install Printer

  • 5

Hi

Can someone help me put some codes together please, I already have a script which I would like to add a check and install or not install to it.

ComputerName= LCase(WshNetwork.ComputerName)
ShortName = Left(ComputerName, 16)
Select Case ShortName
Case”computer1″
wshnetwork.addwindowsprinterconnection “\\pserver\printer1”
wshnetwork.addwindowsprinterconnection “\\pserver\colourprinter1”
WshNetwork.SetDefaultPrinter “\\pserver\printer1″
Case”computer2”
wshnetwork.addwindowsprinterconnection “\\pserver\printer2”
wshnetwork.addwindowsprinterconnection “\\pserver\colourprinter2”
WshNetwork.SetDefaultPrinter “\\pserver\printer2″
Case”computer3”
wshnetwork.addwindowsprinterconnection “\\pserver\printer3”
wshnetwork.addwindowsprinterconnection “\\pserver\colourprinter3”
WshNetwork.SetDefaultPrinter “\\pserver\printer3”
Case Else
REM WScript.Echo “Problem determining PC location.”
End Select

This vbs script is run when a user logins and it will check the computer name and if it matches installed 2 printers and make one of them the default, I want it to check if the computer already have this printer installed and if so don’t install it and check the second one and again don’t install it if it’s installed already and so on checking all the machines.

Thanks

Share

1 Answer

  1. I think it’s solved. This will sometimes popup if we have the same printer installed twice. eg. Printer manager server will install an office printer linking the users GPO and a login script to install the same printer when the users logins to the computer.

    I have changed the login script not to include the office printer and so far no errors when the users login.

    • 0