-
Notifications
You must be signed in to change notification settings - Fork 41
VMHostVssPortGroup
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
Server | Key | string | The Name of the Server we are trying to connect to. The Server can be a vCenter or ESXi. | |
Credential | Mandatory | PSCredential | Credentials needed for connection to the specified Server. | |
VMHostName | Key | string | The Name of the VMHost which is going to be used. | |
Name | Key | string | The Name for the Port Group. | |
VssName | Mandatory | string | The Name of the Virtual Switch associated with the Port Group. The Virtual Switch must be a Standard Virtual Switch. | |
Ensure | Mandatory | Ensure | Value indicating if the Port Group should be Present or Absent. | Present, Absent |
VLanId | Optional | int | The VLAN ID for ports using this Port Group. | 0 - 4095 |
The resource is used to create, update and delete Port Groups which are associated with the specified Virtual Switch. If Ensure is 'Absent', all VMs connected to the Port Group must be PoweredOff to successfully remove the Port Group. If one or more of the VMs are PoweredOn, the removal would not be successful because the Port Group is used by the VMs.
The first Resource in the Configuration creates a new Virtual Switch MyVirtualSwitch with Mtu 1500. The second Resource in the Configuration creates a new Port Group MyVirtualPortGroup which is associated with Virtual Switch MyVirtualSwitch with VLanId set to 1.
Configuration VMHostVssPortGroup_Config {
Param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$Server,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$Credential,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$VMHostName
)
Import-DscResource -ModuleName VMware.vSphereDSC
Node localhost {
VMHostVss VMHostVss {
Server = $Server
Credential = $Credential
Name = $VMHostName
VssName = 'MyVirtualSwitch'
Ensure = 'Present'
Mtu = 1500
}
VMHostVssPortGroup VMHostVssPortGroup {
Server = $Server
Credential = $Credential
VMHostName = $VMHostName
Name = 'MyVirtualPortGroup'
VssName = 'MyVirtualSwitch'
Ensure = 'Present'
VLanId = 1
DependsOn = "[VMHostVss]VMHostVss"
}
}
}
The first Resource in the Configuration removes the Port Group MyVirtualPortGroup which is associated with Virtual Switch MyVirtualSwitch. The second Resource in the Configuration removes the Virtual Switch MyVirtualSwitch with Mtu 1500.
Configuration VMHostVirtualPortGroup_Config {
Param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$Server,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$Credential,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]
$VMHostName
)
Import-DscResource -ModuleName VMware.vSphereDSC
Node localhost {
VMHostVssPortGroup VMHostVssPortGroup {
Server = $Server
Credential = $Credential
VMHostName = $VMHostName
Name = 'MyVirtualPortGroup'
VssName = 'MyVirtualSwitch'
Ensure = 'Absent'
}
VMHostVss VMHostVss {
Server = $Server
Credential = $Credential
Name = $VMHostName
VssName = 'MyVirtualSwitch'
Ensure = 'Absent'
Mtu = 1500
DependsOn = "[VMHostVssPortGroup]VMHostVssPortGroup"
}
}
}
- Home
- Tips & Tricks
- Cluster
- DRSRule
- Datacenter
- DatacenterFolder
- DatastoreCluster
- DatastoreClusterAddDatastore
- DrsCluster
- Folder
- HACluster
- NfsDatastore
- NfsUser
- PowerCLISettings
- StandardPortGroup
- StandardSwitch
- VDPortGroup
- VDSwitch
- VDSwitchVMHost
- VMHostAcceptanceLevel
- VMHostAccount
- VMHostAdvancedSettings
- VMHostAgentVM
- VMHostAuthentication
- VMHostCache
- VMHostConfiguration
- VMHostDCUIKeyboard
- VMHostDnsSettings
- VMHostFirewallRuleset
- VMHostGraphics
- VMHostGraphicsDevice
- VMHostIPRoute
- VMHostIScsiHba
- VMHostIScsiHbaTarget
- VMHostIScsiHbaVMKernelNic
- VMHostNetworkCoreDump
- VMHostNtpSettings
- VMHostPciPassthrough
- VMHostPermission
- VMHostPhysicalNic
- VMHostPowerPolicy
- VMHostRole
- VMHostSNMPAgent
- VMHostSatpClaimRule
- VMHostScsiLun
- VMHostScsiLunPath
- VMHostService
- VMHostSettings
- VMHostSharedSwapSpace
- VMHostSoftwareDevice
- VMHostStorage
- VMHostSyslog
- VMHostTpsSettings
- VMHostVDSwitchMigration
- VMHostVMKernelActiveDumpFile
- VMHostVMKernelActiveDumpPartition
- VMHostVMKernelDumpFile
- VMHostVMKernelModule
- VMHostVdsNic
- VMHostVss
- VMHostVssBridge
- VMHostVssMigration
- VMHostVssNic
- VMHostVssPortGroup
- VMHostVssPortGroupSecurity
- VMHostVssPortGroupShaping
- VMHostVssPortGroupTeaming
- VMHostVssSecurity
- VMHostVssShaping
- VMHostVssTeaming
- VMHostvSANNetworkConfiguration
- VmfsDatastore
- vCenterSettings
- vCenterStatistics
- vCenterVMHost