使用WMI创建具有两个节点的集群时出现通用故障

时间:2012-04-11 07:20:20

标签: c# wmi

请帮助..我正在尝试创建一个包含两个节点的集群(两者都是server 2008),我正在从Windows 7运行这个C#应用程序,同时创建我收到以下异常..

Unhandled Exception: System.Management.ManagementException: Generic failure at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStat us errorCode) at System.Management.ManagementObject.InvokeMethod(String methodName, Managem entBaseObject inParameters, InvokeMethodOptions options) at Test.main.Main() in D:\Abhijit\Sandbox\BatonInstallerProject\BIM\windows\s ource\test\main.cs:line 202

public void CreateCluster(String[] NodeNames, String ClusterName, String ClusterIP)
{
    string[] ipaddresses = new string[1];
    string[] subnetmasks = new string[1];
    subnetmasks[0] = "255.255.255.0"; 
    ipaddresses[0] = ClusterIP;
    ManagementPath mgmtPath = new ManagementPath("MSCluster_Cluster");
    ObjectGetOptions objGetOptions = new ObjectGetOptions();
    ManagementClass mgmtClass = new ManagementClass(conn.GetConnectionScope, mgmtPath, objGetOptions);
    ManagementBaseObject inParams = mgmtClass.GetMethodParameters("CreateCluster");
    inParams["ClusterName"] = ClusterName;
    inParams["NodeNames"] = NodeNames;
    inParams["IPAddresses"] = ipaddresses;
    inParams["SubnetMasks"] = subnetmasks;
    ManagementBaseObject retVal = mgmtClass.InvokeMethod("CreateCluster", inParams, null);
}

在检查了ManagementException的errorCode的enumaration类型后,它显示“失败”..我有任何解决方案请分享它我被困在它几天......

0 个答案:

没有答案