diff -r -u openvpn-2.0_beta11/tun.c openvpn-2.0_beta11-new/tun.c
--- openvpn-2.0_beta11/tun.c	Sun Aug 15 16:59:10 2004
+++ openvpn-2.0_beta11-new/tun.c	Tue Oct  5 11:57:48 2004
@@ -122,7 +122,10 @@
   if (dt == DEV_TYPE_TUN || dt == DEV_TYPE_TAP)
     {
       struct buffer out = alloc_buf_gc (256, gc);
-      get_device_guid (dev_node, BPTR (&out), buf_forward_capacity (&out), gc);
+      if (dev_node)
+        get_device_guid (dev_node, BPTR (&out), buf_forward_capacity (&out), gc);
+      else
+        get_unspecified_device_guid (0, BPTR (&out), buf_forward_capacity (&out), gc);
       return BSTR (&out);
     }
 #endif
@@ -2109,6 +2112,52 @@
 }
 
 /*
+ * Get a adapted GUID and optional actual_name from the 
+ * registry for the TAP device # = device_number.
+ */
+const char *
+get_unspecified_device_guid (const int device_number,
+		             char *actual_name,
+		             int actual_name_size,
+		             struct gc_arena *gc)
+{
+  const struct tap_reg *tr;
+  const struct panel_reg *pr;
+
+  const struct tap_reg *tap_reg = get_tap_reg (gc);
+  const struct panel_reg *panel_reg = get_panel_reg (gc);
+
+  struct buffer ret = alloc_buf_gc (256, gc);
+  struct buffer actual;
+  int i;
+
+  buf_set_write (&actual, actual_name, actual_name_size);
+
+  /* Make sure we have at least one TAP adapter */
+  if (!tap_reg)
+    {
+      msg (M_FATAL, "There are no TAP-Win32 adapters on this system.  You should be able to create a TAP-Win32 adapter by going to Start -> All Programs -> " PACKAGE_NAME " -> Add a new TAP-Win32 virtual ethernet adapter.");
+    }
+
+  /* Move on to specified device number */
+  for (i=0; i < device_number; i++)
+    {
+      if (!tap_reg->next)
+        msg (M_FATAL, "There is no available TAP device.");
+      tap_reg = tap_reg->next;
+    }
+  
+  const char *act;
+  act = guid_to_name (tap_reg->guid, panel_reg);
+  buf_printf (&ret, "%s", tap_reg->guid);
+  if (act)
+    buf_printf (&actual, "%s", act);
+  else
+    buf_printf (&actual, "NULL");
+  return BSTR (&ret);
+}
+
+/*
  * Lookup a --dev-node adapter name in the registry
  * returning the GUID and optional actual_name.
  */
@@ -2135,21 +2184,6 @@
       msg (M_FATAL, "There are no TAP-Win32 adapters on this system.  You should be able to create a TAP-Win32 adapter by going to Start -> All Programs -> " PACKAGE_NAME " -> Add a new TAP-Win32 virtual ethernet adapter.");
     }
 
-  /* If --dev-node not specified, look for a default TAP adapter */
-  if (!name)
-    {
-      const char *act;
-      if (tap_reg->next)
-	msg (M_FATAL, "You have more than one TAP-Win32 adapter on this system.  You must use the --dev-node option to tell me which one to use.  Use openvpn --show-adapters to see a list.");
-      act = guid_to_name (tap_reg->guid, panel_reg);
-      buf_printf (&ret, "%s", tap_reg->guid);
-      if (act)
-	buf_printf (&actual, "%s", act);
-      else
-	buf_printf (&actual, "NULL");
-      return BSTR (&ret);
-    }
-
   /* Check if GUID was explicitly specified as --dev-node parameter */
   if (is_tap_win32 (name, tap_reg))
     {
@@ -2773,33 +2807,71 @@
   {
     char guid_buffer[256];
 
+    if (dev_node)
+      {
+        /* Get the device GUID for the device specified with --dev-node. */
+        device_guid = get_device_guid (dev_node, guid_buffer, sizeof (guid_buffer), &gc);
+
+        /* Open Windows TAP-Win32 adapter */
+        openvpn_snprintf (device_path, sizeof(device_path), "%s%s%s",
+   		          USERMODEDEVICEDIR,
+		          device_guid,
+		          TAPSUFFIX);
+
+        tt->hand = CreateFile (
+			       device_path,
+			       GENERIC_READ | GENERIC_WRITE,
+			       0, /* was: FILE_SHARE_READ */
+			       0,
+			       OPEN_EXISTING,
+			       FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED,
+			       0
+			       );
+
+        if (tt->hand == INVALID_HANDLE_VALUE)
+          msg (M_ERR, "CreateFile failed on TAP device: %s", device_path);
+      }
+    else 
+      {
+        int device_number = 0;
+
+        /* Try opening all TAP devices until we find one available */
+        while(1)
+          {
+            device_guid = get_unspecified_device_guid (device_number, 
+						       guid_buffer, 
+						       sizeof (guid_buffer),
+						       &gc);
+
+            /* Open Windows TAP-Win32 adapter */
+            openvpn_snprintf (device_path, sizeof(device_path), "%s%s%s",
+       		  	      USERMODEDEVICEDIR,
+			      device_guid,
+			      TAPSUFFIX);
+
+            tt->hand = CreateFile (
+			 	   device_path,
+				   GENERIC_READ | GENERIC_WRITE,
+				   0, /* was: FILE_SHARE_READ */
+				   0,
+				   OPEN_EXISTING,
+				   FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED,
+				   0
+				   );
+
+            if (tt->hand == INVALID_HANDLE_VALUE)
+              msg (D_TUNTAP_INFO, "CreateFile failed on TAP device: %s", device_path);
+            else
+              break;
+        
+            device_number++;
+          }
+      }
+
     /* translate high-level device name into a device instance
        GUID using the registry */
-    device_guid = get_device_guid (dev_node, guid_buffer, sizeof (guid_buffer), &gc);
     tt->actual_name = string_alloc (guid_buffer, NULL);
   }
-
-  /*
-   * Open Windows TAP-Win32 adapter
-   */
-
-  openvpn_snprintf (device_path, sizeof(device_path), "%s%s%s",
-		    USERMODEDEVICEDIR,
-		    device_guid,
-		    TAPSUFFIX);
-
-  tt->hand = CreateFile (
-			 device_path,
-			 GENERIC_READ | GENERIC_WRITE,
-			 0, /* was: FILE_SHARE_READ */
-			 0,
-			 OPEN_EXISTING,
-			 FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED,
-			 0
-			 );
-
-  if (tt->hand == INVALID_HANDLE_VALUE)
-    msg (M_ERR, "CreateFile failed on TAP device: %s", device_path);
 
   msg (M_INFO, "TAP-WIN32 device [%s] opened: %s", tt->actual_name, device_path);
 
diff -r -u openvpn-2.0_beta11/tun.h openvpn-2.0_beta11-new/tun.h
--- openvpn-2.0_beta11/tun.h	Sun Aug 15 16:59:08 2004
+++ openvpn-2.0_beta11-new/tun.h	Tue Oct  5 11:04:50 2004
@@ -286,6 +286,11 @@
 			     int actual_name_size,
 			     struct gc_arena *gc);
 
+const char *get_unspecified_device_guid (const int device_number,
+			                 char *actual_name,
+  			                 int actual_name_size,
+			                 struct gc_arena *gc);
+
 void verify_255_255_255_252 (in_addr_t local, in_addr_t remote);
 
 const IP_ADAPTER_INFO *get_adapter_info_list (struct gc_arena *gc);
