简体   繁体   中英

How to list different OU in this command: Get-Mailbox -OrganizationalUnit

How do I list different OUs in the command Get-Mailbox -OrganizationalUnit ?

Get-Mailbox -OrganizationalUnit OU1 works without issues.

I need to list other OU in this command like -OrganizationalUnit OU1, OU2, ... but it doesnt work.

One way to accomplish this is to loop through a list of your OUs and send each of them to the Get-Mailbox command:

$OUs = "OU1","OU2","OU3"

Foreach ($OU in $OUs) {
   Get-Mailbox -OrganizationalUnit $OU
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM