Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need a script to create the same shared folder on 50 remote Windows Server 2003.

I have tried with psexec but havent got the syntax correct yet
psexec @c:\serverlist.txt cmd net share ShareName="e:\Share" /Remark:"Shared Folder" -d

Any help would be appreciated.

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

You certainly call net share with psexec if you want to, but the rmtshare.exe utility would probably be the tool that I'd use.

In your command line you don't need the cmd and the -d (which is, presumably, a psexec argument) is in the wrong place. I think you're looking for psexec @c:\serverlist.txt -d net share ShareName="e:\Share" /Remark:"Shared Folder" instead.

share|improve this answer
    
Thank you! I have run this and it works. –  Jake Mar 14 '12 at 9:40
add comment

I would use RMTSHARE.exe as well. Give that you have a list of servers in serverlist.txt, I would run the following at a command prompt:

for /f %i in (c:\serverlist.txt) do RMTSHARE \\%i\ShareName=e:\share /Remark:"Shared Folder"

This will create a share named "ShareName" that is sharing e:\share with the remark "Shared Folder" and the default share permissions of Everyone: Read

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.