Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

Your Answer


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.