Solved

Modifying user parameters in Active Directory (VBS)

Posted on 2004-09-10
7
962 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

630 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