Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

options to enumerate drives

Status
Not open for further replies.

Olaf Doschke

Programmer
Oct 13, 2004
14,847
DE
The real world problem I have is finding out which drives of the client of a remote desktop session are usb drives.

So a user logs to a windows machine from his client using mstsc, with the extended options set to map his local drives, also ones, that will be attached during the session. That works ok and is displayed in Windows Explorer as "C on \\client","D on \\\client" etc.

I need to detect these mappings from an application running in that session. So far I found out %CLIENTNAME% will give me the client connected and \\tsclient\c will be it's c drive, etc.

But I don't know how many drives there are and more important, what type they are. I tried several things already, which are not stisfying me:

1. wscript.network EnumNetWorkDrives in conjunction with shell.application Namespace() gives me the list of \\tsclient\<driveletter>, but the type returned always is network share.

2. WMI Query "SELECT * FROM Win32_Share" doesn't give me results executed for the %CLIENTNAME% computer.

3. Windows API WTSQuerySessionInformation didn't help me to retreive more client info.

4. Windows API NetShareEnum also didn't list the drives and their types for me, but maybe I need to dig deeper into the options I have and the information structures returned.

I'm a bit stuck. Is asking the user to pick a drive letter D:, E:, ... the only thing I can do to figure out what connected drives are USB drives?

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top