How to run a vbscript passing parameters to a perl script in the background?

Hi,
I have a over 6000 systems that are heavily locked down.  I distribute software to these systems, however the software distribution agent on these systems just up and dies.  In order to fix the agent, I have to remote control the system, reboot in admin mode (they are W2K systems), stop a service, delete files, modify a file, telnet and remove the name from a database, then start the service.

I have written a perl script that successful does all of the above steps.  However I can't run the perl script as the locked down user - permission denied.  I found this nifty vbscript that launches the runas and allows me to pass administrative priveledges to the perl script.  It works great... however I need this to run in the background and not disturb the associate working on the system.  I'm assuming my problem is within the vbscript, below is the code:
---------------------------------------------------------------------------------
On Error Resume Next
dim WshShell,FSO

'change these to the apropriate values.  Make sure that the double quotes remain.
sUser="admin"
sPass="adminpassword"&VBCRLF
sCmd="c:\program files\perl\bin\perl c:\fixagent.pl"

set WshShell = CreateObject("WScript.Shell")
set WshEnv = WshShell.Environment("Process")
WinPath = WshEnv("SystemRoot")&"\System32\runas.exe"
set FSO = CreateObject("Scripting.FileSystemObject")

rc=WshShell.Run("runas /env /user:" & sUser & " " & CHR(34) & sCmd & CHR(34), 2, FALSE)
'run a tight loop until the command window comes up
While wshShell.AppActivate(WinPath) = False
Wend
WshShell.SendKeys sPass 'send the password to the waiting window.

set WshShell=Nothing
set WshEnv=Nothing
set FSO=Nothing

wscript.quit
-----------------------------------------------------------------------------------------------

If it's helpful, let me know if you would like the perl script.

I would really like to get this working as soon as possible.  Any idea on how to get this to run in the background?  I can use a hero ;)

Thanks,
Tilly
CCombergAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dang123Commented:
Tilly,
    .SendKeys works with the window that has focus, I dont think you can run this in the background. Does the script take long to run? Do you have telnet access to the computers or how are you taking remote control of the machines?
Dang123
0
Dang123Commented:

    Oops, I thought one thing and typed another, I ment to ask if you have terminal services access to the machines   : /
0
CCombergAuthor Commented:
The script may or may not take long to run.  After the vbscript passes the runas and launches the perl script, the perl script will look at a log file and see if login was successful, if it doesn't find that it was successful then the script will take about 5 - 8 minutes to run.  If it was successful then it will only take a few seconds to run.

I won't be running this program remotely - what I will end up doing is distributing the script to all 6000+ systems and setting up a job on all the systems (using the 'at' command) to run the script at noon.  Basically like each system is standalone.

Any ideas outside of vbscript to get the perl script to execute in the background as an administrative user versus the locked down user that doesn't have permissions?

Thanks,
Tilly
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Dang123Commented:
Tilly,
    Sorry, the only other thing I can think of is to tell everyone to leave the machine on overnight and schedule it for off-hours (midnight) insted if noon.

Good luck

Dang123
0
CCombergAuthor Commented:
The issue with running it at night is that's when I typically do my distributions and if the agent is broken, I want it fixed before I do the distribution or the distribution will fail.  I've tried the at command and not using interactive but it doesn't seem to kick off my application :-/

If you think of anything let me know - I'm not opposed on trying another method or language :)

Thanks,
Tilly
0
CCombergAuthor Commented:
I've answered my own question - kewl!!  the answer is CPAU developed by Joe Richards and can be found at www.joeware.net.  It is much nicer than the vbscript and has several switches that were useful for me like the -hide switch and the ability to encode the file.

Tilly
0
Dang123Commented:
modulo,
    I have no objections to PAQing the question with a refund.

Tilly,
    Glad you found your answer, and thanks for sharing!

Dang123
0
moduloCommented:
PAQ-ing the question and refunding 500  points

Thanks Dang123 !

modulo

Community Support Moderator
Experts Exchange
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.