1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Networks Mass folder sharing

Discussion in 'Hardware' started by AndyT_uk, 28 Oct 2004.

  1. AndyT_uk

    AndyT_uk What's a Dremel?

    Joined:
    13 Sep 2004
    Posts:
    5
    Likes Received:
    0
    Hi guys

    After just rebuilding our domain server we restored everything from tape. Now unfortunately it doesn't seem to have kept the fact that certain folders were shared. There are now close to 2000 folders that need to be shared(hidden).

    Just wondering if anyone knows of a script/method that would helpe me do this please?

    Cheers

    Andy
     
  2. sinizterguy

    sinizterguy Dark & Sinizter

    Joined:
    25 Jul 2002
    Posts:
    5,461
    Likes Received:
    0
    Show hidden folders, right click and select sharing ?
     
  3. AndyT_uk

    AndyT_uk What's a Dremel?

    Joined:
    13 Sep 2004
    Posts:
    5
    Likes Received:
    0
    the folders are there, they're just not shared anymore and i dont fancy right clicking on all of them to share them

    need a way to do all of them at once
     
  4. Short-Media

    Short-Media What's a Dremel?

    Joined:
    5 Jun 2003
    Posts:
    34
    Likes Received:
    0
    Did you restore the system state & registry (as well as Active Directory) and rebuild the machine to match the correct configuration as your backup?

    Your shares should work provided you didn't change major configuration.
     
  5. Atomic

    Atomic Gerwaff

    Joined:
    6 May 2002
    Posts:
    9,646
    Likes Received:
    94
    Ive bets that they backed the folders up to tape, formatted and did a clean install.

    Therefore lost all the share settings.

    Dunno about a quick way of settingup shares yet... all ours are done automatically by the system when a new user is added.
     
  6. Short-Media

    Short-Media What's a Dremel?

    Joined:
    5 Jun 2003
    Posts:
    34
    Likes Received:
    0
    Ouch.

    I hope you aren't using roaming profiles, because resetting that share is a painful experience :grr:
     
  7. simon w

    simon w What's a Dremel?

    Joined:
    3 Nov 2003
    Posts:
    1,302
    Likes Received:
    0
    Maybe you could use "net share" in some kind of loop in a bat file?
     
  8. hardflipman

    hardflipman What's a Dremel?

    Joined:
    27 Jul 2004
    Posts:
    140
    Likes Received:
    0
    rmtshare sharename foldername

    if you capture the output of running dir to get the folder names then use escel to create a tab delimited file that calls a batch file with the previous command (obviously with suitable variables) for each folder
    e.g.
    call createshare foldername

    and createshare would be something like
    rmtshare \\servername\%1$=localpath\%1
     
  9. buzzy

    buzzy What's a Dremel?

    Joined:
    27 Dec 2003
    Posts:
    211
    Likes Received:
    1
    This is kinda difficult as we don't know where the folders are located - ie whether they're all folders beneath d:\users\ or whether they're all over the place, and whether they're secured with NTFS permissions or whether you require share-level secuity set up.

    The script below is something I wrote for someone which creates 7000 folders and shares all of them (don't ask). It's VBScript which calls NET SHARE to do the sharing (easier than sharing using native VBScript, and I was in a hurry). It can probably be adapted to suit your needs by removing the creation part and substituting in a loop which enumerates a collection of the subfolders. If you provide some more detailed information I could have a go at hacking it for you tonight to do what you need:

    ' **** SCRIPT BEGINS:



    dim fso, wshshell
    dim parentfoldername, oParentfolder, oSubfolder
    dim i

    set fso = createobject ("scripting.filesystemobject")
    set wshshell = createobject ("wscript.shell")

    if wscript.arguments.count = 0 then
    wscript.echo ("Please run from the command line with the path to the parent folder as the argument." & vbcrlf & "For example, to create 7000 shared folders below d:\test, please run:" & vbcrlf & """7k.vbs d:\test\""")
    wscript.quit(1)
    end if

    parentfoldername = wscript.arguments(0)

    if NOT fso.folderexists (parentfoldername) then
    set oParentfolder = fso.createfolder (parentfoldername)
    end if

    if right(parentfoldername,1) = "\" then
    for i = 1 to 7000
    if NOT fso.folderexists (parentfoldername & "subfolder-" & i) then
    set subfolder = fso.createfolder (parentfoldername & "subfolder-" & i)
    wshshell.run "net share " & "subfolder-" & i & "=" & subfolder.path, 0, TRUE
    end if
    next
    else
    for i = 1 to 7000
    if NOT fso.folderexists (parentfoldername & "subfolder-" & i) then
    set subfolder = fso.createfolder (parentfoldername & "\subfolder-" & i)
    wshshell.run "net share " & "subfolder-" & i & "=" & subfolder.path, 0, TRUE
    end if
    next
    end if


    ' **** SCRIPT ENDS
     
Tags:

Share This Page