Change Windows IP address settings remotely with psexec and netsh

Download psexec from Sysinternals / MS. It only needs to be installed on the machine you run the commands from, not the targets.

* All machines must be in the same domain or workgroup
* Firewalls must be down on the targets (haven’t checked exactly which ports, so lowered them for domain access in my case)
* Ideally, create/use a local admin user on each remote machine for execution

Change from DHCP to static IP (note the “-h” for elevated admin access):
psexec \\<remote-computer-name> -u <remote-admin-user> -p <password> -h netsh interface ip set address name=”<interface-name>” static addr=<ip> <mask> <gateway> 1

Since the IP change command doesn’t include DNS settings we also need the the below:

Change DNS settings:
psexec \\<remote-computer-name> -u <user> -p <password> -h netsh interface ip set dns name=”<interface-name>” static addr=<ip>

Example changing the settings remotely on a Japanese Windows 7 machine from a Windows 2012 R2 server:
psexec \\Win7-01 -u admusr -p Passw0rd! -h netsh interface ip set address name=”ローカル エリア接続 2″ static addr= 1

psexec \\Win7-01 -u admusr -p Passw0rd! -h netsh interface ip set dns name=”ローカル エリア接続 2″ static addr=


If you’re uncertain of the interface name: Run “ipconfig” remotely and copy and paste the interface name from there.
psexec \\<remote-computer-name> -u <remote-admin-user> -p <password> ipconfig


Leave a Reply