.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to know if a local drive is an USB drive

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :.NET Framework

Hello, I must search for all drives that are an USB drive, my code was looking for removable devices and works without problem. But now I need also to detect USB that are indentified as LocalDrive, I can't find anywhere how to obtain this information.

I have tried with WMI searching for Win32_DiskDrive where InterfaceType = 'USB' with no result.

Can someone show me some code or point me in the right direction?

Thank you in advance

View Complete Post

More Related Resource Links

uploading a file with wcf works fine with local drive, but only 4096 kb uploaded when I use unc stor

Hello I'm writing a wcf service for uploading files to a server. It works fine when I try to upload the file to the servers local c:/ drive, but if I use a UNC path only 4096 kb is stored. It actually looks like part of the file is lost while storing it with writeStream.Write(buffer, 0, bytesRead);, because I wrote the bytesread to an sql table and the number of elements are always the same no matter how many times I upload the file, but the stored file is always different sizes, ranging from 1996 kb to 4092 kb.   I'm using IIS 7.5 on a windows 7 enterprise machine. My IIS is using a administrator account for the application pool, so it should not be a problem with permissions.   My wcf method uses Stream to upload the file in chunks    public void UploadFile(RemoteFileInfo request)         { //some methods to set the filepath                                   int chunkSize = 4096;                                 byte[] buffer = new byte[chunkSize];                                 Stream writeStream = new FileStream(filePath, FileMode.CreateNew, FileAccess.Write);  &

Move folder from file share to local C:/ drive on same box



I need to copy a folder from a file share to my local C: drive. Is there an easy way to do this in SSIS, or do I have to write a DOS batch file and execute it from SSIS.

Any help would be appreciated


Dave SQL Developer

copy a folder and subfolders + files from remote location to local drive



i am making a windows application( C#.Net) in which there is a folder placed at remote location( on other computer). this folder contains files + subfolders inside it. i need to copy all the files and subfolders present inside this main folder to my local drive. How can i do this. 

Thanks in advance

Save a file to local drive


I tried to save a file to local drive using the code below but got "access denied" error. How to save file to local drive?
 Dim file As String = "c:\myfile"
 Dim stream As New System.IO.FileStream(file, System.IO.FileMode.Create)

I tried to save a file to local drive using the code below but got "access denied" error. How to save file to local drive?

 Dim file As String = "c:\myfile"

 Dim stream As New System.IO.FileStream(file, System.IO.FileMode.Create)

Move SharePoint Document Library Files to Local Drive

How can I move files uploaded into a MOSS 2007 Document library to a local drive? I need to automate this as a job, not a one-time process. Can I use SSIS for it? File Systems Task works fine so long as I create a map drive to the portal. I have tried both the http address and the UNC path to the portal.

Get local drive path using javascript.


HI all,

I am downloading a file from server and want to get its path directly in my javascript code.

How can i get the path where the file is downloaded??

Like instead of saving it first at static location like C drive or any other location, I want to get its direct path.

Urgent plz

Reply asap


Rajnish kaur.

save images on database or local drive


hello , I'll be having a website to upload images and am creating the database now , I'll have one original image and about 6 to 7 thumbnails , I just want it to be in the best possible way so I thought I'll save the original image in database and I'll be saving it's thumbnails on hard drive as they're going to be accessed alot so I dont want the httphandlers to be bringing like 20 images from the database while they can be brought easily from the harddrive...can someone guide me?? I read advantages and disadvantages of both but I really need guidance. 

Using Microsoft.SqlServer.Management.Smo to backup from remote SQL Server to local drive.


I'm trying to use the Microsoft.SqlServer.Management.Smo class to connect to a remote SQL Server, perform a backup and save it to my local drive.

I currently can only connect to a remote SQL Server and backup and save the backup file to the remote SQL Server drives. The same happens when I connect to a local instance of SQL Server and backup a file, I can only save it to my local drive.

Is there a way to specify to the Microsoft.SqlServer.Management.Smo to save to the [local] or [remote] machines?

Patrick Miron

For more about Microsoft.SqlServer.Management.Smo, check out my other thread at http://social.msdn.microsoft.com/Forums/en-CA/sqlgetstarted/thread/656d522a-06a6-4475-8070-93df75ef83a5

Word save file on SharePoint via mapped drive


Hi, I have a Document Library mapped to a drive letter. I am able to browse the drive through Windows Explorer. However when I try to save a document to the drive Word returns, 'Unable to connect to the Web server.' .  I have been unable to find any information regarding this error message. If I try to create a document in the Document Library through Windows Explorer and the mapped drive, I get a different error message: 'Unable to create the file 'New Microsoft Office Word Document.docx' There is no user session key for the specified logon session.' After I click OKand refresh the directory, a 0 KB New Microsoft Word Document.docx file has been created. When that file is opened, it is in Read-Only mode.


Windows Server 2003 R2
Webclient service started
Signed into the Microsoft Online Services Sign in Application
IE configured through the sign in application
site added to the trusted sites in IE

Thank you again for your input.

Why does .NET Framework require 841 MB hard drive space on C:

Just downloaded .NET Framework 4 from Microsoft website. Installation says it requires 841 MB space on my C: drive. Why so much? I am presuming that this is in addition to the space for the other versions of .net installed. This is not going to be installed without a very good reason for this much space required. Can anybody enlighten me on this? Any way to lighten the space requirement load?  

How to restore a database to the d drive

I have a 2008 database I need to restore, but my C drive is almost full.  How do I telll it to restore my database to the D drive?  

regasm 4.0 generates error for DLL on a mapped network drive

Calling regasm from .NET Framework 4.0 generates an error for a DLL that is on a mapped network share.  This occurs during our debug builds on developer machines (we actually call a utility that wraps around regasm to perform COM-based registration).  The error is: RegAsm : error RA0000 : Could not load file or assembly 'file:///m:\<file being regasmed>' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) I can work around this issue by modifying regasm.exe.config to include the loadFromRemoteSources element.  This seems like an annoying change for something that seems like a fairly common task. Is there some better way to enable this? Thanks, -Kevin

Autodelete log files on L: drive

Is there a way to automatically delete sharepoint logs on the server L: drive when space fills up?  I keep getting mom alerts on this drive.

VisualtTotals and group "others" drive me crazy!

Hi all, My problem can be modeled in ADVwork as follow: I’m trying to create a query that for each category member show the Top 2 Products members and member ‘other’ that sum the rest.   As far as I know Visualtotals is the function to be used but all my tests doesn’t works! Here below there is the code that for each category display ‘All’  value and Top 2 items.  I have to substitute ‘All’ value with ‘All Other’ (Visualtotals should do exactly this) Note: In my example Product and Category are dimension attributes not related in a hierarchy Again, in my various test with Visualtotals I found that if TopN is greater than the numbers of attribute members (es top 999) then  my ‘Other’ return ‘All’ instead of null! select {[Measures].[Sales Amount] } on columns, generate  (  [Product].[Category].[Category].members  ,  {topcount([Product].[Category].currentmember *[Product].[Product].members, 3, [Measures].[Order Count])   }  ) on rows from [Adventure Works]

Create database at network drive?

Is it possible to create a SqlServer database at a network drive? Thanks, Ben

How do I get the "Device Instance Id" of USB flash drive?

Hello, How do I get the "Device Instance Id" of USB flash drive? WPF C# code to accomplish this will be greatly appreciated. I'm trying again to get an answer to the above question.  It appears that some do not know what I mean by "Device Instance Id".  Here is how you find it on a computer with the XP operating system: If you go to it the wrong way you will not find it.  You have to follow these steps (on XP): 1) Make sure you have a USB flash drive inserted into one of the USB ports. 2) Click "Start" then right click "MyComputer" then click "Manage". 3) In the "Computer Management" window click "Device Manager". 4) In the right pane expand the "Disk drives". 5) Right click on "USB Flash Disk USB Device" (Will NOT be there if no USB Flash drive inserted). 6) Click "Properties". 7) Click the "Details" tab. 8) The drop down should already have "Device Instance Id" showing, if not, select it. 9) The contents of the text box below contain the information I want. Again, if you get to this window a different way, the "Details" tab may not appear. Again, if you do not have a USB flash drive plugged into your computer, the "USB Flash Disk USB Device" will not appear. This is what has been suggested before, but does not w
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend