Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4014
  • Last Modified:

Powershell command get-mailbox

I use this command :

Get-Mailbox -ResultSize "unlimited" -Filter 'customattribute2 -eq "00" -and customattribute1 -eq "Test"' | Set-Mailbox -CustomAttribute2 "01"

And it'work well. But, I want to add "City" in my request:

Get-Mailbox -ResultSize "unlimited" -Filter 'customattribute2 -eq "01" -and customattribute1 -eq "Test" -and city -eq "Quebec"' | Set-Mailbox -CustomAttribute2 "00"

But I have a error:
Get-Mailbox : Cannot bind parameter 'Filter' to the target. Exception setting "Filter": ""city" is not a recognized filterable property.

What is the command powershell if I want add th city?
0
dgswin
Asked:
dgswin
  • 2
1 Solution
 
jboddyCommented:
I do not think "City" is a mailbox attribute, is it part of the ADUSER.
Unless it has been set as a custom attribute?
0
 
atuldolasjCommented:
Hi dgswin,

The cmdlet "Get-Mailbox" does not accept the property "City" for the -Filter parameter. The following cmdlets accepts the property "City"

Get-Contact
Get-Recipient
Get-User

Please check the article:
http://technet.microsoft.com/en-us/library/bb738155(v=exchg.150).aspx

Regards,
Atul
0
 
jboddyCommented:
A sample script that can be edited to do this is here:
http://social.technet.microsoft.com/Forums/exchange/en-US/af39f4c3-a0c4-40d5-835a-0bcb856ff0a6/powershell-assistance-to-include-getmailbox-and-getmailboxstatics

It gets the size of mailboxes and certain attributes from the AD, just edit out the ones you do not want.
0
 
dgswinAuthor Commented:
My command works with Get-Recipient.

Thank you.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now