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 "Microsoft.com/User 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.
ASKER CERTIFIED SOLUTION
Avatar of FOX
FOX
Flag of United States of America image

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