• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 725
  • Last Modified:

Powershell Command 'Where' clause issue

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
Anthony K O365
Asked:
Anthony K O365
  • 4
  • 3
1 Solution
 
Patrick BogersDatacenter platform engineer LindowsCommented:
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
 
Patrick BogersDatacenter platform engineer LindowsCommented:
*
0
 
Anthony K O365Author Commented:
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
Evaluating UTMs? Here's what you need to know!

Evaluating a UTM appliance and vendor can prove to be an overwhelming exercise.  How can you make sure that you're getting the security that your organization needs without breaking the bank? Check out our UTM Buyer's Guide for more information on what you should be looking for!

 
Anthony K O365Author Commented:
Correction: I just closed my Powershell Session and tried again, and it worked!!
0
 
Patrick BogersDatacenter platform engineer LindowsCommented:
It looks like a valid command....

Super !!!
0
 
Anthony K O365Author Commented:
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
 
Patrick BogersDatacenter platform engineer LindowsCommented:
Sorry for objecting but i corrected the command from the question which worked.
0

Featured Post

Evaluating UTMs? Here's what you need to know!

Evaluating a UTM appliance and vendor can prove to be an overwhelming exercise.  How can you make sure that you're getting the security that your organization needs without breaking the bank? Check out our UTM Buyer's Guide for more information on what you should be looking for!

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