简体   繁体   English

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

[英]Excel run by VSTS agent from Powershell fails for unknown reason

this will be weird run. 这将是奇怪的运行。

I'm setting up build process in our VSTS project. 我正在VSTS项目中设置构建过程。 Everything works smoothly - the build process is supposed to execute powershell script. 一切运行顺利-构建过程应该执行powershell脚本。 Powershell script is executed - but here is the problem. Powershell脚本已执行-但这是问题所在。

The script creates Excel process and is supposed to open spreadsheet file. 该脚本将创建Excel流程,并应打开电子表格文件。 It fails with following error: 失败并显示以下错误:

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.

Unofrtunately it doesn't make any sense as the file do exist, nobody is doing anything with the spreadsheet and the access is - well I wanted to be sure so everyone full control. 不幸的是,它没有任何意义,因为文件确实存在,没有人在使用电子表格做任何事情,并且访问是-我想确保所有人都可以完全控制。

What's even more interesting is that during the build process I had open Process Monitor running - it recorded several accesses of the spreadsheet file by Excel process - but they all ended with "SCUCCESS" - nothing like "ACCESS DENIED". 更有意思的是,在构建过程中,我运行了打开的流程监视器-它记录了Excel流程对电子表格文件的多次访问-但它们都以“ SCUCCESS”结尾-类似于“ ACCESS DENIED”。

I'm puzzled because it doesn't make sense. 我很困惑,因为这没有道理。 Additionally I can run the script from the user used by VSTS agent directly it there are no issues. 另外,我可以从VSTS代理使用的用户直接运行脚本,因为没有问题。

What possibly could interfere with the process? 有什么可能干扰该过程?

For x64 machine,create the following directory: C:\\Windows\\SysWOW64\\config\\systemprofile\\Desktop 对于x64计算机,请创建以下目录: C:\\Windows\\SysWOW64\\config\\systemprofile\\Desktop

Make sure that the agent account has full access control for the C:\\Windows\\SysWOW64\\config\\ folder , C:\\Windows\\SysWOW64\\config\\systemprofile folder and C:\\Windows\\SysWOW64\\config\\systemprofile\\Desktop folder. 确保代理帐户具有对C:\\Windows\\SysWOW64\\config\\文件夹, C:\\Windows\\SysWOW64\\config\\systemprofile文件夹和C:\\Windows\\SysWOW64\\config\\systemprofile\\Desktop文件夹的完全访问控制。

More details in: 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/ 有关更多详细信息,请访问: https : //blogs.msdn.microsoft.com/dataaccesstechnologies/2012/12/19/error-microsoft-office-excel-cannot-access-the-file-while-accessing-microsoft-office-11- SSIS的0对象库/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM