Re: "Run As," Adding Names to Drop-Down Box



"M.H." <REMOVEmstTHIScrowTO5429SEND@xxxxxxxxxxxxx> wrote in message
news:%xdMh.16023$Jl.4497@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
WTC wrote:
"M.H." <REMOVEmstTHIScrowTO5429SEND@xxxxxxxxxxxxx> wrote in message
news:D71Mh.14706$tD2.6109@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
WTC wrote:
"M.H." <REMOVEmstTHIScrowTO5429SEND@xxxxxxxxxxxxx> wrote in message
news:nL_Lh.129620$_73.59636@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
WTC wrote:
"M.H." <REMOVEmstTHIScrowTO5429SEND@xxxxxxxxxxxxx> wrote in message
news:K2WLh.14597$tD2.11093@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
WTC wrote:
I am not sure if what you ask for can be done but their is an
alternative.
Simply created a file called, "MyProgram.cmd" with notepad. Then
use
the
following to start the desired program with different user
credentials.

Contents of "MyProgram.cmd"
-------
runas /user:username "c:\program files\myprogram.exe"

----

You will be asked for a password, simply type in the password for
the
username you specified to start the program.

Or you can create Script called "MYProgram.vbs" with the user
credentials
already supplied.

Contents of "MyProgram.vbs"

-------
set WshShell = CreateObject("WScript.Shell")
WshShell.Run "runas /user:Username ""C:\Program
Files\myprogram.exe"""
WScript.Sleep 100
WshShell.Sendkeys "password~"

--------
Neither of those are working properly for me. The former, I get a
CLI
prompt to enter my password. I do that, window closes, nothing
happens.
Second one, I see a window flash, then nothing. I click on the .exe
at
C:\Program Files\myprogram\myprogram.exe, it starts up without any
problem.
Ok on the first run as command make sure you have the path to the
program
wrap in quotes ("C:\Program Files\myprogram.exe"). Also make sure you
replace Username with you user account.

On the second one, the script, make sure you have the quotations
exactly
like I have in the script. Also, replace Username with your User
Account
Name. Change 100 to 500. If your password is 123456 then make sure
the
password you enter has the ~ at the end like this "1234656~".

Here is what I have:

LibertyBasic.cmd
-----
runas /user:MHxxxxx "C:\Program Files\Liberty BASIC v4.03\liberty.exe"
-----

LibertyBasic.vbs
-----
set WshShell = CreateObject("WScript.Shell")
WshShell.Run "runas /user:MHxxxxx ""C:\Program Files\Liberty BASIC
v4.03\liberty.exe"""
WScript.Sleep 500
WshShell.Sendkeys "xxxxx~"
-----

The only change made was "Sleep 500" from "Sleep 100." I'm still
getting for the cmd a CLI prompt to enter password, then nothing, and
for the VBS a window that flashes for slightly longer (I think, as is
that what "Sleep" does?) and then disappears.

Could you open the Command Prompt and type:

runas /user:MHxxxxx "C:\Program Files\Liberty BASIC v4.03\liberty.exe"

Does any errors occur? If there is an error, it will also affect the
"LibertyBasic.vbs" script.

I discovered that I made an error in the username. It's not MHxxxx,
it's M. Hxxxx. Now when I type runas /user:M. Hxxxxx "C:\Program
Files\Liberty BASIC v4.03\liberty.exe" in the CLI, and then the
password, it says:

RUNAS ERROR: Unable to run - C:\Program Files\Liberty BASIC
v4.03\liberty.exe
1326: Logon failure: unknown user name or bad password.


If you have spaces in the username like M. Hxxxx then put quotes around
it
like "M. Hxxxx". So now the runas line should look like this:

runas /user:"M. Hxxxx" "C:\Program Files\Liberty BASIC v4.03\liberty.exe"

Change the script file as well.

Oh, nm, regarding the cmd, if I enter the right password, the program
starts. Just if you enter the wrong password, the window closes,
without prompting the user to re-enter the password.

Glad you got that sorted out.

--
William Crawford
MS-MVP Windows Shell/User


.



Relevant Pages

  • Re: "Run As," Adding Names to Drop-Down Box
    ... username you specified to start the program. ... prompt to enter my password. ... Second one, I see a window flash, then nothing. ... On the second one, the script, make sure you have the quotations ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: "Run As," Adding Names to Drop-Down Box
    ... credentials. ... username you specified to start the program. ... Second one, I see a window flash, then nothing. ... On the second one, the script, make sure you have the quotations ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: "Run As," Adding Names to Drop-Down Box
    ... following to start the desired program with different user credentials. ... username you specified to start the program. ... Second one, I see a window flash, then nothing. ... On the second one, the script, make sure you have the quotations exactly ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: "Run As," Adding Names to Drop-Down Box
    ... following to start the desired program with different user credentials. ... prompt to enter my password. ... Second one, I see a window flash, then nothing. ... On the second one, the script, make sure you have the quotations exactly ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: "Run As," Adding Names to Drop-Down Box
    ... username you specified to start the program. ... The former, I get a CLI ... prompt to enter my password. ... On the second one, the script, make sure you have the quotations ...
    (microsoft.public.windowsxp.help_and_support)