如何在所有域中搜索用户? [英] How To search for user across all domains?

查看:293
本文介绍了如何在所有域中搜索用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写Powershell脚本来获取特定用户密码的到期时间。这些用户属于我们组织中的不同域(世界各地)。

I am writing a Powershell script to get password expiry for specific set of users. These users belongs to different domains (across the world) in our org.

我使用 Get-Aduser 来获取做到这一点。该脚本仅适用于运行脚本的用户。因此,如果脚本是从美国运行的,则 Get-AdUser 仅查找来自美国的用户。

I use Get-Aduser to get the do this. The script works only for users where the script is run from. So if the script is run from let's say US, the Get-AdUser finds only users from US.

如何我可以在所有域中搜索吗?

How can I search across all domains?

我尝试过

Get-AdUser -Server <GlobalCatalog> [...]

在没有 -Server <的情况下,其结果相同/ code>

This does have the same result without -Server

推荐答案

您是否尝试过使用以下内容:

Have you tried using the following:

Get-ADUser -Filter {(yourFilterCondition)} -SearchBase "" -Server X.Y.Z.W:3268 -Properties desiredProperties | select-object...

设置 SearchBase 是这里的关键。并且,还尝试在3268端口上执行查询,以从所有域中读取值。

Setting SearchBase to "" is the key thing here. And, also try to perform the query on 3268 port for reading values from all domains.

这篇关于如何在所有域中搜索用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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