Link to home
Start Free TrialLog in
Avatar of Michael Leonard
Michael LeonardFlag for United States of America

asked on

need assistance with this powershell script

can someone help me with this script,  this is what i have so far, but its not working, getting a blank CSV:

the goal is to export out the values of the "targetAddress" attribute for all users that match company: XYZ

Get-ADUser -Filter {Company -eq "XYZ"} -Properties targetaddress | Select-Object Name, targetaddress | Sort-Object Name | Export-Csv -NoTypeInformation c:\temp\taexport.csv

Open in new window

Avatar of Hayes Jupe
Hayes Jupe
Flag of Australia image

works fine for me...

break it down into its parts to work out where the issue is

i.e.

Get-ADUser -Filter {Company -eq "XYZ"}   do you get anything back for that? if not, your filter is wrong

if you do get the correct info back, move on to
Get-ADUser -Filter {Company -eq "XYZ"} -Properties targetaddress | Select-Object Name, targetaddress | Sort-Object Name
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Michael Leonard

ASKER

thanks we will test again this morning with the wildcard option.
thanks for the help, we retested with the wildcard option and that worked!