-
-
Save rpatterson/bd6f33fc109ab29df3fa265d8ebb3907 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^=3^,5^ delims^=^"{} %%p in ('%ListRunningVMS%') do ( | |
echo "%%p" | |
REM Order here seems to be important. When I did `nicpromisc1 deny` then | |
REM `nicpromisc1 allow-all` inside the 2 `setlinkstate1` commands, the | |
REM `VBoxManage.exe` process would hang and seemed to lose it's connection to the | |
REM VirtualBox servcice or some such. | |
%VBoxManageEXE% controlvm %%p nicpromisc1 deny | |
%VBoxManageEXE% controlvm %%p setlinkstate1 off | |
%VBoxManageEXE% controlvm %%p setlinkstate1 on | |
%VBoxManageEXE% controlvm %%p nicpromisc1 allow-all | |
) |
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
<?xml version="1.0" encoding="UTF-16"?> | |
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> | |
<RegistrationInfo> | |
<Date>2020-08-08T11:46:34.3582137</Date> | |
<Author>HOST\Adminstrator</Author> | |
<Description>Reconnect VirtualBox guest network connections when a change in the host networking interferes with guest network connectivity.</Description> | |
<URI>\VBox - Replug Guests</URI> | |
</RegistrationInfo> | |
<Triggers> | |
<EventTrigger> | |
<Enabled>true</Enabled> | |
<Subscription><QueryList><Query Id="0" Path="System"><Select Path="System">*[System[Provider[@Name='Microsoft-Windows-NDIS'] and EventID=10400]]</Select></Query></QueryList></Subscription> | |
</EventTrigger> | |
</Triggers> | |
<Principals> | |
<Principal id="Author"> | |
<UserId>S-1-5-21-2497750225-423207635-496948950-1002</UserId> | |
<LogonType>Password</LogonType> | |
<RunLevel>HighestAvailable</RunLevel> | |
</Principal> | |
</Principals> | |
<Settings> | |
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> | |
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries> | |
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries> | |
<AllowHardTerminate>true</AllowHardTerminate> | |
<StartWhenAvailable>false</StartWhenAvailable> | |
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> | |
<IdleSettings> | |
<StopOnIdleEnd>true</StopOnIdleEnd> | |
<RestartOnIdle>false</RestartOnIdle> | |
</IdleSettings> | |
<AllowStartOnDemand>true</AllowStartOnDemand> | |
<Enabled>true</Enabled> | |
<Hidden>false</Hidden> | |
<RunOnlyIfIdle>false</RunOnlyIfIdle> | |
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession> | |
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine> | |
<WakeToRun>false</WakeToRun> | |
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit> | |
<Priority>7</Priority> | |
</Settings> | |
<Actions Context="Author"> | |
<Exec> | |
<Command>C:\tools\replug_vbox_network\replug_vbox_network.cmd</Command> | |
</Exec> | |
</Actions> | |
</Task> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment