I'm attempting to use your functions to add vmk ports to an existing dVs
My syntax is as follows:
$dvkernname = new-dvswvmKernel -esxname $vmhost.name -dvswname $dvs -dvpgname $nfspg -ipaddr $nfsip -ipnetmask $dvsMask
I have defined these variables earlier on in my script
I receive the following error:
Get-View : Cannot validate argument on parameter 'VIObject'. The argument is nu
ll or empty. Supply an argument that is not null or empty and then try the comm
and again.
At Functions\dvsw_functions.ps1:55 char:40
+ $dvSwPg = $dvSw.Portgroup | %{Get-View <<<< $_} | where {$_.Name -eq $dv
PgName} + CategoryInfo : InvalidData: (:) [Get-View], ParameterBindingVal idationException + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom ation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView
Exception calling "AddVirtualNic" with "2" argument(s): "A specified parameter
was not correct.
PortConnection.portgroupKey"
At \Functions\dvsw_functions.ps1:71 char:29
+ $hostNetSys.AddVirtualNic <<<< ($null, $nic) + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException
I see when you published the functions you declared your variables inside the function .ps1. I'm confused on how to use this. Depending on which environment my script is processing, my variables change before passed to your function.