CLIXML
The Export-Clixml
 cmdlet can be used to serialize objects to file, which can then be easily deserialized with Import-Clixml
. Serialization is the process of exporting objects to a file or data format with its specific type information. It is similar to the techniques we learned earlier, except that it keeps the type information with it:
#Defining file for export $exportedFile ='C:\temp\exportedProcesses.xml' #Exporting services and strong into variable Get-Process| Tee-Object -Variable exportedProcesses | Export-Clixml $exportedFile #Showing variable $exportedProcesses #Importing services $importedProcesses = Import-Clixml $exportedFile #Comparing objects - no difference should be visible Compare-Object -ReferenceObject $exportedProcesses -DifferenceObject $importedProcesses -Property ProcessName, Id #Starting another process - Notepad.exe Notepad.exe #Comparing objects with current process list Compare-Object -ReferenceObject $exportedProcesses -DifferenceObject $(Get-Process...