$ipaddress = 15
$NICS = Get-Wmiobject Win32_NetworkAdapterConfiguration |
where {$_.IPEnabled -eq “TRUE”}
foreach ($NIC in $NICs) {
$NIC.EnableStatic("10.0.0.$($ipaddress++)","255.255.255.0")
$NIC.SetGateways("10.0.0.1",1)
$NIC.SetDNSServerSearchOrder("10.0.0.100")
}
我尝试了此操作,但没有用。我需要一个命令,该命令将读取当前的静态IP,然后将其递增1。