Solved

Modifying user parameters in Active Directory (VBS)

Posted on 2004-09-10
7
945 Views
Last Modified: 2008-01-16
Hello!

I have aprox. 2000 user accounts on my AD and i have to modify everybodys Profile and Home Directory path and drive letter.

Profile path is now something like this "\\server1\users$\%username%\Profile" and i want it to be
"\\server2\homes$\%username%\Profile"

Does somedoby knows good Visual Basic script for that job?


Rgds,
Lauri
0
Comment
Question by:Skege
  • 3
  • 3
7 Comments
 
LVL 16

Expert Comment

by:JamesDS
ID: 12025518
Skege
You can select all users within ADUC, right-click and select properties, in the relevant place you can enter your string:
"\\server2\homes$\%username%\Profile"

This works on my Windows 2003 domain, so I am hoping it goes for you too!

IT WONT MOVE THE DATA FOR YOU :)

If you need a script then look at www.15seconds.com, which has lots of downloadable scripts and a good search tool.


Cheers

JamesDS
0
 
LVL 18

Expert Comment

by:exx1976
ID: 12027518
This is easy to accomplish..  But first..  Are these PC profiles, or Terminal Services profiles?
0
 

Author Comment

by:Skege
ID: 12041570
Hello,

JamesDS,
And i need script because meaby i have to change some other attributes in future, so it´s easyer to modify script :)

exx1976,
These profiles are normal PC profiles.

0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 18

Expert Comment

by:exx1976
ID: 12043154
No problem.  The attributes you want to modify are   PROFILEPATH, HOMEDIRECTORY, and HOMEDIRDRIVE.


HTH,
exx
0
 

Author Comment

by:Skege
ID: 12048847
Yeah, I know what attributes i have to change but i don´t know how to do it :)

This script is from MS script cenral:

****************************************************

Const ADS_PROPERTY_UPDATE = 2
Set objUser = GetObject _
("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")

objUser.Put "givenName", "Ken"
objUser.Put "initials", "E."
objUser.Put "sn", "Myer"
objUser.Put "displayName", "Myer, Ken"
objUser.Put "physicalDeliveryOfficeName", "Room 4358"
objUser.Put "telephoneNumber", "(425) 555-1211"
objUser.Put "mail", "myerken@fabrikam.com"
objUser.Put "wWWHomePage", "http://www.fabrikam.com"  

objUser.PutEx ADS_PROPERTY_UPDATE, _
"description", Array("Management staff")
objUser.PutEx ADS_PROPERTY_UPDATE, _
"otherTelephone", Array("(800) 555-1212", "(425) 555-1213")  
objUser.PutEx ADS_PROPERTY_UPDATE, _
"url", Array("http://www.fabrikam.com/management")

objUser.SetInfo

********************************************************

That script modifyes user account called "myerken" attributes, but i want to modify everybodys attributes in one OU.
( example "LDAP://ou=Users,ou=Sales,dc=example,dc=com")

So how i can modify that script?

</Skege>
0
 
LVL 18

Accepted Solution

by:
exx1976 earned 125 total points
ID: 12049248
Like this:

Set oOU = GetObject("LDAP://OU=xxxx,DC=fabrikam,DC=com")

For each oUser in oOU
     oUser.ProfilePath = "\\server2\home$\%username%\profile"
     oUser.HomeDirectory = "\\server2\home$%username%\home"
     oUser.Put "HomeDirDrive","H:"
Next


That will modify EVERY user in the OU you point it at.


HTH,
exx
0
 

Author Comment

by:Skege
ID: 12052064
Okay, thank.
I modify that script and now it works like an angel :)
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now