Hi everyone,
i have a problem that i can't solve... this is my script:
param([string]$PktFile = $( Read-Host "InputPkt" )
#[string]$MailFile = $( Read-Host "InputMail" )
)
$pos=$PktFile.IndexOf(".")
$CSV=$PktFile.Substring(0,$pos)
$CSV = $CSV + ".txt"
Rename-Item c:\$PktFile $CSV
$Import=@(Import-Csv C:\$CSV)
$Lista = New-Object System.Collections.ArrayList
for($i=0; $i -le ($Import.Length - 1);$i++){
$Lista.Add(($Import.Get($i) | ForEach-Object {$_.Pacchetti; $_.Azione; $_.Tipo_Dipendenza; $_.Pacchetti_Dipendenti}))
$Lista
}And this is the output
0
SIRWEB_xxxxxxxxxxxxxxxxxxx
Promozione
Promozione
SITO_CARGO_xxxxxxxxxxxxxxx
why is displayed the value of $i of the for? How can i prevent this?
Thanks
Cristian