[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2320
  • Last Modified:

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?
0
Microfiche
Asked:
Microfiche
  • 9
  • 8
1 Solution
 
Darius GhassemCommented:
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.
0
 
MicroficheAuthor Commented:
Thanks - but what would call the batch file?

Did you mean put the batch file in the Program/Script area?
0
 
Darius GhassemCommented:
Sorry you are correct put the batch file in Program Scripts that calls up the script. Leave the Arguments blank.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
oBdACommented:
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.
0
 
MicroficheAuthor Commented:
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...
0
 
Darius GhassemCommented:
0
 
MicroficheAuthor Commented:
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...
0
 
MicroficheAuthor Commented:
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?
0
 
Darius GhassemCommented:
Did you check the option to run With the Highest Privilege?
0
 
MicroficheAuthor Commented:
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.
0
 
Darius GhassemCommented:
Where is the Start In option pointed too?
0
 
MicroficheAuthor Commented:
Start in = the same folder as the batch file.
0
 
Darius GhassemCommented:
We are missing something simple
0
 
MicroficheAuthor Commented:
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...
0
 
Darius GhassemCommented:
Do you have another server so you can try on?
0
 
MicroficheAuthor Commented:
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.
0
 
Darius GhassemCommented:
I have had issues with Windows 2008 Server 64-bit schedule tasks but most of the problems were fixed with the hotfix and\or batch file.

http://social.technet.microsoft.com/Forums/en-US/winservermanager/thread/81039824-943d-4856-b944-580a908b5f6e
0
 
MicroficheAuthor Commented:
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.
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now