我試圖從Windows 10 Azure Active Directory(AAD)加入的計算機上獲取Powershell的當前Windows用戶名&域。如何在Windows Powershell中獲取Azure Active Directory用戶名?
我已經嘗試了this question的提示,但它們似乎都不適用於加入Azure Active Directory的計算機。
例如用戶:Jonathan Doe, [email protected]
你只會得到用戶的專有名稱& AzureAD
(不是他們的用戶名或‘真正的’域):
$env:UserName --> JonathanDoe
$env:UserDomain --> AzureAD
[System.Security.Principal.WindowsIdentity]::GetCurrent().Name --> AzureAD\JonathanDoe
有誰知道如何獲得用戶的實際憑據或特定的任何部分Azure AAD域名? (例如john
或example.com
或理想[email protected]
)
謝謝!這工作完美。 – semenko
歡迎您! –