On my Windows 2008 system, I've attached an external USB drive that's encrypted using Truecrypt. Once I mounted the Truecrypt drive, I share some of the directories from that drive using Windows file sharing. I find that whenever I restart the server, these shared directories are no longer shared and I to recreate share them. Pain.

Is there any way to avoid having to recreate these shares every time? Perhaps if I can script the sharing of the drives, perhaps I can run the script I mount the drive? If so, can someone tell me what the script commands are? For example, I want to share Z:\dir1 as \myserver\dir1 to everyone (no authentication required).


4 Answers 4


If you restart the server service then those shares should be restored.

If you wanted to script this just do a net stop server followed by a net start server.

  • That worked! But now my clients are getting prompted for authentication even though I've turned off "Passoword Protected Sharing" and I've added "Everyone" with full-control to the share.
    – Sajee
    Jun 17, 2009 at 22:22

Add "ANONYMOUS" instead of Everyone

  • Thanks, that worked. I had to keep Everyone and add Anonymous (which by itself didn't work). Any idea about this: serverfault.com/questions/27713/… ?
    – Sajee
    Jun 18, 2009 at 12:26
  • After I restarted the server service, I'm getting a Windows Security auth dialog when I go to \\myserver. Any idea why this is happening? I tried removing Everyone and just using anonymous but I'm still getting the auth dialog.
    – Sajee
    Jun 18, 2009 at 14:13

it's ok, but NFS shares and QUOTAS don't restore.


In truecrypt, you can add the external drive as a system favourite, and to automatically mount system favourites when windows starts. This works around the problem of shares becoming unshared. The only problem is, the system drive needs to be encrypted, and have the SAME PASSWORD as the external drive.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .