Added pscustomobject to hashtable converter

This commit is contained in:
2022-12-17 02:11:13 +03:00
parent bc645fc0d8
commit d1128997cc
4 changed files with 63 additions and 11 deletions

View 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
}
}