VbScript on Server 2008
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")
objExcel.ActiveWorkbook.RefreshAll
WScript.Sleep 10000 ' Waiting as refresh may take upto ten seconds
objExcel.ActiveWorkbook.SaveAs strSaveFile & "_" & Year(Now) & "-" & Month(Now) & "-" & Day(Now) & ".xlsx"
objExcel.ActiveWorkbook.Close
objExcel.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing
WScript.Quit
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
Actions:
Action-Start a program
Program/script-%windir%\system32\wscript.exe
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"
There are no answers at this time
Comments