Copy vSwith portgroup from an existing ESXi host
2017-08-24 11:36
507 查看
Script
------------------------------------------------------------------------------------------
##
## http://www.virtu-al.net/2009/06/27/powercli-easy-vswitch-portgroup-setup/ ## copying all vSwitches and PortGroups from an existing ESX server over to a new server
Add-PSSnapin vmWARE.VimAutomation.Core
$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-VirtualSwitch |Foreach {
$vSwitch = $_
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
}
$_ |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
}
}
}
附件:http://down.51cto.com/data/2366942
------------------------------------------------------------------------------------------
##
## http://www.virtu-al.net/2009/06/27/powercli-easy-vswitch-portgroup-setup/ ## copying all vSwitches and PortGroups from an existing ESX server over to a new server
Add-PSSnapin vmWARE.VimAutomation.Core
$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-VirtualSwitch |Foreach {
$vSwitch = $_
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
}
$_ |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
}
}
}
附件:http://down.51cto.com/data/2366942
相关文章推荐
- BDNtv: Deriving a model from an existing database with ECO II in Delphi 2005
- Export portgroup from the host
- (OK) How to access a NAT guest from host with VirtualBox - NAT Port Forwarding
- (OK) Creating VMs from an existing VDI file —— in OS X
- Splitting an existing replicat ( or extract ) with the RANGE command into multiple replicats (extrac
- Cannot proceed with delivery: an existing transporter instance is currently uploading this package
- Generating a string with elements from an array based on pattern matching
- Adding an ESXi Host to a Directory Service
- The group member's supported protocols are incompatible with those of existing members
- vs2012打包部署时“cannot extract icon with index 0 from file xxx.exe”的解决方案
- Cannot proceed with delivery: an existing transporter instance is currently uploading this package
- Replacing the ESXi Host Default Certificate with a CA-Signed Certificate
- How To Add a New Disk(s) to An Existing Diskgroup on RAC (Best Practices).
- SharePoint Solution Generator - part 1: create a site definition from an existing site
- How do you copy the contents of an array to a std::vector in C++ without looping? (From stack over flow)
- Cannot proceed with delivery: an existing transporter instance is currently uploading this package
- Populate A List Item With Record Group In Oracle Forms Using Populate_List And Create_Group_From_Query Command
- How to run an existing SQL Server Agent Job from C#
- [C#.NET][Entity Framework] Code First - Reverse engineering from an existing database at EF6.1.0
- To create an .edmx file from an existing database