Created
May 13, 2021 13:11
-
-
Save gowatana/140471de75d2c2867a9e5e0377c628b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ESX = "192.168.10.164" # または esxi01.example.com | |
$VDS = "VDS_A" | |
$VMNIC1 = "vmnic1" | |
$VMNIC2 = "vmnic2" | |
$UPLINK1 = "UpLink_1" | |
$UPLINK2 = "UpLink_2" | |
$UPLINK_PG = "UpLinkPG_A" | |
$PG = "PG_A" | |
# ①VDS_Aへ新規ホストを追加 | |
Get-VDSwitch -Name $VDS | Add-VDSwitchVMHost -VMHost $ESX | |
# ②vmnic1のアップリンク設定 | |
$vmHostNetworkAdapter = Get-VMHost -Name $ESX | Get-VMHostNetworkAdapter -Physical -Name $VMNIC1 | |
Add-VDSwitchPhysicalNetworkAdapter -DistributedSwitch $VDS -VMHostPhysicalNic $vmHostNetworkAdapter -Confirm:$false | |
Get-VDSwitch -VMHost $ESX -Name $VDS | Get-VDUplinkTeamingPolicy | Set-VDUplinkTeamingPolicy -ActiveUplinkPort $UPLINK1 | |
# ③vmnic2のアップリンク設定 | |
$vmHostNetworkAdapter = Get-VMHost -Name $ESX | Get-VMHostNetworkAdapter -Physical -Name $VMNIC2 | |
Add-VDSwitchPhysicalNetworkAdapter -DistributedSwitch $VDS -VMHostPhysicalNic $vmHostNetworkAdapter -Confirm:$false | |
Get-VDSwitch -VMHost $ESX -Name $VDS | Get-VDUplinkTeamingPolicy | Set-VDUplinkTeamingPolicy -ActiveUplinkPort $UPLINK2 | |
# ④vmk0の移行 | |
Get-VMHost $ESX | Get-VMHostNetworkAdapter -Name vmk0 | Set-VMHostNetworkAdapter -PortGroup $PG -Confirm:$false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
VMTNの下記の投稿むけ。
https://communities.vmware.com/t5/Japanese-Discussions/PowerCLI%E3%82%92%E7%94%A8%E3%81%84%E3%81%9FESXi%E3%83%9B%E3%82%B9%E3%83%88%E3%81%AEvDS%E8%A8%AD%E5%AE%9A%E6%96%B9%E6%B3%95%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6/m-p/2847007