Functions/Data/Convert-HashTableToPSObject.ps1
Function Convert-HashTableToPSObject { [cmdletbinding()] Param ( # A Key\Value Pair Object [Parameter(Mandatory=$true,ValueFromPipeline=$true)] $hashtable ) Process { # Instantiate a NEW basic hash table. $BasicHashTable = [ordered]@{} # Fill Hash Table from the hashtable key/value data foreach ($key in $hashtable.keys) {$BasicHashTable.Add($key,$hashtable.$Key)} # Compose PSObject from the new Hashtable $PSOBject = [pscustomobject]($BasicHashTable) # Out PSObject $PSOBject } } |