Monday, May 30, 2016

How To Change IP Address From Another Computer

As network administrator, sometimes I need to change IP Addresses, Subnet Masks, Gateways and DNS to any client in my office. But I'm too lazy to walking across the room to change it at the front desk. Then I found a good method to do this job remotely from my computer.

All you need is PSTools a compilation of some useful tools to manage your client computer with Command prompt.

How to use :

Download PSTools and extract to anyplace you want. Then open command prompt on the folder.

PsExec is a light-weight telnet replacement that lets you execute processes on remote systems. You can use IP addresses or hostnames with PsExec. To launch an interactive command prompt on a remote computer, run the following command (you should run theses commands as domain admin):

psexec.exe \\ip_or_hostname cmd

If you are unable to connect to the remote system, it may have something to do with a firewall or antivirus on the remote system. Or also you need to type username and password to connect to client computer. As example :

psexec.exe \\ip_or_hostname -u username -p password cmd

Now that you have an interactive command prompt open on the remote system, we will be using the netsh command to change all the IP info. To find the name of the interface you would like to change, run this command:
netsh interface ip show config
Here are the commands to set or change an IP address, gateway, subnet mask, and DNS servers:
Set IP address, gateway, and subnet mask statically:

netsh interface ip set address name="Local Area Connection" static 192.168.1.34 255.255.255.0 192.168.1.254 1

Set IP address, gateway, and subnet mask to be received by DHCP (This will attempt to renew the IP info immediately after running this command):

netsh interface ip set address name="Local Area Connection" source=dhcp

To set a primary DNS server (if there are multiple DNS servers set prior, this will remove them):

netsh interface ip set dns "Local Area Connection" static 4.2.2.1

To set a secondary or additional DNS server:

netsh interface ip add dns "Local Area Connection" 8.8.8.8

To set the DNS servers to be received by DHCP (This will attempt to renew the DNS info immediately after running this command):

netsh interface ip set dns "Local Area Connection" source=dhcp

I hope this help you and feel free to comment if there is any questions.