Enabling or disabling NIC remotely with windows 2008

9,819

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

Share:
9,819

Related videos on Youtube

f.cipriani
Author by

f.cipriani

Updated on September 18, 2022

Comments

  • f.cipriani
    f.cipriani over 1 year

    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?

    • Keltari
      Keltari over 10 years
      once you remotely disable it, how would you remotely enable it?
    • PsychoData
      PsychoData over 10 years
      I think we're assuming that he's a good little administrator and has out of band access methods to get back into it.
    • Admin
      Admin over 10 years
      I'm pretty sure that's by design. You might want to try Psexec and the command "locally".
    • f.cipriani
      f.cipriani over 10 years
      @Keltari as PsychoData said I have more than one NIC on the remote PC. I thought I could use one of the others to disable and bring back the one I need
    • f.cipriani
      f.cipriani over 10 years
      @moses I was able to enable and disable the NIC using Psexec: psexec.exe \\remotecomputer netsh interface set interface "interfacename" disabled if you make it an answer I'll be glad to accept it
  • Scott Chamberlain
    Scott Chamberlain over 10 years
    This would make a good comment, but you don't provide any kind of a solution in this answer. Once you have more rep you will be able to comment on other questions