Sterling33
Member
- Joined
- Nov 17, 2005
- Messages
- 12
- Programming Experience
- 3-5
Hi all,
I was wondering if anyone could possibley help me with the code added below? It seems that I have an issue where I manage to go through the For Loop the first time with no issues, but manage to get an 'Unknow Error' when on the second Loop. I managed to isolate the problem to the line in red. It seems that during the first run through of the loop the instance is created and added as an object of the object array with no issues, but during the next loop around it does not. The instance seems not to be created and/or placed in the next element of the array. Is there something im missing?
Any help would be great. Thanks,
- Sterling
I was wondering if anyone could possibley help me with the code added below? It seems that I have an issue where I manage to go through the For Loop the first time with no issues, but manage to get an 'Unknow Error' when on the second Loop. I managed to isolate the problem to the line in red. It seems that during the first run through of the loop the instance is created and added as an object of the object array with no issues, but during the next loop around it does not. The instance seems not to be created and/or placed in the next element of the array. Is there something im missing?
VB.NET:
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] instOSDetails(2) [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] SWbemObject
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2][COLOR=#000000] Services [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#000000] SWbemServices[/COLOR]
[/SIZE]Dim[/COLOR][/SIZE][SIZE=2] Locator [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] SWbemLocator[/SIZE]
[SIZE=2]Service = Locator.ConnectServer(Namespace, UserName, Password)[/SIZE]
[SIZE=2]
[/SIZE][/SIZE][SIZE=2][COLOR=#0000ff]For[/COLOR][/SIZE][SIZE=2] i [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer[/COLOR][/SIZE][SIZE=2] = 0 [/SIZE][SIZE=2][COLOR=#0000ff]To[/COLOR][/SIZE][SIZE=2] 2
[COLOR=red]instOSDetails(i) = Services.Get("SMS_OS_Details").SpawnInstance_[/COLOR]
instOSDetails(i).MaxVersion = "5.99.999"
instOSDetails(i).MinVersion = "5.00.000"
instOSDetails(i).name = "Win NT"
instOSDetails(i).Platform = "I386"
[/SIZE][SIZE=2][COLOR=#0000ff]Next[/COLOR][/SIZE][SIZE=2] i
[/SIZE]
Any help would be great. Thanks,
- Sterling