Created
March 5, 2015 14:40
-
-
Save dlwyatt/4166704557cf73bdd3ae to your computer and use it in GitHub Desktop.
ConvertTo-Hashtable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ConvertTo-Hashtable | |
{ | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $true, ValueFromPipeline = $true)] | |
[psobject[]] $InputObject | |
) | |
process | |
{ | |
foreach ($object in $InputObject) | |
{ | |
$hash = @{} | |
foreach ($property in $object.PSObject.Properties) | |
{ | |
$hash[$property.Name] = $property.Value | |
} | |
$hash | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment