diff --git a/ChangeLog.md b/ChangeLog.md
index 484c612..f9f85b8 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,9 @@
### ChangeLog for vNugglets.VDNetworking PowerShell module
+#### v1.2.0, Jun 2018
+- \[enhancement] Added `Set-VNVMHostNetworkAdapterVDUplink` for setting the VDSwitch Uplink for a VMHost physical NIC ("VMNIC") on the VDSwitch of which the VMNIC is already a part
+- \[enhancement] Added `Get-VNVSwitchByVMHostNetworkAdapter` for getting the virtual switch (standard or distributed) with which the given VMHostNetworkAdapter physical NIC is associated, if any
+
#### v1.1.0, Jan 2018
- \[update] Added `-WhatIf` support to `New-VNVDTrafficRuleAction`, `New-VNVDTrafficRuleQualifier`
- \[bugfix] `-Enabled` parameter on `Set-VNVDTrafficRuleSet` was not working as expected. Fixed
diff --git a/ReadMe.md b/ReadMe.md
index 246f20a..29820f9 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -6,7 +6,7 @@ Contents:
- [Getting Help](#gettingHelpSection)
- [ChangeLog](#changelog)
-This PowerShell module provides functionality to automate the management of VMware vSphere virtual distributed networking items for which VMware PowerCLI does not already provide support. For example, for the reporting on-, creation of-, and removal of traffic filtering and marking rules at the vDPortgroup level.
+This PowerShell module provides functionality to automate the management of VMware vSphere virtual distributed networking items for which VMware PowerCLI does not already provide support. For example, for the reporting on-, creation of-, and removal of traffic filtering and marking rules at the vDPortgroup level. Another capability: managing the VDUplink of which a VMHost VMNIC is a part.
Some of the functionality provided by the cmdlets in this module:
- Get VDPortgroup traffic policy
@@ -15,12 +15,13 @@ Some of the functionality provided by the cmdlets in this module:
- Create traffic policy rule qualifiers, for use in creation of new policy rules
- Create new traffic rules for the ruleset for the given vDPortgroup
- Remove given traffic rule(s) from a vDPortgroup
+- Set the VDSwitch Uplink for a VMHost physical NIC ("VMNIC") on the VDSwitch of which the VMNIC is already a part
### QuickStart
Chomping at the bit to get going with using this module? Of course you are! Go like this:
- This module available in the PowerShell Gallery! To install it on your machine or to save it for inspection, first, use one of these:
- - Install the module:
+ - Install the module (maybe after you've inspected it first with the command after this):
`Find-Module vNugglets.VDNetworking | Install-Module`
- Or, save the module first for further inspection/distribution (always a good idea):
@@ -55,12 +56,3 @@ The cmdlets in this module all have proper help, so you can learn and discover j
### ChangeLog
The [ChangeLog](ChangeLog.md) for this module is, of course, a log of the major changes through the module's history. Enjoy the story.
-
-### Other Notes
-A few notes on updates to this repo:
-
-Jan 2018
-- initial public "prod" release
-
-Dec 2017
-- initial public dev release
diff --git a/ToDoAndNotes.md b/ToDoAndNotes.md
index 7facc84..cfa6c57 100644
--- a/ToDoAndNotes.md
+++ b/ToDoAndNotes.md
@@ -1,10 +1,11 @@
-## Notes on Traffic Filtering and Marking code
+## Notes on vNugglets.VDNetworking PowerShell module
### Need to make:
- Tests (partial, currently, written for interactive test, not fully automated)
### Maybe eventually add/update:
+- `Set-VNVMHostNetworkAdapterVDUplink`: add check that, if all specified VMHostNetworkAdapters are already associated with the given UplinkNames, take no action and return a Verbose message to that effect ("already in desired state"); approximate start/finish points for this feature are noted in comments in the code
- `Copy-VNVDTrafficRule -Rule -Ruleset `
- `Set-VNVDTrafficRule` -- to update a rule, maybe? (like change qualifier/action?)
- `New-VNVDTrafficRule`
diff --git a/Update-ThisModuleManifest.ps1 b/Update-ThisModuleManifest.ps1
index 72c21ca..cbaac3f 100644
--- a/Update-ThisModuleManifest.ps1
+++ b/Update-ThisModuleManifest.ps1
@@ -15,7 +15,7 @@ begin {
$hshManifestParams = @{
# Confirm = $true
Path = $strFilespecForPsd1
- ModuleVersion = "1.1.0"
+ ModuleVersion = "1.2.0"
Author = "Matt Boren (@mtboren)"
CompanyName = 'vNugglets for the VMware PowerCLI community'
Copyright = "MIT License"
@@ -23,7 +23,7 @@ begin {
# AliasesToExport = @()
FileList = Write-Output "${strModuleName}.psd1" "${strModuleName}_ModRoot.psm1" "en-US\about_${strModuleName}.help.txt" GetItems.ps1 NewItems.ps1 RemoveItems.ps1 SetItems.ps1 "${strModuleName}_SupportingFunctions.ps1" "${strModuleName}.format.ps1xml" "${strModuleName}_init.ps1" "${strModuleName}_ClassDefinition.ps1"
FormatsToProcess = "${strModuleName}.format.ps1xml"
- FunctionsToExport = Write-Output Get-VNVDTrafficFilterPolicyConfig Get-VNVDTrafficRuleSet Get-VNVDTrafficRule Get-VNVDTrafficRuleQualifier Get-VNVDTrafficRuleAction New-VNVDTrafficRuleQualifier New-VNVDTrafficRuleAction New-VNVDTrafficRule Remove-VNVDTrafficRule Set-VNVDTrafficRuleSet
+ FunctionsToExport = Write-Output Get-VNVDTrafficFilterPolicyConfig Get-VNVDTrafficRuleSet Get-VNVDTrafficRule Get-VNVDTrafficRuleQualifier Get-VNVDTrafficRuleAction Get-VNVSwitchByVMHostNetworkAdapter New-VNVDTrafficRuleQualifier New-VNVDTrafficRuleAction New-VNVDTrafficRule Remove-VNVDTrafficRule Set-VNVDTrafficRuleSet Set-VNVMHostNetworkAdapterVDUplink
IconUri = "https://avatars0.githubusercontent.com/u/10615837"
LicenseUri = "https://github.com/vNugglets/vNuggletsPSMod_vDNetworking/blob/master/License"
NestedModules = Write-Output GetItems.ps1 NewItems.ps1 RemoveItems.ps1 SetItems.ps1 "${strModuleName}_SupportingFunctions.ps1"
@@ -33,7 +33,7 @@ begin {
RequiredModules = "VMware.VimAutomation.Vds"
RootModule = "${strModuleName}_ModRoot.psm1"
ScriptsToProcess = "${strModuleName}_init.ps1", "${strModuleName}_ClassDefinition.ps1"
- Tags = Write-Output vNugglets VMware vSphere PowerCLI VDPortGroup TrafficFiltering Filter Filtering TrafficMarking Mark Marking VDSwitch
+ Tags = Write-Output vNugglets VMware vSphere PowerCLI VDPortGroup TrafficFiltering Filter Filtering TrafficMarking Mark Marking VDSwitch Uplink VDUplink VMHostNetworkAdapater VMNIC
# Verbose = $true
} ## end hashtable
diff --git a/docs/examples.md b/docs/examples.md
index abda739..0cdd565 100644
--- a/docs/examples.md
+++ b/docs/examples.md
@@ -41,6 +41,13 @@ Get-VDSwitch -Name myVDSw0 | Get-VDPortGroup -Name myVDPG0 | Get-VNVDTrafficFilt
Get-VDSwitch -Name myVDSw0 | Get-VDPortGroup -Name myVDPG0 | Get-VNVDTrafficRuleSet
```
+#### `Get-VNVSwitchByVMHostNetworkAdapter`: Get the virtual switch (standard or distributed) with which the given VMHostNetworkAdapter physical NIC is associated, if any.
+
+```PowerShell
+## Get the vSwitch with which VMNIC2 on myVMHost0.dom.com is associated
+Get-VMHost myVMHost0.dom.com | Get-VMHostNetworkAdapter -Name vmnic2 | Get-VNVSwitchByVMHostNetworkAdapter
+```
+
#### `New-VNVDTrafficRule`: Make new Traffic Rule and add it to the given Traffic Ruleset of a vDPortgroup traffic filter policy
```PowerShell
@@ -100,3 +107,15 @@ Get-VDSwitch -Name myVDSw0 | Get-VDPortGroup -Name myVDPG0 | Get-VNVDTrafficFilt
Get-VDSwitch -Name myVDSw0 | Get-VDPortGroup -Name myVDPG0 | Get-VNVDTrafficRuleSet | Set-VNVDTrafficRuleSet -Enabled:$false
```
+#### `Set-VNVMHostNetworkAdapterVDUplink`: Set the VDSwitch Uplink for a VMHost physical NIC ("VMNIC") on the VDSwitch of which the VMNIC is already a part
+
+```PowerShell
+## Set the VMNIC "vminic3" from VMHost myVMHost0.dom.com to be in VDUplink "Uplinks-02" on VDS myVDSwitch0 (the vDSwitch of which VMNIC3 is a part)
+Get-VMHost myVMHost0.dom.com | Get-VMHostNetworkAdapter -Name vmnic3 | Set-VNVMHostNetworkAdapterVDUplink -UplinkName Uplinks-02
+
+## Set the VMNICs "vminic2", "vminic3" from VMHost myVMHost0.dom.com to be in VDUplinks "Uplinks-01", "Uplinks-02" on VDS myVDSwitch0 (the vDSwitch of which VMNIC2 and VMNIC3 are a part)
+## Could then check out the current status like:
+## Get-VDSwitch myVDSwitch0 | Get-VDPort -Uplink | Where-Object {$_.ProxyHost.Name -eq "myVMHost0.dom.com"} | Select-Object key, ConnectedEntity, ProxyHost, Name | Sort-Object ProxyHost, Name
+Set-VNVMHostNetworkAdapterVDUplink -VMHostNetworkAdapter (Get-VMHost myVMHost0.dom.com | Get-VMHostNetworkAdapter -Name vmnic2, vmnic3) -UplinkName Uplinks-01, Uplinks-02
+```
+
diff --git a/makeExamplesMd.ps1 b/makeExamplesMd.ps1
index 9db8f29..9fc9602 100644
--- a/makeExamplesMd.ps1
+++ b/makeExamplesMd.ps1
@@ -6,7 +6,11 @@ Get-Command -Module vNugglets.VDNetworking -PipelineVariable oThisCommand | Fore
$oHelp_ThisCommand = Get-Help -Full -Name $oThisCommand.Name
## make a string with the example description(s) and example code(s) for this cmdlet
$strExampleCodeBlock = ($oHelp_ThisCommand.examples.example | Foreach-Object {
- "`n## {0}`n{1}" -f ($($_.remarks.Text | Where-Object {-not [System.String]::IsNullOrEmpty($_)}) -join "`n"), $_.code
+ ## for this example, make a single string that is like:
+ # ## example's comment line 0 here
+ # ## example's comment line 1 here
+ # example's actual code here
+ "`n{0}`n{1}" -f ($($_.remarks.Text | Where-Object {-not [System.String]::IsNullOrEmpty($_)} | Foreach-Object {$_.Split("`n")} | Foreach-Object {"## $_"}) -join "`n"), $_.code
}) -join "`n"
## make a string that has the cmdlet name and description followed by a code block with example(s)
"#### ``{0}``: {1}`n`n``````PowerShell{2}`n```````n" -f `
diff --git a/vNugglets.VDNetworking/GetItems.ps1 b/vNugglets.VDNetworking/GetItems.ps1
index ea26472..338dac8 100644
--- a/vNugglets.VDNetworking/GetItems.ps1
+++ b/vNugglets.VDNetworking/GetItems.ps1
@@ -201,4 +201,46 @@ function Get-VNVDTrafficRuleAction {
$_.TrafficRule.Action
} ## end foreach-object
} ## end process
-} ## end function
\ No newline at end of file
+} ## end function
+
+
+
+function Get-VNVSwitchByVMHostNetworkAdapter {
+<# .Description
+ Get the virtual switch (standard or distributed) with which the given VMHostNetworkAdapter physical NIC is associated, if any.
+
+ .Example
+ Get-VMHost myVMHost0.dom.com | Get-VMHostNetworkAdapter -Name vmnic2 | Get-VNVSwitchByVMHostNetworkAdapter
+ Get the vSwitch with which VMNIC2 on myVMHost0.dom.com is associated
+
+ .Outputs
+ Virtual standard- or distributed switch with which given physical VMHost network adapter is associated, if any
+#>
+ [CmdletBinding()]
+ param(
+ ## The VMHostNetworkAdapter (physical NIC) for which to get the vSwitch
+ [parameter(Mandatory=$true, ValueFromPipeline=$true)][VMware.VimAutomation.Types.Host.NIC.PhysicalNic[]]$VMHostNetworkAdapter
+ ) ## end param
+
+ process {
+ $VMHostNetworkAdapter | Foreach-Object {
+ $oThisVMHostNetworkAdapter = $_
+ if ($oAssociatedVSwitch = $oThisVMHostNetworkAdapter.VMHost.ExtensionData.Config.Network.Vswitch, $oThisVMHostNetworkAdapter.VMHost.ExtensionData.Config.Network.ProxySwitch | Foreach-Object {$_} | Where-Object {$_.Pnic -contains $oThisVMHostNetworkAdapter.Id}) {
+ switch ($oAssociatedVSwitch) {
+ ## vSS
+ {$_ -is [VMware.Vim.HostVirtualSwitch]} {
+ $oThisVMHostNetworkAdapter.VMHost | Get-VirtualSwitch -Standard -Name $oAssociatedVSwitch.Name
+ break
+ } ## end case
+ ## vDSwitch
+ {$_ -is [VMware.Vim.HostProxySwitch]} {
+ $oThisVMHostNetworkAdapter.VMHost | Get-VDSwitch -Name $oAssociatedVSwitch.DvsName
+ break
+ } ## end case
+ default {Write-Warning "vSwitch not of expected type of either [VMware.Vim.HostVirtualSwitch] or [VMware.Vim.HostProxySwitch]. What kind of vSwitch is it? $_"}
+ } ## end switch
+ } ## end if
+ else {Write-Verbose "No vSwitch associated with VMNIC '$($oThisVMHostNetworkAdapter.Name)' found on VMHost '$($oThisVMHostNetworkAdapter.VMHost.Name)'"}
+ } ## end Foreach-Object
+ } ## end process
+} ## end fn
\ No newline at end of file
diff --git a/vNugglets.VDNetworking/SetItems.ps1 b/vNugglets.VDNetworking/SetItems.ps1
index 65496a4..16a58be 100644
--- a/vNugglets.VDNetworking/SetItems.ps1
+++ b/vNugglets.VDNetworking/SetItems.ps1
@@ -38,3 +38,127 @@ function Set-VNVDTrafficRuleSet {
} ## end foreach-object
} ## end process
} ## end function
+
+
+function Set-VNVMHostNetworkAdapterVDUplink {
+<# .Description
+ Set the VDSwitch Uplink for a VMHost physical NIC ("VMNIC") on the VDSwitch of which the VMNIC is already a part
+
+ .Example
+ Get-VMHost myVMHost0.dom.com | Get-VMHostNetworkAdapter -Name vmnic3 | Set-VNVMHostNetworkAdapterVDUplink -UplinkName Uplinks-02
+ Set the VMNIC "vminic3" from VMHost myVMHost0.dom.com to be in VDUplink "Uplinks-02" on VDS myVDSwitch0 (the vDSwitch of which VMNIC3 is a part)
+
+ .Example
+ Set-VNVMHostNetworkAdapterVDUplink -VMHostNetworkAdapter (Get-VMHost myVMHost0.dom.com | Get-VMHostNetworkAdapter -Name vmnic2, vmnic3) -UplinkName Uplinks-01, Uplinks-02
+ Set the VMNICs "vminic2", "vminic3" from VMHost myVMHost0.dom.com to be in VDUplinks "Uplinks-01", "Uplinks-02" on VDS myVDSwitch0 (the vDSwitch of which VMNIC2 and VMNIC3 are a part)
+ Could then check out the current status like:
+ Get-VDSwitch myVDSwitch0 | Get-VDPort -Uplink | Where-Object {$_.ProxyHost.Name -eq "myVMHost0.dom.com"} | Select-Object key, ConnectedEntity, ProxyHost, Name | Sort-Object ProxyHost, Name
+
+ .Notes
+ One cannot put two VMNICs from a VMHost in the same vDUplink -- they should go into separate/unique vDUplinks
+ Requires that VMHostNetworkAdapter(s) are all associated with a single vDSwitch (not VMNICs from multiple vDSwitches) and that the vSwitch type is _Distributed_ (not Standard)
+
+ Function checks that:
+ - all VMHostNetworkAdapters specified are on same VMHost and same vDSwitch
+ - all UplinkNames specified are on same vDSwitch
+
+ The core NetworkSystem and config spec syntax is based on LucD's post (of course) at https://code.vmware.com/forums/2530/vsphere-powercli#576477?start=15&tstart=0
+
+ .Outputs
+ VMware.VimAutomation.Vds.Types.V1.VDPort for the Uplink VDPort with which the VMNIC(s) are now affiliated
+#>
+ [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact="High")]
+ [OutputType([VMware.VimAutomation.Vds.Types.V1.VDPort])]
+ param(
+ ## The VMHost Network Adapter(s) ("VMNIC") to set in a given vDUplink. If more than one specified, then specify the same number of -UplinkName values, too. The first VMHostNetworkAdapter will be set to the first UplinkName, the second to the second UplinkName, and so on
+ [parameter(Mandatory=$true, ValueFromPipeline=$true)][VMware.VimAutomation.Types.Host.NIC.PhysicalNic[]]$VMHostNetworkAdapter,
+
+ ## The name(s) of the vDUplink with which to associate the VMNIC. If more than one specified, then specify the same number of -VMHostNetworkAdapter values, too
+ [parameter(Mandatory=$true)][String[]]$UplinkName
+ ) ## end param
+
+ process {
+ ## make sure that the same number of VMNICs and UplinkNames were provided
+ if (($VMHostNetworkAdapter | Measure-Object).Count -eq ($UplinkName | Measure-Object).Count) {
+ ## the VMHost(s) of these VMNICs
+ $oTargetVMHost = $VMHostNetworkAdapter.VMHost | Select-Object -Unique
+ ## if the VMNICs are from more than one VMHost
+ if (($oTargetVMHost | Measure-Object).Count -gt 1) {Write-Error "VMHostNetworkAdapters provided are from more than one VMHost. Specify VMNICs from just a single VMHost"}
+ ## else, the VMNICs are from the same VMHost
+ else {
+ ## get VDSwitch(es) of which VMNIC is a part (uses another function in this module)
+ $arrTargetVSwitches = $VMHostNetworkAdapter | Get-VNVSwitchByVMHostNetworkAdapter
+ ## get the unique vSwitches associated with these VMNICs (should be only one vSwitch)
+ $oTargetVDSwitch = $arrTargetVSwitches | Select-Object -Unique
+
+ ## if all VMHostNetworkAdapters are associated with vSwitches (num VMNICs is different than num of retrieved vSwitches), and all VMNICs are from same vSwitch
+ if ((($arrTargetVSwitches | Measure-Object).Count -eq $VMHostNetworkAdapter.Count) -and (($oTargetVDSwitch | Measure-Object).Count -eq 1)) {
+ ## get the DistributedVirtualSwitchHostMember object for this VMHost and vDSwitch; this object has things like the VDPorts that are the Uplink ports for this VMHost on this vDSwitch, the current PNIC backing info for this VMHost/vDSwitch (if any), etc.
+ $oVDSwitchHostMember = $oTargetVDSwitch.ExtensionData.Config.Host | Where-Object {$_.Config.Host.ToString() -eq $oTargetVMHost.Id}
+ ## get the vDUplink ports for this VDSwitch and this VMHost -- the .ExtensionData.Config.Host objects have subsequent property ".Config.Host" (yes, same property names again) from which to determine the corresponding item by VMHost ID
+ $arrVDUplinks_thisVDS_thisVMHost = Get-VDPort -Key $oVDSwitchHostMember.UplinkPortKey -VDSwitch $oTargetVDSwitch
+
+ ## get the UplinkName(s) specified that are not defined on the target vDSwitch (as returned by Compare-Object with a property of SideIndicator with a value of "=>" -- meaning, they were in the DifferenceObject and not the ReferenceObject)
+ $arrUplinkNamesNameOnVDSwitch = Compare-Object -ReferenceObject $arrVDUplinks_thisVDS_thisVMHost.Name -DifferenceObject $UplinkName | Where-Object {$_.SideIndicator -eq "=>"}
+ ## if all values of $UplinkName are valid for this VDSwitch
+ if ($null -eq $arrUplinkNamesNameOnVDSwitch) {
+ ## the TODO of "check that there are any arrVDUplinks_thisVDS_thisVMHost where the VMNIC <--> UplinkName correlation needs changed" would start about here:
+
+ ## make the messages for ShouldProcess()
+ $strShouldProcessMsg_target = "vDSwitch '{0}' for VMHost '{1}'" -f $oTargetVDSwitch.Name, $oTargetVMHost.Name
+ $strShouldProcessMsg_action = "Set VMNIC{0} '{1}' to be in vDUplink{0} '{2}'" -f $(if ($VMHostNetworkAdapter.Count -ne 1) {"s"}), ($VMHostNetworkAdapter.Name -join ", "), ($UplinkName -join ", ")
+ if ($PSCmdlet.ShouldProcess($strShouldProcessMsg_target, $strShouldProcessMsg_action)) {
+ ## get NetworkSystem for the VMHost for this VMNIC
+ $viewNetworkSystem_thisVMHost = Get-View -Id $oTargetVMHost.ExtensionData.ConfigManager.NetworkSystem -Property NetworkConfig, NetworkInfo
+
+ ## the existing PnicSpec objects for this VDSwitchHostMemeber.Config object
+ $arrExistingPnicSpec = $oVDSwitchHostMember.Config.Backing.PnicSpec | Where-Object {$VMHostNetworkAdapter.Name -notcontains $_.PnicDevice}
+ $arrNewPnicSpec = $VMHostNetworkAdapter | Foreach-Object -begin {$intI = 0} -process {
+ ## the UplinkName that corresponds positionally in the $UplinkName param to the position in the $VMHostNetworkAdapter param that we currently are
+ $strUplinkNameToUseForThisVMNic = $UplinkName | Select-Object -First 1 -Skip $intI
+ New-Object -Type VMware.Vim.DistributedVirtualSwitchHostMemberPnicSpec -Property @{
+ PnicDevice = $_.Name
+ UplinkPortKey = ($arrVDUplinks_thisVDS_thisVMHost | Where-Object {$_.Name -eq $strUplinkNameToUseForThisVMNic}).Key
+ } ## end New-Object
+ $intI++
+ } ## end Foreach-Object
+
+ ## make reconfigSpec to use to UpdateNetworkConfig() on NetworkSystem
+ $oHostNetworkConfig_toUse = New-Object -Type VMware.Vim.HostNetworkConfig -Property @{
+ ProxySwitch = @(
+ New-Object -Type VMware.Vim.HostProxySwitchConfig -Property @{
+ Uuid = $oTargetVDSwitch.ExtensionData.Uuid
+ ChangeOperation = [VMware.Vim.HostConfigChangeOperation]::edit
+ Spec = New-Object -Type VMware.Vim.HostProxySwitchSpec -Property @{
+ Backing = New-Object -Type VMware.Vim.DistributedVirtualSwitchHostMemberPnicBacking -Property @{
+ ## the PnicSpecs from above -- the existing "other" ones for other VMNICs on this vDS for this VMHost, and the new PnicSpec(s) for the VMHostNetworkAdapter(s)
+ PnicSpec = $arrExistingPnicSpec, $arrNewPnicSpec | Where-Object {$null -ne $_} | Foreach-Object {$_}
+ } ## end New-Object
+ } ## end New-Object
+ } ## end New-Object
+ ) ## end array
+ } ## end New-Object
+ try {
+ ## do the UpdateNetworkConfig()
+ $oHostNetworkConfigResult = $viewNetworkSystem_thisVMHost.UpdateNetworkConfig($oHostNetworkConfig_toUse, [VMware.Vim.HostConfigChangeMode]::modify)
+ ## return an object with the VMNIC and vDUplink info for vDUplinks for this VMHost on this vDSwitch
+ Get-VDPort -Key $oVDSwitchHostMember.UplinkPortKey -VDSwitch $oTargetVDSwitch | Sort-Object ProxyHost, Name
+ } ## end try
+ catch {$PSCmdlet.ThrowTerminatingError($_)}
+ } ## end if ShouldProcess()
+
+ ## the TODO of "check that there are any arrVDUplinks_thisVDS_thisVMHost where the VMNIC <--> UplinkName correlation needs changed" would end about here
+ } ## end if all values of $UplinkName are valid for this VDSwitch
+
+ else {
+ $intNumSpecifiedUplinkNamesNotOnThisVSwitch = ($arrUplinkNamesNameOnVDSwitch | Measure-Object).Count
+ Write-Error ("Uplink{0} '{1}' {2} not in '{3}' for vDSwitch '{4}', in which '{5}' take part. Please specify only Uplink names that are in use on this vSwitch." -f $(if ($intNumSpecifiedUplinkNamesNotOnThisVSwitch -ne 1) {"s"}), ($arrUplinkNamesNameOnVDSwitch.InputObject -join ", "), $(if ($intNumSpecifiedUplinkNamesNotOnThisVSwitch -ne 1) {"are"} else {"is"}), ($arrVDUplinks_thisVDS_thisVMHost.Name -join ", "), $oTargetVDSwitch.Name, ($VMHostNetworkAdapter.Name -join ", "))
+ } ## end else
+ } ## end if all VMHostNetworkAdapters are associated with vSwitches (num VMNICs is different than num of retrieved vSwitches), and all VMNICs are from same vSwitch
+
+ else {Write-Error "Either the VMNICs specified are not all associated with a vSwitch, or are not all are associated with the same vSwitch. Please check that all VMNICs are a part of the same vDSwitch"}
+ } ## end else the VMNICs are from the same VMHost
+ } ## end if same number of VMNICs and UplinkNames were provided
+ else {Write-Error ("A different number of VMNICs ({0}) and UplinkNames ({1}) were specified. Please specify the same number of values for -VMHostNetworkAdapter and -UplinkName" -f $VMHostNetworkAdapter.Count, $UplinkName.Count)}
+ } ## end process
+} ## end fn
\ No newline at end of file
diff --git a/vNugglets.VDNetworking/vNugglets.VDNetworking.psd1 b/vNugglets.VDNetworking/vNugglets.VDNetworking.psd1
index d930a71..281186a 100644
--- a/vNugglets.VDNetworking/vNugglets.VDNetworking.psd1
+++ b/vNugglets.VDNetworking/vNugglets.VDNetworking.psd1
@@ -3,7 +3,7 @@
#
# Generated by: Matt Boren (@mtboren)
#
-# Generated on: 1/10/2018
+# Generated on: 6/18/2018
#
@{
@@ -12,7 +12,7 @@
RootModule = 'vNugglets.VDNetworking_ModRoot.psm1'
# Version number of this module.
-ModuleVersion = '1.1.0'
+ModuleVersion = '1.2.0'
# Supported PSEditions
# CompatiblePSEditions = @()
@@ -76,9 +76,10 @@ NestedModules = @('GetItems.ps1',
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Get-VNVDTrafficFilterPolicyConfig', 'Get-VNVDTrafficRuleSet',
'Get-VNVDTrafficRule', 'Get-VNVDTrafficRuleQualifier',
- 'Get-VNVDTrafficRuleAction', 'New-VNVDTrafficRuleQualifier',
- 'New-VNVDTrafficRuleAction', 'New-VNVDTrafficRule',
- 'Remove-VNVDTrafficRule', 'Set-VNVDTrafficRuleSet'
+ 'Get-VNVDTrafficRuleAction', 'Get-VNVSwitchByVMHostNetworkAdapter',
+ 'New-VNVDTrafficRuleQualifier', 'New-VNVDTrafficRuleAction',
+ 'New-VNVDTrafficRule', 'Remove-VNVDTrafficRule',
+ 'Set-VNVDTrafficRuleSet', 'Set-VNVMHostNetworkAdapterVDUplink'
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()
@@ -111,7 +112,7 @@ PrivateData = @{
PSData = @{
# Tags applied to this module. These help with module discovery in online galleries.
- Tags = 'vNugglets','VMware','vSphere','PowerCLI','VDPortGroup','TrafficFiltering','Filter','Filtering','TrafficMarking','Mark','Marking','VDSwitch'
+ Tags = 'vNugglets','VMware','vSphere','PowerCLI','VDPortGroup','TrafficFiltering','Filter','Filtering','TrafficMarking','Mark','Marking','VDSwitch','Uplink','VDUplink','VMHostNetworkAdapater','VMNIC'
# A URL to the license for this module.
LicenseUri = 'https://github.com/vNugglets/vNuggletsPSMod_vDNetworking/blob/master/License'
@@ -125,14 +126,8 @@ PrivateData = @{
# ReleaseNotes of this module
ReleaseNotes = 'See ReadMe and other docs at https://github.com/vNugglets/vNuggletsPSMod_vDNetworking'
- # Prerelease string of this module
- # Prerelease = ''
-
- # Flag to indicate whether the module requires explicit user acceptance for install/update
- # RequireLicenseAcceptance = $false
-
# External dependent modules of this module
- # ExternalModuleDependencies = @()
+ # ExternalModuleDependencies = ''
} # End of PSData hashtable