Last active
August 9, 2020 18:08
-
-
Save filimonov/58779d1495e81568fb36a52463d2bdb1 to your computer and use it in GitHub Desktop.
"Replug" the cable of running VirtualBox VM (network freeze in guest VM after host windows hybernate - awake)
This file contains hidden or 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
@echo off | |
set VboxManageEXE="%VBOX_MSI_INSTALL_PATH%\VBoxManage.exe" | |
set ListRunningVMS=%VboxManageEXE% list runningvms | |
for /f tokens^=2^,4^ delims^=^" %%p in ('%ListRunningVMS%') do ( | |
echo "%%p" | |
%VBoxManageEXE% controlvm %%p setlinkstate1 off | |
%VBoxManageEXE% controlvm %%p setlinkstate1 on | |
) |
If the method above doesn't work, replace:
%VBoxManageEXE% controlvm %%p setlinkstate1 off
%VBoxManageEXE% controlvm %%p setlinkstate1 on
With:
%VBoxManageEXE% controlvm %%p nicpromisc1 deny
%VBoxManageEXE% controlvm %%p nicpromisc1 allow-all
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Related to
Generally it gets the list of running machines, and after that for each VM calls:
Adjust the script if you use multiple network cards (setlinkstate - where N is the number of network card).
Iteration on active vms is based on https://superuser.com/a/1184354