Windows – Enabling or disabling NIC remotely with windows 2008

netshnetworkingwindowswindows-server-2003windows-server-2008-r2

I've been trying to enable or disable a NIC on Windows 2003 Server from a Windows 2008 Server PC. After googling around a bit, the command should be something like this:

netsh -r remotecomputer interface set interface "interface name" disabled

But when I try it, I get this error: "The newname and enable/disable option for LAN interfaces is not valid when administrating a remote machine".

I have admin access on both systems, and they are on the same LAN.

Anybody knows the right way to do it?

Best Answer

By design, turning off a NIC is disallowed when done remotely.

Running with Psexec essentially runs the command as a local user, to bypass this restriction.

psexec.exe \remotecomputer netsh interface set interface "interfacename" disabled

If you need credentials:

psexec.exe \remotecomputer -u username -p password netsh interface set interface "interfacename" disabled

Related Question