dim oAdSysInfo, sCompPath set WShShell = WScript.CreateObject("WScript.Shell") set WShNetwork = WScript.CreateObject("WScript.Network") set oAdSysInfo = CreateObject("AdSystemInfo") Set oPrinters = WshNetwork.EnumPrinterConnections ' Delete existing connections to network printers For i = 0 to oPrinters.Count - 1 Step 2 On Error Resume Next if Left(oPrinters.Item(i), 3) <> "lpt" And Left(oPrinters.Item(i), 3) <> "usb" then WshNetwork.RemovePrinterConnection oPrinters.Item(i+1), true, true else WScript.Echo "No network printers found" end if Next ' Get the Computer Name sCompPath = oAdSysInfo.ComputerName ' Set the printer dependant on the OU name for the PC if InStr (1, sCompPath, "OU=G15", 1) then WShNetwork.AddWindowsPrinterConnection "\\server9\IT_1300n" WShNetwork.SetDefaultPrinter "\\server9\IT_1300n" elseif InStr(1, SCompPath, "OU=ADMIN", 1) then WShNetwork.AddWindowsPrinterConnection "\\server9\ADMIN_4300" WShNetwork.SetDefaultPrinter "\\server9\ADMIN_4300" elseif InStr(1, SCompPath, "OU=D04", 1) then WShNetwork.AddWindowsPrinterConnection "\\server9\D4_3700" WShNetwork.AddWindowsPrinterConnection "\\server9\D4_4300" WShNetwork.SetDefaultPrinter "\\server9\D4_4300" elseif InStr(1, SCompPath, "OU=D05", 1) then WShNetwork.AddWindowsPrinterConnection "\\server9\D5_1300" WShNetwork.SetDefaultPrinter "\\server9\D5_1300" elseif InStr(1, SCompPath, "OU=DRAMA", 1) then WShNetwork.AddWindowsPrinterConnection "\\server9\DRAMA_4650" WShNetwork.SetDefaultPrinter "\\server9\DRAMA_4650" else WScript.Echo "A default printer has not been assigned. Please contact IT so that the problem can be resolved" end if