Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Confused about context

$
0
0

I'm not a programmer and need some help with scripting an export from AD in PowerShell.

The following command returns a list of all users who have "tvstation" set as their company field.
get-aduser -filter {company -eq 'tvstation'} -Properties name,title,company,userprincipalname,telephoneNumber | sort-object name | export-csv c:\temp\tvsstation.csv

However, there are 500 some members of that group, and some of them have "corporate parent" set as their company field. I would prefer to filter by OU membership.
OU=tvstation,OU=Chicago,OU=US,OU=Employees,OU=TMUsers,DC=CorporateParent,DC=com

How do I change the initial command to filter by OU?


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>