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