Win32_SoftwareFeatureParent, ROOT\cimv2, VB Net samples

Class | Methods | Properties (2) | Qualifiers (7) | Instances (40) | Namespaces (1)
Samples: VB Script | C# | VB.Net | Search on:Microsoft

Win32_SoftwareFeatureParent - VB.Net code samples

WMI query - sample windows WQL with VB.Net, Antecedent property of Win32_SoftwareFeatureParent

Get a specified instance of Win32_SoftwareFeatureParent by a key, get a default unnamed instance (singleton) of the class or list instances of the class by wmi query using this VB.Net sample code.
See in another language: VBScript, C#
	'Project -> Add reference -> System.Management
	'Imports System.Management
	
	'Get the namespace management scope
	Dim Scope As New ManagementScope("\\.\ROOT\cimv2")
	
	'Get a result of WML query 
	Dim Query As New ObjectQuery("SELECT * FROM Win32_SoftwareFeatureParent Where Antecedent="Win32_SoftwareFeature.IdentifyingNumber=\"{B7E38540-E355-3503-AFD7-635B2F2F76E1}\",Name=\"VC_Redist_12222_x86_enu\",ProductName=\"Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.4974\",Version=\"9.0.30729.4974\""Dependent="Win32_SoftwareFeature.IdentifyingNumber=\"{B7E38540-E355-3503-AFD7-635B2F2F76E1}\",Name=\"FT_VC_Redist_ATL_x86\",ProductName=\"Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.4974\",Version=\"9.0.30729.4974\""")
	
	'Create object searcher
	Dim Searcher As New ManagementObjectSearcher(Scope, Query)
	
	'Get a collection of WMI objects
	Dim queryCollection As ManagementObjectCollection = Searcher.Get
	
	'Enumerate wmi object 
	For Each mObject As ManagementObject In queryCollection
	  'write out some property value
	  Console.WriteLine("Antecedent : {0}", mObject("Antecedent"))
	Next
	

WMI query - list of class instances

List of all instances of Win32_SoftwareFeatureParent class in C#.
See in another language: VBScript, VB.Net.
	//https://wutils.com/wmi/
	
	//Project -> Add reference -> System.Management
	//using System.Management;
	
	//set the class name and namespace
	string NamespacePath = "\\\\.\\ROOT\\cimv2";
	string ClassName = "Win32_SoftwareFeatureParent";
	
	//Create ManagementClass
	ManagementClass oClass = new ManagementClass(NamespacePath + ":" + ClassName);
	
	//Get all instances of the class and enumerate them
	foreach (ManagementObject oObject in oClass.GetInstances())
	{
		//access a property of the Management object
		Console.WriteLine("Antecedent : {0}", oObject["Antecedent"]);
	}
	
comments powered by Disqus
WUtils.com