Sunday, January 6, 2008

Adding Network Printers Using a VBS Script

This script will install network printers for users that are a member of a specified security group. You can run this from the user's login script.

Dim shellobj, netobj, username, adsobj

On Error Resume Next

Set shellobj = WScript.CreateObject("WScript.Shell")
Set netobj = WScript.CreateObject("WScript.Network")

While username = ""
username = netobj.UserName

adsPath = "WinNT://Active Directory Domain Name/" & username
Set adsobj = GetObject(adsPath)

For Each Prop IN adsobj.Groups
Select Case Prop.Name

Case "security group"
netobj.AddWindowsPrinterConnection "\\server name\printer share name"

No comments: