Hawk
(Lurker)
2003-10-24 04:10 PM
Runas and Sanur

I am working on a script which uses Runas to install security patches, and Sanur to provide the password. Runas and Sanur work fine. The problem is that once sanur.exe quits on my system, the script continues to run without waiting for the security patches to complete. Here's the runas line in my script:

Shell '%comspec% /c "runas /env /user:$domain\$userid "$program" | \\sawpdc01\patches\sanur.exe password"'

Is there something wrong with this line in my script, or is there a way that I can make the sytem wait until the patch is installed before continuing?

Thanks


Richard H.Administrator
(KiX Supporter)
2003-10-24 04:23 PM
Re: Runas and Sanur

quote:
Check what switches "$program" supports. IIRC MS patches have a switch which will suspend the calling process until it completes.
Ignore me, I'm talking garbage [Embarrassed]

[ 24. October 2003, 16:27: Message edited by: Richard H. ]


Richie19Rich77
(Seasoned Scripter)
2003-10-24 04:44 PM
Re: Runas and Sanur

I have a RunAs program designed by ANB Software that is a upgraded version of the Windows RunAs.

FreeWare, and allows you to type the password within the command line, so it will allow you to do the command you are using without using sanur.exe .

But remember to make it secure you should use KixCrypt to wrap it up in a exe file. RunAs - ANB Software Download.


Richie19Rich77
(Seasoned Scripter)
2003-10-24 04:48 PM
Re: Runas and Sanur

code:
Shell '%COMSPEC% /c RunAs.exe /user:'+$User+' "'+$CommandLine+'" | C:\sanur.exe '+$Pass'

This should be the command you want for the old RunAs or below using the new RunAs software.

code:
Shell '%COMSPEC% /c RunAs.exe /user:'+$User+' /pass:'+$Pass+' "'+$CommandLine+'"'



Richard H.Administrator
(KiX Supporter)
2003-10-24 05:05 PM
Re: Runas and Sanur

Hawks problem is not that the job doesn't run (it does) but that he wants the script to suspend while it is running.

Hawk
(Lurker)
2003-10-24 05:36 PM
Re: Runas and Sanur

Thanks everyone! I downloaded the upgraded version of RunAs and at first I had the same problem using that file. However, that version of RunAs allows you to put a "/w" to wait for the program to finish, which did the trick!

Sealeopard
(KiX Master)
2003-10-25 02:23 PM
Re: Runas and Sanur

Great, another script that puts administrative passwords into it in plain text!

Please read Installing an Application as an Admin and NEVER put admin passwords into scripts!