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
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
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.
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.
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
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