Jay, the following code runs on both computers but on my computer (Comp1)
with Vs.Net installed, I get all the drives including any mapped drives in
the array dr and all the shared folders on my network in the sdr array.
However, when I run this on my computer (Comp2) that only has the
redistributable Framework 1.1, I only get the Root Drive "c:" returned in dr
and nothing in sdr. On Comp2, I have my hard drive partitioned into two
drives but I stll only get the "c:" returned in dr and not the partitioned.
Any ideas as to why does this works on Comp1 and not Comp2?
Note that I have shared folders on both computers and drives mapped from
each to the other.
'This Gets all Drives including Mapped Drives on Comp1 but only "c:" on Comp2
Dim dr() As String
Dim i, k, j As Integer
Dim id As String
Dim searcher As New ManagementObjectSearcher("SELECT * FROM _
Win32_LogicalDisk") 'for logical Disks
Dim ManObjOp As ManagementObject
i = searcher.Get.Count
If searcher.Get.Count > 1 Then
ReDim dr(i - 1)
For Each ManObjOp In searcher.Get
dr(k) = (ManObjOp("DeviceID").ToString)
Next
end if
'This gets all Shared Drives and Folders ok on Comp1 but nothing on Comp2
Dim sdr() as string
Dim o As IWshNetwork2 = CType(CreateObject("WScript.Network"), _ IWshNetwork2)
Dim odrives As WshCollection = CType(o.EnumNetworkDrives, WshCollection)
If odrives.Count > 0 Then
ReDim sdr(CInt(odrives.Count / 2))
For i = 0 To odrives.Count - 1 Step 2
sdr(i) = odrives.Item(i + 1).ToString.ToLower
Next
end if