Avatar of leadtheway
leadtheway
Flag for United States of America asked on

Powershell query for OU membership

I have a list of computers in a text file and I want to query AD to pull the OU they belong to.  Is this possible, i know to query ad to pull the computer from the OU, but i want to take a preexisting list and query to get OU membership
PowershellActive Directory

Avatar of undefined
Last Comment
footech

8/22/2022 - Mon
Emmanuel Adebayo

Dsquery command will do this for you perfectly
leadtheway

ASKER
but I'd have to do one at a time right?
SOLUTION
Emmanuel Adebayo

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
leadtheway

ASKER
Can you help with the syntax, I'm not familiar with dsquery, mostly use PS
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER CERTIFIED SOLUTION
footech

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.