I would like to use Jenkins to open an excel file (.xlsx) through bat or powershell plugin.
The powershell code is very simple as shown below. And it works when I type it into the powershell.
However, when I use this code in Jenkins, it will show me “successful”, but actually there is no excel opened.
$excel = New-Object -comobject Excel.Application
$FilePath = 'C:UsersigxlDesktoptrial.xlsx'
$workbook = $excel.Workbooks.Open($FilePath)
$excel.Visible = $true
Jenkins powershell code and Console Output
enter image description here
enter image description here
I check my task manager, found there is an excel process.
Although the user is igxl which is the same as my windows login account, I still need to click the ‘Show processes from all users’ to show it.
enter image description here
Any advice will be appreciated.
Best regards
- change the logon account of Jenkins to the same as the windows login account.
- modify the microsoft-excel-application’s identity in DCOM config to the same as the windows login account.
goldenPineapple is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.