I'm moving over a .vbs script to a vb.net compiled applciation. I got the following code to work ok:
pcContext = New PrincipalContext(ContextType.Domain, "mine.local", "ou=2022,dc=mine,dc=local", "administrator", "mypassword!!")
upUser = New UserPrincipal(pcContext)
upUser.SamAccountName = szSAMAcctName
upUser.GivenName = szFirst
upUser.Surname = szLast
upUser.MiddleName = szMiddle
upUser.Description = szDescription
upUser.HomeDirectory = szHomeDirectory
upUser.DisplayName = szDisplayName
upUser.EmployeeId = szID
upUser.Enabled = True
'upUser.postalCode = szID
And it creates the new user perfectly. However, I need to use other fields in AD that show in active directory users and computers like office. In VBSCript the field is called physicalDeliveryOfficeName
but that field is not listed nor is there anything close to it. The other field I want to use is postalCode.
How can I update these fields when I create the user?