Hi.
I'm using a ManagementObjectCollection object.
My issue is that when a remote PC I'm monitoring shuts down, the ManagementObjectCollection will not function anymore.
To explain further, if I do this:
mok3 will go to a timeout state if the PC shuts down
So is there a way to maintain the mok3 until the end of the for loop or I can only use try catch?
I saw a copyto method but using it will always result out of range:
Thanks.
I'm using a ManagementObjectCollection object.
My issue is that when a remote PC I'm monitoring shuts down, the ManagementObjectCollection will not function anymore.
To explain further, if I do this:
Code:
Dim mok3 As ManagementObjectCollection
Try
mok3 = searcher3.Get()
.....
'And here the PC has shut down:
Try
For Each mo As System.Management.ManagementObject In mok3
''' goes to Catch
So is there a way to maintain the mok3 until the end of the for loop or I can only use try catch?
I saw a copyto method but using it will always result out of range:
Code:
Dim mok3 As ManagementObjectCollection
Try
mok3 = searcher3.Get()
Dim varArray As Array = varArray.CreateInstance(mok3.[GetType](), mok3.Count)
mok3.CopyTo(varArray, mok3.Coun)
Catch ex As Exception
End Try