Map all shared drives 
Author Message
 Map all shared drives

How would go about mapping a shared drive.

I have code that maps network drives but only the server drives show up.
I would like to be able to do something like this.

Comupter Name
Share name
 folder
  files
---
Comupter Name
Share name
 folder
  files
---
etc...

I figure I  can use Adsi to get the computer names, problem is using UNC
with FSO to get to folders and files. How would I get around this?

Thank you for any advice.
Jc

*** Sent via Developersdex http://www.*-*-*.com/ ***
Don't just participate in USENET...get rewarded for it!



Wed, 15 Dec 2004 00:54:28 GMT  
 Map all shared drives
Not sure I understand the question.  Whatever you are mapping, it will use the
MapNetworkDrive method to map a drive.  As for using FSO for something, you can
use most of the FSO methods with UNC paths.


Quote:

> How would go about mapping a shared drive.

> I have code that maps network drives but only the server drives show up.
> I would like to be able to do something like this.

> Comupter Name
> Share name
>  folder
>   files
> ---
> Comupter Name
> Share name
>  folder
>   files
> ---
> etc...

> I figure I  can use Adsi to get the computer names, problem is using UNC
> with FSO to get to folders and files. How would I get around this?

> Thank you for any advice.
> Jc

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Wed, 15 Dec 2004 02:08:42 GMT  
 Map all shared drives

Thank you for the response.

Maybe Map is not the correct word.
I considered map to be "display".

I would like to display all the Computers on WorkGroup, which I can.
Then I wanted to show all the drives on each computer and continue to
drill down from there (folders/files).

Here is a test to see the folders.

<%
StrPath = "\\WORKGROUP\NT2KSERVER\"

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(StrPath) 'Line 5

For Each objItem In objFolder.SubFolders
Response.Write objItem &"<BR>"
Next

Set objFSO = Nothing
Set objFolder = Nothing
%>

----
Microsoft VBScript runtime error '800a004c'

Path not found

/Universal ASP scripts/ FSO_WSH/FSO_folders.asp, line 5
-----

Any ideas on how to this to work?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Wed, 15 Dec 2004 02:59:14 GMT  
 Map all shared drives

Quote:

> Thank you for the response.

> Maybe Map is not the correct word.
> I considered map to be "display".

> I would like to display all the Computers on WorkGroup, which I can.
> Then I wanted to show all the drives on each computer and continue to
> drill down from there (folders/files).

> ...snipped...

> Any ideas on how to this to work?

This works fine from WSH hosted script even from a non-admin account...  I assume you should be able to adapt it to server side ASP.

server = "servername"
set shares = getobject("WinNT://" & server & "/lanmanserver")
s = ""
for each share in shares
  if not isobject(share) then exit for
  s = s & share.name & vbcrlf
Next
msgbox s

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Wed, 15 Dec 2004 03:56:05 GMT  
 Map all shared drives

I feel like I'm lanmanServer "challenged" right now. ;)

This script shows shares doesn't it? (which is fine)
I have this going...

<%

Public Function GetShares(ComputerName)
Dim Share
Dim ShareName
Dim sn 'Share name
Set Share = GetObject("WinNT://"& ComputerName &"/LanmanServer") '***
Errors here

For Each sn In Share
If Not isobject(sn) Then Exit For
If sn.Name <> "" Then
ShareName = sn.Name &"|"& ShareName
End If
Next

GetShares = ShareName
End Function

'Method 1
'On Error Resume Next
Set WshNetwork = Server.CreateObject("WScript.Network")
'Set WshNetwork = CreateObject("Scripting.FileSystemObject")

Dim WorkGroup
Set WorkGroup = GetObject("WinNT://WORKGROUP")

For Each C in WorkGroup
        Response.Write C.Name &"<BR>&nbsp;&nbsp;"
                Dim s 'shares
                Dim sStr ' String
                sStr = Split(GetShares(C.Name),"|")
        For s = 0 To UBound(sStr)
        Response.Write s &"<BR>"
        ' then I will add the folder breakdown
        Next
Next

Set WshNetwork = Nothing
%>

On NT2kServer I have:
D:
Share 1

E:
Share 2

I Really appreciate your support.
jc

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Wed, 15 Dec 2004 04:29:07 GMT  
 Map all shared drives

Quote:
> Set Share = GetObject("WinNT://"& ComputerName &"/LanmanServer") '***
> Errors here

It won't error if you disable anonymous access and allow any form of authenicated access...  Otherwise you'll need to pass account/password and use the OpenDSObject method with credentials.

IADsOpenDSObject::OpenDSObject
http://msdn.microsoft.com/library/en-us/netdir/adsi/iadsopendsobject_...

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Wed, 15 Dec 2004 04:55:13 GMT  
 Map all shared drives

Ok now Im going to complicate this a bit more. sorry ;-)

If I use OpenDSObject I will not be able to see any mac shares.

I'm using MacSoho and app for the mac that lets create shares that will
show up in network browser.

Is there a way to temporaraly disable anonymous access to run this then
reactivate them. There seems to always be away...

I acctually got LanmanServer to work.
This is what I have so far.

<%

Public Function GetShares(ComputerName)
Dim Share
Dim ShareName
Dim sn 'Share name
Set Share = GetObject("WinNT://"& ComputerName &"/LanmanServer")

For Each sn In Share
If Not isobject(sn) Then Exit For
If sn.Name <> "" Then
ShareName = sn.Name &"|"& ShareName
End If
Next

GetShares = ShareName
End Function

Public Function GetShareFolders(ComputerName, ShareName)
Dim Share
Dim FolderName
Dim fn 'Folder name
Set Share = GetObject("WinNT://"& ComputerName &"/LanmanServer/"&
ShareName)

' *** testing
'Set dso = GetObject("WinNT:")
'Set Share = dso.OpenDSObject("WinNT://"& ComputerName, "FSOuser",
"eatpork", ADS_SECURE_AUTHENTICATION)
' Unspecified error

For Each fn In Share
If Not isobject(fn) Then Exit For
If sn.Name <> "" Then
FolderName = fn.Name &"|"& FolderName
End If
Next

GetShareFolders = FolderName
End Function

'Method 1
'On Error Resume Next
Set WshNetwork = Server.CreateObject("WScript.Network")
'Set WshNetwork = CreateObject("Scripting.FileSystemObject")

Dim WorkGroup
Set WorkGroup = GetObject("WinNT://WORKGROUP")

For Each C in WorkGroup
        Response.Write C.Name &"<BR>"
                Dim s 'shares
                Dim sStr ' String
                sStr = Split(GetShares(C.Name),"|")
        For s = 0 To UBound(sStr)
        Response.Write "&nbsp;&nbsp;"& s &"<BR>"
                fStr = Split(GetShareFolders(s,C.Name),"|")
                For f = 0 To UBound(fStr)
                Response.Write "&nbsp;&nbsp;"& f &"<BR>"
                Next
        ' then I will add the folder breakdown
        Next
Next

Set WshNetwork = Nothing
%>

Again, thank you.
(I have been working on this all week.)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Wed, 15 Dec 2004 05:29:05 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Create/Remove drive map to network share

2. Mapping a network drive directly to a subfolder of a share

3. How do I map a drive that has already been mapped

4. get drive size from network network mapped drives

5. Mapping network drives is good but how do you share a local drive/folder?

6. Mapping shared printers with a Logon Script.

7. Map Remote Share

8. mapped shares

9. Win2000 File Share Mapping bug

10. Map a shared folder to my computer

11. Map many network shares using text file

12. Map Hidden User Shares

 

 
Powered by phpBB® Forum Software