Recreate File Shares

G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

I'm trying to write a script that will recreate the file shares on a file
server i rebuilt. All the sharenames, sharepaths, descriptions are in a CSV
file.

I will use the WMI to create the shares, i just need to know the best way to
parse the CSV file to create my variables to let the WMI do its thing.
Sample of CSV file below

D:\Share1,Finance,0,,Finance Share
D:\Share2,HR,0,,Human Resources Share
D:\Share3\test,ShareName,0,10,Other Share


What is the best way to parse this?
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

"" wrote:
> I'm trying to write a script that will recreate the file
> shares on a file
> server i rebuilt. All the sharenames, sharepaths,
> descriptions are in a CSV
> file.
>
> I will use the WMI to create the shares, i just need to know
> the best way to
> parse the CSV file to create my variables to let the WMI do
> its thing.
> Sample of CSV file below
>
> D:Share1,Finance,0,,Finance Share
> D:Share2,HR,0,,Human Resources Share
> D:Share3test,ShareName,0,10,Other Share
>
>
> What is the best way to parse this?

hi

there is only one way to share the folders

there is a registry key lanmanserver in

HKLMsystemCCSserviceslanmanservershare

which holds the information of all the shaares on the server

if you want to share some folders automatically you will have to look
at that registry key for other shares and create the same registry key
for other folders so that they will be automatically shared after
rebooting the sever.

and you have the backup of old registry you can restore that registry
to have all the shares back

--
Posted using the http://www.windowsforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.windowsforumz.com/File-System-Recreate-Shares-ftopict397528.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.windowsforumz.com/eform.php?p=1317487
 

Scott

Distinguished
Apr 1, 2004
1,356
0
19,280
Archived from groups: microsoft.public.win2000.file_system (More info?)

You may be able to use the same method we have here....

net share d$=c:\downloads /Cache:None /Users:1

It looks like you have some other variables. Check the documentation on
then the share command for more info.

Scott in Arizona


Jorge_de_Almeida_Pinto wrote:
> "" wrote:
> > I'm trying to write a script that will recreate the file
> > shares on a file
> > server i rebuilt. All the sharenames, sharepaths,
> > descriptions are in a CSV
> > file.
> >
> > I will use the WMI to create the shares, i just need to know
> > the best way to
> > parse the CSV file to create my variables to let the WMI do
> > its thing.
> > Sample of CSV file below
> >
> > D:Share1,Finance,0,,Finance Share
> > D:Share2,HR,0,,Human Resources Share
> > D:Share3test,ShareName,0,10,Other Share
> >
> >
> > What is the best way to parse this?
>
> some code example:
>
> add another column representing the server you want to do this
>
> server,path,sharename,0,number_of_connections,description
>
> this way you can create it from every computer
>
> read each line as an array and use each part in the array.. from the
> server and the path construct a UNC path and work with that
>
> Set FSO = CreateObject("Scripting.FileSystemObject")
> FSO.CreateFolder(xUNCPathDir)
>
> Set xobjWMIsvc = GetObject("winmgmts:" &
> "{impersonationLevel=impersonate}!\" & <SERVER> & "rootcimv2")
> Set xobjShare = xobjWMIsvc.Get("Win32_Share")
> xobjShare.Create <PATH TO SHARE>, <sharename>, 0, 4294967295
> (=unlimited), <description>
>
> the scripting repository from MS provides great examples
>