Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Change attribute "userWorkstations" for all users of an OU

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,62132
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Change attribute "userWorkstations" for all users of an OU
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Change attribute "userWorkstations" for all u... - 7/2/2008 10:09:52 PM   
  cmdr_paule

 

Posts: 3
Score: 0
Joined: 7/2/2008
Status: offline
Hi Scripting Community,

I'm an new member of your site and not the best VBS scripter...

I want to change the attribute "userWorkstations" of all user objects within an OU in AD. So I want to add all users an allowed workstation for logon.

I found a script for doing it only for one user object:


Code:Set objUser = GetObject _
("LDAP://cn=Ken Myer,ou=Finance,dc=fabrikam,dc=com")

objUser.Put "userWorkstations", "atl-ws-01,atl-ws-02,atl-ws-03"
objUser.SetInfoIs there anybody  who can help me to modify the script for a whole OU? (I think this would be done by a FOR loop, right?!)

_____________________________

Greetz Cmdr_Paule
-----------------------
Computers help us to solve problems, which we did not have before.
 
 
Post #: 1
 
 RE: Change attribute "userWorkstations" for a... - 7/3/2008 12:19:59 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
If you search you should be able to find lots of examples of doing something for all the users in an OU. Just take that code and have it do your something instead.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to cmdr_paule)
 
 
Post #: 2
 
 RE: Change attribute "userWorkstations" for a... - 7/3/2008 6:06:15 PM   
  cmdr_paule

 

Posts: 3
Score: 0
Joined: 7/2/2008
Status: offline
OK, after searching and trying I have the following script:


      

The problem is, that this script replaces the existing computer names in the attribute field. But I want to add a new one to the existing names. Do you have any ideas?

I read that the PutEx Method with the ADS_PROPERTY_APPEND variable should add values to multivalue fields. But I don't really know, if userWorkstations is a multivalued field...

_____________________________

Greetz Cmdr_Paule
-----------------------
Computers help us to solve problems, which we did not have before.

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Change attribute "userWorkstations" for a... - 7/7/2008 4:00:48 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
"But I don't really know, if userWorkstations is a multivalued field..."

Have you investigated to see?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to cmdr_paule)
 
 
Post #: 4
 
 RE: Change attribute "userWorkstations" for a... - 7/7/2008 6:54:21 PM   
  cmdr_paule

 

Posts: 3
Score: 0
Joined: 7/2/2008
Status: offline
quote:

Have you investigated to see?


Of course! Now I recognized that it seems to be a single valued field: "Is-Single-Valued: True" (http://msdn.microsoft.com/en-us/library/ms680868(VS.85).aspx)

Then it is probably impossible to add some new values...

Now I will try first to read out the existing values and then use these and the new one to fill the field again.

_____________________________

Greetz Cmdr_Paule
-----------------------
Computers help us to solve problems, which we did not have before.

(in reply to ebgreen)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Change attribute "userWorkstations" for all users of an OU Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts