Anyone know how to get a directory listing...

  • Thread starter Thread starter Michael C
  • Start date Start date
It looks like WNetEnumResource might do the trick. Anyone know of any good
examples of using WNetEnumResource in C#?

Thanks,
Michael C
 
"a822uss" is a UNC server name, right? And "trng" is a share? That won't
work. What I need would be more like this:

\\\\a822uss\\C: or \\\\a822uss\\D:

Microsoft does it in SQL Server Enterprise Manager when you open up the
ATTACH DATABASE dialog window; I just want to do that. A directory listing
on a remote machine without having to create a share on every single hard
drive on every single computer in every single city on three different
continents.

Anyone know how Microsoft does it?

Thanks,
Michael C
 
Just had one of those moments. Of course Microsoft does this through
extended stored procedures on the SQL Server itself... circumventing all
the issues that crop up trying to do it via the Win32 API, MFC, or any other
way for that matter...

Thanks,
Michael C
 
Unless I'm mistaken, Microsoft's attach database dialog window only shows
you the directory tree on the (remote) machine where SQL Server is running.
It doesn't work for "every hard drive on every single computer in every
single city on three different continents" either. They play by the same
rules that you do.

So, if you put a web service on each machine that you need to see the drive
contents on, and passed in parameters to get the drive contents, you should
be able to do this without that much effort too.

--- N
 
Through Enterprise Manager you can add SQL Servers to your SQL Server Groups
in every single SQL Server in your enterprise, "in every single city on
three different continents" if you have SQL Servers there. Additionally,
the Attach Database dialog lists the directory tree on the remote computer
where the SQL Server you have chosen is running; and all this without
installing additional web services, UNC path shares or any other
modifications to the remote machine!

If you have 100 SQL Servers, in 50 different cities, on three different
continents, you are going to have a lot of fun installing and managing a web
server on every single machine (in addition to administering SQL Server),
no? UNC path shares for the root directory of every hard drive installed on
all these machines present an equally nightmarish option.

Microsoft's "rules" appear to involve utilizing the undocumented extended
stored procedure xp_subdir to make their solution work. I doubt the
developers at MS had to search for hours on other people's websites to find
out about the xp_subdir extended stored procedure to make their solution
work. Try searching for xp_subdir on the MS website: Nothing. In the KB:
Nothing. In MSDN: Nothing. I don't see how that's really "playing by the
same rules that I do" since you bring it up, since MS seems to have some
inside information that I have to get through the back-channels of other
people's websites.

Thanks for the web service idea though; installing it on all my SQL Servers,
managing and securing this modification in addition to SQL Server admin is
not an option though.

Michael C.
 
Back
Top