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

Server 2003: How to set up shares in batch?

Status
Not open for further replies.

mmcc

IS-IT--Management
Jul 27, 2005
23
US
A vbs script or command line script(or a combination) is what I am looking for to accomplish the following:

Needed to take approx. 2000 folders(all in the same path) and convert them to shares of the same name allowing only 1 connection to them. The names of the 2000 folders are identical to the User logon names. The folders happen to be the user's "home folder". ALSO, BOTH share permissions and Security settings have to be set on each one to give Full Control to the particular User AND Domain Admins only.

Background: On one domain controller these 2000 shares exist-all with the proper permissions as stated above. I used Ntbackup to copy them across the network to a second domain controller. Then I used restore of the .bkf file which resulted in the 2000 folders to be created on the second controller(which is what I wanted) BUT they are no longer shares but just plain old folders(with valid data). I now need to make them look exactly as they did on the first controller-as shares with share permissions and NTFS permissions.



 
First, let me suggest alternate ways of doing this:
1) Delete the new folders. Use xcopy with the -O parameter to recopy with security. Then share the *parent* folder. This can be easier to maintain.
2) Are both Windows 2k or 2k3? Delete the new folders. Create a Domain DFS share on a share from the root. Set up another link from the new server. Replicate between them. Leave both up and enjoy having redunancy.
3) Are you on AD, with all clients on 2k or above? Create a group policy that redirects the "My Documents" folders to a network share (I used DFS as above). When the policy takes effect, contents of My Documents automatically moves to the network. Then tell your users to move their own data. We used this approach.

Last, here is a script, off the top of my head!!
cacls is included in Windows XP, and 2003. It may be a rezkit utility on Windows 2k. Good Luck.
for /d %%A in (*.*) do (
net share %%A "%%~fA"
cacls "%%~fA" /E /G:%%A:C
)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top