Set VLAN ID on a virtual machine network on Windows 2012

I'm currently working in C# consuming Hyper-V V2 WMI API to do different tasks related to virtual machines. I've not been able to figure out how to get/set VLAN ID. I've found many links on net pointing to PS HyperV lib exploring "Get-VMNICVLAN"
and "Set-VMNICVLAN" but they dont seem to be working from me as Nic.connection[0] always seem to be null in my case. Perhaps that only works with Windows 2008 Hyper-V.  
Also I'm not familiar with WMI scripts much so converting that code to C# is being a pain. Can someone please tell me exactly how to do so in C# using WMI.
Regards
Usman

Hello Brian
Thanks for your reply. Perhaps V1 and V2 are not only namespaces since there are many class names, method names, parameter names are different, or perhaps I didnt work with the standard way with V1. Like "msvm_VirtualSwitch" changed to "msvm_VirtualEthernetSwitch",
"msvm_VirtualSystemGlobalSettingData" to "msvm_VirtualSystemSettingData" and specific for VLAN "Msvm_VLANEndpointSettingData" to "MSVM_EthernetSwitchPortVLanSettingData" and many more places.
I would easily set VLANID using code below in V1
string szArg = szArg = "NetworkVSP:" + szSwitch + @"\\" + szSwitchPort;
ManagementObject vlansettingdata = this.wmi.GetWmiObject("Msvm_VLANEndpointSettingData", "InstanceID Like 'Microsoft:{0}%'", new object[] { szArg });
vlansettingdata.SetPropertyValue("AccessVLAN", nVlanid);
vlansettingdata.Put();
But now even having reached the vlansettingdata object in V2, I get a "Generic Error" on calling vlansettingdata.Put(); Here's a snippet of code I'm using in V2, which may be wrong
ManagementObjectCollection vlansSettings = switchPortObj.GetRelated("MSVM_EthernetSwitchPortVLanSettingData");
ManagementObject vlanSettingsData = null;
if (vlansSettings != null)
foreach (ManagementObject settingData in vlansSettings)
if (settingData != null)
vlanSettingsData = settingData;
break;
if (vlanSettingsData != null)
vlanSettingsData.SetPropertyValue("OperationMode", "1");
vlanSettingsData.SetPropertyValue("AccessVLANID", nVlanid);
vlanSettingsData.Put();
IsVlanSet = true;
Forgive my ultimately dirty raw code, its just part of a test app that's getting uglier with desperate attempts to succeed.
Regards
Usman

Similar Messages

  • Is it legal to use Macintosh virtual machine hosted by Windows operating system? If yes, please suggest recommended hardware and license cost?

    Is it legal to use Macintosh virtual machine hosted by Windows operating system? If yes, please suggest recommended hardware and license cost?

    steve359 wrote:
    I thought that at least some version of OSX could not be VM in Mavericks, but if you say it is allowed so be it.
    There are some people who dispute the details of what "the software" means in the license. From my point of view, I have a license to run all of those versions each license explicity says I can use a VM. I don't think it is illegal or even unseemly. The only version restriction I know of that the new VM policy only applies to Lion or greater. 10.6 could only be run on a VM if you had the expensive server version. The licenses do explicity list the acceptable uses and that includes OS X Server, software development, and non-commercial use. They don't want people selling online access to OS X, that's all.
    I do not VM Windows on my MBP because I have no need.
    Me neither. I used to though. Funny how a Mac was the most critical tool in debugging web sites on various versions of IE
    I don't even run OS X in a VM anyway. It does work but it is quite resource intensive. Maybe if I had one of those new Mac Pros...

  • Activate Virtual Machines on OEM Server 2012 R2 Standard

    As allowed under my license I can run my OEM Server 2012 R2 as a Hyper V Host and run 2 production Server 2012 R2 VMs.
    So how do I activate these VMs? What am I missing?
    I tried using the OEM key of the server/host. Failed.
    I tried using the AVMA key. Failed.
    Shouldn't be this hard.
    One of the machines I want to activate is a Server Core. I can see posts around the place saying use the OEM and if it fails call Microsoft activation. But I can find none of the options or information how to complete the phone activation via sconfig or
    command line options.
    Really should not be this hard at all. Someone should be fired and this process fixed.

    Hi,
    Did you talk about Windows Server 2012r2 with hyper-v role or Hyper-v Server 2012r2? 
    Activating a VM is the same as activating a physical machine. When the VM asks to be activated, you would use the same product key as you used to activate your physical host. If this is an OEM licensed server, your OEM should have provided you with the proper
    key.
    Please refer to:
    http://social.technet.microsoft.com/Forums/en-US/7cbd9aab-2c95-4bc1-b0a1-5a24a0945ebf/activate-the-virtual-machine
    http://www.petri.com/automatic-virtual-machine-activation-avma-windows-server-2012-r2-hyper-v.htm
    Regards.
    Vivian Wang

  • Networking arch linux virtual machine networking

    For a project, I've got an arch linux virtual machine running on the school network. The image has SSH installed and that works just fine, the problem is that the network admin didn't give it access to the internet (so I can access it only over lan). What I would like to do is run updates on it and install several libraries that I need for deploying a web application (rails). The easy way to install them is obviously through pacman, which leads me to my question: Is there a way to make a network interface on the server that would use ssh to make a bridged connection to the internet?
    Not super sure if I worded that correctly, but it seems that it ought to be possible to have a network interface on the vm that, when the vm opens an ssh connection to some ssh server (on the lan) allows the vm to use that connection for more than just ssh.
    Thanks.

    I was making this too complicated... I set up a squid proxy on a different machine and it all works well.

  • Vmware Esxi5.1 virtual machine network adapters problem

    I have an issue with a windows 2008 R2 virtual machine on an ESXi 5.1 free version server , network adapters inside the VM is not identified , they appear with exclamation mark and when I tried to reinstall drivers for intel e1000 adapter it keeps telling me that no adapters are present , in addition to that it doesn't identify vmxnet2 and vmxnet3 even I tried to uninstall and reinstall vmware tools!
    Anyone can help with this issue !?
    Thanks

    I want to use the VM as a DHCP server or share the VM's internet connection with OS X -- the Mac will masquerade as a virtual Linux box, not vice-versa. So I must establish a network through the VM. The blog post "Setting up an IPv6 Test Environment under Mac OS X using VMware Fusion" [http://blogs.sun.com/richlewis469/entry/settingup_an_ipv6test] and the MacPort aiccu [http://www.sixxs.net/tools/aiccu> appear to be relevant ...

  • Virtual Machine Network Health not working

    Server 2012 R2 is supposed to have a feature which detects when the public LAN connection used to get into the VM's becomes unavailable, this is supposed to kick in around 60 seconds after it being unavailable. however, I have tried to test this by physically
    unplugging the network cable, and disabling the network adapter in ncpa.cpl and the virtual machine doesn't seem to live migrate to the other node. the settings for the network adapter in the virtual machine configuration has the "protected network"
    box checked by default. is there something else we need to check/configure here?
    it looks like it tries to migrate but fails, the message in the information details state:
    Live migration of 'Virtual Machine Test-TERM' failed.
    'Virtual Machine Test-TERM' failed to fixup network settings. Verify VM settings and update them as necessary
    thanks
    Steve

    Hi,
    The cluster failured and the live migration often trigerd by the heart beat communcation crash.
    Thanks.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Install R12 on a Virtual Machine hosted on Windows Vista

    I wanted to install Oracle EBS R12.1.1 on Windows Vista Home Premium 64-bit but used to get .\jre\nt\1.6.0\bin\java error. Hussein Sawwan
    helped and said that this is not certified. He adviced me to create a VMWare Server. Following is my experience. I hope it is helpful. Any
    suggestions, additions are more than welcome. Thanks to all who helpmed me especially Hussein Sawwan, Helios, Gareth Roberts.
    I used to get .\jre\nt\1.6.0\bin\java error after the installation would zoom through 33%. That was because my staging area was not correct. The staging area should be just next to c:\ or whatever be the root directory (or drive). No space or special characters in folder name. My current structure is as follows:
    c:\r12stage. Under r12stage I have following folders and subfolders
    oraAppDB -- 49 Disks
    oraApps -- 11 Disks
    oraAS -- 3 Disks (This comes from the Rapid Install Tools)
    oraDB -- 5 Disks
    startCD -- 1 Disk plus other folders. Just copy startcd from the unzipped download and paste to r12stage area.
    I then created a virtual machine using VMWare Server (free download but need to register to get the serial number). Because I installed
    vmware server on Vista Home Premium 64 bit Host OS, I have to boot my machine by pressing F8 and then select Disable Digital Signature
    Enformcement. Thanks to Gareth Roberts for this tip. Create a vm and install Windows 2003 by selecting the .img file (first cd) by selecting Use ISO image and then path of the windows 2003 cd 1 (zipped file). start the virtual machine, that will install windows 2003 and then ask for location of 2nd cd. On the host machine, where the second win 2003 zip file resides, unzip the second zip file and name the folder as cd2. share this folder to the __vmware_user__ and from the virtual machine, map network drive to \\hostmachinename\cd2. Select this as the location of cd2 and complete the installation. Install MKS Toolkit from http://cygwin.com/ and visual c++ from Microsoft website. for information on this please refer to the following URL. Thanks to Muhammad Habib
    http://mhabib.wordpress.com/2007/03/14/installing-oracle-applications-e-bussiness-11i-on-windows-xp/
    After installation is done and Windows Update is run, share the r12stage directory on the host machine to the vmuser and launch rapidwiz.cmd from the command prompt and follow the instruction. For internet connection from the VM use Ethernet as NAT.
    If the installation errors halfway through, clean up your VM by following instructions in document id 292424.1 in MetaLink. If you dont have access to Metalink then I summarize the steps briefly over here.
    Launch the Registry Editor.
    Navigate to the HKEY_LOCAL_MACHINE\Software key.
    Select the Apache Group subkey and delete it.
    Select the Oracle subkey and delete it.
    Navigate to the HKEY_LOCAL_MACHINE\System\Current Control Set\Services.
    Carefully select and delete each service beginning with Oracle. For example, delete "Oracle Apache Server PROD_<nodename>".
    When you are finished, exit the Registry Editor.
    Navigate to the Environment Variables editing screen according to your system setup. For example, right-click My Computer and select
    Properties. From the Advanced tab, click the Environment Variables button.
    Select the following system variables if created during the failed installation, and delete them: DISCO_JRE, DISCO_VBROKER, JSERV,
    VBROKER_JAVAVM, VBROKER_TAG, WV_GATEWAY.
    Select the Path variable, but do not delete it. Carefully edit it and remove any component with "Oracle" in the name, or that otherwise
    references the failed install. For example, delete "E:\11.5.10\test\visora\8.0.6\bin;".
    Save and exit System Properties.
    Open a command window and navigate to the C:\Program Files\ directory. Delete the Oracle subdirectory.
    If your Oracle Inventory directory was not C:\Program Files\Oracle\Inventory and was therefore not deleted in the previous step, locate it
    and delete it.
    Restart your machine
    It is now safe to remove the Oracle filesystem that was partially installed during the failed installation. Go to the base install directory,
    or top-level directory under which you installed either the Database Server (DATA, DB) or the Applications Tier Server (APPL, ORA, COMN)
    directories, or both. Note that you may choose to rename a directory before you delete it. This allows you to use the same directory name and start a new installation even before you finish the delete filesystem operation. For example, if you placed your filesystem in a "test" directory under
    "E:\11.5.10":
    C:\> E:
    E:\> cd 11.5.10
    E:\> rename test oldtest
    E:\> del /s /q oldtest
    In another window:
    C:\> cd <stage install directory>
    Q:\> rapidwiz.cmd
    After cleaning up if you still get error like RW-50004: Error Code received when running external process. Check log file for
    details. Running database Install driver for VIS instance, after 13% complte step 1 of 5 then I suggest that you re-create the machine and follow the above steps again. Including installing win 2003, mks tool kit , vc++, etc. It will be a success.
    Starting concurrent manager takes up enormous memory and slows down everything, so if you dont need it then dont ever start it. APPS password is apps and sysadmin user is sysadmin.
    Good luck.
    Mahesh Acharya

    I had Vista 64-bit machine, installed Ubuntu in VMWare. Installed Oracle apps on 32-bit Ubuntu under VMware and was able to access Oracle apps. But, it is very very slow. It hangs sometimes and takes 15-20mins to display Ubuntu screens. Am I missing something here. I have a 4GB RAM and VMWare can not use all the 4GB. It may be using 2GB of 4GB. Am I missing something?

  • Failed to install windows server 2012 in virtual machine hosted in window 8.1

    I installed Hyper-V in windows 8.1, then when I tried to install windows server 2012 R2 or windows server 2008 R2 in virtual machine, I got the following error:
    the following is my virtual machine setting:
    is there anyone an help to resolve it? thank you very much.

    Hi,
    Good to hear that you have solved this issue. Thanks for sharing as it would be helpful to anyone who encounters similar issues.
    Best regards,
    Susie

  • How to access for Virtual machines in System Center 2012 r2 by remote console through code?

    Hi All,
    I am new in System Center. I am using System Center 2012 R2. I have a web application written by dot net, which shows the list of virtual machines created in the SCVMM.  Now, I need to select a Virtual Machine from the list, and click a link named "console
    access". This will allow the console access to the virtual machine. How can I perform this task?
    Thanks in advance,
    Moohak

    The SCVMM VM console is an ActiveX application.
    It is installed with the SCVMM Console application.
    If you search around for the old SCVMM Self Service portal, you will discover how MSFT originally enabled this from a web front end.
    If you look at Windows Azure Pack you will find a new pattern using RDP gateway.
    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.

  • System Center Virtual Machine Manager SC VMM 2012 SP1 Installation fails: Unable to assign the name NO_PARAM to this host because this name is already in use.

    I'm trying to install VMM 2012 SP1 on a Windows Server 2012 machine and it fails with this error,
    the scenario is as follows,
    Old database (from 2012 RTM) exists on remote SQL 2012 SP1 server
    Server was 2008 R2 SP1 so I decided to make a fresh installation of 2012 with the same name
    installed ADK
    specific error: 01:42:13:VMMPostinstallProcessor threw an exception: Threw Exception.Type: Microsoft.VirtualManager.Setup.Exceptions.BackEndErrorException, Exception.Message: Unable to assign the name NO_PARAM to this host because this name is already in
    use.
    please help

    I had a similar problem today when upgrading from SCVMM 2012 RTM to SCVMM 2012 SP1 RTM. To re-create the issue you describe originally you can actually just uninstall SCVMM 2012 SP1 RTM with "retain data" option and re-install the software on the same
    computer (with the same name of course), attaching it to the retained DB. If you change the SCVMM server name I believe it will make some things go wrong after your install, like missing VM template passwords for example as the data gets encrypted in
    the DB. Maybe it didn't but I didn't risk it. I definitely know if you change service accounts on a scenario like this you will be without the encrypted DB data which isn't much fun. To avoid changing the computer name, if you look in the setup log
    files in %systemdrive%\ProgramData\VMMLogs\, specifically the SetupWizard.log file. You will see details on it failing because the same computer name is in the DB table "dbo.tbl_ADHC_AgentServer" and until it is removed from that table I wasn't able to get
    the install to complete at all. The error in my logs looked something like this "InnerException.Type: System.Data.SqlClient.SqlException, InnerException.Message: Violation of UNIQUE KEY constraint 'unique_ADHC_AgentServer_ComputerName'. Cannot insert duplicate
    key in object 'dbo.tbl_ADHC_AgentServer'. The duplicate key value is (computername.is.writtenhere). The statement has been terminated." In the row data in the DB it also seems to suggest that the computer name had "Virtual Machine Manager Library Files" on
    it which is strange since I always remove the local SCVMM server as a library server after I install it and use an off box library server.

  • Getting Windows Server 2008 to Create a Virtual Machine to Run Windows 8.1 Is Easy -- Not So Getting Windows Server 2012 To Do So

    I spent an entire work day trying to configure HYPER-V on Windows 2012 R2 Server to run Windows 8.1 in a virtual operating system. Gave up entirely on Windows 2012 R2 Server since no matter how I changed the memory configuration, it insisted there was
    too little memory available to perform bootstrap and initialization of the Windows 2012 R2 Server / Windows 8.1 combination. In vivid contrast, getting Windows 8.1 installed and operational under HYPER-V running on Windows 2008 Server is a snap. No whining
    from HYPER-V about a purported lack of memory. The machine has 2GB of main memory and nothing much running on it besides HYPER-V.  This situation is, of course, all my fault.
    MARK D ROCKMAN

    Hi Sir ,
    Personally , 2 GB for 2012R2 host and a windows8.1 VM is a little low .
    Also the memory consumption is different between 2012R2 and 2008 .
    I would suggest you run RAMmap.exe to check the free space , then you may see how many RAM can be used :
    http://technet.microsoft.com/en-us/sysinternals/ff700229.aspx
    By the way , win8.1 is not in the
    supported guest OS list of 2008 hyper-v server .
    Best Regards
    Elton JI
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Oracle VM as virtual machine - Networking

    hi
    I have seen some docs about networking, and thus how to install oracle vm 3.2.x as virtual guest on top of the cloud stack (HA enabled).
    Is there any best practices document for networking in this fashion?
    We like to have 3 networks.
    Network management VLAN1 (local IP adresses)
    Storage Network VLAN2 (local IP adresses)
    VM Network VLAN3 (public IP's)
    While the oracle vm runs as a guest, there is only the public network wehere we can select for nic's.
    It's possible to run OVM as guest with diffrent network segment? Should we use this configuration in a production ervironment
    Thanks for your support

    I was making this too complicated... I set up a squid proxy on a different machine and it all works well.

  • How to create a virtual machine from a windows 8 installed in a usb drive with bitlocker on

    BAsically I created the vm with dissk2vhd and then mounting it on oracle virtual box but the bit locker is not letting the machine start. How can I bypass this
    Many thanks
    Fab

    I'm not sure you can, bitlocker ties your installation to the hardware.
    "To P2V a BitLocker drive, please suspend the protection"
    REF: http://blogs.technet.com/b/chrad/archive/2012/03/12/upgrading-to-windows-8-consumer-preview-just-got-easier-using-vhd-tools-to-p2v.aspx

  • Bitlocker within Virtual Machines on Hyper-V 2012 R2 Host

    I'm just trying to get a definitive answer to the question of can we enable Bitlocker encryption within a VM that's housed on a hyper-V 2012 R2 host?
    Some posts I've seen say it can be done and detail the steps, but others suggest that you can only use Bitlocker on data drives within the VM and not boot drives.
    Can anyone please clarify the situation for me?
    Cheers for now
    Russell

    Bitlocker is not supported inside VMs. That is due to the fact that TPM chips cannot be passed through into VMs.
    It does however not mean, that BL won't work. You cannot use netunlock as it needs a tpm - correct. But you can use startup keys (emulated floppy disks) that provide the key so you have a hands-free reboot.
    Like this: add a floppy image to your vm. Format that floppy. Tell Bitlocker to use additional startup keys and not require a tpm. Than, enable Bitlocker:
    manage-bde -on c: -sk a:
    [will write a startup key to that virtual floppy].
    I've just been looking at the BitLocker documentation and was wondering if I can use the ADaccountorgroup protector instead of the virtual floppy drive, as suggested by the text below (from TechNet):-
    An alternative to the startup key protector on non-TPM hardware is to use a password and an
    ADaccountorgroup protector to protect the operating system volume. In this scenario, you would add the protectors first.  This is done with the command:
    manage-bde -protectors -add C: -pw -sid <user or group>
    This command will require you to enter and then confirm the password protector before adding them to the volume.  With the protectors enabled on the volume, you can then turn BitLocker on.
    I assume that as long as the AD Group or User is present, the volume can be unlocked?
    Cheers for now
    Russell

  • DNS best practice in local domain network of Windows 2012?

    Hello.
    We have a small local domain network in our office. Which one is the best practice for the DNS: to setup a DNS in our network forwarding to public DNSs or directly using public DNS in all computers including
    server?
    Thanks.
    Selim

    Hi Selim,
    Definately the first option  "setup a DNS in our network forwarding to public DNSs " and all computers including server has local DNS configured
    Even better best practice would be, this local DNS points to a standalone DNS server in DMZone which queries the public DNS.
    Using a centralized DNS utilizes the DNS cache to answer similar queries, resulting in faster response time, less internet usage for repeated queries.
    Also an additional DNS layer helps protect your internal DNS data from attackers out in the internet.
    Using internal DNS on all the computer will also help you host intranet websites and accessibility to them directly. Moreover when you are on a AD domain, you need to have the computers DNS configured properly for AD authentication to happen.
    Regards,
    Satyajit
    Please “Vote As Helpful”
    if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.

Maybe you are looking for

  • How To Get and activate bluetooth..

    My  hp Product number:  E4R28EA#A2N Serial number: {Personal Information Removed} HP Pavilion 15-e040sx Notebook PC I want to send my files to mobile via bluetooth.. So I dont know where to get  and and activate bluetooth.. Please help me to nstall a

  • Safari did something I've never seen before

    This is regarding my bookmarks. I went to click on a bookmark and my bookmark got deleted and there was this little dust cloud animation when I clicked. Nothing bad happened. I just had to go make another bookmark but I have never seen this happen be

  • Portal Login ID in ABAP

    Hi, consider a scenario. I am login into Enterprise portal using - admin_it. I want to know by which user has login into portal. By which method or function can i read this login id into abap. Regards, Priya

  • Machine not running the correct deployment type

    I have an application; Office 2013, with multiple deployment types.  These deployment types each install Office with a different MUI. The requirements on the deployment types are 'Organizational Unit' must be one of xxxxx I have my final deployment t

  • How can I change incorrect "date received" info in Mail?

    When I switched to Mavericks I had to leave behind Eudora, which I liked.  I started using Mail, but when Mail imported my email files from Eudora it misdated many of the files, using the date the file was imported as the "date received".  Since I us