Showing posts with label csv. Show all posts
Showing posts with label csv. Show all posts

Tuesday, January 20, 2009

export and import processes by using a variable

step 1) PS> $p = get-process

step 2) Now write the variable to a CSV file and a CliXML file:
PS> $p | export-CSV .\test.csv
PS> $p | export-CliXML .\test.xml

step 3) Now import these values into two new variables:
PS> $p1 = import-csv .\test.csv
PS> $p2 = import-CliXML .\test.xml

step 4) To view their output from these variables:
PS> $p1 <----------- in a list format
PS> $p2 <----------- in a tabular format

Monday, January 19, 2009

when XML denies CSV and HTM

to get the ServiceController objects for all of the services that are running in their own processes, then export this information to a CSV file

PS R:\> get-service
| where { $_.serviceType -eq "Win32OwnProcess" }
| export-csv -notype ./edit3.csv

or,

PS R:> get-service | where { $_.serviceType -eq "Win32OwnProcess" } | export-csv -notype ./edit3.csv


or,

PS R:\> get-service
| where { $_.serviceType -eq "Win32OwnProcess" }
| export-csv -notype ./edit3.htm <--- not applicable for .xml


` edit3.csv ` contains delimited (comma-separted) text.