Anthony K O365
asked on
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?
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?
*
ASKER
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.
At one time I was able to use Get-MailboxStatistics -database MB1 |Where-Object {$_.alias -eq 'Jsmith'}
Not sure what happened.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It looks like a valid command....
Super !!!
Super !!!
ASKER
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!
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!
Sorry for objecting but i corrected the command from the question which worked.
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.