Hello,
I have the following lines in a powershell script to search for the # and then remove it from the AD record (thus setting the field to in ADSI Edit):
$iUsers1 = Get-QADUser -SearchRoot $OU -SizeLimit 0 -objectAttributes @{extensionAttribute13 = “#”} | Set-QADUser -objectAttributes @{extensionAttribute13=@{Clear=@()}}
$iUsers2 = Get-QADUser -SearchRoot $OU -SizeLimit 0 -homePhone = “#” | Set-QADUser -homePhone = $null
The extensionAttribute13 field is successfully cleared. The -homePhone field is not and I receive the following error:
Set-QADUser : Cannot validate argument on parameter ‘Identity’. The argument is null or empty. Supply an argument that is not null or empty and then try the command again.
At C:\Remove_hash_2.ps1:15 char:84
- $iUsers13 = Get-QADUser -SearchRoot $OU -SizeLimit 0 -homePhone = “#” | Set-QADUser <<<< -homePhone = $null
- CategoryInfo : InvalidData: (
[Set-QADUser], ParameterBindingValidationException - FullyQualifiedErrorId : ParameterArgumentValidationError,Quest.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.SetUserCmdlet
- CategoryInfo : InvalidData: (
To make sure I had the correct syntax, I did the following from the ActiveRoles AD shell:
Set-QADUser 'username' -homePhone $null
And that worked.
I would appreciate any guidance with this.
Thank you.