Example #1
0
        public void AddVirtualNic(VMware.Vim.HostConfigManager configMgr, string portGroupName, string IPaddress, string subNetmask)
        {
            VMware.Vim.ManagedObjectReference nwSystem = configMgr.NetworkSystem;

            HostVirtualNicSpec vNicSpec = new HostVirtualNicSpec();
            HostIpConfig       ipConfig = new HostIpConfig();

            ipConfig.dhcp       = false;
            ipConfig.ipAddress  = IPaddress;
            ipConfig.subnetMask = subNetmask;
            vNicSpec.ip         = ipConfig;

            vimService.AddVirtualNic(nwSystem != null ? new VimApi_55.ManagedObjectReference()
            {
                type  = nwSystem.Type,
                Value = nwSystem.Value
            } : null, portGroupName, vNicSpec);
        }