?
Solved

FInding a mapped drive using WMI

Posted on 2007-11-28
1
Medium Priority
?
1,637 Views
Last Modified: 2008-02-01
I am new to WMI but I have been a software developer for several years so I understand the process behind WMI.  I am using Win32_MappedLogicalDisk to look at all the properties located in the class, I can get the drive letter the mapped drive is using, but I need to get the UNC path as well. Is there another class or property that I should use instead?
strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
Set colItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_MappedLogicalDisk",,48) 
For Each objItem in colItems 
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "Win32_MappedLogicalDisk instance"
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "Access: " & objItem.Access
    Wscript.Echo "Availability: " & objItem.Availability
    Wscript.Echo "BlockSize: " & objItem.BlockSize
    Wscript.Echo "Caption: " & objItem.Caption
    Wscript.Echo "Compressed: " & objItem.Compressed
    Wscript.Echo "ConfigManagerErrorCode: " & objItem.ConfigManagerErrorCode
    Wscript.Echo "ConfigManagerUserConfig: " & objItem.ConfigManagerUserConfig
    Wscript.Echo "CreationClassName: " & objItem.CreationClassName
    Wscript.Echo "Description: " & objItem.Description
    Wscript.Echo "DeviceID: " & objItem.DeviceID
    Wscript.Echo "ErrorCleared: " & objItem.ErrorCleared
    Wscript.Echo "ErrorDescription: " & objItem.ErrorDescription
    Wscript.Echo "ErrorMethodology: " & objItem.ErrorMethodology
    Wscript.Echo "FileSystem: " & objItem.FileSystem
    Wscript.Echo "FreeSpace: " & objItem.FreeSpace
    Wscript.Echo "InstallDate: " & objItem.InstallDate
    Wscript.Echo "LastErrorCode: " & objItem.LastErrorCode
    Wscript.Echo "MaximumComponentLength: " & objItem.MaximumComponentLength
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "NumberOfBlocks: " & objItem.NumberOfBlocks
    Wscript.Echo "PNPDeviceID: " & objItem.PNPDeviceID
    If isNull(objItem.PowerManagementCapabilities) Then
        Wscript.Echo "PowerManagementCapabilities: "
    Else
        Wscript.Echo "PowerManagementCapabilities: " & Join(objItem.PowerManagementCapabilities, ",")
    End If
    Wscript.Echo "PowerManagementSupported: " & objItem.PowerManagementSupported
    Wscript.Echo "ProviderName: " & objItem.ProviderName
    Wscript.Echo "Purpose: " & objItem.Purpose
    Wscript.Echo "QuotasDisabled: " & objItem.QuotasDisabled
    Wscript.Echo "QuotasIncomplete: " & objItem.QuotasIncomplete
    Wscript.Echo "QuotasRebuilding: " & objItem.QuotasRebuilding
    Wscript.Echo "SessionID: " & objItem.SessionID
    Wscript.Echo "Size: " & objItem.Size
    Wscript.Echo "Status: " & objItem.Status
    Wscript.Echo "StatusInfo: " & objItem.StatusInfo
    Wscript.Echo "SupportsDiskQuotas: " & objItem.SupportsDiskQuotas
    Wscript.Echo "SupportsFileBasedCompression: " & objItem.SupportsFileBasedCompression
    Wscript.Echo "SystemCreationClassName: " & objItem.SystemCreationClassName
    Wscript.Echo "SystemName: " & objItem.SystemName
    Wscript.Echo "VolumeName: " & objItem.VolumeName
    Wscript.Echo "VolumeSerialNumber: " & objItem.VolumeSerialNumber
Next

Open in new window

0
Comment
Question by:Mister_Spock
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 22

Accepted Solution

by:
cookre earned 2000 total points
ID: 20369637
ProviderName give you the  \\<name>\<share> the letter was mapped to.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question