Are your shared folders in TrueCrypt volumes automatically resetting shared status on reboot? It is a fairly well known problem with very few available solutions. After few days of scouring the web and looking through handful of solutions, I have combined them in a simpler manner. The code below is well documented (:: comments) so that anyone with basic computer knowledge can edit it with ease.
Here we go...
Open notepad, or your favorite simple text editor (notepad++, etc.).
Copy and paste the following code, and follow the instructions in the lines beginning with two colons (::).
@echo off
:: These lines followed by two colons are comments. Please read them carefully.
:: Before you proceed, add your TrueCrypt volume(s) to "Favorites". Otherwise the parameters below won't work.
:: If you need help with adding TrueCrypt volume(s) to "Favorites", please refer to TrueCrypt user manual.
:: Do not check 'Mount selected volume upon logon', or any of the other options around it.
:: The user is required to enter the TrueCrypt password manually, as always, so the password will not be stored in a command file anywhere.
:: Except for entry of the TrueCrypt password, everything happens automatically when a user logs on.
:: The script which does the work will simply wait for the TrueCrypt volume to be mounted, then do the sharing.
:: Windows Vista User Account Control (UAC) need not be disabled or modified.
:: Only simple batch commands using CMD.exe are required - no other scripting language.
:: There are no "tricks," no changes to the registry, no use of undocumented commands.
title Mount TrueCrypt Volume(s)
echo ENTER PASSWORD into TrueCrypt.....
:: Set path to "TrueCrypt.exe"
:: Only change what is between quotes if path to your "TrueCrypt.exe" differs from the one below.
:: For example, in a 64-bit installation the path would be "C:\Program Files\TrueCrypt\TrueCrypt.exe"
:: Please keep the parameters after the quotes unchanged.
@ "C:\Program Files (x86)\TrueCrypt\TrueCrypt.exe" /auto favorites /quit
:: The following code mounts your shared folder
:: This is how the commands "NET SHARE" work...
:: NET SHARE [share name]=[path] /GRANT:[user],[permission]
:: Note- The square brackets [] are for reference only, and should not be used in main commands.
:: [share name] can be any name you give to your particular shared folder.
:: [path] is the path to that folder.
:: [user] can be windows user name(s), or EVERYONE for the folder to be accessible to everyone.
:: [permission] can be FULL for full access, READ for read-only access, etc.
:: Important: If the [share name] or [path] contain space or special characters, put them between quotes. For example: "[share name]=[path]"
:: That is it for the batch command part. Save the file as [filename].bat; for example- truecrypt.bat
:: Follow the instructions bellow to add this batch file to windows startup...
:: Launch the Task Scheduler.
:: Create a new task.
:: Select an Admin account, run only when user is logged on, highest privileges.
:: Trigger at logon, all users (or a specific user), "enabled."
:: Start a program, browse for your script Whatever.cmd (or .bat)
:: Run as soon as possible if scheduled start is missed.
:: The command lines for two shared folders may look something like this...
NET SHARE Pics=D:\Pictures /GRANT:EVERYONE,FULL
NET SHARE "My Documents=D:\My Documents" /GRANT:EVERYONE,READ
PASTEBIN LINK [FULL]
It is recommended to copy-paste the code from the above pastebin link.
The script above may look intimidating, but it is only six lines of code. Rest of it is documentation.
PASTEBIN LINK [DOCUMENTATION REMOVED]@echo off
title Mount TrueCrypt Volume(s)
echo ENTER PASSWORD into TrueCrypt.....
@ "C:\Program Files (x86)\TrueCrypt\TrueCrypt.exe" /auto favorites /quitNET SHARE Pics=D:\Pictures /GRANT:EVERYONE,FULLNET SHARE "My Documents=D:\My Documents" /GRANT:EVERYONE,READ
Also, if the NET SHARE command is executing before TrueCrypt completely loads the volumes, you can insert a delay command in your batch script between line 4 and 5 above.
If you are facing any trouble please let me know by commenting below, or contact me directly via the Contact page.
Related Google Queries:
Windows 7 Professional: always forgets shared directory on truecrypt volume
"Shares" on local hard drive are lost when the drive is disconnected
I followed the tutorial and receive a 0x02 error when running the task. Any ideas on why?
ReplyDelete