Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用Vestris.VMWareLib克隆.Vm_C#_Powershell_Vmware_Powercli - Fatal编程技术网

C# 使用Vestris.VMWareLib克隆.Vm

C# 使用Vestris.VMWareLib克隆.Vm,c#,powershell,vmware,powercli,C#,Powershell,Vmware,Powercli,我正在尝试使用VVMWareLib克隆虚拟机 我使用的代码如下 using System; using Vestris.VMWareLib; namespace QsBuild.Blocks.VmWare { public interface ICloneVmBlock { void CloneVm(string filename); } internal class CloneVmBlock : ICloneVmBlock {

我正在尝试使用VVMWareLib克隆虚拟机

我使用的代码如下

using System;
using Vestris.VMWareLib;

namespace QsBuild.Blocks.VmWare
{
    public interface ICloneVmBlock
    {
        void CloneVm(string filename);
    }

    internal class CloneVmBlock : ICloneVmBlock
    {
        public void CloneVm(string filename, string destConfigPathName)
        {
            var virtualhost = new VMWareVirtualHost();

            virtualhost.ConnectToVMWareVIServer("IpServer", "UserName", "Password");

            var vm =
                virtualhost.Open(
                    filename);

            Console.WriteLine("vm is open");
            vm.Clone(VMWareVirtualMachineCloneType.Full, "[datastore1] QA20 (Ubuntu Linux)/QA20.vmx", 150);
        }
    }
}
Vestris.VMWareLib.dll中发生“System.exception”类型的异常,但未在用户代码中处理>

其他信息:克隆虚拟机失败: cloneType=“Full”destConfigPathName=“[VMQA]”timeoutInSeconds=150

当我点击更多细节时,我会收到一条信息

{“不支持该操作”}

堆栈跟踪

在 Vestris.VMWareLib.vmwarevirturalMachine.Clone(vmwarevirturalMachine克隆类型 cloneType,字符串destconfigupathname,Int32 timeoutines)位于 中的QsBuild.Blocks.VmWare.CloneVmBlock.CloneVm(字符串文件名) d:\TFS\Trunk\Tools\DevEnv\QsBuild\QsBuild\Blocks\VmWare\CloneVmBlock.cs:line 中的QsBuild.Tests.Blocks.VmWare.CloneVmBlockTests.CloneVm()处有24个 d:\TFS\Trunk\Tools\DevEnv\QsBuild\QsBuild.Tests\Blocks\VmWare\CloneVmBlockTests.cs:line 十六,


我在这里找到了一些答案