473,395 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

valid drives

Is there a way to check if a drive is valid, both when you know the drive
letter and when you want to get a listing of all valid drive letters?


Nov 21 '05 #1
4 1308

| Is there a way to check if a drive is valid, both when you know the drive
| letter and when you want to get a listing of all valid drive letters?

yes.
Nov 21 '05 #2
David,

See this below, the style shows that it is not from me, however I don't know
where I got it anymore.

Imports System.Management
\\\
Dim searcher As New ManagementObjectSearcher _
("SELECT * FROM Win32_LogicalDisk")
Dim ManObjOp As ManagementObject
If searcher.Get.Count > 1 Then
For Each ManObjOp In searcher.Get
Dim win32 As String = "Win32_LogicalDisk='" &
ManObjOp("Name").ToString & "'"
Dim ManObjLogD As New ManagementObject(win32)
For Each diskProperty As PropertyData In
ManObjLogD.Properties
If Not diskProperty.Value Is Nothing Then
Console.WriteLine _
("{0} = {1}", diskProperty.Name, diskProperty.Value)
End If
Next
Next
End If
///
I hope this helps a little bit?

Cor
Nov 21 '05 #3
GetLogicalDrives API will give you a list of all currently available
drives:

Friend Declare Function GetLogicalDrives Lib "kernel32.dll" ( _
) As Int32

Roman

"David A. Osborn" <do********@hotmail.com> сообщил/сообщила в новостях
следующее: news:sdwNe.290020$xm3.237012@attbi_s21...
Is there a way to check if a drive is valid, both when you know the drive letter and when you want to get a listing of all valid drive letters?

Nov 21 '05 #4
Hi,

In addition to Cor's comment you can use environment.getlogicaldrives

http://msdn.microsoft.com/library/de...rivestopic.asp

Ken
-------------------------

"David A. Osborn" wrote:
Is there a way to check if a drive is valid, both when you know the drive
letter and when you want to get a listing of all valid drive letters?


Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Travis L. Alltop | last post by:
All, To make a long story short, we are swapping out the "knock-off" drives that the NA purchased on E-Bay in one of our production SQL Servers (SQL Server 2000 Enterprise) this weekend for...
36
by: Ron Johnson | last post by:
http://hardware.devchannel.org/hardwarechannel/03/10/20/1953249.shtml?tid=20&tid=38&tid=49 -- ----------------------------------------------------------------- Ron Johnson, Jr....
7
by: Eric.Jones | last post by:
I've encountered a strange error with loading delimited files from a Samba (SMB) network drive, has anyone else seen this before? (Platform: WinXP Pro, UDB PE 8015, level 02060106, SAMPLE db) ...
3
by: Flix | last post by:
I need to detect the root directories of the installed hard disks (es: C:, D:, E:, etc.). I'm not interested in cd drives. I know that there is a way (a bit slow, if I remeber) to retrive all the...
0
by: Dennis | last post by:
I have tried to use the IWshRuntimeLibrary and ManagementObjectSearcher("SELECT * FROM Win32_LogicalDisk") to get all Logical Drives, Mapped Network Drives, Shared Folders and Shared Drives with...
4
by: D Miller | last post by:
This should be easy, but I can not figure it out, how does one get a list of current drives on the computer? Thanks, David
2
by: ImOk | last post by:
WHen I run this under Windows I get the Count of drives but then I get an error message on the Reset() when I try to enumerate. Does this work for anyone? $fs = new...
8
by: Salad | last post by:
I was asked to get my daughter a flash drive. She needs to use it to copy files to it so she can transfer the files at school to her desktop at home. I've never used one but I figure some of...
14
AnuSumesh
by: AnuSumesh | last post by:
Hi all, I am writing one application using c# in which firstly I m getting impersonating the user and then i want to retrieve mapped Drives. But issue is when I am calling method in following...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.