2017-09-04 99 views
0

employeeid属性の取得方法は?employeeid属性を取得する方法

Get-AzureADUser -ObjectId "[email protected]" | 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を使用して取得する方法がわかりません。

Get-AzureADUser -ObjectId "[email protected]" | 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 

答えて

1

それはキー/値のペアがオブジェクトである辞書/ハッシュテーブルですので、試してみてください:あなたの例を使用して

(Get-AzureADUser -ObjectId "[email protected]").ExtensionProperty["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, ` 
@{N="EmployeeId";E={$_.ExtensionProperty["employeeId"]} } | export-csv $_default_log -NoTypeInformation -Encoding UTF8 
+0

私はクエストを編集しましたn。このハッシュテーブルを最後の更新スクリプト内に追加するにはどうすればよいですか? – Arbelac

+0

最後に私の他の質問も見ることができますか? https://stackoverflow.com/questions/46035299/azure-active-directory-v2-powershell-finding-all-licenced-office-365-usersもう一度ありがとう – Arbelac

関連する問題