From: Donald MacKenzie on
Hello again. I have another program that need to be lauched by a batchfile
however it needs to be run as a different user

here we go.

batchfile name is: mount-truecrypt.bat
inside has this:

REM mounting truecypt volumes !! do not change !!
"c:\program files\truecrypt\truecrypt.exe" /volume
"\Device\Harddisk1\Partition1" /letter F /favorites /p newutopianewutopia10
/q
"c:\program files\truecrypt\truecrypt.exe" /volume
"\Device\Harddisk2\Partition1" /letter N /favorites /p newutopianewutopia10
/q


REM starting sharing for truecrypt /y is required for unattended interaction
net stop server /y
net start server /y
net start "computer browser" /y
exit

i need this file to run as the user truecrypt with the password 1234567890



From: Tim Meddick on
To run your batchfile as a different user on the local or remote machine :

runas /user:truecrypt "mount-truecrypt.bat"

Here, the user "truecrypt" can be replaced with "remotepc\truecrypt" where 'remotepc'
is the computername of a remote machine.

The above command requires you to input the specified user's password when requested.

However, if you need the command to run "unattended" (as in a batch file) you will
need to download [psexec.exe] from sysinternals)

psexec remotepc -u truecrypt -p 1234567890 c:\windows\mount-truecrypt.bat

Please note that, in this command, an "absolute path" to the target-program is
required.

==

Cheers, Tim Meddick, Peckham, London. :-)




"Donald MacKenzie" <donald7.44(a)gmail.com> wrote in message
news:OaDcXP7dKHA.5372(a)TK2MSFTNGP05.phx.gbl...
> Hello again. I have another program that need to be lauched by a batchfile however
> it needs to be run as a different user
>
> here we go.
>
> batchfile name is: mount-truecrypt.bat
> inside has this:
>
> REM mounting truecypt volumes !! do not change !!
> "c:\program files\truecrypt\truecrypt.exe" /volume "\Device\Harddisk1\Partition1"
> /letter F /favorites /p newutopianewutopia10 /q
> "c:\program files\truecrypt\truecrypt.exe" /volume "\Device\Harddisk2\Partition1"
> /letter N /favorites /p newutopianewutopia10 /q
>
>
> REM starting sharing for truecrypt /y is required for unattended interaction
> net stop server /y
> net start server /y
> net start "computer browser" /y
> exit
>
> i need this file to run as the user truecrypt with the password 1234567890
>
>
>

From: Al Dunbar on


"Tim Meddick" <timmeddick(a)gawab.com> wrote in message
news:#ggNEsCeKHA.1592(a)TK2MSFTNGP06.phx.gbl...
> To run your batchfile as a different user on the local or remote machine :
>
> runas /user:truecrypt "mount-truecrypt.bat"
>
> Here, the user "truecrypt" can be replaced with "remotepc\truecrypt" where
> 'remotepc' is the computername of a remote machine.

Just to avoid some possible confusion, using "/user:remotepc\username"
switch does not cause the batch file to be run on the remote PC. It will run
on the pc on which you are typing the runas command, but using the
credentials of an account on another machine.

To actually run a batch file on a remote system requires a facility such as
psexec (as explained below).

> The above command requires you to input the specified user's password when
> requested.
>
> However, if you need the command to run "unattended" (as in a batch file)
> you will need to download [psexec.exe] from sysinternals)
>
> psexec remotepc -u truecrypt -p 1234567890 c:\windows\mount-truecrypt.bat
>
> Please note that, in this command, an "absolute path" to the
> target-program is required.

Note also that the path is relative to the remote pc, not the local one.

/Al

>
> ==
>
> Cheers, Tim Meddick, Peckham, London. :-)
>
>
>
>
> "Donald MacKenzie" <donald7.44(a)gmail.com> wrote in message
> news:OaDcXP7dKHA.5372(a)TK2MSFTNGP05.phx.gbl...
>> Hello again. I have another program that need to be lauched by a
>> batchfile however it needs to be run as a different user
>>
>> here we go.
>>
>> batchfile name is: mount-truecrypt.bat
>> inside has this:
>>
>> REM mounting truecypt volumes !! do not change !!
>> "c:\program files\truecrypt\truecrypt.exe" /volume
>> "\Device\Harddisk1\Partition1" /letter F /favorites /p
>> newutopianewutopia10 /q
>> "c:\program files\truecrypt\truecrypt.exe" /volume
>> "\Device\Harddisk2\Partition1" /letter N /favorites /p
>> newutopianewutopia10 /q
>>
>>
>> REM starting sharing for truecrypt /y is required for unattended
>> interaction
>> net stop server /y
>> net start server /y
>> net start "computer browser" /y
>> exit
>>
>> i need this file to run as the user truecrypt with the password
>> 1234567890
>>
>>
>>
>
From: Anteaus on
Better method which doesn't expose the password:

http://www.autoitscript.com/autoit3/docs/functions/RunAs.htm


"Donald MacKenzie" wrote:

> Hello again. I have another program that need to be lauched by a batchfile
> however it needs to be run as a different user
>
> here we go.
>
> batchfile name is: mount-truecrypt.bat
> inside has this:
>
> REM mounting truecypt volumes !! do not change !!
> "c:\program files\truecrypt\truecrypt.exe" /volume
> "\Device\Harddisk1\Partition1" /letter F /favorites /p newutopianewutopia10
> /q
> "c:\program files\truecrypt\truecrypt.exe" /volume
> "\Device\Harddisk2\Partition1" /letter N /favorites /p newutopianewutopia10
> /q
>
>
> REM starting sharing for truecrypt /y is required for unattended interaction
> net stop server /y
> net start server /y
> net start "computer browser" /y
> exit
>
> i need this file to run as the user truecrypt with the password 1234567890
>
>
>
> .
>