Solved

Modifying user parameters in Active Directory (VBS)

Posted on 2004-09-10
7
953 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Application Deployment 2 273
no logon server available 8 161
Windows 2000 unable to connect to the internet by ethernet cable 14 135
AD account Auto logoff 1 58
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…
How many times a day do you open, acknowledge, or close an IT incident? What’s your process? Do you have a process depending on the incident, systems involved, and other factors? New Relic Alerts gives you options for how you interact with notifica…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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