문제

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?

도움이 되었습니까?

해결책

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 }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top