Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 251495

Re: vDS Report Generation

$
0
0

The variable $DvSallowPromiscuous will be $null when the Where-clause is not successfull

$DvSallowPromiscuous = $DvSallowPromSec | where-object {$_.Name -NotLike "*DVUplinks"}

In that case you should use an If-statement in the New-Object sequence.

Something like this

     New-Object PSObject -Property @{
            "Date/Time" = $Date
            Hostname = $GetVMHost
            "ISeC Section" = $Num
            Setting = [string]::Join(',',"$GetDvSName $SecVal")
            Value = &{
                if($DvSallowPromiscuous){
                [string]::Join(',',$DvSallowPromiscuous1)
                } else {"na"}}
            Compliancy = $text
        }

When $DvSallowPromiscuous is $null, the Value property will now contain the text "na", and the code will not try to execute the Join function


Viewing all articles
Browse latest Browse all 251495

Trending Articles