Added pscustomobject to hashtable converter
This commit is contained in:
@@ -126,8 +126,11 @@ function New-Address {
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Port,
|
||||
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
|
||||
[parameter(
|
||||
Mandatory=$false,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true
|
||||
)]
|
||||
[ValidateScript({ $_ -is [Hashtable] -or $_ -is [PSCustomObject] })]
|
||||
$CustomFields
|
||||
)
|
||||
@@ -156,10 +159,7 @@ function New-Address {
|
||||
|
||||
if ($CustomFields) {
|
||||
if ($CustomFields -is [PSCustomObject]) {
|
||||
$_customFields = @{};
|
||||
$CustomFields | Get-Member -MemberType *Property | Where-Object {
|
||||
$_customFields.($_.name) = $CustomFields.($_.name)
|
||||
}
|
||||
$_customFields = ConvertTo-Hashtable -InputObject $CustomFields
|
||||
} else { $_customFields = $CustomFields }
|
||||
|
||||
$_body = $_body + $_customFields
|
||||
|
||||
Reference in New Issue
Block a user