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
Try like this
where{$_.Team -eq 'HR'} |
Select Cpu,Memory
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try like this
where{$_.Team -eq 'HR'} |
Select Cpu,Memory
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You may try as below
$vmlist = Import-CSV "D:\import.csv"
$vmlist | ?{$_.team -eq "HR"} | select CPU,Memory
superb, that was quick and perfect. Thank you very much