Avatar of Lou Pereira
Lou Pereira
Flag for United States of America asked on

Run TASK scheduler on demand

Hello,
I created a script to run a task already defined in task scheduler on demand.  I would like to use VBScript as I can compile to an exe and encrypt the id and password.  Any help would be great.  Thanks
Script:
set objShell = CreateObject("WScript.Shell")
objShell.run "cmd.exe /C ""SCHTASKS /Run /S servername /U halcyon\uswername /P password" & " /I" & " /TN" & " \Exports\Bank of eden (qqq) file Export"""

Thank you for your help
VB ScriptWindows Server 2008

Avatar of undefined
Last Comment
Lou Pereira

8/22/2022 - Mon
Lofty Worm

Lou Pereira

ASKER
Thank you for the password info, but I am more interested in finding out why does the code I posted is not working.
Lou Pereira

ASKER
BTW, it works from the command prompt if I type the following:
SCHTASKS /Run /S servername /U halcyon\username /P password /I /TN "\Exports\Bank of eden (qqq) file Export"
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Lofty Worm

Ahh, I must have read it wrong.  
Have you tried replacing the " with ( ) or '
Lofty Worm

So, What is the error you are getting?
You compile it to exe right, then execute it and what happens?
ASKER CERTIFIED SOLUTION
Qlemo

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Lofty Worm

It appears the multiple quotes have been a problem for others.  I am sorry, I thought this was a different issue, but I will try to help anyway.  I dug this up, and it may help
http://www.visualbasicscript.com/m34387-print.aspx
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Tommy Kinard

I think you misspelled username

uswername

objShell.run "cmd.exe /C ""SCHTASKS /Run /S servername /U halcyon\uswername /P password" & " /I" & " /TN" & " \Exports\Bank of eden (qqq) file Export"""
Lou Pereira

ASKER
Thank you for you kind help, much appreciated.  This was a simple request I am sure but you provided the correct answer the first time!  I was able to complete a critical and visible project.   Again thank you