Sure, you can use PowerShell’s native CliXml
format:
@{
a = 1
b = [pscustomobject]@{
prop = "value"
}
} | Export-Clixml -Path hashtable.ps1xml
Deserialize with Import-CliXml
:
PS C:\> $ht = Import-CliXml hashtable.ps1xml
PS C:\> $ht['b'].prop -eq 'value'
True
More Related Contents:
- Save hash table in PowerShell object notation (PSON)
- PSCustomObject to Hashtable
- Hashtables and key order
- this code my teacher gave it to us as homework and it does not work with me idk why
- In what scenario was Invoke-Expression designed to be used?
- How can I write/create a powershell script verbatim, from another powershell script?
- How can I replace every occurrence of a String in a file with PowerShell?
- How do I pass variables with the Invoke-Command cmdlet?
- Any way to double-click on .PS1 file & open them in PowerShell?
- Set-Content appends a newline (line break, CRLF) at the end of my file
- Progress during large file copy (Copy-Item & Write-Progress?)
- How to get started with PowerShell? [closed]
- How to convert to UInt64 from a string in Powershell? String-to-number conversion
- How to process a file in PowerShell line-by-line as a stream
- How to unzip a file in Powershell?
- Echo equivalent in PowerShell for script testing
- Why is an empty PowerShell pipeline not the same as null?
- PowerShell script to check the status of a URL
- Accessing Windows Credential Manager from PowerShell
- Out-FINcodedCommand.ps1 is not recognized – executing a script in the current directory
- Copy file with square brackets [ ] in the filename and use * wildcard
- Check if a file exists or not in Windows PowerShell?
- Create Outlook email draft using PowerShell
- Read a Csv file with powershell and capture corresponding data
- Remove last line from file with Powershell
- Using –% in PowerShell
- List hidden sub-directories and sizes
- Are the cmdlets in a pipeline executing in parallel?
- PS Script is exporting an empty CSVs
- Drag and Drop to a Powershell script