Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Change DHCP IP to static IP

$
0
0

i used below script to change DHCP Ip to static on multiple servers. Nut no luck :(

http://social.technet.microsoft.com/Forums/windowsserver/en-US/50f07ed6-c076-4920-a7f2-3a0f5292a177/dhcp-to-static-ip-address?forum=winserverpowershell

$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


Viewing all articles
Browse latest Browse all 6937

Trending Articles