Remote IPing

So one afternoon about a week ago, I found myself needing to change a Windows client’s IP settings. I didn’t want to make the walk up three flights of stairs to do it. So I Google’d a way to do it remotely, and turns out it’s a pretty easy thing to do. More and how after the jump.

Okay, so before we get ahead of ourselves, some info on my environment: I am on a machine running Windows 8, the remote machine was a Windows 7 client on my local network. What I needed to do was to get the remote machine to use DHCP to automatically obtain it’s network settings, as opposed to the static settings that were applied. You could probably use the same methods here for remotely configuring nearly any Windows machine from Vista and upward, and XP (with a few other older versions, like NT or 2000) with some command variations. There’s more about that on the source page. The whole process went swimmingly well for me, and I even did it again for another remote client mere days ago.

So here’s what you’d need to do to copy me!
> Get PsExec tools (v2.1, at time of writing), part of Windows Sysinternals, off of Microsoft’s TechNet.
> With that downloaded and extracted, hold down Shift and right-click on “PsExec.exe” (from the extracted files) then select “Copy as path”.
> Run a Command Prompt (depending on where you extracted the PsExec tools to, you might need to run CMD with administrative rights)
> In your CMD window, right click and select Paste” to throw down the path of your PsExec.exe file. Now you’ll want to supply some instructions to run PsExec.exe with, like spawning a CMD process on the remote PC that you can use to change stuff! You’ll want to your CMD prompt to look something like this:

>”C:\PsTools\PsExec.exe” \\computername -u computername\username cmd.exe

For example:
>”C:\PsTools\PsExec.exe” \\RemotePCName -u RemotePCName\AnAdminUser cmd.exe

You can swop the names with IP addresses, if you like.

> Once you’ve run that, you should be prompted to enter the password for the user account that you specified in the command. Supply the password!

> If you get everything right, you should be greeted with a regular CMD prompt. Except this one will be running on the remote computer. Now you’re free to throw down whatever CMD command you like!

To change the network config of my remote PCs from static to DHCP, I used these commands (in order, because changing the address of a remote machine will cause your connection to drop, though the command will apply, so best to apply the DNS settings first):

To determine the names of the network interfaces present on the remote computer:

netsh interface ip show config

To set the remote computers’ target interface’s DNS settings to DHCP:

netsh interface ip set dns “Local Area Connection” dhcp

To set the remote computers’ target interface’s IP, subnet, and gateway options to DHCP:

netsh interface ip set address “Local Area Connection” dhcp

Replace the interface name, ie. “Local Area Connection”, with the name of the interface on the target machine. Hit Enter after each command to have it execute. You can use these netsh commands to set the network configuration of a PC that you’re working on too, they’re not just for remote machines.

And that’s one way to change a remote Windows client’s network settings from a static configuration to a dynamic one. I hope that helps someone somewhere someday.