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
Lou PereiraAsked:
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.

Lou PereiraAuthor Commented:
Thank you for the password info, but I am more interested in finding out why does the code I posted is not working.
0
Lou PereiraAuthor Commented:
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"
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

loftywormCommented:
Ahh, I must have read it wrong.  
Have you tried replacing the " with ( ) or '
0
loftywormCommented:
So, What is the error you are getting?
You compile it to exe right, then execute it and what happens?
0
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
You didn't enclose the task name into double quotes. I would not call cmd.exe to make it more simple:
set objShell = CreateObject("WScript.Shell") 
objShell.run "SCHTASKS /Run /S servername /U halcyon\uswername /P " & "password" & " /I /TN ""\Exports\Bank of eden (qqq) file Export"" "

Open in new window

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
loftywormCommented:
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
0
Tommy KinardCommented:
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"""
0
Lou PereiraAuthor Commented:
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
0
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
VB Script

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.