PowerCLI

  • 1.  Get-View filter for not equals?

    Posted 8 days ago

    In particular I am looking for any hosts that do not have a particular build number.  I have come up with something to filter for the build number but -ne or ! do not work in place of the =.  Any suggestions?

    This is the one liner I am using to search for the build version.

    Get-View -ViewType HostSystem -Property Name,Config.Product -Filter @{'Config.Product.FullName'='24585383'}  | Sort-Object Name | Format-Table Name, @{L='Host Version & Build Version';E={$_.Config.Product.FullName}}
     
    Michael



  • 2.  RE: Get-View filter for not equals?
    Best Answer

    Posted 7 days ago

    The Value part in the Filter is a RegEx expression, so you can do a 'not match' using a Regex expression.
    Something like this, for example

    Get-View -ViewType HostSystem -Property Name,Config.Product -Filter @{'Config.Product.FullName'='^((?!24585383).)+$'} 


    ------------------------------


    Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference


    ------------------------------



  • 3.  RE: Get-View filter for not equals?

    Posted 7 days ago

    LucD comes to the rescue once more.  Thank you sir!