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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Sharename using FSO

Status
Not open for further replies.

DanWorrall

Programmer
Joined
Jan 1, 2004
Messages
2
Location
GB
When using the FileSystemObject from the MS Scripting Runtime; i'm trying to extrapolate the Sharename of a drive.

When looking at other code, it appears that the drivetype must be 3 (Network shared), I'm using Windows XP Sp1 and my drives are shared, but the FSO reports them as being DriveType 2, so i can't get the sharename.
Does anyone know of any other way to extrapolate the sharename from a drive other than the FSO?

Thanks
 
DanWorrall:

Your getting DriveType 2 because the drives are fixed discs local to your machine. If you map a drive to a network share then you'll get DriveType 3 and you'll be able to determine what share name you used to connect to that server.

I don't know of any fuction that will expose the available shares on a remote server without connecting to that server first. I think you need to establish authority before you can view that information and you can't establish authority without knowing a share to connect to.

Also, since any directory on a drive can be shared it's hard to say which is 'THE' share name. If you want a list of available share names for your local machine you can use the 'net share' function of a windows shell:

Dim WshShell
Set WshShell = CreateObject("WScript.Shell")

WshShell.Exec("%comspec% /c net share > C:\ShareNames.txt")

Then you can parse the text file to find the share your interested in. 'C:\' for example.

Ron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top