How to empty CustomAttribute fields using Power Shell?

Dell Admin
Dell Admin used Ask the Experts™
on
I need to empty the value in CustomAttribute1 and CustomAttribute2 for some Exchange 2013 mailboxes. Can you help please?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT Support Analyst II (Lead Infrastructure Engineer)
Commented:
Get-Mailbox -Identity mailbox1 | Set-Mailbox -CustomAttribute1 "<not set>"  -CustomerAttribute2 "<not set>"

Open in new window


 

Returns the entry to the default < not set > .. dont forget the quotes as < & > are "reserved for future use."

Author

Commented:
Thanks Jacob.

I need to see who are not empty on those fields first. I found the following two commands give different result:
Get-Mailbox -Filter {CustomAttribute1 -ne $null} | select Name, CustomAttribute1, CustomAttribue2
Get-Mailbox | ? CustomAttribute1 -ne $null | select Name, CustomAttribute1, CustomAttribue2

Aren't they supposed to give the same result?
Jacob DurhamIT Support Analyst II (Lead Infrastructure Engineer)

Commented:
Empty

get-mailbox -ResultSize unlimited | Where-Object CustomAttribute1 -like $null

Open in new window



NotEmpty
get-mailbox -ResultSize unlimited | Where-Object CustomAttribute1 -notlike $null

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial