I'm having trouble using backtick (grave accent) for multi-line filter expression in PowerShell with the Get-AdUser command. Specifically I'm testing PowerShell 2.0 on Windows 7.
A working example (filter is all on one line):
Get-ADUser -Filter {Name -like "Smith*" -and Enabled -eq $True}
# This works as expected, a list of matching objects is returned on pipeline
A broken example (filter is split with multiple lines):
Get-ADUser -Filter {Name -like "Smith*" `
-and Enabled -eq $True}
# Error message indicates "Operator not supported at position [of backtick]
A second broken example (multi-line filter with -and before backtick):
Get-ADUser -Filter {Name -like "Smith*" -and `
Enabled -eq $True}
#Error message indicates "Syntax error at position [of backtick]"
Please provide examples of workarounds or explain the reason that these multi-line filters aren't supported. I'm having trouble figuring this one out but it seems like this should be a simple and common type of operation in PowerShell.