Powershell - 用户所属的列表组 [英] Powershell - list groups users are a member of

查看:101
本文介绍了Powershell - 用户所属的列表组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我正在尝试编写一个powershell脚本,列出AD中特定OU所属的所有用户组。你能帮忙吗

I am trying to write a powershell script to list all the groups all users in a particular OU in AD are a member of. Can you please help

谢谢你

推荐答案

以下内容应该让您入门。它输出指定OU中用户的可分辨名称,后跟它们是其直接成员的组的可分辨名称。它不会显示嵌套的组成员身份,也不会显示"主要"成员身份。每个用户的
组(最有可能是"域用户")。您可以将输出重定向到文本文件。

The following should get you started. It outputs the distinguished names of the users in a specified OU, followed by the distinguished names of the groups they are direct members of. It does not reveal nested group membership, or the "primary" group of each user (which is most likely "Domain Users"). You can redirect the output to a text file.


Users = Get-ADUser -Filter * -SearchBase" ou =学校,DC =山顶,DC = rlmueller,DC =净" -Properties memberOf
ForEach(
Users = Get-ADUser -Filter * -SearchBase "ou=School,dc=Hilltop,dc=rlmueller,dc=net" -Properties memberOf ForEach (


User In


这篇关于Powershell - 用户所属的列表组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆