如何使用 Windows Powershell 查询 Active Directory 以获取用户主体名称、业务 phone 和职位

How to query Acive Directory with Windows Powershell for userprincipalname,business phone, and Job Title

对这里的脚本编写有点陌生。当前正在使用广告模块来增强 shell。所以我希望能够查询 userprincipalname、business phone 和 Job Title。最后我想把它放在 excel sheet 上,这样我就可以找到那些没有 phone # 或职位的人。导出不是什么大事,因为我可以 select 它没电了 shell。

我可以通过以下查询

获得名称和业务phone
Get-AdUser -Filter * -Properties OfficePhone | FT OfficePhone,UserPrincipalName

我以为这可能就像在末尾添加标题一样简单,但是这不起作用。非常感谢任何帮助,并在此先感谢您!

你必须首先告诉它你想获得标题:

Get-AdUser -Filter * -Properties OfficePhone,Title | FT OfficePhone,UserPrincipalName,Title