J
Just Me
I got the following code from the doc but find it works the same if disk.Get
is included or not.
The help for ManagementObject.Get says:
Binds to the management object.
Whatever that means.
Can someone describe what Get does in a few more words?
Should it be uncommented in the code below?
Also I haven't found the doc saying to use IsDBNull.
Is that documented someplace?
Thanks a lot for any info
Public Shared Sub DriveProperties(ByRef drive As String)
Dim DiskProperties As PropertyDataCollection
Dim DiskProperty
Dim disk As New ManagementObject("win32_logicaldisk.deviceid=""" & drive &
"""")
'disk.Get()
Console.WriteLine("**** Properties of Drive " & drive)
DiskProperties = disk.Properties
For Each DiskProperty In DiskProperties
If IsDBNull(DiskProperty.Value.ToString()) Then
Console.WriteLine("Name = {0} Value not defined", DiskProperty.Name)
Else
Console.WriteLine("Name= {0} Value={1}", DiskProperty.Name,
DiskProperty.Value.ToString())
End If
Next
disk = Nothing
End Sub
is included or not.
The help for ManagementObject.Get says:
Binds to the management object.
Whatever that means.
Can someone describe what Get does in a few more words?
Should it be uncommented in the code below?
Also I haven't found the doc saying to use IsDBNull.
Is that documented someplace?
Thanks a lot for any info
Public Shared Sub DriveProperties(ByRef drive As String)
Dim DiskProperties As PropertyDataCollection
Dim DiskProperty
Dim disk As New ManagementObject("win32_logicaldisk.deviceid=""" & drive &
"""")
'disk.Get()
Console.WriteLine("**** Properties of Drive " & drive)
DiskProperties = disk.Properties
For Each DiskProperty In DiskProperties
If IsDBNull(DiskProperty.Value.ToString()) Then
Console.WriteLine("Name = {0} Value not defined", DiskProperty.Name)
Else
Console.WriteLine("Name= {0} Value={1}", DiskProperty.Name,
DiskProperty.Value.ToString())
End If
Next
disk = Nothing
End Sub