Create User in AD with extensionAttributes set

Edwin Fuller
Tera Guru

I've copied the "ActionCreateUser_AD_v2.ps1" to include other fields as per my organizations requirements; See attached file. It works fine until I try to include extensionAttributes4 where it fails with the message of

 

"A parameter cannot be found that matches parameter name 'extensionAttribute4'"

 

Part of script that is attempting to set extensionAttribute4

 

If($BusinessUnit){
$params['extensionAttribute4'] = $BusinessUnit
}

 

Please help me with the correct way to set extensionAttributes when creating new users in AD

 

 

 

1 REPLY 1

Amit Verma
Kilo Patron
Kilo Patron

Hi @Edwin Fuller 

 

You need to tweak your script a bit. You can either make use of -otherattributes in your cmdlet or you can set the attributes using Set-AdUser cmdlet with -add switch. Refer below links :

https://stackoverflow.com/questions/49622393/ad-custom-attribute-new-aduser-powershell

https://stackoverflow.com/questions/44266220/adding-users-to-ad-using-new-aduser-and-splatting

https://stackoverflow.com/questions/15807496/adding-and-removing-extensionattribute-to-ad-object

https://stackoverflow.com/questions/57959890/set-aduser-extensionattribute-wont-work-but-things-like...

 

Thanks and Regards
Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.