473,508 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Strongly Typed (mgmtclassgen) problems

Hi All,

I'm currently working with the mgmtclassgen generated strongly typed
classes. For normal inquiries all seems fine, however I'm struggling with
using the generated classes in a situation where I would previously have
used "Associators Of" e.g. with Win32_DiskDriveToDiskPartition.

I can't seem to work out the logic for how to pass the correct values to the
class. I assume that once I can crack this one, then the other classes of
the same sort (e.g. Win32_LogicalDiskToPartition) will work in the same kind
of way.

The code I have so far looks something like this (edited down, so not
actually run) :

Dim WMIScope As System.Management.ManagementScope
Dim WMIPath As System.Management.ManagementPath

WMIScope.Options.Username = "user"
WMIScope.Options.Password = "password"
WMIScope.Options.Impersonation = ImpersonationLevel.Impersonate
WMIScope.Options.EnablePrivileges = True
WMIPath.Server = "server"
WMIPath.NamespacePath = "\root\cimv2"
WMIPath.ClassName = ""
WMIScope.Path = WMIPath

Dim DiskDrive As New ROOT.CIMV2.Win32.DiskDrive(WMIScope, "*")

For Each DiskDrive In ROOT.CIMV2.Win32.DiskDrive.GetInstances(WMIScope, "")
' this loop works fine

' code handling DiskDrive.? fields removed

' here on down there are problems
Dim DiskPartition As New ROOT.CIMV2.Win32.DiskPartition(WMIScope, "*")
Dim DiskDriveToDiskPartition As New
ROOT.CIMV2.Win32.DiskDriveToDiskPartition(WMIScope , DiskDrive.Path,
DiskPartition.path)

For Each DiskPartition In
DiskDriveToDiskPartition.GetInstances(WMIScope, "")
' code handling DiskPartition.? fields removed
Next
Next

Can anyone shed some light on this as I'd like to try and stay with the
generated classes as they provide a number of advantages.

Cheers,

Greta
Nov 21 '05 #1
0 767

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

Similar topics

4
5718
by: Bill Cohagan | last post by:
I'm trying to figure out the "best" way to implement a strongly typed ArrayList. Using inheritance is one approach. It has the advantage that I only have to write overrides for the Add method and...
4
294
by: Bill Cohagan | last post by:
I'm trying to figure out the "best" way to implement a strongly typed ArrayList. Using inheritance is one approach. It has the advantage that I only have to write overrides for the Add method and...
20
5947
by: Dennis | last post by:
I use the following code for a strongly typed arraylist and it works great. However, I was wondering if this is the proper way to do it. I realize that if I want to implement sorting of the...
5
4220
by: Simon | last post by:
Hi all, I am writing a windows application using vb.net on the 1.1 framework. We have in the application, some strongly typed collections that have been written as classes that do not inherit...
0
7231
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,...
1
7066
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...
0
7504
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...
1
5059
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...
0
4724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3214
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...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
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 ...
1
773
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.