If you want to change Linux attributes gidNumber, uid and uidnumber via PowerShell you will recognize that it is not possible by adding a parameter.
At least it is not possible with the cmdlet New-ADUser or Set-ADUser.
But you can workaround this problem with the parameters -add, -replace, -clear and -remove that enables to set these attributes.
First You Create the User, Then you set the Linux Attributes
Basically it remains the way it is. You cannot set a user with Linux attributes via New-ADUsser. The user mustbe there before you can add the Linux attributes.
- Create the new user with New-ADUser.
- Adjust the Linux attributes with the cmdlet Set-ADUser.
For setting the attributes gidNumber, uid and uidNumber you start the same way as you always do with Set-ADUser:
1 |
Set-ADUser -identity Thomas.Mueller |
Now just apply the parameter –add to set the Linux attributes:
1 |
Set-ADUser -identity Thomas.Mueller -add @{gidnumber="1234" ; uid="thomasmueller" ; uidnumber="13"} |
However, first you need to consider that –add requires a hash table to follow. The hash table starts with the @ symbol and the {}. That means you don’t address the attributes you want to fill with “-“. Instead you have to write the full attribute name followed by “=” and the value which the attribute should take. You seperate multiple attributes with a semicolon “;”.
Here you will find out more about adding parameters: Active Directory: PowerShell and Multi Value Attributes
FirstAttribute AG – Microsoft Consulting Partner for
Migration and Active Directory
3 Comments
Leave your reply.