dfinke / ImportExcel

PowerShell module to import/export Excel spreadsheets, without Excel
https://www.powershellgallery.com/packages/ImportExcel/
Apache License 2.0
2.48k stars 400 forks source link

When an Excel process is running with another user logged in Stop-Process is asking for confirmation #1628

Closed LordOfRaptor-max closed 3 months ago

LordOfRaptor-max commented 3 months ago

Confirm prompts pops up when another user has an Excel process opened and the parameter -KillExcel is used

Example: Confirm Are you sure you want to perform the Stop-Process operation on the following item: EXCEL(25596)? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y")

If you add the parameter -Force in Open-ExcelPackage.ps1 on line 17 you eliminate the prompt issue and all excel process will kill without any interruption.

Get-Process -Name "excel" -ErrorAction Ignore | Stop-Process -Force

scriptingstudio commented 3 months ago

related #1560

dfinke commented 3 months ago

Going to stay with the workaround.

LordOfRaptor-max commented 2 weeks ago

This basically makes the parameter -KillExcel useless when using the function Export-Excel. Export-Excel are missing the -Force -Confirm:false parameters. Please note that the parameter KillExcel can only kill the process on the current user that execute the script. NOT if you have Excel.exe opened with another user logged in to the server.