Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Scripting Active Directory User Objects

Reply
 
Old 09-25-2008   #1 (permalink)
Benny Van


 
 

Scripting Active Directory User Objects

Hello All
just a quick question, I would like to set users in AD with one
attribute - Terminal Server Profile. User profiles are stored
centrally somewhere. I need to make all current 100 users' terminal
server profile point to that location and using the user logon name as
profile folder name. Currently the fields are blank, can that be done
using VBscript?

And how?
Thanks

Ben

My System SpecsSystem Spec
Old 09-25-2008   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: Scripting Active Directory User Objects

Benny Van wrote:
Quote:

> just a quick question, I would like to set users in AD with one
> attribute - Terminal Server Profile. User profiles are stored
> centrally somewhere. I need to make all current 100 users' terminal
> server profile point to that location and using the user logon name as
> profile folder name. Currently the fields are blank, can that be done
> using VBscript?
>
If your DC is W2k3 or above you can use code from this link:

http://www.microsoft.com/technet/scr.../tsusvb11.mspx

You need some way to bind to the 100 users in a loop and repeat code from
the link. I assume by "user logon name" you mean the "pre-Windows 2000
logon" name, which is the value of the sAMAccountName attribute of the user
object. For example, to configure all users in an OU the code could be
similar to:
========
' Specify terminal server profile path.
strPath = "\\MyServer\MyShare"

' Bind to OU using Distinguished Name of OU.
Set objOU = GetObject("LDAP://ou=West,dc=MyDomain,dc=com")
' Filter on user objects.
objOU.Filter = Array("user")

' Enumerate all users in OU.
For Each objUser In objOU
' Retrieve logon name.
strName = objUser.sAMAccountName
' Assign Profile Path.
objUser.TerminalServicesProfilePath = strPath & "\" & strName
objUser.SetInfo
Next
=======
If instead the 100 users are members of a group, you can enumerate the
members of the group. In brief:
======
' Bind to group object using Distinguished Name of group.
Set objGroup = GetObject("LDAP://cn=TSGroup,ou=West,dc=MyDomain,dc=com")

' Enumerate direct members of group.
For Each objUser In objGroup.Members
'.... same as above.
Next

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Active directory - object deletion with comparison to SMS 2003 objects PowerShell
SCRIPTING DFS and Active Directory VB Script
Problems obtaining user properties from Active Directory PowerShell
accountExpire user attribute in Active Directory PowerShell
Active Directory Vista networking & sharing


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46