Skip to content

Instantly share code, notes, and snippets.

@t2psyto
Created September 8, 2021 00:06
イーサネットデバイスを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