2

When issuing the "net use" command in Windows there is a "Status" column. Is it possible to get that via any of the methods found in the mpr.dll?

I'm currently using WNetOpenEnum and then using WNetEnumResource to iterate though the drives that are mapped. I can get all of the columns except status.

I thought that one of the fields in the NetResource struct would specify the status, but when I run "net use" and have two drives, one of which has Status of "OK" and one of which is "Unavailable" the fields are all the same.

Idaho
  • 241
  • 2
  • 5

2 Answers2

0

I know this is a really old post, but I stumbled upon it during some searches, and thought I'd chime in with an idea anyway. Sometimes when all else fails, I go a 'hacky' route to get what I need done.

In this case, I might try just piping the output of net use to a .txt file, (probably in the System's Temp folder), reading it in, and parsing it for what I need, then deleting it from the system, just to keep things clean.

i.e. net use > C:\Temp\netuse.txt

J. Scott Elblein
  • 4,013
  • 15
  • 58
  • 94
0

You might be able to do this with the win32_share class since it supports IPC and status. try checking out http://www.mvps.org/emorcillo/en/code/grl/share.shtml

Yes - its vb.net, but may give you what you need here

Adam Tuliper
  • 29,982
  • 4
  • 53
  • 71