0

I run Outlook 2010 in a virtual machine running Windows 7. Networking is provided through the host. Outlook connects to an Exchange server.

When the host's IP address changes (e.g. moving to a different wifi network), this breaks Outlook's connectivity. I haven't investigated in depth, but it seems to stubbornly retain a TCP connection and not start a new one. The status bar at the bottom keeps displaying “This folder was last updated at <time>” and new emails aren't downloaded.

Pressing the “Update Folder” or “Send/Receive All Folders” buttons doesn't help. Switching to offline mode (“Work Offline” button) and back online doesn't help.

Sometimes, eventually, Outlooks reconnects. But that takes minutes or hours. How can I instruct Outlook to reconnect now?

Killing Outlook and restarting it works, but it's disruptive. This issue is specific to running Outlook in a VM, or presumably behind a gateway whose IP address changes: if the IP address of the Windows machine itself changes, Outlook does reconnect correctly.

2 Answers 2

1

I couldn't find a way to convince Outlook to reconnect to the server, short of restarting it or disabling and (painfully) reenabling the network interface.

So what I do is to unplug and plug back in the virtual cable between the VM and the host with the following VBoxCableReconnect script. Of course the script is specific to VirtualBox, but I expect that similar things are possible with other VM technologies.

#! /usr/bin/env perl
use strict;
use warnings;

sub vbox_list {
    my %vms;
    my ($running) = @_;
    my $what = $running ? 'runningvms' : 'vms';
    local $ENV{LC_ALL} = 'C';
    open VBOX, "VBoxManage list -l $what |" or die 'VBoxManage: $!';
    local $/ = "\n\n\n";
    while (my $section = <VBOX>) {
        my %vm = ();
        $section =~ s/\n\n.*//s; # strip shared folders, etc.
        foreach my $line (split /\n/, $section) {
            $line =~ s/\A([^:]+):\s+// or next;
            $vm{$1} = $line;
        }
        $vms{$vm{UUID}} = {%vm};
    }
    close VBOX;
    return %vms;
}

sub vbox_list_cables {
    my ($vms) = @_;
    my @cables;
    foreach my $vm (values %$vms) {
        my %vm = %$vm;
        foreach my $key (keys %vm) {
            next unless $key =~ /\ANIC *([0-9]+)\z/;
            my $num = $1;
            if ($vm{$key} =~ /(^|, )Cable connected: on($|, )/) {
                push @cables, [$vm{UUID}, $vm{Name}, $num];
            }
        }
    }
    return @cables;
}

sub vbox_iterate_cableconnected {
    my ($cables, $onoff) = @_;
    foreach my $cable (@$cables) {
        my ($uuid, $name, $num) = @$cable;
        system 'VBoxManage', 'controlvm', $uuid, "setlinkstate$num", $onoff;
        # TODO: report errors
    }
}

my %vms = vbox_list(1);
my @cables = vbox_list_cables(\%vms);
vbox_iterate_cableconnected(\@cables, 'off');
sleep(1);
vbox_iterate_cableconnected(\@cables, 'on');

Run this as the user running the VM when bringing up a network interface on the host.

0

Control and right click the outlook icon by the clock and you have a new menu item called 'Connection Status' where you can reconnect far quicker than any other method.

3
  • This sure looks like it should work, but it doesn't help. I see that connections are restarted when I click on the “Reconnect” button, but my mailboxes aren't being updated. Sep 3, 2014 at 9:58
  • I'm assuming you are using vmware on mac? Every time I experienced a problem similar to yours I would change vmware's network setting from NAT to BRIDGE or vice versa. Sep 6, 2014 at 19:33
  • VirtualBox on Linux, but same difference. I'll experiment with turning the network off at the VB level. I tried disabling the network in Windows, to make it send whatever event it sends to Outlook when it isn't running in a VM and the network goes down, but I didn't find a way to do it without admin powers and digging into very deep menus. Sep 6, 2014 at 22:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .