8 responses

  1. Hans Castorp
    2013-02-01

    When running the example:

    Get-Process | Where-Object ProcessName –EQ ‘sqlserver’

    I get the following error message:

    PS C:\> Get-Process | Where-Object ProcessName –EQ ‘sqlserver’
    Where-Object : Cannot bind parameter ‘FilterScript’. Cannot convert the “ProcessName” value of type “System.String” to type “System.Management.Automation.ScriptBlock”.
    At line:1 char:27
    + Get-Process | Where-Object <<<< ProcessName –EQ 'sqlserver'
    + CategoryInfo : InvalidArgument: (:) [Where-Object], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.WhereObjectCommand

    Reply

    • Wayne Sheffield
      2013-02-02

      Hi Hans – that should be sqlservr (remove the final “e”). However, neither way generates this error for me, so I’m not sure what to say. What version of PowerShell are you using? You can see this by entering $host at the PowerShell prompt.

      Reply

  2. Hans Castorp
    2013-02-04

    Thanks for the answer, the PowerShell version is 2.0 running on Windows 7 64bit.

    Reply

  3. Hans Castorp
    2013-02-04

    With PowerShell 2.0 it seems the syntax would be:

    Get-Process -ProcessName sqlservr

    Reply

  4. Grig
    2013-02-13

    For me it works:
    Get-Process | Where-Object { $_.ProcessName -EQ “sqlservr” }

    Reply

  5. May
    2013-02-20

    Get-Process | Where-Object ProcessName –EQ ‘sqlserver’

    Did not work for me but I was able to do it like this:

    Get-Process sqlservr

    Reply

  6. Spence
    2013-03-04

    Shouldnt the line
    If you have a Unix background, you know that everything in Unix is treated as a drive.
    read
    If you have a Unix background, you know that everything in Unix is treated as a file.

    Reply

    • intrepidis
      2013-06-19

      @Spence, yes I believe you’re correct. Actually, when I read “drive” it threw me a bit, but now you mention “file” I’m confident that it’s the correct term. i.e. On Unix a FAT32 partition could be mounted as “/mnt/c”.

      Reply

Leave a Reply to let me know how you liked this post

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top
mobile desktop