PowerShell script time out setting


#1

Hello guys,

Now i am deloveloping a UiPath robot within powershell script which is used to format an excel file. For that, such statement “$xlApp = New-Object -ComObject Excel.Application” is taken in that script. but sometimes it failed due to the excel error ( Excel stopped working ) . and the robot will be pending on the invoke powershell script, how can i fix this issue? many thanks.


#2

Hi @rudy,

If this occurs in a single machine, check office installation and update if anything required. Better to check in a different machine as well with the same workflow.


#3

No, all the machines in our company may give this error during the robot execution.


#4

Then check the powershell scripts, once done with all the tasks in excel you have to release the com object.

Try something like the following in your powershell script

$E.Quit()
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($E)
Remove-Variable E


#5

Actually i complete my powershell like below:

$xlApp = New-Object -ComObject Excel.Application;


$xlApp.Quit();
$xlApp = $null;
[System.GC]::Collect();

It failed in the first statement.