|
20 | 20 | [Parameter(Mandatory=$true)][String[]]$DVPortgroupName
|
21 | 21 | )
|
22 | 22 |
|
| 23 | + $minSwitchVersion = "6.6.0" |
| 24 | + |
23 | 25 | foreach ($dvpgname in $DVPortgroupName) {
|
24 | 26 | $dvpg = Get-VDPortgroup -Name $dvpgname -ErrorAction SilentlyContinue
|
25 | 27 | $switchVersion = ($dvpg | Get-VDSwitch).Version
|
26 |
| - if($dvpg -and $switchVersion -ge "6.6.0") { |
| 28 | + if($dvpg -and [version]$switchVersion -ge [version]$minSwitchVersion) { |
27 | 29 | $securityPolicy = $dvpg.ExtensionData.Config.DefaultPortConfig.SecurityPolicy
|
28 | 30 | $macMgmtPolicy = $dvpg.ExtensionData.Config.DefaultPortConfig.MacManagementPolicy
|
29 | 31 |
|
|
41 | 43 | }
|
42 | 44 | $securityPolicyResults
|
43 | 45 | } else {
|
44 |
| - Write-Host -ForegroundColor Red "Unable to find DVPortgroup $dvpgname or VDS is not running 6.6.0 or later" |
| 46 | + Write-Host -ForegroundColor Red "Unable to find DVPortgroup $dvpgname or VDS is not running $minSwitchVersion or later" |
45 | 47 | break
|
46 | 48 | }
|
47 | 49 | }
|
@@ -88,11 +90,13 @@ Function Set-MacLearn {
|
88 | 90 | [Parameter(Mandatory=$false)][Int]$Limit=4096,
|
89 | 91 | [Parameter(Mandatory=$false)][String]$LimitPolicy="DROP"
|
90 | 92 | )
|
| 93 | + |
| 94 | + $minSwitchVersion = "6.6.0" |
91 | 95 |
|
92 | 96 | foreach ($dvpgname in $DVPortgroupName) {
|
93 | 97 | $dvpg = Get-VDPortgroup -Name $dvpgname -ErrorAction SilentlyContinue
|
94 | 98 | $switchVersion = ($dvpg | Get-VDSwitch).Version
|
95 |
| - if($dvpg -and $switchVersion -ge "6.6.0") { |
| 99 | + if($dvpg -and [version]$switchVersion -ge [version]$minSwitchVersion) { |
96 | 100 | $originalSecurityPolicy = $dvpg.ExtensionData.Config.DefaultPortConfig.SecurityPolicy
|
97 | 101 |
|
98 | 102 | $spec = New-Object VMware.Vim.DVPortgroupConfigSpec
|
@@ -129,7 +133,7 @@ Function Set-MacLearn {
|
129 | 133 | $task1 | Wait-Task | Out-Null
|
130 | 134 | }
|
131 | 135 | } else {
|
132 |
| - Write-Host -ForegroundColor Red "Unable to find DVPortgroup $dvpgname or VDS is not running 6.6.0 or later" |
| 136 | + Write-Host -ForegroundColor Red "Unable to find DVPortgroup $dvpgname or VDS is not running $minSwitchVersion or later" |
133 | 137 | break
|
134 | 138 | }
|
135 | 139 | }
|
|
0 commit comments