Strange array behaviour

I’m trying to create an array as part of a script. In testing it usually runs fine the first time and get weird the second time.

$Passwords = @( Import-Csv -Path ($Directory + $aFile + '.csv') | Select-Object password Import-Csv -Path ($Directory + $bFile + '.csv') | Select-Object password Import-Csv -Path ($Directory + $cFile + '.csv') | Select-Object password Import-Csv -Path ($Directory + $dFile + '.csv') | Select-Object password ) 

It returns an array of results, as per normal.

If run again it produces

@{password=textO5397} @{password=textR8363} @{password=textS5022} @{password=textS2352} @{password=textS4848} @{password=textH4541} 

It’s frustrating having to constantly close and open the ISE and secondly, no idea why it’s even doing this.

To those who are horrified that we have a CSV of passwords, these are for students in an education setting who often forget their passwords.

submitted by /u/FireLucid
[link] [comments]

Leave a Reply