how do i read and write to the AD uidNumber attribute?

Rob merritt 6 Reputation points
2022-12-05T22:28:43.077+00:00

How do I retrieve the uidnumber instead of @{UIDNumber=37505}

267403-image.png

and on a side note how do i write back a uidNumber in where one is missing

set-aduser NAME uidnumber 404044

Windows for business | Windows Server | User experience | PowerShell
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 47,901 Reputation points
    2022-12-06T02:49:07.06+00:00

    How are you accessing the uidNumber?

    $u = Get-ADUser -Identity xxx -property uidNumber  
      
    PS C:\Junk> $u.uidnumber.gettype()  
      
    IsPublic IsSerial Name                                     BaseType  
    -------- -------- ----                                     --------  
    True     True     Int32                                    System.ValueType  
      
      
    PS C:\Junk> $u.uidNumber  
    43114  
      
      
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.