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

vDS Report Generation

$
0
0

I'm trying to populate vDS settings in a health check script and am receiving the below error. It seems to be failing on joining the values into the object for the report. Just seems to be failing on this portion of the script. All the other sections are working fine.

 

$GetDS = get-virtualswitch -Distributed 
$GetDS | % {$_.Name} | ForEach-Object { 
$GetDS1 = $_
get-virtualswitch -Distributed -Name $GetDS1 | Get-View | % {$_.PortGroup} | ForEach-Object {
$GetDvSSecPol1 = $_
$GetDvSName = $GetDvSSecPol1 | % {Get-View -Id $_} | %{$_.Name} 
$DvSallowPromSec = $GetDvSSecPol1 | % {Get-View -Id $_} | `
Select Name, `
@{N="AllowPromiscuous";E={$_.Config.DefaultPortConfig.SecurityPolicy.AllowPromiscuous.Value}}
$DvSallowPromiscuous = $DvSallowPromSec | where-object {$_.Name -NotLike "*DVUplinks"} 
$DvSallowPromiscuous1 =  $DvSallowPromiscuous | % {$_.AllowPromiscuous} 

$SecVal= "DvS Promiscuous Mode"

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

 

Transcript started, output file is healthcheck_Log_01162013.txt
Exception calling "Join" with "2" argument(s): "Value cannot be null.
Parameter name: value"
At C:\scripts\HC_Execution_Function.ps1:201 char:24
+     Value = [string]::Join <<<< (',',$DvSallowPromiscuous1)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Exception calling "Join" with "2" argument(s): "Value cannot be null.
Parameter name: value"
At C:\scripts\HC_Execution_Function.ps1:224 char:24
+     Value = [string]::Join <<<< (',',$DvSallowForged1)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException


Viewing all articles
Browse latest Browse all 252940

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>