how can i progammatically determine how drives were mapped on a certain server ( or, at least on my PC )

Windows Explorer can do it easily, hopefully, it is not that difficult

DriveInfo object in VB.NET does not seem to have this info available

thanks in advance,
-Alex
AlexF777Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JestersGrindCommented:
You have this in the SQL Server zone, so from a SQL perspective, you can run the following which will list the drive letter of each fixed drive and the amount of free space in MB.

EXEC master..xp_fixeddrives

Greg

0
Racim BOUDJAKDJIDatabase Architect - Dba - Data ScientistCommented:
<<EXEC master..xp_fixeddrives>>
Indeed.  Does not work with mountpoints though.
0
Anthony PerkinsCommented:
Somehow I suspect this has nothing to do with SQL Server...
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Racim BOUDJAKDJIDatabase Architect - Dba - Data ScientistCommented:
<<Somehow I suspect this has nothing to do with SQL Server...>>
LOL....Occurs more and more often...
0
Bob LearnedCommented:
Alex,

Maybe DriveInfo can help you:


' Add a reference to Microsoft.VisualBasic.Compatibility to the project to use the DriveListBox. 

Imports System
Imports System.Collections.Generic
Imports Microsoft.VisualBasic.Compatibility.VB6
Imports System.Windows.Forms
Imports System.Reflection

Namespace VB.Snippets.Hardware

    Public Enum DriveType
        DirCurr = 1
        DirOpen = 0
        DirSub = 2
        DriveCDRom = 5
        DriveFloppy = 3
        DriveHard = 4
        DriveNet = 6
        DriveRAM = 7
        NUM_BITMAPS = 8
        Unknown = -1
    End Enum

    Public Class DriveMappings

        Public Shared Function GetDriveList() As List(Of DriveInfo)

            ' 1) Borrow the DriveListBox from VB6 (compatibility library), which has a list of DriveComboBoxItem (internal class) items.
            ' 2) Cast the DriveListBox to a ComboBox, which is the base class, to access the Items collection.
            ' 3) Use reflection to get the field values from each DriveComboBoxItem object in the combo box item.

            Dim driveListBox As ComboBox = TryCast(New DriveListBox(), ComboBox)

            Dim driveList As New List(Of DriveInfo)()

            For Each drive As Object In driveListBox.Items
                driveList.Add(New DriveInfo())
            Next

            Return driveList
        End Function

        Private Shared Function GetFieldValue(ByVal drive As Object, ByVal fieldName As String) As Object
            Dim field As FieldInfo = drive.GetType().GetField(fieldName)
            Return field.GetValue(drive)
        End Function

        Public Class DriveInfo
            Public DriveType As DriveType
            Public ItemString As String

            Public Overloads Overrides Function ToString() As String
                Return String.Format("name={0}, type={1}", ItemString, DriveType)
            End Function
        End Class

    End Class
End Namespace

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cupCommented:
Do you just want "net use" drives or subst drives as well?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.