Skip to content

Instantly share code, notes, and snippets.

@t2psyto
Created September 8, 2021 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t2psyto/598a8a6901915e37b7488a8a50d3bc51 to your computer and use it in GitHub Desktop.
Save t2psyto/598a8a6901915e37b7488a8a50d3bc51 to your computer and use it in GitHub Desktop.
イーサネットデバイスをpowershellから「無効→有効」にする。デバイスマネージャーで「無効→有効」するのと同じ効果。
@echo off
echo LANケーブルを抜いてください。
pause
@echo on
powershell -Command "$devlan2 =Get-PnPDevice -FriendlyName 'Intel(R) Ethernet Connection I217-V'; Disable-PnpDevice $devlan2.DeviceID -Confirm:$false"
timeout 10
powershell -Command "$devlan2 =Get-PnPDevice -FriendlyName 'Intel(R) Ethernet Connection I217-V'; Enable-PnpDevice $devlan2.DeviceID -Confirm:$false"
timeout 10
netsh interface ip set address "LAN1" dhcp
netsh interface ip set dns "LAN1" dhcp
timeout 5
netsh interface ip set address "LAN1" dhcp
netsh interface ip set dns "LAN1" dhcp
ipconfig
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment