Skip to content

Instantly share code, notes, and snippets.

@kayasax
Created April 13, 2015 08:49
Show Gist options
  • Save kayasax/17534a2af61c75f3cdc2 to your computer and use it in GitHub Desktop.
Save kayasax/17534a2af61c75f3cdc2 to your computer and use it in GitHub Desktop.
powershell Array collection to CSV
$col=@()
#...
# instead adding an hashtable to the collection, we convert it to psobject
$prop=@{"serveur"="$computername";"nom"="$n";"programme"="$p";"arguments"="$a"; "xml"="$x"}
$col+= new-object -type pscustomobject -property $prop
#this allow us to export data to csv
$r |select serveur,nom,programme, arguments,xml |export-csv -path c:\temp\tasks.csv -notype -delimiter ';' -append
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment