Page 1 of 2 12>
Topic Options
#25598 - 2002-07-22 02:40 PM how to pass command line with options to su.exe
lmichiel Offline
Fresh Scripter

Registered: 2002-07-18
Posts: 18
Hi all

I'm trying to do the following:

setl "SU_COMMANDLINE=c:\epoagent\aginst32 /remove"
setl "SU_DOMAIN=@domain"
setl "SU_PASSWORD=xxxxx"
shell "%comspec% /c su administrator"

But it goes wrong because of the /remove bit in the first line. Any clues?

btw suss.exe is running as service on the pc.

cheers
Leo

Top
#25599 - 2002-07-22 02:45 PM Re: how to pass command line with options to su.exe
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
what about:
setl 'SU_COMMANDLINE="c:\epoagent\aginst32 /remove"'

this keeps the whole line with the remove as var... or should. try and reply how it works [Big Grin]

cheers,
_________________________
!

download KiXnet

Top
#25600 - 2002-07-22 02:48 PM Re: how to pass command line with options to su.exe
lmichiel Offline
Fresh Scripter

Registered: 2002-07-18
Posts: 18
To bad, it doesn't work:
CreateProcessAsUser error! (rc=3)
The system cannot find the path specified.

cheers
Leo

Top
#25601 - 2002-07-22 02:54 PM Re: how to pass command line with options to su.exe
Mark Bennett Offline
Getting the hang of it

Registered: 2001-10-10
Posts: 70
I used RUNAS to achieve a switch in user. I found I had to also use ScriptIt (or AutoIt) to type the password (as RUNAS does not allow you to pipe the password into the command). The one thing I didn't like is the password was stored in a file somewhere which is a REALLY bad idea.

However the what I wanted to do was being done selectively and I knew who would be running the script and roughly when. So I put the password in a text file located in a hidden share and left it blank. Then the script would say, "This process has NOT been enabled. Please contact Mickey Mouse on 5551234!"

Mark

Top
#25602 - 2002-07-22 03:03 PM Re: how to pass command line with options to su.exe
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
heh... let's go deeper then.
you could also try something like:
setl 'commandlinearg="this" /remove'

but after the line
call cmd to see how it is written in there.
like:
setl 'commandlinearg="this" /remove'
shell "%comspec% /k set"
_________________________
!

download KiXnet

Top
#25603 - 2002-07-22 04:41 PM Re: how to pass command line with options to su.exe
lmichiel Offline
Fresh Scripter

Registered: 2002-07-18
Posts: 18
The script print the following:
SU_COMMANDLINE="c:\epoagent\aginst32" /remove
it down't give an error but it also doesn't perform the program with the /remove option

It seems that only c:\epoagent\aginst32 is being run

Top
#25604 - 2002-07-22 04:45 PM Re: how to pass command line with options to su.exe
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
could the wksta be xp?
_________________________
!

download KiXnet

Top
#25605 - 2002-07-22 04:49 PM Re: how to pass command line with options to su.exe
lmichiel Offline
Fresh Scripter

Registered: 2002-07-18
Posts: 18
Yes, my machine is running XP prof
Top
#25606 - 2002-07-22 04:51 PM Re: how to pass command line with options to su.exe
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
xp has some problem with passing first argument...

as %0 is not properly interpreted...
if just someone could check this as I don't have any XP wksta to test on
_________________________
!

download KiXnet

Top
#25607 - 2002-07-22 04:57 PM Re: how to pass command line with options to su.exe
lmichiel Offline
Fresh Scripter

Registered: 2002-07-18
Posts: 18
Yes but I'm not running it in a logon script yet, just locally on my PC. SO I don't use %0\..\
Top
#25608 - 2002-07-22 05:03 PM Re: how to pass command line with options to su.exe
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
yes, but xp seems to handle all those differently as you said the %1 doesn't get passed to the program.

does it work, if you open command prompt and put those variables manually and then try to run su?
_________________________
!

download KiXnet

Top
#25609 - 2002-07-22 05:08 PM Re: how to pass command line with options to su.exe
lmichiel Offline
Fresh Scripter

Registered: 2002-07-18
Posts: 18
I've entered the variables manually but still su doens't work
If I enter %SU_COMMANDLINE% on the command prompt, the program runs correctly so it seems to have to do with su.exe (and suss.exe)

I got those from Bryce'S Kix Library

Top
#25610 - 2002-07-22 05:13 PM Re: how to pass command line with options to su.exe
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Lonkero..

It has to be C:\epoagent\aginst32.exe /remove

Leo - How about:

setl 'SU_COMMANDLINE="c:\epoagent\aginst32 /remove"'

Does that work?

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#25611 - 2002-07-22 05:20 PM Re: how to pass command line with options to su.exe
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
kent, what about reading carefully my first post? [Big Grin]
_________________________
!

download KiXnet

Top
#25612 - 2002-07-22 05:21 PM Re: how to pass command line with options to su.exe
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
OK..

Here we go..

Try this..

code:
$Removecmd = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\ePolicy Orchestrator\Application Plugins\ePOAgent2000","Uninstall Command")

setl "SU_COMMANDLINE="+$Removecmd

Does this help?

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#25613 - 2002-07-22 05:43 PM Re: how to pass command line with options to su.exe
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
May I ask why you are trying to remove the ePO Agent? We just upgraded our enterprise and the Agents have all updated across the domain with little or no issue. We went from ePO 2.0 to 2.52.

The upgrade was also completed on locked down workstations too.

Thank you,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#25614 - 2002-07-22 06:30 PM Re: how to pass command line with options to su.exe
lmichiel Offline
Fresh Scripter

Registered: 2002-07-18
Posts: 18
We're using epo with quite some success. However sometimes it happens that the client stops communicating with the server. So only uninstalling this client and reinstalling makes it working again (installing it again over th old installation doesn help)

I've written a perl script which checks for the last communication with the server and if this is longer than 7 days ago, it must remove th old client and reinstall it. It works like a charm on Win 9x machines but I want this to work on Win 2K as well.
I've got a kixstart version of the perl script I use so I want to get this working with SU before I try to use it with perl (the perl script is about 4 times faster)

Top
#25615 - 2002-07-22 06:33 PM Re: how to pass command line with options to su.exe
lmichiel Offline
Fresh Scripter

Registered: 2002-07-18
Posts: 18
quote:
ry this..

code:
--------------------------------------------------------------------------------

$Removecmd = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\ePolicy Orchestrator\Application Plugins\ePOAgent2000","Uninstall Command")

--------------------------------------------------------------------------------

setl "SU_COMMANDLINE="+$Removecmd

Does this help?

Sorry, no go . It has to do with SU because the command works if I enter it as %SU_COMMANDLINE% on the command prompt

Top
#25616 - 2002-07-22 06:44 PM Re: how to pass command line with options to su.exe
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Instead of messing with SU, why not push to Task Scheduler? Looks like you have an admin script running so with JT.EXE, it could also push the task.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#25617 - 2002-07-22 07:09 PM Re: how to pass command line with options to su.exe
lmichiel Offline
Fresh Scripter

Registered: 2002-07-18
Posts: 18
$passwd="chrompack"
settitle("logonscript")
setfocus ("logonscript")
setconsole ("foreground")
run '%windir%\System32\runas.exe /user:administrator "c:\epoagent\aginst32.exe /remove "'
sleep 0.3
sendkeys ($passwd)
sendkeys (chr(13))

THIS DOES THE TRICK WITHOUT SU!
OK it isn't very neat but it works and it is just as (un)safe as using SU. I found this one somewhere hidden on this forum :-)

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 131 anonymous users online.
Newest Members
dimi575, Drecksnacken, Nlill, webtools321, multiman
17734 Registered Users

Generated in 0.044 seconds in which 0.012 seconds were spent on a total of 13 queries. Zlib compression enabled.

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