Hello,
I've created an application that retrieves system information via WMI. In the application I fill a combo box with a list of all the Mapped Network Drives on the PC thats running the application.
On every PC I'm able to obtain the mapped drive letters (using the Name attribute), and in most situations I am able to view each mapped drive's provider name. However, on a few of the PC's that I've tested this application, the ProviderName is not returned.
Here is the code:
refProcess.Name will always return the drive letter. On a few of the machines refProcess.ProviderName returns nothing, on the others it returns the UNC path as expected (\\server\share)
What would cause the ProviderName to not return the UNC Path on some PC but not others?
Thanks
Michael Bull
I've created an application that retrieves system information via WMI. In the application I fill a combo box with a list of all the Mapped Network Drives on the PC thats running the application.
On every PC I'm able to obtain the mapped drive letters (using the Name attribute), and in most situations I am able to view each mapped drive's provider name. However, on a few of the PC's that I've tested this application, the ProviderName is not returned.
Here is the code:
VB.NET:
Dim hostName As String = Dns.GetHostName()
Dim strMoniker As String
Dim colNetDrives as Object
strMoniker = "winmgmts:\\" & Trim(hostName)
strQueryNetDrives = "Select * FROM Win32_MappedLogicalDisk"
refWMI2 = GetObject(strMoniker)
colNetDrives = refWMI2.ExecQuery(strQueryNetDrives)
If colNetDrives.count = 0 Then
Else
For Each refProcess In colNetDrives
lstnetdrives.Items.Add(refProcess.Name & " " & refProcess.ProviderName)
Next
End If
refProcess.Name will always return the drive letter. On a few of the machines refProcess.ProviderName returns nothing, on the others it returns the UNC path as expected (\\server\share)
What would cause the ProviderName to not return the UNC Path on some PC but not others?
Thanks
Michael Bull