列出了不属于几个发行列表PowerShell Exchange Online的用户
我正在寻找主要 smtp 是我们的domain.com 的用户,这些用户不属于我们拥有的某些office365 通讯组列表。例如,距离 1、距离 2、距离 3、距离 4。我不太擅长 PowerShell,但我找到了这个脚本,我希望有人可以帮助我调整它。
此脚本提取所有组的组成员身份。
Get-Mailbox | Where-Object {$_.PrimarySMTPAddress -like "*domain.com"} | ForEach-Object {
$user = Get-User -Identity $_.DistinguishedName
$groups = Get-Group | Where-Object {$_.Members -contains $User}
$_ | Select-Object DisplayName, Alias, PrimarySMTPAddress,
@{Name = 'Groups' ; Expression = {$groups.Name -join '; '}}
} | Export-Csv -Path 'X:\O365UserGroups.csv' -NoTypeInformation
I'm looking to find users whos primary smtp is our domain.com that are not part of certain office365 distribution lists we have. For example Dist1, Dist2, Dist3, Dist4. I'm not very good with PowerShell but I found this script and I'm hoping someone can help me adjust this.
This script pulls the group membership of all groups.
Get-Mailbox | Where-Object {$_.PrimarySMTPAddress -like "*domain.com"} | ForEach-Object {
$user = Get-User -Identity $_.DistinguishedName
$groups = Get-Group | Where-Object {$_.Members -contains $User}
$_ | Select-Object DisplayName, Alias, PrimarySMTPAddress,
@{Name = 'Groups' ; Expression = {$groups.Name -join '; '}}
} | Export-Csv -Path 'X:\O365UserGroups.csv' -NoTypeInformation
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我制作了一个脚本,用于检查主要 smtp 的用户是否是您的 domain.com,以及他们是否是分发组 1 或 2 的成员。如果用户不是分发组的成员,它将输出此内容。您可以自己轻松添加导出到 csv 等。
I have made a script that checks if users whos primary smtp is your domain.com and if they are members of distributionsgroup 1 or 2. If the user is not a member of a distributionsgroup it will output this. You can add export to csv etc easily yourself.