Link to home
Start Free TrialLog in
Avatar of Microfiche
Microfiche

asked on

Schedule VBscript on 64 bit Server 2008 R2

I am trying to schedule a vbscript to print a gantt chart in Excel every week, and I can't seem to get it to run. I can run the script by itself, but when I schedule, it runs and does nothing.

My script is:
Dim XLApp
Dim XLWkb
Set XLApp = CreateObject("Excel.Application")
xlapp.DisplayAlerts = False
xlapp.visible = true
xlapp.workbooks.open "G:\Projects\TimelineR2.xls"
xlapp.activeworkbook.worksheets("sheet1").printout
xlapp.activeworkbook.close
xlapp.DisplayAlerts = True
xlapp.quit

Open in new window


As I said, if I run this manually outside of task Scheduler it runs fine.

Here are task details:

Program/script:
C:\Windows\System32\wscript.exe
Arguments:
"C:\Users\Al\Desktop\print_gantt.vbs"
Start in:
C:\Users\Al\Desktop

Running using my account (admin) with highest priviliges.

Any ideas why this wouldn't work?
Avatar of Darius Ghassem
Darius Ghassem
Flag of United States of America image

Create a batch file that calls up the script. Put the script in the Program/Script area.

Start In should have the location of the script.
Avatar of Microfiche
Microfiche

ASKER

Thanks - but what would call the batch file?

Did you mean put the batch file in the Program/Script area?
Sorry you are correct put the batch file in Program Scripts that calls up the script. Leave the Arguments blank.
In line 6, replace "G:\Projects\TimelineR2.xls" with the actual UNC path to the document ("\\SomeServer\SomeShare\SomeFolder\Projects\TimeLineR2.xls") and try again.
Created the batch file and scheduled - task runs and completes, but no output
Changed the mapped drive to UNC, same results

In both cases, running the batch file directly works fine.

I am getting no error messages...
I am not sure that would apply in this case, as since I changed to a batch file, I did not add quotation marks around the command line. Also - the KB article indicates that the task fails but works if you remove the quotation marks, when mine actually completes, but just doesn't do anything...
When I check Task Manager, both Excel and wscript are being started, but remain running after the task "completes", though no windows are opened or output generated. If I run the batch file, Excel and wscript start, run, Excel opens the document, prints the worksheet, and close.
Anyone?
Did you check the option to run With the Highest Privilege?
Yup, that is checked. I have checked the batch file, the folder the batch file is in, the targeted Excel file and made sure that the account has explicit full permissions to all. I have seen through Googling that this has happened to others on Server 2008 64 bit. Sometimes was fixed through permissions described above, but that didn't seem to work for me.
Where is the Start In option pointed too?
Start in = the same folder as the batch file.
We are missing something simple
It would seem that way. I have other more complex actions scheduled that are working fine.
But I wonder if it is a 64bit Server 2008 thing...
Do you have another server so you can try on?
I have a 2003 server where the document is, but it doesn't have Excel installed, that is why I am running from the 2008 server.
ASKER CERTIFIED SOLUTION
Avatar of Darius Ghassem
Darius Ghassem
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I don't like to apply a hotfix if the problem it fixes doesn't match the problem occuring.
I think we are looking at some other type of problem here...
I will wait a little longer and see if some answer shows up.