Quick post to help anyone struck in the same situation:
you try to create a media with SCCM but the creation failed during the process. Looking at C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\AdminUILog you can see the following pattern :
The main information are :
Error deleting files in temp directory (0x80070091). Retrying after delay.
Unable to delete file C:\Users\FR0088~1\AppData\Local\Temp\_tsmedia_6808\stage\SMS\PKG\CEN00194\Scripts\DeployWiz_Credentials.vbs (0x80070020). Continuing.
Unable to delete all files in temp directory. Giving up. (0x80070091)
Yes, that SCCM is human, it can give up and go for a drink…
Fix
… As usual… as I’m nearly sure you’ve already fought this one : disabling your Antivirus solution is enough to make the ISO creation process goes back to working state !
In my case the antivirus was McAfee, and I had to take extra steps to really stop it from bugging me.
To quickly recap :you’ll have to stop McAfee (asking your security admin to disable it with a password). Once done, you’ll also have to stop the core McAfee service called McAfee Framework service to avoid auto reactivation within minutes.
Note from the field : every time you go working for a new client and discover that he is using McAfee, don’t waste a second asking for a way to disable the solution, as my experience told me ; sooner or later a DISM operation (WinPE creation, driver injection, WIM edition…) or an ISO creation/edition will fail…