Jump to content

Need a batch file to restart ethernet adapter

NTDaws
Go to solution Solved by Oshino Shinobu,
1 hour ago, President Dawson Wehage said:

Please explain how to do that. I'm not very educated in powershell.

If you're doing it through task scheduler, just create a new task to run on logon, then start a program (powershell.exe) and put the command as the arguments. 

 

image.png.248ea00e6492bbc305121ca508fe2f82.png

 

The command format is below. Just replace "Ethernet 2" with whichever adapter you want to restart on login. 

 

Restart-NetAdapter -Name "Ethernet 2"

 

Sup fellas, I need a batch file that will reset the ethernet adapter on login. Anyone able to give me to link me instructions?

 

Thanks

The geek himself.

Link to comment
Share on other sites

Link to post
Share on other sites

Are you open to using powershell instead of batch? 

 

There's a built in cmdlet to do this called Restart-NetAdapter

 

So all you'd need (for example) is:

 

Restart-NetAdapter -Name "Ethernet 2"

 

Just put that as the argument for powershell.exe with a trigger of user login via task scheduler or via login script in group policy.

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, Oshino Shinobu said:

Are you open to using powershell instead of batch? 

 

There's a built in cmdlet to do this called Restart-NetAdapter

 

So all you'd need (for example) is:

 


Restart-NetAdapter -Name "Ethernet 2"

 

Just put that as the argument for powershell.exe with a trigger of user login via task scheduler or via login script in group policy.

Please explain how to do that. I'm not very educated in powershell.

The geek himself.

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, President Dawson Wehage said:

Please explain how to do that. I'm not very educated in powershell.

If you're doing it through task scheduler, just create a new task to run on logon, then start a program (powershell.exe) and put the command as the arguments. 

 

image.png.248ea00e6492bbc305121ca508fe2f82.png

 

The command format is below. Just replace "Ethernet 2" with whichever adapter you want to restart on login. 

 

Restart-NetAdapter -Name "Ethernet 2"

 

Link to comment
Share on other sites

Link to post
Share on other sites

48 minutes ago, Oshino Shinobu said:

If you're doing it through task scheduler, just create a new task to run on logon, then start a program (powershell.exe) and put the command as the arguments. 

 

image.png.248ea00e6492bbc305121ca508fe2f82.png

 

The command format is below. Just replace "Ethernet 2" with whichever adapter you want to restart on login. 

 


Restart-NetAdapter -Name "Ethernet 2"

 

Thanks for the help

The geek himself.

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 months later...
On 3/29/2021 at 7:23 PM, Oshino Shinobu said:

-snip-

Sorry to bother, it was working, but I had to reinstall windows. Now when I do it, I get this error.

Spoiler

Terminal.thumb.PNG.ca18f32eced538d7f6f1f8b12b3129da.PNG

 

The geek himself.

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, President Dawson Wehage said:

Sorry to bother, it was working, but I had to reinstall windows. Now when I do it, I get this error.

  Hide contents

Terminal.thumb.PNG.ca18f32eced538d7f6f1f8b12b3129da.PNG

 

Will probably need to be run as admin. If still going through task scheduler, tick the option to run with highest privileges 

 

EDIT: Also make sure the adapter name/number hasn't changed. Might be different after reinstalling 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×