由Powershell的VSTS代理运行的Excel由于未知原因而失败

时间:2018-08-09 16:03:43

标签: excel windows powershell azure-devops

这将很奇怪。

我正在VSTS项目中设置构建过程。一切运行顺利-构建过程应该执行powershell脚本。 Powershell脚本已执行-但这是问题所在。

该脚本将创建Excel流程,并应打开电子表格文件。失败并显示以下错误:

Microsoft Excel cannot access the file '-correct path-'. There are several possible
reasons:
 The file name or path does not exist.
 The file is being used by another program.
 The workbook you are trying to save has the same name as a currently open workbook.

不幸的是,由于文件确实存在,没有意义,没有人在电子表格中做任何事情,并且访问权限是-我想确保每个人都可以完全控制。

更有趣的是,在构建过程中,我打开了Process Monitor运行-它记录了Excel流程对电子表格文件的多次访问-但它们都以“ SCUCCESS”结尾-类似于“ ACCESS DENIED”。

我很困惑,因为这没有道理。另外,我可以从VSTS代理使用的用户直接运行脚本,因为没有问题。

什么可能会干扰该过程?

1 个答案:

答案 0 :(得分:0)

对于x64机器,创建以下目录: C:\Windows\SysWOW64\config\systemprofile\Desktop

确保代理帐户对C:\Windows\SysWOW64\config\文件夹,C:\Windows\SysWOW64\config\systemprofile文件夹和C:\Windows\SysWOW64\config\systemprofile\Desktop文件夹具有完全访问控制。

更多详细信息,位于: https://blogs.msdn.microsoft.com/dataaccesstechnologies/2012/12/19/error-microsoft-office-excel-cannot-access-the-file-while-accessing-microsoft-office-11-0-object-library-from-ssis/