How do I get my username for Exchange with PowerShell

How do I get my username for Exchange with PowerShell



Is there any command, or other way, that I can get the username that I have used for logging in to the Exchange-module in PowerShell?



For clarification:
This functionality is to be used in a script that will handle permissions for a group of Exchange-admins. And to avoid having to type their admin-accountnames each time they run the script, it would be great if the script could get the name of the account they used when logging in with the PowerShell Exchange-module.




2 Answers
2



You can get your username in the following code:


Get-Mailbox -ResultSize Unlimited | ForEach
Select-Object @label="User" ; expression=$user,DeviceOS, lastsuccesssync



how to get exact user name from get-mobiledevicestatistics in powershell






Sorry for not mentioning this, but since we have a huge number of users, get them all is not an option. Plus, testing the code gives a list of evert user, their device (if they have any) and last successful sync.

– Smorkster
Sep 18 '18 at 9:56






you can try the following code : "Get-Mailbox -ResultSize unlimited | Format-Table -Auto DisplayName, LitigationHoldEnabled" reference from : docs.microsoft.com/en-us/exchange/recipients-in-exchange-online/…

– Alina Li
Sep 18 '18 at 10:30



I never found an clear answer for this, so I insteed used my domain-AD username to search for correct useraccount.



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế