I would like to Clear all the multible attributes for my AD users(reminiscence from Old Office Communication server installation):
I tried the following, but i can’t seem to get past this error:
Actually you don’t need to search first if user objects already have a value present or not. You can just null everything. Here’s one approach to do this. I’m using splatting here to feed the parameters to the Set-ADUser Cmdlet:
Set-ADUser : Cannot validate argument on parameter 'Replace'. The argument is null or an element of the argument collection contains a null value.
At C:\Users\XXXX\OneDrive - JP-Politikens Hus\Work\PS\SfB\ADUser-Clear-multi-Attribute-multi-users_exprimental.ps1:21 char:57
+ Set-ADUser -Identity $($user.SamAccountName) -Replace @{
+ ~~
+ CategoryInfo : InvalidData: (:) [Set-ADUser], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.SetADUser
You can’t set AD attribute to “null” in that way - it must be “cleared”. Also, I found that in our environment, the msRTCSIP attributes have quite different names.
My preferred method was to simply find all the msRTCSIP attributes in the account (since they all have the same prefix, why not) and clear them. It’s hitting AD three times rather than just twice, but the first is just to compile the user list - intelligent filters will help.
The only tricky part was that the attributes are “NoteProperty” types - all we wanted was the attribute names and not the values.