Hi, this article is to share a sample code to set a local printer as default when you don't map printer from a RDP or ICA session.

The non-mapping allow to have a faster longing and allow to restrict where the user can print from the remote application.

Script's example

Set objNetwork = CreateObject("Wscript.Network")

Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.UserName
strComputerDN = objSysInfo.ComputerName

Set objGroup1 = GetObject("LDAP://CN=DELL334,OU=Printer,DC=contoso,DC=com")
If (objGroup1.IsMember("LDAP://" & strUserDN) = True) Then
objNetwork.SetDefaultPrinter "DELL334"

Set objGroup2 = GetObject("LDAP://CN=DELL335,OU=Printer,OU=Printer,DC=contoso,DC=com")
If (objGroup2.IsMember("LDAP://" & strUserDN) = True) Then
objNetwork.SetDefaultPrinter "DELL335"

End If
End If

Place to place it

- In the User section in the login script, I do place it in the local GPO editor for each server.


- In the script I call "objNetwork.SetDefaultPrinter "DELL335"", thus you need the printer named exactly "DELL335" in the Terminal Server with a local printqueue.


- To get the LDAP's full name please use the Advanced Feature while in your AD User and Computer's console

- Set the same security on the printer share as the mapping too, if you want to restrict the printer the user see.


tip published following that thread; http://social.technet.microsoft.com/Forums/windowsserver/en-US/e1795b35-2fed-4369-8767-8286d0f78698/network-printer-driver-reinstalled-at-each-logon-with-rds?forum=winserverprint   to help :o)

If that can help !   Have a nice day

See Also

 Another important place to find a huge amount of Windows Server related articles is the TechNet Wiki itself. The best entry point is Windows Server Resources on the TechNet Wiki.