3 Replies Latest reply on Oct 18, 2019 2:18 AM by ganapa2000

    Import particular row data from csv

    ganapa2000 Hot Shot

      Hi,

       

      I am having issues importing particular row data from csv, please help

      Below is the contents of my csv

       

      Team,CPU,Memory

      HR,100,50

      DEV,200,150

      OPS,100,80

       

      Code

      $vmlist = Import-CSV "D:\import.csv"

      $vmlist | where Team = HR

       

      $vmlist.CPU

      $vmlist.Memory

       

       

      Error

       

      Where-Object : A positional parameter cannot be found that accepts argument 'System.Object[]'.

      At D:\import1.ps1:2 char:11

      + $vmlist | where $vmlist.Team = HR

      +           ~~~~~~~~~~~~~~~~~~~~~~~

          + CategoryInfo          : InvalidArgument: (:) [Where-Object], ParameterBindingException

          + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.WhereObjectCommand