diff --git a/pkg/windows/windows.go b/pkg/windows/windows.go index e2d08fbbb9..22901b381d 100644 --- a/pkg/windows/windows.go +++ b/pkg/windows/windows.go @@ -540,7 +540,9 @@ func (vm *windows) Run(cmd string, psCmd bool) (string, error) { // RebootAndReinitialize restarts the Windows instance and re-initializes the SSH connection for further configuration func (vm *windows) RebootAndReinitialize(ctx context.Context) error { vm.log.Info("rebooting instance") - if _, err := vm.Run("Restart-Computer -Force", true); err != nil { + // SSH connection may terminate during reboot before returning exit status - this is expected + // The real validation is waitUntilUnreachable() and reinitialize(), so we only fail on unexpected errors + if _, err := vm.Run("Restart-Computer -Force", true); err != nil && !strings.Contains(err.Error(), cmdExitNoStatus) { return fmt.Errorf("error rebooting the Windows VM: %w", err) } // Wait for instance to be unreachable via SSH, implies reboot is underway