DSQUERY input file to change AD field and then provide results in output file


hopefully able this.  i have been trying find answer time , nothing seems work.

i trying change company field in ad pulling samaccountname's input file , providing results of changes output file.  below current code using.

for /f %a in (c:\input.txt) @dsquery user -samid %a | dsmod user -company "xyz company" >> c:\output.txt

the problem adds successful changes output file.  anything failed skipped.  i more interested in failed results want both.  using dsquery, dsmod, , whatever else how results output file?

thank time.

if can use powershell , have ad modules, snippet might help:

$file = "c:\input.txt"
$users = get-content  -path $file
foreach ($user in $users)
{
    set-aduser -identity $user -company "xyz company" -verbose >> "c:\output.txt"
}

-----

the set-aduser cmdlet supports parameters -verbose, -debug, -erroraction, , -warningaction. can experiment see parameter(s) gives output want, dependihg on whether messages errors or warnings, etc. check set-aduser details.


richard mueller - mvp directory services



Windows Server  >  Windows Server General Forum



Comments

Popular posts from this blog

server manager error: ADAM.events.xml could not be enumerated.

Cannot access Anywhere Access using domain name?

WMI Failure: Unable to update Local Resource Group