[英]How does one query the GAL from powershell by job title?
I'm reading a document at work that involves a bunch of position titles, but I don't know who the people actually are, I only know their job titles. 我正在阅读一份涉及大量职位名称的工作文件,但我不知道这些人是谁,我只知道他们的职称。
I know this information is available in the Global Address Book, but I don't know how to put in a job title (and I guess location) and get back an actual person's name and contact information. 我知道这些信息可以在全球地址簿中找到,但我不知道如何输入职位(我想位置)并找回一个真实的人的姓名和联系信息。
Is it possible to use powershell to "almost" look up a contact in the GAL using a job title as an input and the contact as an output? 是否可以使用powershell“几乎”使用作业标题作为输入并将联系人作为输出在GAL中查找联系人?
o365 of course... o365当然......
As for ... 至于......
Is it possible to use powershell to "almost" look up a contact in the GAL using a job title as an input and the contact as an output?
是否可以使用powershell“几乎”使用作业标题作为输入并将联系人作为输出在GAL中查找联系人?
... the simple answer, yes. ......简单的答案,是的。 You just write the code for it, just as you would if this was on-premises Exchange, of course using the Exchange Online cmdlets via a PSRemote session.
您只需为它编写代码,就像使用本地Exchange一样,当然也可以通过PSRemote会话使用Exchange Online cmdlet。
Connection to EXO us a daily use case and fully documented as to how, from Microsoft here: Connect to Exchange Online PowerShell 连接到EXO我们的日常用例,并完整记录了如何从Microsoft这里: 连接到Exchange Online PowerShell
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking
Or just use this script from the MS PowerSHellGallery.com 或者只使用MS PowerSHellGallery.com中的此脚本
https://www.powershellgallery.com/packages/Connect-O365/1.5.4/Content/Connect-O365.ps1 https://www.powershellgallery.com/packages/Connect-O365/1.5.4/Content/Connect-O365.ps1
Or this one 或者这个
https://gallery.technet.microsoft.com/office/Connect-to-Office-53f6eb07/file/221497/1/Connect-Office365Services.ps1 https://gallery.technet.microsoft.com/office/Connect-to-Office-53f6eb07/file/221497/1/Connect-Office365Services.ps1
Yet, remember the GAL is populated from AD. 但是,请记住GAL是从AD填充的。 So, if you are in a hybrid environment, you can just hit your on-premises AD to get this.
因此,如果您处于混合环境中,您可以点击内部部署AD来获取此信息。
You have a built in cmdlet for user searches for AD and EXP/EXO: 您有一个内置的cmdlet,用于用户搜索AD和EXP / EXO:
Get-Command -Name '*adaccount*' | Format-Table -AutoSize
CommandType Name Version Source
----------- ---- ------- ------
Alias Set-ADAccountPasswordHash 3.4 DSInternals
Cmdlet Clear-ADAccountExpiration 1.0.1.0 ActiveDirectory
Cmdlet Disable-ADAccount 1.0.1.0 ActiveDirectory
Cmdlet Enable-ADAccount 1.0.1.0 ActiveDirectory
Cmdlet Get-ADAccountAuthorizationGroup 1.0.1.0 ActiveDirectory
Cmdlet Get-ADAccountResultantPasswordReplicationPolicy 1.0.1.0 ActiveDirectory
Cmdlet Search-ADAccount 1.0.1.0 ActiveDirectory
Cmdlet Set-ADAccountAuthenticationPolicySilo 1.0.1.0 ActiveDirectory
Cmdlet Set-ADAccountControl 1.0.1.0 ActiveDirectory
Cmdlet Set-ADAccountExpiration 1.0.1.0 ActiveDirectory
Cmdlet Set-ADAccountPassword 1.0.1.0 ActiveDirectory
Cmdlet Unlock-ADAccount 1.0.1.0 ActiveDirectory
# get function / cmdlet details
(Get-Command -Name Search-ADAccount).Parameters.Keys
Get-help -Name Search-ADAccount -Full
Get-help -Name Search-ADAccount -Online
Get-help -Name Search-ADAccount -Examples
Search-ADAccount -AccountDisabled | FT Name,ObjectClass -A
Search-ADAccount -AccountDisabled -UsersOnly | FT Name,ObjectClass -A
Search-ADAccount -AccountExpired | FT Name,ObjectClass -A
Search-ADAccount -AccountExpiring -TimeSpan 6.00:00:00 | FT Name,ObjectClass -A
Search-ADAccount -AccountInactive -TimeSpan 90.00:00:00 | FT Name,ObjectClass -A
Search-ADAccount -PasswordExpired | FT Name,ObjectClass -A
Search-ADAccount -PasswordNeverExpires | FT Name,ObjectClass -A
Search-ADAccount -LockedOut | FT Name,ObjectClass -A
Search-ADAccount -AccountDisabled -ComputersOnly | FT Name,ObjectClass -A
Search-ADAccount -AccountExpiring -DateTime "3/18/2009" | FT Name,ObjectClass -A
Search-AdAccount -AccountDisabled -SearchBase "DC=AppNC" -Server "FABRIKAM-SRV1:60000"
# Or just use
(Get-Command -Name Get-ADUser).Parameters.Keys
Get-help -Name Get-ADUser -Full
Get-help -Name Get-ADUser -Online
Get-help -Name Get-ADUser -Examples
# If you are really wanting to do this using EXP/EXO, then it provide a cmdlet to help
Get-ADObject -ldapfilter "(&(objectClass=contact)(objectCategory=person)(!showinAddressBook=*))" -properties *
You can also use the ADAC to write this code for you, it's just a matter of clicking through the steps and saving the code to modify as needed. 您也可以使用ADAC为您编写此代码,只需单击步骤并保存代码即可根据需要进行修改。 Follow these instructions.
请遵循这些说明。
Introduction to Active Directory Administrative Center Enhancements (Level 100) Active Directory管理中心增强功能简介(级别100)
Learning PowerShell with Active Directory Administrative Center (PowerShell History Viewer) 使用Active Directory管理中心学习PowerShell(PowerShell历史记录查看器)
Step-By-Step: Utilizing PowerShell History Viewer in Windows Server 2012 R2 循序渐进:在Windows Server 2012 R2中使用PowerShell历史记录查看器
Use Active Directory Administrative Center to Create PowerShell Commands in Windows Server 2012 使用Active Directory管理中心在Windows Server 2012中创建PowerShell命令
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.