| 
    Commandline-guide 
            to virtual network settings and more ...
 by Joakim Schicht
         This document is primarily targeted at VMware Workstation 6.5.1, 
        but will also in most cases apply to version 6.0.x, as well as server 
        edition.   Content How to install/uninstall (all) services for VMware Workstation. How to configure vmware virtual network adapters (vmnetX). How to configure vmware virtual network settings. Extensive analysis of vnetlib.exe and vnetlib.dll.       6 tools described  vnetlib.exe is included in Workstation, VMserver and VMplayer installs.net.exe Windows-builtin
 sc.exe - Windows-builtin
 netsh.exe - Windows-builtin
 devcon.exe is a command-line device manager tool from Microsoft.drv_ctl.exe is a tool available here
 
                                       
        VNETLIB - "VMware network install library executable" 
            BackgroundVnetlib is the invisible engine working in the backgrounds of the gui 
        tools like vmware.exe, vmnetcfg.exe and the installer. Vnetlib can install 
        and uninstall almost all the services, as well as configuring the virtual 
        networking. This little powerful tool can evidentally aid alot in repairing 
        broken installations. And best of all - it's command line.
 Following a string dump of vnetlib.exe the first string that caught my 
        attention was:"vnetlib: this utility is not intended to be run as a standalone application" 
        .
 But obviously it's possible to use it as such anyway.
     This tool has never been documented by VMware!    RequirementsFor taking advantage of its full potential make sure all the necessary 
        files (inf, cat, sys, dll, exe) are located according to this registry 
        entry:
 [HKEY_LOCAL_MACHINE\Software\VMware, Inc.\VMware Workstation]"InstallPath"="This_path_can_be_anywhere"
 Namely 4 services are fully dependant on this entry: adapter, authd, 
        bridge and vmkbd.WMI must also be enabled if vnetlib should be able to interact with bridge. 
        A workaround is described in the vmnetbridge section.
 Vnetlib will also require that %SystemRoot% is writeable, because it copies 
        the files found in the path mentioned above and into 3 specific folders: 
        %SystemRoot%\inf, %SystemRoot%\system32 and %SystemRoot%\system32\drivers. 
        This requirement only applies when installing the services.
 If %SystemRoot% is read-only as is the case with certain Preinstallation 
        Environments, then look at the alternative way of installing theses services, 
        described later in this document.
 
 First a list of all the services that vnetlib is able to interact 
        with:    Vnetlib internal service name    Windows service 
        description                                                      Windows 
        service name  
       
         
          | vmparport | VMware 
            Paralell Port Driver | vmparport |   
          | userif | VMware 
            Network Application Interface | vmnetuserif |   
          | dhcp | Dhcp 
            Service for virtual networks | vmnetdhcp |   
          | nat | Network 
            address translation for virtual networks | vmware 
            nat service |   
          | bridge | VMware 
            Bridge Protocol | vmnetbridge |   
          | vmkbd | VMware 
            Keyboard Driver | vmkbd |   
          | vmx86 | VMware 
            Virtualization Driver | vmx86 |   
          | vmci | VMware 
            vmci Driver | vmci |   
          | hcmon | VMware 
            USB Driver | hcmon |   
          | usb | VMware 
            USB Client Driver | vmusb |   
          | vmmem | VMware 
            Memory Driver | vmmemct |   
          | vmcpu | VMware 
            CPU Driver | vmdesched-driver |   
          | authd | VMware 
            Authorization Service | vmauthdservice |   
          | serverd | VMware 
            Registration Service | vmserverdwin32 |   
          | adapter | VMware 
            Virtual Ethernet Adapter Driver | vmnetadapter |        The commandline switches described in this article are: 
            "vnetlib.exe -- install"
 "vnetlib.exe -- uninstall"
 "vnetlib.exe -- reinstall"
 "vnetlib.exe -- start"
 "vnetlib.exe -- stop"
 "vnetlib.exe -- update"
 "vnetlib.exe -- set"
 "vnetlib.exe -- add"
 "vnetlib.exe -- remove"
 "vnetlib.exe -- enable"
 "vnetlib.exe -- disable"
 "vnetlib.exe -- import"
 "vnetlib.exe -- export"
 
 top
   The "-- install" will take these parameters:    Parameter                                                             Command 
        line  
           
             
              | authd | vnetlib.exe 
                -- install authd |   
              | bridge | vnetlib.exe 
                -- install bridge |   
              | dhcp | vnetlib.exe 
                -- install dhcp |   
              | hcmon | vnetlib.exe 
                -- install hcmon |   
              | nat | vnetlib.exe 
                -- install nat |   
              | serverd | vnetlib.exe 
                -- install serverd |   
              | usb  
                *must use rundll32 | vnetlib.exe 
                -- install usb |   
              | userif | vnetlib.exe 
                -- install userif |   
              | vmci | vnetlib.exe 
                -- install vmci |   
              | vmcpu | vnetlib.exe 
                -- install vmcpu |   
              | vmkbd | vnetlib.exe 
                -- install vmkbd |   
              | vmmem | vnetlib.exe 
                -- install vmmem |   
              | vmparport | vnetlib.exe 
                -- install vmparport |   
              | vmx86 | vnetlib.exe 
                -- install vmx86 |    Additionally there are some special parameters for -- install:    
       
         
          | devices  
            -  will install 5 services; adapter, bridge, dhcp, nat, 
            userif | vnetlib.exe 
            -- install devices |   
          | host      -  will 
            install 3 services; hcmon, vmparport, vmx86 | vnetlib.exe 
            -- install host |        The "-- uninstall" will take these parameters:   Parameter                                                            
        Command line  
           
             
              | authd | vnetlib.exe 
                -- uninstall authd |   
              | bridge | vnetlib.exe 
                -- uninstall bridge |   
              | dhcp | vnetlib.exe 
                -- uninstall dhcp |   
              | hcmon | vnetlib.exe 
                -- uninstall hcmon |   
              | nat | vnetlib.exe 
                -- uninstall nat |   
              | serverd | vnetlib.exe 
                -- uninstall serverd |   
              | usb | vnetlib.exe 
                -- uninstall usb |   
              | userif | vnetlib.exe 
                -- uninstall userif |   
              | vmci | vnetlib.exe 
                -- uninstall vmci |   
              | vmcpu | vnetlib.exe 
                -- uninstall vmcpu |   
              | vmkbd  
                *require a reboot | vnetlib.exe 
                -- uninstall vmkbd |   
              | vmmem | vnetlib.exe 
                -- uninstall vmmem |   
              | vmparport | vnetlib.exe 
                -- uninstall vmparport |   
              | vmx86 | vnetlib.exe 
                -- uninstall vmx86 |   Additionally there are some special parameters for -- uninstall:
    
           
             
              | legacy                    -  will 
                uninstall 3 services; bridge, dhcp, nat | vnetlib.exe 
                -- uninstall  legacy |   
              | all                          
                -  will uninstall 4 services; bridge, dhcp, nat, userif | vnetlib.exe 
                -- uninstall  all |   
              | host                       
                -  will uninstall 3 services; hcmon, vmparport, vmx86 | vnetlib.exe 
                -- uninstall  host |   
              | adapter/aggressive 
                 -  will uninstall 5 services; adapter, bridge, dhcp, 
                nat, userif | vnetlib.exe 
                -- uninstall  adapter |      Starting & Stopping Services:   Parameter           
        Command line for starting service                           
        Command line for stopping service  
           
             
              | authd | vnetlib.exe 
                -- start authd | vnetlib.exe 
                -- stop authd |   
              | bridge | vnetlib.exe 
                -- start bridge | vnetlib.exe 
                -- stop bridge |   
              | dhcp | vnetlib.exe 
                -- start dhcp | vnetlib.exe 
                -- stop dhcp |   
              | hcmon | vnetlib.exe 
                -- start hcmon | vnetlib.exe 
                -- stop hcmon |   
              | nat | vnetlib.exe 
                -- start nat | vnetlib.exe 
                -- stop nat |   
              | serverd | vnetlib.exe 
                -- start serverd | vnetlib.exe 
                -- stop serverd |   
              | userif | vnetlib.exe 
                -- start userif | vnetlib.exe 
                -- stop userif |   
              | vmci | vnetlib.exe 
                -- start vmci | vnetlib.exe 
                -- stop vmci |   
              | vmcpu | vnetlib.exe 
                -- start vmcpu | vnetlib.exe 
                -- stop vmcpu |   
              | vmkbd | vnetlib.exe 
                -- start vmcpu | vnetlib.exe 
                -- stop vmcpu |   
              | vmmem | vnetlib.exe 
                -- start vmmem | vnetlib.exe 
                -- stop vmmem |   
              | vmparport | vnetlib.exe 
                -- start vmparport | vnetlib.exe 
                -- stop vmparport |   
              | vmx86 | vnetlib.exe 
                -- start vmx86 | vnetlib.exe 
                -- stop vmx86 |    Reinstalling services:    Parameter                                             
        Command line  
           
             
              | all | vnetlib.exe 
                -- reinstall all |   
              | host | vnetlib.exe 
                -- reinstall host |   
              | network | vnetlib.exe 
                -- reinstall network |   
              | drivers/adapters | vnetlib.exe 
                -- reinstall adapters |  *Not recommended, use uninstall/install instead.
 Updating the settings:
   Parameter                       
        Command line  
           
             
              | adapter | vnetlib.exe 
                -- update adapter |   
              | all | vnetlib.exe 
                -- update all |   
              | dhcp | vnetlib.exe 
                -- update dhcp |   
              | nat | vnetlib.exe 
                -- update nat |   Modifying adapters:
    
           
             
              | Remove 
                adapter vmnet6 | vnetlib.exe 
                -- remove adapter vmnet6 |   
              | Add 
                adapter vmnet9 | vnetlib.exe 
                -- add adapter vmnet9 |   
              | Enable 
                adapter vmnet5 | vnetlib.exe 
                -- enable adapter vmnet5 |   
              | Disable 
                adapter vmnet3 | vnetlib.exe 
                -- disable adapter vmnet3 |  *Will take vmnet0/vmnet1/vmnet2/vmnet3/vmnet4/vmnet5/vmnet6/vmnet7/vmnet8/vmnet9   Changing configuration in adapter:     
           
             
              | Set subnet mask 
                of vmnet8 | vnetlib.exe 
                -- set vnet vmnet5 mask 255.255.255.0 |   
              | Set 
                IP adress of vmnet5 | vnetlib.exe 
                -- set adapter vmnet5 addr 10.10.10.2 |   Example reconfiguration of adapter vmnet8:
    
           
             
              | vnetlib.exe 
                -- stop nat |   
              | vnetlib.exe 
                -- stop dhcp |   
              | vnetlib.exe 
                -- set vnet vmnet8 mask 255.255.255.0 |   
              | vnetlib.exe 
                -- set adapter vmnet8 addr 10.11.12.2 |   
              | vnetlib.exe 
                -- update dhcp vmnet8 |   
              | vnetlib.exe 
                -- update nat vmnet8 |   
              | vnetlib.exe 
                -- update adapter vmnet8 |   
              | vnetlib.exe 
                -- start dhcp |   
              | vnetlib.exe 
                -- start nat |     vnetlib.exe -- stop natvnetlib.exe -- stop dhcp
 vnetlib.exe -- set vnet vmnet8 mask 255.255.255.0
 vnetlib.exe -- set adapter vmnet8 addr 10.11.12.2
 vnetlib.exe -- update dhcp vmnet8
 vnetlib.exe -- update nat vmnet8
 vnetlib.exe -- update adapter vmnet8
 vnetlib.exe -- start dhcp
 vnetlib.exe -- start nat
 Backup & Restore of settings:
    
           
             
              | Make 
                a backup of current setting in all your configured vmnets | vnetlib.exe 
                -- export backup-file-name |   
              | Restore 
                vmnet-settings from a backup | vnetlib.exe 
                -- import backup-file-name |   top
 
  
                                                        
        Notes on some of the services:    vmusb:   Installing with vnetlib.exe seems broken. Actually vnetlib will never 
        throw you any error messages of any kind telling you if something did 
        not go as planned, but for vmusb even the log tells you it went ok.    vminst.log:inst : 02/21/09 17:29:20 I1:VNL_InstallUSB: installing USB inf: 'C:\Programfiler\VMware\VMware 
        Workstation\vmusb.inf'
 inst : 02/21/09 17:29:22 I1:ParseCommand: operation: successful
 But no vmusb service installed in registry and no driver files copied 
        either. Workaround is using rundll32.exe.
  Executing this will NOT work;
  
           
             
              | rundll32 
                setupapi,InstallHinfSection _Install1.NT 128 "drive\full path\vmusb.inf |   But this WILL WORK;
  
           
            *Important to NOT have any quotation marks around the last parameter, even 
      though spaces are in the path. 
              | rundll32 
                setupapi,InstallHinfSection _Install1.NT 128 drive\full path\vmusb.inf |     Note:I see usb is not listed as a service that vnetlib will take as parameter 
        for the -- start switch, so it might not be possible to get it working 
        through vnetlib.exe.
 "vnetlib -- uninstall usb" is working perfect though.
 I believe the activation of the service is handled internally inside the 
        player and workstation binary (guessing).
   vmnetadapter:     Executing this will NOT work:  
           
             
              | vnetlib.exe 
                -- install adapter |   *Instead vmnetadapter must be installed standalone with rundll32.exe.  Installing VMnetAdapter1:
  
           
            *Important to NOT have any quotation marks around the last parameter, even 
      though spaces are in the path. 
              | rundll32 
                setupapi,InstallHinfSection VMnetAdapter1.Install 128 C:\path\netadapter.inf |     Note:Uninstalling adapter or driver with a subsequent install of driver/devices 
        will require a reboot.
 It is then necessary to issue a "vnetlib -- update all" to get vmnetadapter 
        visible again after the reboot.
    vmnetbridge: A second way to install bridging is with rundll32:
  
           
             
              | rundll32 
                setupapi,InstallHinfSection VMnetBridge.Install 128 c:\path\netbridge.inf |  If executed in same dir as inf file then:  
           
             
              | rundll32 
                setupapi,InstallHinfSection VMnetBridge.Install 128 %CD%\netbridge.inf |   "vnetlib -- install bridge" is equal to "vnetlib -- bridge 
            install"
 
 top
 
     
                                                             
        vnetlib.dll related findings:    The dynamic link library of vnetlib have lots of exported functions 
        that can be called directly by for example rundll32.exe.     
       
         
              | rundll32 
                vnetlib.dll,VNL_SetSuppressDriverPrompt |   *Will write this to registry:    [HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMnetLib\VMnetConfig]"SuppressPrompts"=dword:00000000
    Setting this value to 1 will effectively suppress the warnings for unsigned 
        drivers (emulate a click on "Continue Anyway"), that will be thrown at 
        you if playing with modified inf files.        
           
             
              | rundll32 
                vnetlib.dll,VNL_RemoveAllNetworkDevices | is 
            equivalent to | vnetlib.exe 
                -- remove adapter all |   
              | rundll32 
                vnetlib.dll,VNL_StopDHCP | is 
            equivalent to | vnetlib.exe 
                -- stop dhcp |   
              | rundll32 
                vnetlib.dll,VNL_StartDHCP | is 
            equivalent to | vnetlib.exe 
                -- start dhcp |   
              | rundll32 
                vnetlib.dll,VNL_UninstallDHCP | is 
            equivalent to | vnetlib.exe 
                -- uninstall dhcp |   
              | rundll32 
                vnetlib.dll,VNL_UninstallNAT | is 
            equivalent to | vnetlib.exe 
                -- uninstall nat |   Complete list:
  
           
             
              | VNL_StartBridge | VNL_StopBridge |   
              | VNL_StartDHCP | VNL_StopDHCP |   
              | VNL_StartHcmon | VNL_StopHcmon |   
              | VNL_StartNAT | VNL_StopNAT |   
              | VNL_StartUserIf | VNL_StopUserIf |   
              | VNL_StartVMCI | VNL_StopVMCI |   
              | VNL_StartVmkbd | VNL_StopVmkbd |   
              | VNL_StartVmparport | VNL_StopVmparport |   
              | VNL_StartVMX86 | VNL_StopVMX86 |  *I am sure the remaining uninstall related functions can be figured out 
                                                                    
        Note WMI:   
 For full support for all the commands you must have wmi running on the 
        system. Vnetlib.exe will still work without it, but interacting with "bridge" 
        does not work then. That can still be solved if vmnetbridge is installed 
        with rundll32.exe as described above.  
                                                                  Bug or Feature?   
 There is something wrong in the way vnetlib.exe checks the parameters 
        supplied. It appears that it will accept a whole lot more than suggested 
        above. In fact, it will only do some limited checks to see if the parameter 
        is close enough to the original/intended. This will vary depending on 
        how many parameters that have similar looking names. In some cases it 
        will only check for the first letter and in some cases also the total 
        number of characters for that parameter.   Example:"dhcp" will be accepted as "d" "dh" "de"
 "all" will be accepted as "ali" and "-- install all" = "-- install authd"
 "serverd" will be accepted as "status"
 "adapter" will be accepted as "anabolics", but also "aggressive" and "aggressively"
 "devices" will be accepted as "drivers" "default" and "donjuan", but not 
        as "devicess". Still not sure what it is supposed to be for this one.
 "nat" will be accepted as "n" "net"
 "bridge" will be accepted as "b" "br" "bbb" "brittt"
 "legacy" will be accepted as "looser", but not as "loooser"
 "userif" will only accept "userif"
 and so on...
   "vnetlib -- set vnet vmnet3 addr 10.10.10.10" == "vnetlib -- set vnnn 
        vmnet3 addr 10.10.10.10""vnetlib -- set adapter vmnet3 addr 10.10.10.10" == "vnetlib -- set analsex 
        vmnet3 addr 10.10.10.10"
 "vnetlib -- update anabolics vmnet3" == "vnetlib -- update adapter vmnet3"
 "vnetlib -- update vnnn vmnet3" == "vnetlib -- update vnet vmnet3"
 "vnetlib -- remove adapter vmnet3" == "vnetlib -- remove a vmnet3" == 
        "vnetlib -- remove aaaaaaa vmnet3",,,,but "vnetlib -- remove v vmnet3" 
        and "vnetlib -- remove aaaaaaaa vmnet3" will not work
    If there is a pattern in this that makes sense and is logically justified, 
        then let me know. Yes it made me VERY confused in the beginning.   Other commands found:   
       
         
          | vnetlib.exe 
            -- set installpath drive\directory |  *will set this registry entry:  [HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMnetlib]
 "InstallPath"="C:\\LODR\\ws651"
   The actual meaning of this key is unknown to me. 
 top
 
                                                         
        TODO - what is not yet resolved: 
        
 - Install usb directly with vnetlib. - Figure out the usage of possible commands like; team, unteam, garp, 
        ungarp, connect, disconnect..
    Read-only %SystemRoot%:
    In such a case we need to install the services and interact with the 
        binaries in a slightly different way.We can then use these 5 tools:
   net.exe - Windows-builtinsc.exe - Windows-builtin
 devcon.exe - is a command-line device manager tool from Microsoft.
 drv_ctl.exe - is a tool available here (http://alter.org.ua/en/soft/win/drv_inst/ 
            ) here
 netsh.exe - Windows-builtin
   top    Starting and stopping services with net.exe uses the windows 
        service name (see table at the top).     Example usage net.exe:  
           
             
              | net 
                start vmx86 |  |   
              | net 
                start VMAuthdService |  |   
              | net 
                start VMnetBridge |  |   
              | net 
                start VMnetuserif |  |   
              | net 
                start VMnetAdapter |  |   
              | net 
                start vmserverdWin32 |  |   
              | net 
                start hcmon |  |   
              | net 
                start VMnetDHCP |  |   
              | net 
                start "VMware NAT Service |  |   
              | net 
                start vmparport |  |   
              | net 
                start vmount2 | VMware 
            Virtual Mount Manager Extended (version 6.0.x) |   
              | net 
                start vstor2-p2v30 |  |   
              | net 
                start vstor2-ws60 |  |   
              | net 
                start vpxd | VMware 
            VirtualCenter Server service |   
 Services from executables can be installed with sc.exe. 
         Example usage sc.exe:    
       
         
          | sc.exe 
            create VMnetDHCP binpath= "M:\LODR\ws651\vmnetdhcp.exe" depend= VMnetuserif 
            DisplayName= "VMware DHCP Service" |   
          | sc.exe 
            create ufad-ws60 binpath= ""M:\LODR\ws651\vmware-ufad.exe" -d "M:\LODR\ws651\\" 
            -s ufad-p2v.xml" DisplayName= "VMware Agent Service" |      Services with accompanying drivers can also be installed to alternative/non-default 
        locations with drv_ctl.exe.    Example usage drv_ctl.exe:    
           
             
              | drv_ctl.exe 
                --inst-nostart vmx86 "R:\vm\vmware\vmx86.sys" |   
              | drv_ctl.exe 
                --inst-nostart vstor2-ws60  "R:\vm\vmware\vstor2-ws60.sys" |      Devcon.exe can also enable/disable the network adapters. 
          
           
             
              | Temporarily 
                disable/enable vmnet1 | devcon.exe 
                disable @root\vmware\0000 |   
              |  | devcon.exe 
                enable @root\vmware\0000 |   
              | Temporarily 
                disable/enable vmnet8 | devcon.exe 
                disable @root\vmware\0001 |   
              |  | devcon.exe 
                enable @root\vmware\0001 |  
 top         Sample configurations of vmnet1 and vmnet8 with netsh.exe: 
                
           
             
              | netsh.exe 
                interface ip set address name="VMware Network Adapter VMnet1" 
                source=static addr=192.168.100.1 mask=255.255.255.0 |   
              | netsh.exe 
                interface ip set dns name="VMware Network Adapter VMnet1" source=static 
                addr=none register=PRIMARY |   
              | netsh.exe 
                interface ip set wins name="VMware Network Adapter VMnet1" source=static 
                addr=none |   
              |  |   
              | netsh.exe 
                interface ip set address name="VMware Network Adapter VMnet8" 
                source=static addr=10.10.10.100 mask=255.255.255.0 |   
              | netsh.exe 
                interface ip set dns name="VMware Network Adapter VMnet8" source=static 
                addr=none register=PRIMARY |   
              | netsh.exe 
                interface ip set wins name= "VMware Network Adapter VMnet8" source= 
                static addr= none |                                                      
        Extra bonus snippets for Workstation 6.0.x: 
         VMware Virtual Image Editing     
           
             
              | vmount2.exe 
                -service |   
              | vmount2.exe 
                /RegServer |   
              | regsvr32.exe 
                /s vielib.dll |   
              | vmount2.exe 
                /UnregServer |   
              | "sc.exe 
                create vstor2 binpath= "C:\Programfiler\Fellesfiler\VMware\VMware 
                Virtual Image Editing\vstor2.sys"  DisplayName= "Vstor2 Virtual 
                Storage Driver"" |                                                                     top
 
  
  
      
      
     top
    
 |