Solved

Modifying user parameters in Active Directory (VBS)

Posted on 2004-09-10
7
946 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

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…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

18 Experts available now in Live!

Get 1:1 Help Now