Helper/Add-ObjectProperty.ps1
function Add-ObjectProperty { param ( [Parameter(Position=0, Mandatory=$true)] [PSObject]$Object, [Parameter(Position=1, Mandatory=$true)] [string]$PropertyName, [Parameter(Position=2, Mandatory=$true)] $PropertyValue ) if (!($Object.psobject.Properties.Name -eq $PropertyName)) { if ($PropertyValue) { Add-Member -InputObject $Object -MemberType NoteProperty -Name $PropertyName -Value $PropertyValue } else { Add-Member -InputObject $Object -MemberType NoteProperty -Name $PropertyName } } Return $Object } Export-ModuleMember -Function Add-ObjectProperty |