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";
Comments
Post a Comment