Deploy Printers based on computer OU - Windows 10

Hi my environment is 

Server: Windows 2012 r2 

Clients:  Windows 10 Professional

I have a vbs script that works fine with Windows 7 in deploying printers based on OU.  I have tried to apply the same script to Windows 10 however this does not work.  Can someone please tell me what I need to do to get this working.

my script is as follows:

Error Resume Next'
set objSysInfo = CreateObject("ADSystemInfo")
strName = objSysInfo.ComputerName
arrComputerName = Split(strName, ",")
arrOU = Split(arrComputerName(1), "=")
strComputerOU = arrOU(1)
Set objNetwork = CreateObject("WScript.Network")
arrpc = Split(arrComputerName(0), "=")
strComputerName = arrpc(1)



REM ***Remove Network Printers***

Set wshNet = CreateObject("WScript.Network")
Set wshPrn = wshNet.EnumPrinterConnections
For x = 0 To wshPrn.Count - 1 Step 2
If Left(wshPrn.Item(x+1),2) = "\\" Then wshNet.RemovePrinterConnection wshPrn.Item(x+1),True,True
Next


Select Case strComputerOU

Case "staffroom"
ObjNetwork.AddWindowsPrinterConnection "\\AW-FP01\Admin Photocopier"
ObjNetwork.AddWindowsPrinterConnection "\\AW-FP01\Admin Kyocera Printer"
ObjNetwork.SetDefaultPrinter "\\AW-FP01\Main Admin Kyocera Printer"

end select

WScript.Quit

The removing of the printers works fine.  the ObjNetwork.AddWindowsPrinterConnection and the ObjNetwork.SetDefaultPrinter work if they are applied in a separate .vbs file.  The problem appears to be determining the OU, and then mapping a printer according to the OU.  

Like I say, the code itself is fine, because it works on Windows 7.  It appears to be an issue with Windows 10.  I'm hoping there's someone out there that knows the work around for this.  I need to somehow find a solution for this.  

August 20th, 2015 3:08pm

The best solution is to use GP.
Free Windows Admin Tool Kit Click here and download it now
August 20th, 2015 3:09pm

The best solution is
August 20th, 2015 4:25pm

Not if you set up the GP correctly. Post in GP forum for detailed assistance on setting location and OU dependent printers. It has to do with how you assign the printers.
Free Windows Admin Tool Kit Click here and download it now
August 20th, 2015 4:45pm

Not if you set up the GP correctly. Post in GP forum for detailed assistance on setting location and OU dependent printers. It has to do with how you assign the
August 21st, 2015 1:51pm

The best solution is to us

Free Windows Admin Tool Kit Click here and download it now
August 21st, 2015 1:57pm

Start by removing 'On Error Resume Next" from your script and fix all of the errors.  Until you do that it is not really possible to know what you issues are.

August 21st, 2015 1:58pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics