如何检索employeeid属性 [英] How to retrieve the employeeid attribute

查看:40
本文介绍了如何检索employeeid属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检索 employeeid 属性?我执行时没有任何输出:

How to retrieve the employeeid attribute? I do not get any output when I execute:

Get-AzureADUser -ObjectId "Andre@contoso.com" | Select-Object -ExpandProperty ExtensionProperty

Key                         Value
---                         -----
odata.metadata              https://graph.windows.net/xxxxxxxxxxx-xxxx-xxxxxxxxxxxx/$metadata#directoryObjects/Mic...
odata.type                  Microsoft.DirectoryServices.User
employeeId                  118880
onPremisesDistinguishedName
userIdentities              []

我不知道如何使用AzureAD PowerShell检索它.

I do not know how to retrieve it with AzureAD PowerShell.

Get-AzureADUser -ObjectId "Andre@contoso.com" | Select-Object employeeId

employeeId
----------

最新更新:

$_default_log = $env:userprofile + '\Documents\azuread_enabled_accounts.csv'
Get-AzureADUser -All $true -Filter 'accountEnabled eq true' |
    select DisplayName, UserPrincipalName, Mail, Department, UserType,
        CreationType, RefreshTokensValidFromDateTime, AccountEnabled,
        @{name='Licensed';expression={if($_.AssignedLicenses){$TRUE}else{$False}}},
        @{name='Plan';expression={if($_.AssignedPlans){$TRUE}else{$False}}},ObjectId |
    Export-Csv $_default_log -NoTypeInformation -Encoding UTF8

推荐答案

它是Dictionary/HashTable,它是一个键/值对对象,因此请尝试:

It's Dictionary/HashTable which is a Key/Value pairs object, so Try:

(Get-AzureADUser -ObjectId "Andre@contoso.com").ExtensionProperty["employeeId"]

使用您的示例,将其添加为最后一个属性:

Using your Example, added as last property:

$_default_log = $env:userprofile + '\Documents\azuread_enabled_accounts.csv'
get-azureaduser -all $true -filter 'accountEnabled eq true' | select DisplayName,`
UserPrincipalName,Mail,Department,UserType,CreationType,RefreshTokensValidFromDateTime,AccountEnabled,`
@{name='Licensed';expression={if($_.AssignedLicenses){$TRUE}else{$False}}},`
@{name='Plan';expression={if($_.AssignedPlans){$TRUE}else{$False}}},ObjectId, `
@{N="EmployeeId";E={$_.ExtensionProperty["employeeId"]} } | export-csv $_default_log -NoTypeInformation -Encoding UTF8

这篇关于如何检索employeeid属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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