Added pscustomobject to hashtable converter
This commit is contained in:
21
functions/private/ConvertTo-Hashtable.ps1
Normal file
21
functions/private/ConvertTo-Hashtable.ps1
Normal file
@@ -0,0 +1,21 @@
|
||||
function ConvertTo-Hashtable {
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[PSCustomObject]$InputObject
|
||||
)
|
||||
process {
|
||||
$_hashtable = @{}
|
||||
$InputObject | Get-Member -MemberType *Property | Where-Object {
|
||||
$_hashtable.($_.name) = $CustomFields.($_.name)
|
||||
}
|
||||
|
||||
Write-Output $_hashtable
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user