$username = "root"
$password = "mypassword"
$ipstart = "192.168.1."
$ipend = 23..25
$ipnew = 11
foreach ($iplist in $ipend) {
$serverip = $ipstart + $iplist
Connect-VIServer -Server $serverip -user $username -Password $password | Out-Null
$kernelip = $ipstart + $ipnew
New-VMHostNetworkAdapter -VirtualSwitch vSwitch0 -PortGroup "Mnagement Network" -IP $kernelip -SubnetMask 255.255.255.0
$ipnew = $ipnew + 1
Disconnect-VIServer -Server * -Confirm:$false
}本文出自 “汜水流年_” 博客,请务必保留此出处http://timefiles.blog.51cto.com/8475652/1964994
原文地址:http://timefiles.blog.51cto.com/8475652/1964994