Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # $VISRV = Connect-VIServer (Read-Host "Please enter the name of your VI SERVER")
- # $BASEHost = Get-VMHost -Name (Read-Host "Please enter the name of your existing server as seen in the VI Client:")
- # $NEWHost = Get-VMHost -Name (Read-Host "Please enter the name of the server to configure as seen in the VI Client:")
- $BASEHost = Get-VMHost -Name 'esx5'
- $NEWHost = Get-VMHost -Name 'esx4'
- $BASEHost |Get-VirtualSwitch |Foreach {
- If (($NEWHost |Get-VirtualSwitch -Name $_.Name -ErrorAction SilentlyContinue) -eq $null){
- Write-Host "Creating Virtual Switch $($_.Name)"
- $NewSwitch = $NEWHost |New-VirtualSwitch -Name $_.Name -NumPorts $_.NumPorts -Mtu $_.Mtu
- }
- $vSwitch = $_
- $_ |Get-VirtualPortGroup |Foreach {
- If (($NEWHost |Get-VirtualPortGroup -Name $_.Name -ErrorAction SilentlyContinue) -eq $null){
- Write-Host "Creating Portgroup $($_.Name)"
- $NewPortGroup = $NEWHost |Get-VirtualSwitch -Name $vSwitch |New-VirtualPortGroup -Name $_.Name -VLanId $_.VLanID
- # -whatif
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement