bbbngowc Posted August 12, 2009 Posted August 12, 2009 Hi,Can someone point me in the right direction with attempting the following please?We have about 200 users that need access to 3 new servers on our 2003 Server AD network. Is there a script or something that can add the computers to each of the users "LogOn to" in AD?
bbbngowc Posted August 12, 2009 Author Posted August 12, 2009 Ok,I found this script. Anyone familiar with VB Scripting could tell me if this will work?Dim strComputer, objUser, strWorkstations, arrNames, k, objOU' Bind to user object.Set objOU = GetObject _("LDAP://DC=DOMAIN,DC=COM")objOU.Filter = Array("user")' Specify NetBIOS name of computer to add.strComputer = "SERVER1,SERVER2,SERVER3"For Each objUser in objOU' Retrieve value of userWorkstations attribute.strWorkstations = objUser.userWorkstations' Check if new computer name already included.arrNames = Split(strWorkstations, ",")For k = 0 To UBound(arrNames)If (LCase(strComputer) = LCase(arrNames(k))) Then' This computer already included. Abort.Wscript.Echo "User already allowed to logon to " & strComputerEnd IfNext' Append new computer name.If (strWorkstations = "") ThenstrWorkstations = strComputerElsestrWorkstations = strWorkstations & "," & strComputerEnd If' Save new value.objUser.userWorkstations = strWorkstationsobjUser.SetInfoNext
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now