Private/Get-HaloNullObject.ps1
|
function Get-HaloNullObject { <# .SYNOPSIS Nulls all values of an object .DESCRIPTION Provides an null object for use in provisioning items in the Halo API .OUTPUTS A powershell object containing the response. #> [CmdletBinding()] [OutputType([PSCustomObject])] param( # The object whose nested properties should be replaced with null values. [Parameter( Mandatory = $True )] [PSCustomObject]$NullObject ) $NullObject.PSObject.Properties | ForEach-Object { Write-Verbose ('Attribute Name: {0}' -f $_.name) Write-Verbose ('Attribute Type: {0}' -f (($_.Value.GetType()).name)) if ($_.Value -isnot [PSCustomObject]) { $_.Value = $Null } else { $_.Value = Get-HaloNullObject -NullObject $_.Value } } return $NullObject } |