1. Check the network adapter device ID using powershell (http://blogs.msdn.com/daiken/archive/2007/02/09/enable-disable-network-connection.aspx) :
a. Open powershell
b. key in the following command to find out which network adapter:
Get-wmiobject win32_NetworkAdapter | format-table
You will see the device ID and key in the following command to the detail of the network adapter and open the network properties to reconfirm:
Get-WmiObject win32_networkadapter | where {$_.DeviceId -eq 5}
2. Create a script, in folder C:\Windows\restart_lan.ps1
a. Content for restart_lan.ps1 (make sure you have the correct "deviceid")
$lannetwork = Get-WmiObject win32_networkadapter | where {$_.DeviceId -eq 5}
$lannetwork.Disable()
$lannetwork.Enable()
3. Create a bat file to run the powershell script in folder C:\Windows\restart_lan.bat
a. Content for restart_lan.bat
powershell c:\windows\restart_lan.ps1
4. Add the script to windows startup (http://www.tutorial5.com/content/view/157/47/ )
a. Click Start - Run and type mmc
b. On the Management console that starts, click File -> Add/Remove Snap-in.
c. On the window that opens, search for Group Policy Object editor on the left panel, click Add and in the properties window that pops out leave the settings that are selected (Local computer) and click ok.
d. Navigate through the left panel by opening each branch like this: Console Root -> Computer configuration -> Windows Settings -> Scripts (Startup/shutdown)
e. Open the properties window for Startup or Shutdown as you desire from the right panel; on the window that pops out add, edit or remove scripts that you want.
0 comments:
Post a Comment