Quantcast
Channel: Hyper-V forum
Viewing all 19461 articles
Browse latest View live

C# code to remove or Eject the floppy drive

$
0
0

Hi guyz, i got the below code from MSDN regarding removal of resources from vm. The below example is for removing some nic settings.

What i need is to remove or Eject the Floppy disk which i have earlier attached from a virtual machine.

I followed the below procedure, but every time it gives me "Failed to remove resources from virtual machine"

Can any plz give working c# code to eject floppy drive(not through Powershell)

using System;
using System.Management;

namespace HyperVSamples
{
    class RemoveVirtualSystemResourcesClass
    {
        ManagementObject virtualSystemService = null;
        ManagementScope scope = null;

        RemoveVirtualSystemResourcesClass()
        {
            scope = new ManagementScope(@"root\virtualization", null);
            virtualSystemService = Utility.GetServiceObject(scope, "Msvm_VirtualSystemManagementService");
        }

        ManagementObject GetVirtualSystemEthernetPortSetting(ManagementObject vmSetting, string SyntheticNicElementName)
        {
            ManagementObject SyntheticNicSetting = null;
            ManagementObjectCollection SyntheticNicSettings = vmSetting.GetRelated
            (
             "Msvm_SyntheticEthernetPortSettingData","Msvm_VirtualSystemSettingDataComponent",
                null,
                null,"PartComponent","GroupComponent",
                false,
                null
            );

            foreach (ManagementObject instance in SyntheticNicSettings)
            {
                if (instance["ElementName"].ToString().ToLower() == SyntheticNicElementName.ToLower())
                {
                    SyntheticNicSetting = instance;
                    break;
                }
            }

            return SyntheticNicSetting;

        }

        void RemoveVirtualSystemResources(string vmName, string syntheticNicName)
        {

            ManagementObject vm = Utility.GetTargetComputer(vmName, scope);
            ManagementObject vmSetting = Utility.GetVirtualSystemSettingData(vm);

            ManagementObject syntheticNicPortSetting = GetVirtualSystemEthernetPortSetting(vmSetting, syntheticNicName);

            ManagementBaseObject inParams = virtualSystemService.GetMethodParameters("RemoveVirtualSystemResources");
            inParams["TargetSystem"] = vm.Path.Path;
            string[] resources = new string[1];
            resources[0] = syntheticNicPortSetting.Path.Path;

            inParams["ResourcesettingData"] = resources;

            ManagementBaseObject outParams = virtualSystemService.InvokeMethod("RemoveVirtualSystemResources", inParams, null);

            if ((UInt32)outParams["ReturnValue"] == ReturnCode.Started)
            {
                if (Utility.JobCompleted(outParams, scope))
                {
                    Console.WriteLine("SyntheticNic was removed successfully.");

                }
                else
                {
                    Console.WriteLine("Failed to remove SyntheticNic from VM");
                }
            }
            else if ((UInt32)outParams["ReturnValue"] == ReturnCode.Completed)
            {
                Console.WriteLine("SyntheticNic was removed successfully.");
            }
            else
            {
                Console.WriteLine("Remove SyntheticNic failed with error : {0}", outParams["ReturnValue"]);
            }

            inParams.Dispose();
            outParams.Dispose();
            vm.Dispose();
            vmSetting.Dispose();
            syntheticNicPortSetting.Dispose();
        }

        void Close()
        {
            this.virtualSystemService.Dispose();
        }

        static void Main(string[] args)
        {
            if (args != null && args.Length != 2)
            {
                Console.WriteLine("Usage: RemoveVirtualSystemResources vmName syntheticNicName");
                Console.WriteLine("Example: RemoveVirtualSystemResources MyFirstVM myStaticNic");
                return;
            }

            RemoveVirtualSystemResourcesClass removeResource = new RemoveVirtualSystemResourcesClass();
            removeResource.RemoveVirtualSystemResources(args[0], args[1]);
            removeResource.Close();
        }
    }
}






Running Hyper-V locally

$
0
0
I am installing a couple of Hyper-V servers for the first time using the 2012 Core Server.  I would like to have local access to the Hyper-v management console, but can't find any instructions.  Is it possible?  Thanks.

Hyper-V Manager Windows 8/Server 2012 -> failed to connect Server 2008 R2

$
0
0

Hey guys,


After I installed a couple of new Server 2012 Hyper-V within the last months and startet using Windows 8 with Remote Server Administration Tools, I figured out I can't get Access to the "old" Server 2008 R2 Hyper-V Systems.

The Hyper-V Manager Windows 8/2012 says "The operations on Computer Failed." If I'm trying to connect from a Server 2008 R2 to a Server 2012 it works.
I would expect that if I would try it the other way. But old to new? 0o

I never read something and couldn't find informations about that issue and I'm pretty shure there is an KB entry or an update or something else.

Can someone gimme a hint and point me? ;(

Server Core 2012 with Hyper V Memory Limit Issues

$
0
0

I have a 2 different servers running server 2012 core. One has 8GB RAM running SBS 2008 and the other has 36GB of RAM running SBS2011.
Each server only hosts the single instance of SBS on it, nothing else.

Both have the same issue where I get an out of bounds error when trying to give them enough RAM.
The host for the SBS2008 one limits it to just over 6GB which leaves the Host with 1.1GB of wasted RAM all the time.

The host for the SBS2011 one limits it to just over 10GB... leaving about 25GB wasted.

Never had this issue on Server 2008R2 Core, and now found that neither of the SBS guest OS's support dynamic RAM. I cant find anything to help bypass this startup memory limit. Any ideas?

I just want to be able to set around 6.8GB of RAM on the SBS2008 host and 32GB on the SBS2011 host. No need of dynamic RAM at all.

Hyper-V Replica

$
0
0

If I setup to servers with Hyper-V and configure replication on my VMs, what is supposed to happen if the primary host goes down unplanned.

Does the backup host start the replica VMs automatically or do I have to do that manually.

Run Hyper-v Manager through VPN tunnel

$
0
0

I have a problem and I know it is a shit way to deal with the situation but its the best that I can do.

I have a friend that uses SBS2011 on a Hyper-V server (also has some other VM's on there). His problem is that when it goes down he can not turn on the servers again remotely.
What I was hoping to achieve is that by having a win7 box with a VPN tunnel (i have set this up) and RSAT tools installed I would be able to connect to the host and bring the machines back on line when there is a issue.

But what happens is that when I run Hyper-V Manager i get "You do not have the required permission to complete this task. Contact the system administrator of the authorization policy for the computer 192.168.1.2" Now I thought this was because the Hyper-V host was not domain connected (but not sure how to check that) so I created a local user account that has the same name and password as this is how I had to connect last time using my non-domain laptop to connect to the Hyper-V host (that was an experience I would like to avoid in the future).

I am sure there is a guide out there that tells me how to do this but I don't know what would work in my situation. Can someone point me in the right direction?

Hyper V and firewall

$
0
0

i am thinking to use hyper-v and put it for small production test, however i was curious if i need 3rd party firewall for this, or does hyper-v has build in firewall that i can managed thought web gui or different way?

thank you

Use SMB 3.0 on a Hyper-V 2012 without domain

$
0
0

I have a Hyper-V 2012 installed on a machine and I want to configure it to access a shared folder on my file server, which is a Windows 2012 machine. On that shared folder I will have all my virtual machines. I want to use SMB 3.0. I do not want to use iSCSI or NFS.

From what I'm reading, I will need a Domain set up. This is a testing environment though and I don't have a domain, and I don't want to set up a domain just for the testing environment.

Is there a way I can host Hyper-V machines on an SMB 3.0 shared folder, without needing a Domain Controller?



vEthernet lead to no network connectivity

$
0
0

Hi,

i have the following configuration set up:  net1, net2 are teamed together switch-indipended mode. connectivity to the network is given.

If i create a Hyper-V-switch (External) with option "Allow management operating system to share this network adapter" set i lose all connectivity to the network. the newly created vEthernet-Adapter is not able to obtain a IP from the DHCP, doesn't work with a static one also.

Anyone has an ida how to fix this?

Thanks

Frank

P.S. on another server simular set-up works well

Unable to Add VHD to VM

$
0
0

I am having trouble adding VHDs to a VM.  I get the following error '<VM Name>' failed to add resources... The disk is already connected to the virtual machine '<VM Name>' 

The VM Host is Windows Server 2012 and the VM in question is Windows Server 2008R2.  The problem occurs both in the GUI and using powershell Add-VMHardDiskDrive command.  The VHD is newly created.  I have tried using both fixed and dynamic VHDs.  I used get-vmharddiskdrive to verify that the VHD does not already exist on the VM.  The problem has occurred on multiple VMs.  The VMs are on a clustered host and I have tried removing the VM from the cluster to see if that would help the problem and it did not.  In some cases, I am able to successfully add a VHD, but most of the time it fails. 

Any assistance with this problem would be appreciated.

Is this the place for Server 2012 VDI?

Hyper-V 2012: Replication fails to automatically resume after a server reboot

$
0
0

Hello,

I have a VM lab with Windows 2012 and Hyper-V. Overall it has been awesome, but I have one small glitch:

The VMs on server A replicate to server B. The new Hyper-V replication feature works perfectly, except for my one problem. When I shut down and then restart the servers, replication does not always automatically resume for all VMs. Some VMs will resume replication on their own and some will require a manual resume - and it seems to be random. I can always restart replication by right clicking and the hitting Replication --> Resume Replication, but I rather hoped that this would happen automatically, all of the time.

Has anyone else experienced this? Is there a cure?

Hyper-V virtual Machine fails to start

$
0
0

Can somebody help me here....Whenever I start a virtual machine with the name of vm1 In Hyper-V  I get this error that:-the application encountered an error while attempting to change the state of VM1...vm1 failed to start. Failed to start the virtual machine VM1 because one of the Hyper-V components not running.

Awadh Ombaso

Virtual Machines - DMZ - Failover Cluster

$
0
0

Hi,

I have a problem in my Cluster Hyper-V, in my case, I have 2 VM`s with NIC´s configured in a DMZ, but if a case failover, another note up this machines, but use ANOTHER NIC, the question is:

How to configure a VM to use a specific a prefer NIC in a failover case.

Sorry for my En.

Thanks,

Denis

Virtual machine, iSCSI storage and snapshots

$
0
0

Hi all,

I have VM with iSCSI attached disk on Hyper-V 2012. And when I take snapshot and then apply it, data on iSCSI disk changes. How does it happen? I thought that iSCSI disk is like physical and I can't take a snapshot from it. Perhaps this is the feature of my storage system or its hyper-v feature that realized by default.

Anatoly



Падение сетевой производительности в Windows Server 2012 Hyper-V

$
0
0

Добрый день,

имеет Windows Sever 2012 + создаем teaming на 2 10Gb адаптерах. Пробуем прогнать тест между двумя серверам - все работает на скоростях близких к 9 Gb/s. Как только прокидваем этот team в Hyper-V как External - получаем резкое снижение пропускной способности при передачи файлов с одной машины на другую - скорость падает до 2-3 Gb/s.

Это нормальное падение производительности при передачи адаптера в Hyper-V? Есть ли возможность улучшить производительность? Дело в том что на данных хостах установлен Windows Server 2012 и они собраны в кластер - при Live Migration виртуальных машин - это чувствительно - да и не должно быть такое снижение. Подозрение что это какая то ошибка, либо мы что то недопонимаем....

Re-Enable Hyper V Replica

$
0
0

Hi,

I am trying to re-enable hyper v replication but I get an error:-

[Window Title]
Enable Replication

[Main Instruction]
Enabling replication failed.

[Content]
Hyper-V failed to enable replication.

Hyper-V is not in a state to accept replication on the Replica server for virtual machine 'EX2010'.

[Expanded Information]
Hyper-V failed to enable replication for virtual machine 'EX2010': Operation aborted (0x80004004). (Virtual Machine ID F80A330B-9D0A-4CFD-B6B1-B69C023B2D69)

Hyper-V could not replicate changes for virtual machine 'EX2010' as Hyper-V is not in a state to accept replication on the Replica server. (Virtual machine ID F80A330B-9D0A-4CFD-B6B1-B69C023B2D69)

Replication was working great however I wanted to only replicate 2 out of the 3 VHD's for this machine. I removed replication and tried to enable again but this time I deselected the vhd I didn't want and choose "use existing virtual machine on replic server as the initial copy"

Any help would be appreciated.

Thanks,



Windows Server 2012 Cluster - Live Migration fails

$
0
0

Hello! I`ve built a cluster with 2 nodes and shared storage via Dell PowerVault MD3600i (iSCSI). It works fine but when i try to start Live Migration from host 1 to host 2 I get an error:

Live Migration of Virtual Machine failed. Could not find Ethernet switch '3bb15814-...-28CA'

There is only one Virtual Network Adapter and it`s connected to Virtual Switch 'trunk' (external) - it`s created on both hosts. Live migration from host 2 to host 1 works just fine and quick migration works well to.

What may be wrong and what else I need to do? Thanks!

(Sorry for my bad english).



Windows Server 2012 Hyper-V. VHD or Pass-through Disk?

$
0
0

Hello!

We have planned to install Postgree application on the Windows Server 2003 / 2008 OS. We are in process of virtualization host server configurationplanning and therefore we have the following questions according your experience.

  • Is there an essential performance lack if we use VHD/VHDX disks?
  • Is there bigger data lost / damaging risk if we use VHD/VHDX files?
  • What is your experience with Windows Server 2012 Hyper-V?

Thanks!

Server 2012 Hyper V Cluster or Replication?

$
0
0

A bit of background to my environment before my question:-

2x Windows Server 2012 Hyper V hosts

No SAN or shared storage at present

4Gbps NIC Team

I am wondering which would be the best way to setup these hosts for redundancy. We are currently using the local storage to hold the VHDs as we want to avoid the SAN route if possible. As I understand it, in order to get no downtime, we need a cluster and for a cluster we will need some form of shared storage be it SAN or iSCSI to a NAS or separate file server?

If not, is there a way that if a host fails, the other host will immediately take on the load of host 1 without downtime or data loss? My idea was to have copies of the VHDs on the DAS of both hosts and then if a host fails the changes are written to the log file to be written to the VM on host 2 seamlessly?

Any answers appreciated and thanks in advance!

Viewing all 19461 articles
Browse latest View live




Latest Images