All PowerShell Versions
If you would like to save the results of a PowerShell command to disk so that you can take it with you to another machine, here is a simple way:
$Path = "$env:temp\mylist.xml" Get-Service | Add-Member -MemberType NoteProperty -Name ComputerName -Value $env:COMPUTERNAME -PassThru | Export-Clixml -Depth 1 -Path $Path explorer.exe "/select,$Path"
This will get all services using Get-Service. The results are tagged with a new column called "ComputerName" that will show the computer name on which the data was taken.
Then, the results are saved to disk as serialized XML. Explorer will open the destination folder and select the created XML file so you can easily copy it to a USB stick and take it wherever you want.
To "rehydrate" the results elsewhere back into real objects, do this:
$Path = "$env:temp\mylist.xml" Import-Clixml -Path $Path