Clear 2 attributes for selected Users

I’ve successfully gathered an inventory of Users that have a value for 2 attributes.

#backup current users and values -Task_a
Get-ADUser -filter {enabled -eq $true} -Properties delivContLength,submissionContLength |
Where-Object { $_.delivContLength -ne $null -or $_.submissionContLength -ne $null } |
select DistinguishedName,name,delivContLength,submissionContLength | Export-Csv .\TASK_a.csv -NoTypeInformation

Can this be piped into a Set-ADUser -clear attribute for both attributes? Get-Member says I’m still piping an ADUser object but I’m not sure how to pinpoint the Clear to just those 2 attributes.

something like this?

 | Set-ADUser -Clear delivContLength,submissionContLength

Yes, exactly like that.

Set-ADUser -Clear delivContLength,submissionContLength

Please use the pre /pre tags when posting code or errors. The pinned post at the top of the forum has specifics on how to format your question/code.


Doug, thanks, will do