Scripting Question

VbScript on Server 2008

01/26/2015 1394 views

I am having a problem running a vbscript on Server 2008.  It used to work till I modified the script.  The scripted works great manually and produces the correct end result. 

Background:  Script runs opens excel and updates all sheets from a connection to a database, and saves the file.

Script attached here:

Dim objExcel, objWorkbook


Set objExcel = CreateObject("Excel.Application")

strPathExcel = "\\XXXXX\"

strFile = "KPI Daily Report"

strSaveFile = strPathExcel & strFile

objExcel.Visible = True

objExcel.Workbooks.open (strPathExcel & strFile & ".xlsx")


WScript.Sleep 10000  ' Waiting  as refresh may take upto ten seconds

objExcel.ActiveWorkbook.SaveAs strSaveFile & "_" & Year(Now) & "-" & Month(Now) & "-" & Day(Now) & ".xlsx"



Set objWorkbook = Nothing
Set objExcel = Nothing



Here are my Task scheduler settings:

Run whether user is logged on or not, and Run with Highest Privileges.  User account is domain admin.

Configured for Server 2008


Action-Start a program


No Conditions

Just looking for any help in making this task complete.  All ODBC Drivers are installed on the server for System and User DSN as it need that to run manually. 

Add Argument (Optional)-"C:\KPI Board Reporting.vbs"

1 Comment   [ + ] Show comment


  • There are inconsistencies in your question. If you set it up to run whether or not a user is logged in then if no user is logged in, what is the relevance of domain admin? If you are running the script as local system eg via Kace, then it is going to break in all sorts of ways as the local system account has no profile and the excel object model normally fails to work if a user has not run excel at least once, in order to create the correct excel structure in their profile.

Be the first to answer this question

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ