#This Line of script get content from txt file and pass it over to get user get user then gets all properties and only select DN
#Gc =Get-Content 
#% = foreach
#$=Variable


#$Userlist = GC "C:\Scripts\UserListBatch6.txt"
#foreach ($User in $Userlist)
#{
#Get-ADuser "$User" -Properties distinguishedName,cn | 
#select name, distinguishedname | out-file "c:\scripts\output\UserDN.csv"
#}

gc .\UserListBatch6.txt | %{Get-aduser $_ | select name, distinguishedname} | out-file "c:\scripts\output\UserDN.txt"