0
get-content C:\OUlist.txt | get-qadcomputer -SearchRoot $_ -DontUseDefaultIncludedProperties -IncludedProperties info

In the OUlist.txt file there is a list of OUs. I am having trouble passing each of the OUs to the get-qadcomputer command. If I hard code the OU in the command using 'company.com\workstation\Win7' instead of the "$_" the script runs fine.

Is there something that I am doing incorrectly to with regard to passing the OU down the pipeline?

Decorius
  • 23
  • 1
  • 2
  • 5

1 Answers1

1

The -SearchRoot parameter does not accept pipeline input, so you'll need to use a loop:

get-content C:\OUlist.txt | ForEach-Object { get-qadcomputer -SearchRoot $_ -DontUseDefaultIncludedProperties -IncludedProperties info }
KevinD
  • 3,023
  • 2
  • 22
  • 26
  • This indeed was the issue, resolved and working now. Obvious when I look at the situation now, there was just too many trees in the way for me to see the forest. Thank you for your vision. – Decorius Mar 24 '14 at 19:26