Active Directory PowerShell get a user's NetBIOS account name including the domain name with Get-ADUser or Get-ADObject

If you want to get a user's full NetBIOS account name in the format DOMAIN\Username - for example EUROPE\TSmith with the Active Directory PowerShell cmdlets Get-ADUser or Get-ADObject this can be done by reading the msDS-PrincipalName attribute.

This can be viewed in ADSIEdit.msc however you'll need to ensure that "Constructed" attribute types is selected because this value isn't stored for the user but is generated dynamically.



In PowerShell you can simply enter the following command:


Get-ADUser -Identity "CN=Terry Smith,CN=Users,DC=demoxcs2022,DC=int" -Properties "msDS-PrincipalName";


or even the following 

Get-ADObject -Identity "CN=Terry Smith,CN=Users,DC=demoxcs2022,DC=int" -Properties "msDS-PrincipalName";


 While you're here -
Why not check out our 
Active Directory Documentation Tool?


Comments

Popular posts from this blog

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

TFTPD32 or TFTPD64 reports Bind error 10013 An attempt was made to access a socket in a way forbidden by its access permissions.

Enable function lock for F1-F12 on HP ZBook mobile workstations