Solved

Powershell Command 'Where' clause issue

Posted on 2014-01-08
8
704 Views
Last Modified: 2014-01-08
In running the Get-mailboxStatistics, I keep getting the following error:

Get-MailboxStatistics |Where {$_.alias -eq 'Jsmith'}

"The term 'Where' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

I also tried the ? alias, same error.  Any thoughts?
0
Comment
Question by:K Anthony O365
  • 4
  • 3
8 Comments
 
LVL 20

Expert Comment

by:Patrick Bogers
ID: 39766349
Hi

Shouldnt Where be substituted by Where-Object and add the server like below?

Get-MailboxStatistics -server serverhere |Where-Object {$_.alias -eq 'Jsmith'}

Please try it, havent got PS near now.
0
 
LVL 20

Expert Comment

by:Patrick Bogers
ID: 39766365
*
0
 

Author Comment

by:K Anthony O365
ID: 39766379
The server switch doesn't make a difference. Getting same error.

At one time I was able to use Get-MailboxStatistics -database MB1 |Where-Object {$_.alias -eq 'Jsmith'}

Not sure what happened.
0
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Accepted Solution

by:
K Anthony O365 earned 0 total points
ID: 39766388
Correction: I just closed my Powershell Session and tried again, and it worked!!
0
 
LVL 20

Expert Comment

by:Patrick Bogers
ID: 39766417
It looks like a valid command....

Super !!!
0
 

Author Comment

by:K Anthony O365
ID: 39766448
I've requested that this question be closed as follows:

Accepted answer: 0 points for ktookes's comment #a39766388

for the following reason:

I was able to solve this by closing and reopening the PS Session. Worked!
0
 
LVL 20

Expert Comment

by:Patrick Bogers
ID: 39766449
Sorry for objecting but i corrected the command from the question which worked.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video we show how to create a Shared Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Sha…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question