Excel file could not be created in the scheduled task


hi there,

i not quite sure whether question should created here. if not please move accordingly.

i have 1 vb script going create excel file , dump logs spreadsheet.

the script runs problem comes when tried make scheduled task.

the environtment windows 2008 r2 without sp1.

the script following

------------------------------------

dim scriptdir
scriptdir = replace(wscript.scriptfullname,wscript.scriptname,"")

dim fso
set fso = createobject("scripting.filesystemobject")
if not fso.folderexists(scriptdir & "dumpfiles") fso.createfolder(scriptdir & "dumpfiles")

dim objexcel
const xlexcel8 = 56

dim strcomputer,logfile

strcomputer = "mydc01"
logfile = "system"

fso.createtextfile scriptdir & "test.log",true

set objexcel = createobject("excel.application")
objexcel.visible = false
objexcel.displayalerts = false
set objworkbook = objexcel.workbooks.add()

objworkbook.saveas scriptdir & _
 "dumpfiles\" & strcomputer & "." & _
 replace(dateadd("d",-1,date),"/",".") & "." & logfile & ".dump.xls",xlexcel8   
fso.createtextfile scriptdir & "test.log",true
set objworksheet = objworkbook.worksheets(1)

excelheader = array("category","eventcode","eventidentifier","sourcename",_
     "eventtype","timegenerated","user","message")
objexcel.range("a1",chr(ubound(excelheader)+65) & "1").value = excelheader
objexcel.cells(1,8).columnwidth = 80

objworkbook.save
objexcel.quit()
------------------------------

when tried run task, see testing file "test.log" created without issue spreadfile isn't. checked task manager , see there 1 more excel.exe process created. seems there wrong when saving it.

any suggestion?

thanks!

i solved issue.

this not problem of script windows.

to solve issue, create folder following

c:\windows\syswow64\config\systemprofile\desktop

i did on windows 2008 r2. might different on x86 system. once folder created, script can run no problem.

windows 2003 have folder default. looks bug in windows 2008.

hope post can frastrated administrators me yesterday.



Windows Server  >  Windows Server General Forum



Comments

Popular posts from this blog

DCOM received error "2147746132" from...

DFSR RPC replication errors 5014 1726 with large files over VPN

ADFS 3.0 Event ID 4625 | An Error occurred During Logon | Status: 0xC000035B