Solved

Modifying user parameters in Active Directory (VBS)

Posted on 2004-09-10
7
950 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

830 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