Link to home
Create AccountLog in
Avatar of techdrive
techdriveFlag for United States of America

asked on

powershell getting user in sub-OU's

I have a powershell script that goes and gets

Import-Csv c:\importfile.csv | ForEach-Object {
    Get-Mailbox $_.'User-email' | where {$_.organizationalunit -LIKE " Accounts/"}

Open in new window

presently I get users only in the user accounts OU. What I would like to do is grab any user in a sub ou under User accounts.
Avatar of FOX
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
You can add in an additional -NE "" and use a * after the last / in your -like statement