i used below script to change DHCP Ip to static on multiple servers. Nut no luck :(
$NICs = Get-WMIObject Win32_NetworkAdapterConfiguration -computername (gc .\servers.txt) | where{$_.IPEnabled -eq $true -and $_.DHCPEnabled -eq $true}
Foreach($NIC in $NICs) {
$ip = ($NIC.IPAddress[0])
$gateway = $NIC.DefaultIPGateway
$subnet = $NIC.IPSubnet[0]
$dns = $NIC.DNSServerSearchOrder
$NIC.EnableStatic($ip, $subnet)
$NIC.SetGateways($gateway)
$NIC.SetDNSServerSearchOrder($dns)
$NIC.SetDynamicDNSRegistration("FALSE")
}
when i execute this on windows 2000 and windows 2003 server is disconnecting not able to connect to the server with then Ip or server name .
Please provide some solution or alternate script with hel me to update the DHCP ip to static.
Thanks, jeevan