Link to home
Start Free TrialLog in
Avatar of jolhan
jolhan

asked on

How to automatically share a folder in a Truecrypt volume after it has been mounted

I'm mounting a truecrypt volume each time I'm starting my computer (Vista Home Premium).
Within the mounted volume,I would like to share a folder (Directory).
I am able to share the folder when the volume is mounted, howeber each time I'm starting the computer the folder has lost its shared status.

Is there a way to automatically share such a directory after a volume is mounted?
Thanks in advance for your help.
Avatar of Dave Howe
Dave Howe
Flag of United Kingdom of Great Britain and Northern Ireland image

you can automatically run a script when a truecrypt volume is mounted using an autoruns.inf file.

you can programatically (ie, in a script) add a mapped drive - at the command prompt the command is "net share" and in vbs you can use the create method on the lanman object as follows:

Set FservObj = GetObject("WinNT://ComputerName/lanmanserver")
Set newshare = FservObj.create("fileshare","test")
newshare.path = "C:\temp"
newshare.Setinfo
Set newshare = nothing
Avatar of jolhan
jolhan

ASKER

Dave,
Thanks for your answer. I already learnt a lot from it.
Unfortunately, I believe that I'm doing something wrong since it doesn't work yet.
Whenever I'm powering on my Vista Home Premium laptop named "HP", I'm mounting a Z;\ volume with Truecrypt.
In the root directory of this Z volume, I added the following autoruns.inf file:

Set FservObj = GetObject("WinNT://hp/lanmanserver")
Set newshare = FservObj.create("fileshare","websites")
newshare.path = "Z:\websites"
newshare.Setinfo
Set newshare = nothing

My purpose is to be able to access the Z:\websites directory from another computer.

With the .inf file nothing is happening,
I can manually right click on the folder and share it form the property menu.
Is there any way to verify if a .inf file is correctly executed while opening an encrypted volume?
ASKER CERTIFIED SOLUTION
Avatar of Dave Howe
Dave Howe
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jolhan

ASKER

Dave,
we are making a lot of progress here, but the result is not there yet:
I  wrote the autoruns.inf and the VBS file

autoruns.inf
[autorun]
  shellexecute=starter.vbs

starter.vbs
 Set FservObj = GetObject("WinNT://hp/lanmanserver")
 Set newshare = FservObj.create("fileshare","test")
 newshare.path = "z:\websites"
 newshare.Setinfo
 Set newshare = nothing

Unfortunately, the Autorun is not executed after mounting the Z:\ drive as it is not a CD/DVD but it is seen as a local disk.
Any idea on how to solve this?
yeah, sorry, I typoed on my first post. it should be "autorun" not "autoruns" ...

but regardless - unless you change "z:\websites" to the actual name of your mounted truecrypt volume, it isn't going to do any good.