Skip to content

Instantly share code, notes, and snippets.

@Depicus
Created February 18, 2015 23:26
Show Gist options
  • Save Depicus/50f64fa0a8afb999c195 to your computer and use it in GitHub Desktop.
Save Depicus/50f64fa0a8afb999c195 to your computer and use it in GitHub Desktop.
Sub ModifyUsers(ByVal TheObject)
Dim TheUser
For Each TheUser In TheObject
Select Case TheUser.Class
Case "user"
TheUser.Put("DefaultPrinter", "LDNLGHNPXXX")
TheUser.Setinfo()
Case "organizationalUnit", "container"
ModifyUsers(TheUser)
End Select
Next
End Sub
Dim TheDomain
Set TheDomain=GetObject(LDAP://OU=AddingPrinters,DC=depicus,DC=com)
ModifyUsers(TheDomain)
Set TheDomain = Nothing
MsgBox "Finished"
WScript.Quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment