IVR - System.IO.IOException: The file exists error when using...

Expand / Collapse

IVR - System.IO.IOException: The file exists error when using PowerShell scripts

Article ID: 51880 - Last Review: March 13, 2013


In an environment where the PowerShell scripts are used in the Execute activity, you may get the System.IO.IOException: The file exists.  Every time the Execute activity runs a PowerShell script, a temporary file is created in the C:\Windows\Temp folder.


Over time, if there is no maintenance on the Temp folder, it will become saturated with temporary files. A limitation of the operating system prevents you from creating more than 65535 files in your temp folder. If this threshold is met, no other files will be created and the PowerShell script will not execute. The result will be the calls being sent to the failure path of the activity.

Our development group is looking at having the temporary file deleted after the call is complete. This will be included in a future release.



Attached to this article is an archive containing 2 files; RunMe.bat and CleanTmpFiles.bat. Extracting both files and launch the RunMe batch file, this will create a scheduled task that will run nightly at 21:00 that will clean every .tmp file located in the C:\Windows\Temp folder.

If you wish to delete the scheduled task, you can:

  1. Click Start and type taskschd.msc 
  2. In the Task Scheduler, click on Task Scheduler Library
  3. The created task will be called At1. You can right-click on it and select Delete



Keywords: powershell file exists System.IO.IOException

Rate this Article:


PowerShellTmpFix.zip PowerShellTmpFix.zip (346 GB, 585 views)

Add Your Comments

Name: *
Email Address:
Web Address:
Verification Code:

Last Modified:Wednesday, March 13, 2013
Last Modified By: amontpetit
Type: FIX
Article not rated yet.
Article has been viewed 8,896 times.