User Accounts 'If you've ever found yourself trying to change the HomeDirectory, ProfilePath, logonscript path or the homeDrive of 'about 100 users at once by hand, you know that the experience is not something you ever look forward to repeating 'Now, I know you will never even have attempted the exercise manually if your user base is anywhere above 100 'Some of us will have the luxury of using a 3rd-part application like DameWare or Hyena 'Well, for the little poor guys like me out there, here's a "VERY CHEAP" AND FAST alternative. 'Enjoy 'Deji Akomolafe - 01-04-04 Const ADS_SCOPE_SUBTREE = 2 Const ADS_PROPERTY_CLEAR = 1 On Error Resume Next Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOObject" objConnection.Open "Active Directory Provider" Set objCOmmand.ActiveConnection = objConnection objCommand.CommandText = _ "Select sAMAccountName,distinguishedName from 'LDAP://DC=MyDomain,DC=com' " _ & "where objectClass='User'" objCommand.Properties("Page Size") = 1000 objCommand.Properties("Timeout") = 30 objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE objCommand.Properties("Cache Results") = False Set objRecordSet = objCommand.Execute objRecordSet.MoveFirst Do Until objRecordSet.EOF objUserName = objRecordSet.Fields("sAMAccountName").Value objUserDN = objRecordSet.Fields("distinguishedName").Value Set ObjPath = getObject("LDAP://" & objUserDN) Wscript.Echo objUserName 'PUT NEW VALUES IN 'Uncomment the following 5 lines and make the necessary changes to set the Values you need 'ObjPath.Put "profilePath", "\\MyServer\Shared-Prof-Folder\" & objUserName 'ObjPath.Put "scriptPath", "mylogon.vbs" 'ObjPath.Put "homeDirectory", "\\MyServer\Share-Home-Drive-Folder\" & objUserName 'ObjPath.Put "homeDrive", "Q:" 'ObjPath.SetInfo 'Do It Now 'CLEAR ALL VALUES 'Uncomment the following 5 lines IF you want to reset ALL the attributes to NOTHING 'objPath.PutEx ADS_PROPERTY_CLEAR, "profilePath", 0 'objPath.PutEx ADS_PROPERTY_CLEAR, "scriptPath", 0 'objPath.PutEx ADS_PROPERTY_CLEAR, "homeDirectory", 0 'objPath.PutEx ADS_PROPERTY_CLEAR, "homeDrive", 0 'objPath.SetInfo 'Do It Now objRecordSet.MoveNext Loop Set objRecordSet = Nothing Set objCOmmand.ActiveConnection = Nothing Set objCommand = Nothing Set objConnection = Nothing