PowerCLI: the easiest way to create Private VLANS

May 26, 2016 Kim Bottu 0

If you like to test PVLANs but don’t like clicking around in the webclient, try creating them from PowerCLI. The Primary VLAN in each line is always the same one and in your first line, the primary and the secondary VLAN are the same VLAN. This is because the primary PVLAN will also serve as the Pormiscuous PVLAN. I have chosen 200. On the next lines the Primary and Secondary VLANs are different from eachother. $vds = Get-VDSwitch ‘Your vDS’ Get-VDSwitch $vds | New-VDSwitchPrivateVlan -PrimaryVlanId 200 -SecondaryVlanId 200 -PrivateVlanType Promiscuous Get-VDSwitch $vds | New-VDSwitchPrivateVlan -PrimaryVlanId 200 -SecondaryVlanId 201 -PrivateVlanType Community Get-VDSwitch $vds | New-VDSwitchPrivateVlan -PrimaryVlanId 200 -SecondaryVlanId 203 -PrivateVlanType Isolated  

PowerCLI: backup and restore an array of ESXi hosts

May 14, 2016 Kim Bottu 0

The following script makes a backup of the ESXi Host configuration file for an Array of Hosts in a folder on your Management station in C:\BackupMeUp. If you run the backup task multiple times, it will overwrite the saved configuration files for the hosts it already contains a configuration file for. Backup an Array of ESXi hosts Write-Host “Backing up ESXi config to C:\BackupMeUp” $vmhost_array = @(“esxi1.mydomain.com”) foreach ($vmhost in $vmhost_array) { Get-VMHostFirmware -VMHost $vmhost -BackupConfiguration -DestinationPath C:\BackupMeUp } Write-Host “Backup is completed!” The following script restores the host configuration from the folder on your Management station C:\BackupMeUp for an Array of Hosts. Make sure that you know which hosts it will restore, and that you modify this in the […]