get list of mailboxes without pictures
I'm trying to get a list of the mailboxes without pictures so I can add pix. I have tried the Get-Mailbox command with the following syntax and it works for one mailbox
Get-Mailbox username |fl name,haspicture
This gives me the result of the single mailbox name and True or False for the has picture object. I would like to run this for all mailboxes and have tried several filter options like -Filter and cannot get the correct result. It seems like this is
what I want to run is this:
Get-Mailbox -Filter "haspicture -eq $true" |fl name,haspicture
but I get this error
Invoke-Command : Cannot bind parameter 'Filter' to the target. Exception setting "Filter": ""haspicture" is not a recognized filterable property. For a complete list of filterable properties see the command help.
"haspicture -eq True" at position 1."
At mailserver.domain.com.psm1:133
48 char:29
+ $scriptCmd = { & <<<< $script:InvokeCommand `
+ CategoryInfo : WriteError: (:) [Get-Mailbox], ParameterBindingException
+ FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.Exchange.Management.RecipientTasks.GetMailbox
Any ideas on the syntax would be great or maybe I'm going about it wrong.
thanks, Dave
March 10th, 2012 1:41pm
Hi
try this code
Get-Mailbox |select-object name, haspicture |format-list
if you only want to get the mailboxes which have a picture configured use this code
Get-Mailbox |where-object {$_.haspicture -eq $true} |select-object name, haspicture |format-list
regards Thomas Paetzold visit my blog on: http://sus42.wordpress.com
Free Windows Admin Tool Kit Click here and download it now
March 10th, 2012 1:45pm
Thank you Thomas
That gives me all of the mailboxes and shows either True or False for if they have a picture. I would like to just get the ones where haspicture = false.
Dave
March 10th, 2012 1:50pm
Hi,
then this would be the solution:
Get-Mailbox |where-object {$_.haspicture -eq $false} |select-object name, haspicture |format-list
if you dont want to display the result for the haspicture attribute then this would work
Get-Mailbox |where-object {$_.haspicture -eq $false} |select-object name |format-list
regards Thomas Paetzold visit my blog on: http://sus42.wordpress.com
Free Windows Admin Tool Kit Click here and download it now
March 10th, 2012 3:13pm
Perfecto!!
thank you Thomas!
Dave
March 10th, 2012 3:21pm