简体   繁体   English

如何在此命令中列出不同的OU:Get-Mailbox -OrganizationalUnit

[英]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列出不同的OU?

Get-Mailbox -OrganizationalUnit OU1 works without issues. Get-Mailbox -OrganizationalUnit OU1可以正常运行。

I need to list other OU in this command like -OrganizationalUnit OU1, OU2, ... but it doesnt work. 我需要在这个命令中列出其他OU,如-OrganizationalUnit OU1, OU2, ...但它不起作用。

One way to accomplish this is to loop through a list of your OUs and send each of them to the Get-Mailbox command: 实现此目的的一种方法是遍历您的OU列表并将它们中的每一个发送到Get-Mailbox命令:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试使用调用命令获取与 OU 相关的所有 GPO - trying to get all the GPO's related to the OU with invoke command 如何获取带参数(说明为空白)的广告中的所有OU-没有说明? - How to get all OU in Ad with parameter (description blank ) - without description? 调用命令错误,尝试通过脚本从 dc 的特定 OU 获取链接的 GPO - Invoke command error, trying to get linked GPO's from specific OU from dc by script 使用Powershell获取嵌套OU - Get Nested OU's using Powershell Powershell 获取OU中所有服务器的lastlogonDate - Powershell get lastlogonDate of all servers in OU 获取所有包含相同名称 OU=NEEDOU 的 OU 的用户。 从某个数据库 - Get all users that consist bunch of OU with the same names OU=NEEDOU. From a certain database 获取其他时区的日期戳(Windows命令行) - Get datestamp for a different timezone (Windows command line) 如何使用Windows命令行获取已删除的临时文件名列表和只读文件名列表? - How to get the deleted temp file names list and read only file names list using windows command line? Powershell:如何将 get-netadapter 命令的 output 格式化为带有分隔符的单个列表/行 - Powershell : How to format the output of get-netadapter command to a single list/line with a delimiter 如何在gui动作后面获取command命令? - How to get the command command behind gui action?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM