I have a weird issues with Powershell Version 2.0.
The following works on newer versions but its not working as expected on this version. Any help is appreciated.
$DB = Import-Csv -Path "$($path)\DBExtrat.csv"
which is fine.
Headers in DBExtrat.csv ('hostname','hostip','name','type'
)
all 4 headers are reorganized and show up if i run
$DB
But if I try
$DB.name
or $DB.hostname
it returns noting. I need to be able to call it like this because my whole logic is tied to those specific variables names.
I've already tried adding the -header
option:
$DB = Import-Csv -Path "$($path)\DBExtrat.csv" -Header 'hostname','hostip','name','type'
but it doesn't work and also creates unnecessary extra row with header data.