Last active
December 11, 2023 11:40
-
-
Save pduchnovsky/c4bc56197c64a4ad095a8dc74d1908f4 to your computer and use it in GitHub Desktop.
Restart Adapter when not UP | https://duchnovsky.com/2023/02/automated-adapter-restart/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Restart Adapter when not UP (intel i225-v and i226-v issue workaround) | |
# Script developed by pduchnovsky | |
# https://duchnovsky.com/2023/02/automated-adapter-restart/ | |
$AdapterName = "Ethernet" | |
$PowerShellPath = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" | |
$Argument = "-command `"Get-NetAdapter $AdapterName | ? status -ne up | Restart-NetAdapter`"" | |
$Name = "Restart Adapter" | |
$Trigger = New-ScheduledTaskTrigger -AtStartup | |
$Action = New-ScheduledTaskAction -Execute $PowerShellPath $Argument | |
$Settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -ExecutionTimeLimit 0 | |
$Principal = New-ScheduledTaskPrincipal -UserID "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest | |
Register-ScheduledTask -TaskName $Name -Trigger $Trigger -Action $Action -Settings $Settings -Principal $Principal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment