I go with the below. It seems to work OK for me.
Code:
For script to run on computers use Loopback processing in Merge Mode
That would allow you to apply a script to a Computer Account but using the User section of the policy.
To set it up what you need to do is:
1. Create a Group Policy with the Loopback Policy enabled:
Computer Configuration --> Administrative Templates --> System --> Group Policy
User Group Policy loopback processing mode: Enabled & Merge
2. Create a Group Policy attached to the OU containing the computer account with the script in the:
User Configuration --> Windows Settings --> Scripts Logon --> printers.vbs.
The Replace operation stops all other User based policies applying there and only uses those that would apply to the Computer OU.
The Merge operation uses the normal User based policies as well, but any policies set on the Computer OU take precedence.
Script for automated mapping of printer according to room number:
rem ** Next line must not be deleted **
Set WshNetwork = CreateObject("WScript.Network")
rem ** This will delete existing printers **
On Error Resume Next
Set oPrinters = WshNetwork.EnumPrinterConnections
For i = 1 to oPrinters.Count - 1 Step 2
WshNetwork.RemovePrinterConnection oPrinters.Item(i)
Next
rem ** Setup new printer connection **
WshNetwork.AddWindowsPrinterConnection "\\server\HP"
rem ** Setup default printer **
WshNetwork.SetDefaultPrinter "\\server\HP"