#149390 - 2005-10-06 02:55 PM
runas with quotes in the command??
|
matthewst
Getting the hang of it
Registered: 2005-01-26
Posts: 89
|
RUN "runas /user:user deploy.exe "ct2"" $ReturnCode = SendKeys("password") $ReturnCode = SendKeys("{ENTER}")
the script works when i remove "ct2" but the deploy.exe doesn't do what i need it to do without "ct2"
the command line for the program is:"X:\Acad install\AdminImage\deploy.exe" "CT2"
|
|
Top
|
|
|
|
#149392 - 2005-10-06 03:07 PM
Re: runas with quotes in the command??
|
matthewst
Getting the hang of it
Registered: 2005-01-26
Posts: 89
|
like this? RUN 'runas /user:user deploy.exe "ct2"'
|
|
Top
|
|
|
|
#149394 - 2005-10-06 03:29 PM
Re: runas with quotes in the command??
|
matthewst
Getting the hang of it
Registered: 2005-01-26
Posts: 89
|
no go... with run ' runas......"ct2" ' i get the runas syntax displayed with run " runas......"ct2" " i get ERROR : unknown command [ct2]! Script: Q:\adminimage\test.kix Line : 1 Enter the password for domain\user
|
|
Top
|
|
|
|
#149396 - 2005-10-06 03:46 PM
Re: runas with quotes in the command??
|
matthewst
Getting the hang of it
Registered: 2005-01-26
Posts: 89
|
i get the syntax again i'm also trying this
$ReturnCode = SendKeys("runas /user:domain\user deploy.exe") $ReturnCode = SendKeys("{ENTER}") $ReturnCode = SendKeys("password") $ReturnCode = SendKeys("{ENTER}")
|
|
Top
|
|
|
|
#149398 - 2005-10-06 03:54 PM
Re: runas with quotes in the command??
|
iffy
Starting to like KiXtart
Registered: 2005-05-29
Posts: 149
Loc: The Netherlands
|
If I do a runas /? I see that a double quote is escaped with a backslash (\), you might want to try that. Else perhaps creating a batchfile with the complete commandline for runas is an option. That batchfile could possible even be dynamically created from within KiX.
|
|
Top
|
|
|
|
#149399 - 2005-10-06 03:55 PM
Re: runas with quotes in the command??
|
matthewst
Getting the hang of it
Registered: 2005-01-26
Posts: 89
|
hmm.... what is need is a way to run a program with admin privileges, using run with different credentials is not an option because the user would have to know the admin username and pass, 3rd party programs such as tqcrunas and others are not an option because they are not approved to run on air force computers, if I can get it work with kix (preferably) or another script language I can encrypt it so the users would not be able to view the admin username or pass embedded in the script.
|
|
Top
|
|
|
|
#149400 - 2005-10-06 04:03 PM
Re: runas with quotes in the command??
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
From Joeware there is CPAU - Create Process as User which is a freeware tool that uses a proprietary encryption process that Joe describes as using "strong obfuscation."
Quimeras uses the Microsoft CryptoApi for it's TqcRunAs product. It is a commercial product, but it reasonably priced for what it does.
|
|
Top
|
|
|
|
#149401 - 2005-10-06 04:34 PM
Re: runas with quotes in the command??
|
matthewst
Getting the hang of it
Registered: 2005-01-26
Posts: 89
|
thoes require an exe to interpret the script they generate, thoes exe's are not allowed on my network
|
|
Top
|
|
|
|
#149403 - 2005-10-06 04:51 PM
Re: runas with quotes in the command??
|
matthewst
Getting the hang of it
Registered: 2005-01-26
Posts: 89
|
thanks anyway guys
|
|
Top
|
|
|
|
#149405 - 2005-10-06 05:28 PM
Re: runas with quotes in the command??
|
matthewst
Getting the hang of it
Registered: 2005-01-26
Posts: 89
|
that would be fine but i need the user to be able to run it when they need to
|
|
Top
|
|
|
|
#149407 - 2005-10-06 08:40 PM
Re: runas with quotes in the command??
|
matthewst
Getting the hang of it
Registered: 2005-01-26
Posts: 89
|
GOT IT!!!!!!!!!! tried vbs and with a lot of trial and error was able to get the following vbs script cut down to 11 lines and working, now i only have to encrypt it
THANKS TO EVERYONE HERE FOR YOU HELP
'Start of Script 'VBRUNAS.VBS 'v1.2 March 2001 'Jeffery Hicks 'jhicks@quilogy.com http://www.quilogy.com 'USAGE: cscript|wscript VBRUNAS.VBS Username Password Command 'DESC: A RUNAS replacement to take password at a command prompt. 'NOTES: This is meant to be used for local access. If you want to run a command 'across the network as another user, you must add the /NETONLY switch to the RUNAS 'command.
' ********************************************************************************* ' * THIS PROGRAM IS OFFERED AS IS AND MAY BE FREELY MODIFIED OR ALTERED AS * ' * NECESSARY TO MEET YOUR NEEDS. THE AUTHOR MAKES NO GUARANTEES OR WARRANTIES, * ' * EXPRESS, IMPLIED OR OF ANY OTHER KIND TO THIS CODE OR ANY USER MODIFICATIONS. * ' * DO NOT USE IN A PRODUCTION ENVIRONMENT UNTIL YOU HAVE TESTED IN A SECURED LAB * ' * ENVIRONMENT. USE AT YOUR OWN RISK. * ' *********************************************************************************
On Error Resume Next dim WshShell,oArgs,FSO
set oArgs=wscript.Arguments
if InStr(oArgs(0),"?")<>0 then wscript.echo VBCRLF & "? HELP ?" & VBCRLF Usage end if
if oArgs.Count <3 then wscript.echo VBCRLF & "! Usage Error !" & VBCRLF Usage end if
sUser=oArgs(0) sPass=oArgs(1)&VBCRLF sCmd=oArgs(2)
set WshShell = CreateObject("WScript.Shell") set WshEnv = WshShell.Environment("Process") WinPath = WshEnv("SystemRoot")&"\System32\runas.exe" set FSO = CreateObject("Scripting.FileSystemObject")
if FSO.FileExists(winpath) then 'wscript.echo winpath & " " & "verified" else wscript.echo "!! ERROR !!" & VBCRLF & "Can't find or verify " & winpath &"." & VBCRLF & "You must be running Windows 2000 for this script to work." set WshShell=Nothing set WshEnv=Nothing set oArgs=Nothing set FSO=Nothing wscript.quit end if
rc=WshShell.Run("runas /user:" & sUser & " " & CHR(34) & sCmd & CHR(34), 2, FALSE) Wscript.Sleep 30 'need to give time for window to open. WshShell.AppActivate(WinPath) 'make sure we grab the right window to send password to WshShell.SendKeys sPass 'send the password to the waiting window.
set WshShell=Nothing set oArgs=Nothing set WshEnv=Nothing set FSO=Nothing
wscript.quit
'************************ '* Usage Subroutine * '************************ Sub Usage() On Error Resume Next msg="Usage: cscript|wscript vbrunas.vbs Username Password Command" & VBCRLF & VBCRLF & "You should use the full path where necessary and put long file names or commands" & VBCRLF & "with parameters in quotes" & VBCRLF & VBCRLF &"For example:" & VBCRLF &" cscript vbrunas.vbs quilogy\jhicks luckydog e:\scripts\admin.vbs" & VBCRLF & VBCRLF &" cscript vbrunas.vbs quilogy\jhicks luckydog " & CHR(34) &"e:\program files\scripts\admin.vbs 1stParameter 2ndParameter" & CHR(34)& VBCRLF & VBCRLF & VBCLRF & "cscript vbrunas.vbs /?|-? will display this message."
wscript.echo msg
wscript.quit
|
|
Top
|
|
|
|
#149408 - 2005-10-07 12:09 AM
Re: runas with quotes in the command??
|
iffy
Starting to like KiXtart
Registered: 2005-05-29
Posts: 149
Loc: The Netherlands
|
Did you try escaping the " with a \ as explained in runas /? that I posted earlier. Just curious as to if that would have worked in your case.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1821 anonymous users online.
|
|
|