SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm learning PowerShell with SharePoint and I found this simple powershell example

$timers = (Get-SPTimerJob | ($_.isDisabled -eq $false) )  

And I get this error

Expressions are only allowed as the first element of a pipeline.

Can you explain the error/How to fix?

share|improve this question
up vote 4 down vote accepted
$timers = Get-SPTimerJob | where-object { $_.isDisabled -eq $false }

Just a little bit of syntax error. Get-SPTimerJob needs to be piped to 'something', the where clause (short hand '?'), and use curly braces {} instead of round braces ().

You can use "?" as an alias for where-object, but for production scripts it's recommended to keep the full command names.

share|improve this answer
@x0n, why would you not recommend using aliases? – djeeg Apr 19 '11 at 0:27
it's mainly for readability. It's not that big of a sin to use the built-in aliases, but you wouldn't want to use custom aliases for production scripts as this kills portability. Aliases are best used as an aid for interactive use to cut down on typing, or for one-off throwaway scripts. – x0n Apr 19 '11 at 15:18

You need to do something like:

$timers = Get-SPTimerJob | where { $_.isDisabled -eq $false }
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.