Page 1 of 1 1
Topic Options
#76955 - 2003-10-01 02:45 PM Why dos RUNAS not work with in .kix
ulro Offline
Fresh Scripter

Registered: 2003-09-25
Posts: 9
Loc: Denmark
Hi
I’ve bin reading all the instructions in topic "Runas like SU... Scripted without console!!!" and tried different things....

So now I’m trying to start a simple RUNAS command from a .kix

First I did at test of the RUNAS from cmd:

- Runas /env /user:nt\administrator cmd
- entered the password
and it worked fine!

then I’ve made this .kix:

$USER = "administrator"
$PASSWORD = "due2keho"

run 'runas /env /user:nt\$USER cmd'

sendkeys("$PASSWORD{ENTER}")

I’m starting the .kix with this .cmd:

@echo off
REM echo run MM6_11_d.exe

\\CWTCPH06\multimark\KIX_install\kix32.exe \\CWTCPH06\multimark\KIX_install\test.kix

and now I’m getting this error:

Enter the password for nt\administrator:
Attempting to start cmd as user "nt\administrator" ...
0Press any key to continue . . . RUNAS ERROR: Unable to run - cmd
267: The directory name is invalid.

any ideas??

Top
#76956 - 2003-10-01 02:52 PM Re: Why dos RUNAS not work with in .kix
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Sure, you must wait for the console window to open, set focus to the command windows, then sendkeys.

By the way, this isn't a very secure method as your password is in plain text in the body of your script.

Top
#76957 - 2003-10-01 03:54 PM Re: Why dos RUNAS not work with in .kix
ulro Offline
Fresh Scripter

Registered: 2003-09-25
Posts: 9
Loc: Denmark
Hi agin

Thanks Chris S. i know about the lack security
now i'm just trying to get this to work!

Now i tried this :
$USER = "administrator"
$PASSWORD = "due2keho"

run 'runas /env /user:nt\$USER "cmd"'
SetFocus("c:\windows\system32\cmd.exe")
sendkeys("$PASSWORD{ENTER}")

i've still get the error:

Enter the password for nt\administrator:
Attempting to start cmd as user "nt\administrator" ...
0Press any key to continue . . . RUNAS ERROR: Unable to run - cmd
267: The directory name is invalid.

any other suggestions ??

Top
#76958 - 2003-10-01 04:02 PM Re: Why dos RUNAS not work with in .kix
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yes.
change the line to:
run 'runas /env /user:nt\$USER "%comspec% /c echo my own thing!"'
_________________________
!

download KiXnet

Top
#76959 - 2003-10-01 04:33 PM Re: Why dos RUNAS not work with in .kix
ulro Offline
Fresh Scripter

Registered: 2003-09-25
Posts: 9
Loc: Denmark
Hi Lonkero
i supose like this:

$USER = "administrator"
$PASSWORD = "due2keho"

run 'runas /env /user:nt\$USER "%comspec% /c cmd"'

SetFocus ("C:\WINDOWS\System32\cmd.exe") = 0

SendKeys ("$PASSWORD{ENTER}")

or ?

but still errors :

1Enter the password for nt\Administrator:
" ...pting to start C:\WINDOWS\system32\cmd.exe /c cmd as user "nt\Administrator
0Press any key to continue . . . RUNAS ERROR: Unable to run - C:\WINDOWS\system3
2\cmd.exe /c cmd
267: The directory name is invalid.

Top
#76960 - 2003-10-01 04:44 PM Re: Why dos RUNAS not work with in .kix
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
do you have trouble copying ready code? [Big Grin]

I just REMOVED your CMD and you insisted to add it back in?

what you should do is lookup at the faq what comspec is.
there is also documentation on MS site.

it gives you the full path to command prompt, no matter what machine.
that's why I replaced your "cmd" as it said:
quote:
267: The directory name is invalid


[ 01. October 2003, 16:44: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#76961 - 2003-10-01 11:50 PM Re: Why dos RUNAS not work with in .kix
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Actually, there are a couple of other FAQ articles, too, that are worth reading. The RUNAS is a poor solution to your problem and the FAQ does provide easy-to-implement secure solutions.

In your case, I'd say you should run an admin script that pushes out the installation. I do this all the time and it's just a couple of lines of code.
Prototype:
code:
$comps=netview2()
for each $comp in $comps
$rc=scheduletask($comp)
next



[ 02. October 2003, 14:27: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#76962 - 2003-10-02 11:01 AM Re: Why dos RUNAS not work with in .kix
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Before you run "RUNAS", "SU" or any of the other utilities that change your credentials you must change directory to a local drive that you have access permissions on.
Top
#76963 - 2003-10-02 11:41 AM Re: Why dos RUNAS not work with in .kix
Richie19Rich77 Offline
Seasoned Scripter
*****

Registered: 2002-08-16
Posts: 624
Loc: London, England
code:
CD 'C:\' ;Run From Local Drive
Shell '%COMSPEC% /c RunAs.exe /user:Administrator "C:\Windows\Notepad.exe" | %%KIXCRYPTDIR%%\sanur.exe {Password}'

Works for me, drop "| %KIXCRYPTDIR%\sanur.exe {Password}" if you want it to prompt for password.

If you are going to use RunAs, use sanur.exe to push the password to RunAs, SendKeys is so unrealiable.

Looking at your code, You have a Server with a domain called "NT" ??

[ 02. October 2003, 11:52: Message edited by: Richard Farthing ]

Top
#76964 - 2003-10-02 02:28 PM Re: Why dos RUNAS not work with in .kix
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Adn the admin password seems to be "due2keho" [Eek!] [Confused]

[ 02. October 2003, 14:29: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#76965 - 2003-10-02 05:47 PM Re: Why dos RUNAS not work with in .kix
Richie19Rich77 Offline
Seasoned Scripter
*****

Registered: 2002-08-16
Posts: 624
Loc: London, England
Whats the outcome on this one, give us some feed back.

Thanks

Top
#76966 - 2003-10-03 01:47 AM Re: Why dos RUNAS not work with in .kix
Paul_Berquam Offline
Hey THIS is FUN

Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
heh heh... sendkeys.... memories... [Big Grin]

what happens if you enter it using:

/user:localcomputername\localadminaccountname

??
_________________________
He was a good little monkey and always very curious...

Top
#76967 - 2003-10-03 10:20 AM Re: Why dos RUNAS not work with in .kix
Richie19Rich77 Offline
Seasoned Scripter
*****

Registered: 2002-08-16
Posts: 624
Loc: London, England
Yeah you can do /user:'+@WKSTA+'\Administrator', which will use the local administrator account, but remember if that account does not have domain admin rights you will not be able to read any data on the domain.

Will recieve a Username and Password incorrect or Access Denied Error.

Top
#76968 - 2003-10-03 07:57 PM Re: Why dos RUNAS not work with in .kix
Paul_Berquam Offline
Hey THIS is FUN

Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
Actually what I meant to post was

"Have you tried running this from your local machine using a local path and a local system account, to verify that it's not a permissions based problem."

[ 03. October 2003, 19:58: Message edited by: Paul_Berquam ]
_________________________
He was a good little monkey and always very curious...

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.067 seconds in which 0.027 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org