Hello
I have a Powershell script to convert XLS files to CSV. The CMD file calls the PS1 script, it takes all the XLS files from my input folder and convert them to CSV. that works nice if you run the CMD file from the desktop.
The problem starts when I use a Windows Scheduled Tasks to run the CMD files every 10 minutes. I get below error and the files are not converted
New-Object : Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)). At C:\PowerShell\BatchConvertXLS.ps1:58 char:14 + $Excel = New-Object -Com Excel.Application + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : ResourceUnavailable: (:) [New-Object], COMExcept ion + FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Comman ds.NewObjectCommand Property 'visible' cannot be found on this object; make sure it exists and is settable. At C:\PowerShell\BatchConvertXLS.ps1:59 char:5 + $Excel.visible = $False + ~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : PropertyNotFound Property 'displayalerts' cannot be found on this object; make sure it exists and is settable
Any idea how to make it works?
I am using Windows 2012 with excel 2013 installed
Thanks
Javier Villegas | @javier_vill | http://sql-javier-villegas.blogspot.com/
Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you