Is there anyway to ...
 
Notifications
Clear all

We appreciate the contributions many of you have been able to make towards repairing the storm damage and keeping a roof over our heads. With your help we’ve been able to complete much of the critical work. There is still work to be done to secure the house and your continued support will be a huge help.

Guests have read-only access to our forums. If you wish to participate you will need to register. Be sure to activate your account from the email sent to you when you register.

[Closed] Is there anyway to get the User Principal Name (UPN)

3 Posts
2 Users
1 Reactions
1,815 Views
(@r00ster)
Active Member Registered
Joined: 1 year ago
Posts: 4
Topic starter  

Okay, so there is way to get the "old" SAM account name of a user using:

USER=set:username,hidden:1
Host=text:Username,display:%username%,font-face:Tahoma,font-size:90%

Is there also any way to get the User Principal Name (UPN) of the user like or something similar:

UPN=set:upn,hidden:1
Host=text:UPN,display:%upn%,font-face:Tahoma,font-size:90%

 


   
Glenn
(@glenn)
Member Admin
Joined: 8 years ago
Posts: 1926
 

from my brief reading you might be able to get it using CMD "whoami /upn".  failing that we can implement GetUserNameEx

https://learn.microsoft.com/en-us/windows/win32/api/secext/nf-secext-getusernameexw

and possibly GetComputerObjectName while we're at it.

https://learn.microsoft.com/en-us/windows/win32/api/secext/nf-secext-getcomputerobjectnamew


   
(@r00ster)
Active Member Registered
Joined: 1 year ago
Posts: 4
Topic starter  

Yes thanks learned something new

This worked for me, thanks again @glenn 😉 :

CMD=interval:60,color:FFFFFF,style:b,text:UPN:,file:powershell.exe,parameters:"whoami /upn"

   
Glenn reacted
Glenn's Page