473,788 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Root.CIMV2 namespace - how to access it?

Greetings,

I am trying to find a way to use a form of GetObject in
VB.Net and have been researching WMI. Apparently, this is
a vast subject, but seems to reference a Namespace called
Root.CIMV2. Does anyone know how to access this namespace?

Thanks,
Rich
Nov 21 '05 #1
2 21878
Rich,

Take a look at the System.Manageme nt namespace - classes included within
this namespace are managed wrapper classes created around the original WMI
classes. You probably shouldn't need to use GetObject then (unless you have
some other purpose to use it). Here are some links to get you started using
these classes:

http://msdn.microsoft.com/library/?u...asp?frame=true
http://msdn.microsoft.com/library/de...ml/vs04d6a.asp
http://www.devx.com/dotnet/Article/20162

hope that helps..
Imran.
"Rich" <an*******@disc ussions.microso ft.com> wrote in message
news:0a******** *************** *****@phx.gbl.. .
Greetings,

I am trying to find a way to use a form of GetObject in
VB.Net and have been researching WMI. Apparently, this is
a vast subject, but seems to reference a Namespace called
Root.CIMV2. Does anyone know how to access this namespace?

Thanks,
Rich

Nov 21 '05 #2
Thanks for these references. I downloaded the sample
application. But here is an example I was originally
working with where vb.Net was complaining
------------------------------------------
Private Sub IsUserLoggedIn( )
Dim userName As String = "rich"
Dim bUser As Boolean
Dim mc As New ManagementClass ("Win32_Process ")
Dim moc As ManagementObjec tCollection = mc.GetInstances
Dim mo As ManagementObjec t
For Each mo In moc
Dim p As New ROOT.CIMV2.Proc ess(mo) '<--error here
Dim processDomain, processUser As String
p.GetOwner(proc essDomain, processUser)
If processUser = userName Then
bUser = True
End If
Next
End Sub
----------------------------------------------

I made a reference to System.Manageme nt and also using

Imports System.Manageme nt

This following example works OK

---------------------------------------------
Public Sub ManagementScope GetObjectThing( )
Dim scope As New ManagementScope ("\\.\root\cimv 2")
scope.Connect()
Dim objectQuery As New ObjectQuery("se lect * from
Win32_Operating System")
Dim searcher As New ManagementObjec tSearcher(scope ,
objectQuery)
Dim os As ManagementObjec t

For Each os In searcher.Get()
Console.WriteLi ne("OS = " & os("Name").ToSt ring())
Console.WriteLi ne(" Free memory = " & os
("FreePhysicalM emory").ToStrin g())
Next os
End Sub
--------------------------------------------------

How can I reference ROOT.CIMV2.Proc ess from the 1st
example?

For Each mo In moc
Dim p As New ROOT.CIMV2.Proc ess(mo) '<--error here

Note: my actual objective is to be able to capture a dll
object (of my creation) which is already running (already
been instantiated from a first application) and be able to
read data from this dll object from a 2nd application
which has also has a reference to this dll. The first
application passes/writes data to a property in the dll.
I want to read this data contained in the active dll from
the 2nd application (a separate application but part of
the same project). I WMI a way that I could achieve this?
In Microsoft Office I can pass a vb6 dll object from MS
Access to MS Excel. I load the vb6 dll with data from
Access, pass the dll as argument to Excel using
automation, and Excel can read the contents of the dll.
Surely, a vb.net dll can do the same thing, but how?

Note: I use createObject to invoke the Excel application
and then open a specific workbook, then call a procedure
in the Excel workbook from Access and pass the vb6 dll as
an argument. I would like to be able to do something
similar to the Access/Excel paradigm in vb.net. But
Access and Excel are ActiveX applications. How could I
achieve similar functionality in my vb.net applications?

Thanks,
Rich

-----Original Message-----
Rich,

Take a look at the System.Manageme nt namespace - classes included withinthis namespace are managed wrapper classes created around the original WMIclasses. You probably shouldn't need to use GetObject then (unless you havesome other purpose to use it). Here are some links to get you started usingthese classes:

http://msdn.microsoft.com/library/?url=/library/en- us/cpguide/html/cpconmanagingap plicationsusing wmi.asp?
frame=truehttp://msdn.microsoft.com/library/default.asp? url=/library/en-us/dnhcvs04/html/vs04d6a.asphttp://www.devx.com/dotnet/Article/20162

hope that helps..
Imran.
"Rich" <an*******@disc ussions.microso ft.com> wrote in messagenews:0a******* *************** ******@phx.gbl. ..
Greetings,

I am trying to find a way to use a form of GetObject in
VB.Net and have been researching WMI. Apparently, this is a vast subject, but seems to reference a Namespace called Root.CIMV2. Does anyone know how to access this namespace?
Thanks,
Rich

.

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2814
by: Pablo Garcia | last post by:
I am working with Windows Management Instrumentation (WMI). I must use the namespace ROOT.CIMV2, I have written "using ROOT.CIMV2.Win32" on the top of the file, but a compilation error happened because I hadn't Add the Reference where that namespace is. If someone knows which is the Reference I must Add to the project, tell me, please. Thank you very much.
1
2252
by: Pablo Garcia | last post by:
Please, if someone knows which reference I must Add to use the namespace ROOT.CIMV2, please tell me. Thank you
4
5259
by: SnakeS | last post by:
When I do: using ROOT.CIMV2.Win32; the class there isn't. This namespace or class I didn't find it. How i using this classes?
3
3097
by: Lee Moody | last post by:
Does anyone know where I can access programmically the value stored in the "Root Namespace" parameter of the project's common properties? To find this within the IDE, select your project name under the solution explorer, right click, select properties, the first form that comes up has the value stored in the "Root Namespace" field. I need to find out how to find this value using code. Thanks in advance.
2
1972
by: Jeff Brown | last post by:
Hi, I suspect that this isn't possible, but I figured I'd ask. My project has a root namespace, let's say it's "Root", that applies to almost every source file (which is why I've set it as the project's root namespace). However, the project also includes a couple of source files whose contents will live in an entirely different namespace, let's say the "Special"
6
78417
by: active | last post by:
This works with Strict Off But not with Strict On Sometimes I can figure out what is needed by running it and using QuickWatch to see the type required but GetObject("winmgmts:\\" & StrComputer & "\root\cimv2") returns a value System._ComObject of Type Object
1
4224
by: tomujtaba | last post by:
Hi, I am trying to read some IIS information from Windows 2003 Server. Earlier I was using "root\cimv2" for Hard disk information of the server and its working. Now I want to read IIS related information using "root\MicrosoftIISV2", and my application throughing an exception of access denied. I am using PacketPrivacy authentication level, also I have administrators group account. I don't know why this problem is
4
2664
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... We have some code written in C# that's trying to manage a farm of servers. It's using the WMI classes to look at the remote machine for certain installed packages, and occasionally it blows up but I can't figure out why. The code is ManagementScope scope = new ManagementScope(string.Format(@"\\{0}\root\cimv2", serverName)); scope.Connect();
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4070
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3674
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.