473,394 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 21843
Rich,

Take a look at the System.Management 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*******@discussions.microsoft.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 ManagementObjectCollection = mc.GetInstances
Dim mo As ManagementObject
For Each mo In moc
Dim p As New ROOT.CIMV2.Process(mo) '<--error here
Dim processDomain, processUser As String
p.GetOwner(processDomain, processUser)
If processUser = userName Then
bUser = True
End If
Next
End Sub
----------------------------------------------

I made a reference to System.Management and also using

Imports System.Management

This following example works OK

---------------------------------------------
Public Sub ManagementScopeGetObjectThing()
Dim scope As New ManagementScope("\\.\root\cimv2")
scope.Connect()
Dim objectQuery As New ObjectQuery("select * from
Win32_OperatingSystem")
Dim searcher As New ManagementObjectSearcher(scope,
objectQuery)
Dim os As ManagementObject

For Each os In searcher.Get()
Console.WriteLine("OS = " & os("Name").ToString())
Console.WriteLine(" Free memory = " & os
("FreePhysicalMemory").ToString())
Next os
End Sub
--------------------------------------------------

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

For Each mo In moc
Dim p As New ROOT.CIMV2.Process(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.Management 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/cpconmanagingapplicationsusingwmi.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*******@discussions.microsoft.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
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...
1
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
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
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...
2
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...
6
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:\\" &...
1
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...
4
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...

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.