Home > Windows Server Tips > Windows Systems and Network Administration > Changing user account properties during NT migration
Windows Server Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

WINDOWS SYSTEMS AND NETWORK ADMINISTRATION

Changing user account properties during NT migration


Greg Peters
08.16.2005
Rating: -2.43- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Please let us know how useful you find this tip by rating it below. Do you have a useful Windows tip, timesaver or workaround to share? Submit it to our monthly tip contest and you could win a prize!


In the process of migrating users from NT BDCs to Windows 2000, we needed to change the users' profile paths. This script was put together from snipits of other code and some tweaking. It would be pretty easy to modify the code for other user properties.

'===================================================
' Name:  moduser.vbs
' Description:  Modify profile path of user accounts.  
Only those with a current roaming profile are udpated. ' Original: 13 Jun 05 ' '================================================= Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;" Set objCommand = CreateObject("ADODB.Command") objCommand.ActiveConnection = objConnection WScript.StdOut.WriteLine "Enter search criteria.
Wildcards can be used." strUserName = WScript.StdIn.ReadLine WScript.Echo objCommand.CommandText = _ "<LDAP://dc=,dc=>;" & _ "(&(objectCategory=user)(sAMAccountName=" & strUserName & "));" & _ "sAMAccountName,profilePath,ADsPath;subtree" Set objRecordSet = objCommand.Execute If objRecordset.EOF Then Wscript.Echo "No user account(s) found with the specified criteria." Else Wscript.Echo "User account(s) with the specified criteria:" While Not objRecordset.EOF Wscript.Echo objRecordset.Fields("sAMAccountName") & " : " & _ objRecordset.Fields("profilePath") objRecordset.MoveNext WEnd End If WScript.Echo strNewProfPath = "" While strNewProfPath = "" WScript.StdOut.WriteLine "Enter new profile server and share: " StrNewProfPath = WScript.StdIn.ReadLine WEnd WScript.Echo ' Refresh record set to apply new path. Set objRecordSet = objCommand.Execute While Not objRecordset.EOF If IsNull(objRecordSet.Fields("profilePath")) Then WScript.Echo objRecordSet.Fields("sAMAccountName") & " has no roaming profile." WScript.Echo Else strADsPath = objRecordSet.Fields("ADsPath") Set objUser = GetObject(strADsPath) objUser.Put "profilePath", strNewProfPath & "" & _ objRecordset.Fields("sAMAccountName") & ".USR" objUser.SetInfo End If objRecordset.MoveNext WEnd ' Refresh record set to view new profile path. Set objRecordSet = objCommand.Execute WScript.Echo "User account(s) with the new target data:" While Not objRecordset.EOF 'WScript.Echo objRecordSet.Fields("profilePath") If objRecordSet.Fields("profilePath") <> " " Then Wscript.Echo objRecordset.Fields("sAMAccountName") & " : " & _ objRecordset.Fields("profilePath") End If objRecordset.MoveNext WEnd objConnection.Close

Rate this Tip
To rate tips, you must be a member of SearchWindowsServer.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Windows Systems and Network Administration
How to use Group Policy to centralize system configurations
Troubleshooting Windows application crashes or hangs
Converting VMware ESX machines to Hyper-V format
Using DFSR for SYSVOL replication in Windows Server 2008
Top 25 Windows PowerShell commands for administrators
Key DFS improvements in Windows Server 2008 R2
Free Windows security tools every admin must have
Group Policy makes strides in Windows Server 2008 R2
Quick tips for troubleshooting NTFS permissions
Common causes of Windows server security vulnerabilities

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Server Room Design - Planning, Cooling, Maintenance
HomeTopicsBlogsITKnowledge ExchangeTipsNewsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2004 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts