====== Powershell : Arrays ====== [[prog:powershell|powershell]] {{youtube>PXBMdIkH24I}} #déclaration d'un tableau $Array = @() $Processes = Get-Process # On charge un tableau Foreach($proc in $Processes) { if ( $proc.ws/1mb -gt 100){ $proc.ws/1mb write-host $proc.name $array += New-Object psobject -property @{'ProcessName' = $proc.name; 'WorkingSet' = $Proc.ws} } } # on ne prends que 2 champs et on exporte dans un csv $Array | select 'ProcessName','WorkingSet' | Export-csv .\file.csv -noTypeInformation $csvimport = @() $csvimport = import-csv .\file.csv ForEach($dog in $csvImport){Write-host "Process Name:" $dog.processname "working Set :" $dog.WorkingSet}