Jenkins由于将Excel 2010切换到Excel 2016而出错

我有一个Jenkins的工作,它调用一个(Windows)电源shell脚本。 在该脚本中,我使用以下方法调用excel:

$excel = new-object -comobject excel.application $excel.visible = $true $workbook = $excel.workbooks.open($myTool) 

但升级到Excel 2016(从Excel 2010)后,这不再工作。 错误信息:

 New-Object : Retrieving the COM class factory for component with CLSID {0002450 0-0000-0000-C000-000000000046} failed due to the following error: 80080005. At myScript.ps1:99 char:20 + $excel = new-object <<<< -comobject excel.application + CategoryInfo : ResourceUnavailable: (:) [New-Object], COMExcept ion + FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Comman ds.NewObjectCommand 

我testing了myScript,它仍然可以在Windows Powershell ISE中使用,但在使用Jenkins时不能使用。

我在我的笔记本电脑上运行Jenkins,并在服务中使用 – >以“此帐户”身份login。

任何想法可能是Excel 2016和2010之间的问题?