I can run the following script to get each user's name, FQDN's and RDS (Terminal Services) path. If I pipe the script to an OutFile when I run it, I get a text file with these elements listed on separate lines. If I break it into two scripts with one getting display name and RDS profile and the other getting FQDN and RDS profile, I can work through the 2 output files with Word and Excel to get a spreadsheet of all 3 elements, but I would much rather not have to go through the added hassle since we will be checking this somewhat frequently in the near future.
What can I do to the script below to have it output all 3 elements of each userID in a table? If not in a table, then a text file with the elements separated by semicolons (doesn't have to be semicolons, but it can't be commas since the FQDN is full of commas) and each user's info on a separate line so that I can easily bring it into Excel?
The script is:
$Users = ([ADSISearcher]"(&(objectCategory=person)(objectClass=user))").findall() | select path
foreach ($user in $users) {
$userSearch = [adsi]"$($user.path)"
$userSearch.psbase.InvokeGet(“displayname”)
$userSearch.psbase.InvokeGet(“distinguishedname”)
$userSearch.psbase.InvokeGet(“terminalservicesprofilepath”)
}
Thank you for your help with this.