Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > runas script to launch batch file

Reply
Thread Tools Display Modes

runas script to launch batch file

 
 
Donald MacKenzie
Guest
Posts: n/a

 
      12-08-2009
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



 
Reply With Quote
 
 
 
 
Tim Meddick
Guest
Posts: n/a

 
      12-08-2009
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" <> wrote in message
news:...
> 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
>
>
>


 
Reply With Quote
 
Al Dunbar
Guest
Posts: n/a

 
      12-09-2009


"Tim Meddick" <> wrote in message
news:#...
> 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" <> wrote in message
> news:...
>> 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
>>
>>
>>

>

 
Reply With Quote
 
Anteaus
Guest
Posts: n/a

 
      12-15-2009
Better method which doesn't expose the password:

http://www.autoitscript.com/autoit3/...ions/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
>
>
>
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error code 0x8024D007 jenny Windows Update 10 11-23-2009 05:48 PM
Error number: 0x8024D007 Manel Windows Update 13 11-16-2009 03:23 PM
Windows Media Player (11) is not installed properly. Reinstall... Godenjoyer Windows Media Player 19 10-28-2009 10:50 PM
Why didn't Vista Find my config.cfg file? Steve Wood Windows Vista File Management 2 07-20-2007 04:08 PM
Tag only some file types Phillip Windows Vista File Management 15 04-10-2007 02:23 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59