public static void Main(string[] args) { // This first part is to simply setup the connection to the Cimom string progName = System.AppDomain.CurrentDomain.FriendlyName; if (args.Length != 4) { Console.WriteLine("Usage: " + progName + " <server name> <username> <password> <namespace>"); return; } string host = args[0]; string user = args[1]; string pwd = args[2]; string defaultNamespace = args[3]; // This is the line that defines our wbem client. No connection is made // to the Cimom until a call is made. WbemClient client = new WbemClient(host, user, pwd, defaultNamespace); GetClassOpSettings gcos = new GetClassOpSettings("CIM_NFS"); EnumerateClassNamesOpSettings ecnos = new EnumerateClassNamesOpSettings(); GetClassOpSettings gcos2 = new GetClassOpSettings("CIM_Component"); BatchRequest batch = new BatchRequest("root/cimv2"); batch.Add(gcos); batch.Add(ecnos); batch.Add(gcos2); BatchResponse response = client.ExecuteBatchRequest(batch); }
public void EnumerateClassNamesTest3() { try { //Should only get class names derived from this class EnumerateClassNamesOpSettings op = new EnumerateClassNamesOpSettings("CIM_FileSystem"); op.DeepInheritance = true; CimNameList list = client.EnumerateClassNames(op); bool cim_nfs = false; bool cim_log = false; foreach(CimName name in list) { if (name == "CIM_NFS") cim_nfs = true; // Should be found if (name == "CIM_Log") cim_log = true; //Should NOT be found } Assert.IsTrue(cim_nfs); Assert.IsFalse(cim_log); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void EnumerateClassNamesTest2() { try { EnumerateClassNamesOpSettings op = new EnumerateClassNamesOpSettings(); op.DeepInheritance = true; CimNameList list = client.EnumerateClassNames(op); Console.WriteLine(list.Count); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
private void EnumerateClassNames(string className) { EnumerateClassNamesOpSettings ecn = new EnumerateClassNamesOpSettings(); ecn.ClassName = className; ecn.DeepInheritance = true; CimNameList classNames = mainWbemClient.EnumerateClassNames(ecn); treeView1.Nodes.Clear(); treeView1.Nodes.Add(TreeNodeUtils.CimToNode(classNames)); DisplayList(classNames); }
public CimNameList EnumerateClassNames(EnumerateClassNamesOpSettings settings) { SingleResponse response = MakeSingleRequest("EnumerateClassNames", settings); if (response.Value == null) { return new CimNameList(); // return an empty list } CheckSingleResponse(response, typeof(CimNameList)); return (CimNameList)response.Value; }
public void EnumerateClassNames(EnumerateClassNamesOpSettings settings, CimDataTypeHandler callBack) { ParseResponse pr = new ParseResponse(); string reqXml = Wbem.CimXml.CreateRequest.ToXml(settings, this.DefaultNamespace); string respXml = ExecuteRequest("EnumerateClassNames", reqXml); pr.ParseXml(respXml, callBack); }