Clean-up script upload consistently fails after 1 hour wait
- Dominant language
- Go
- Stars
- 15.8k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
#### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
#### Overview of the Issue
The build succeeds, but the clean-up script upload consistently fails after 1 hour wait. This recurring failure is causing inconvenience.
There doesn’t seem to be a way to configure or reduce the clean-up timeout:
https://developer.hashicorp.com/packer/docs/provisioners/powershell#skip_clean
#### Reproduction Steps
Steps to reproduce this issue
### Packer version
Packer version: 1.12.0
### Simplified Packer Template
### Operating system and Environment details
Base image: win11-23h2-avd
version: 22631.5624.250706
### Log Fragments and crash.log files
PACKER 2025/07/15 14:56:02 ui: azure-arm: Chocolatey uninstalled successfully, removing folders...
PACKER 2025/07/15 14:56:02 ui: azure-arm: Chocolatey uninstalled successfully.
PACKER 2025/07/15 14:56:02 packer-provisioner-powershell plugin: c:/Windows/Temp/script-[redacted].ps1 returned with exit code 0
PACKER 2025/07/15 14:56:02 packer-provisioner-powershell plugin: [INFO] 511 bytes written for 'uploadData'
PACKER 2025/07/15 14:56:02 [INFO] 511 bytes written for 'uploadData'
**PACKER 2025/07/15 14:56:02** packer-plugin-**azure_v2.2.1_x5.0_linux_amd64** plugin: 2025/07/15 14:56:02 Uploading file to 'c:/Windows/Temp/packer-cleanup-[redacted].ps1'
**PACKER 2025/07/15 15:56:07** packer-provisioner-powershell plugin: **failed to upload the remote cleanup script**: "clean up script \"c:/Windows/Temp/packer-cleanup-[redacted].ps1\" failed to upload: Error removing temporary file $env:TEMP\\winrmcp-[redacted].tmp: cleanup operation returned code=**16001**"
PACKER 2025/07/15 15:56:07 packer-provisioner-powershell plugin: Retryable error: clean up script "c:/Windows/Temp/packer-cleanup-[redacted].ps1" failed to upload: Error removing temporary file $env:TEMP\winrmcp-[redacted].tmp: cleanup operation returned code=16001
PACKER 2025/07/15 15:56:07 packer-provisioner-powershell plugin: remote cleanup script failed to upload; skipping the removal of temporary files: c:/Windows/Temp/packer-ps-env-vars-[redacted].ps1,c:/Windows/Temp/script-[redacted].ps1;
PACKER 2025/07/15 15:56:07 ui: ==> azure-arm: Restarting Machine
Set the env var `PACKER_LOG=1` for maximum log detail.
Contributor guide
Assessment
This issue has not been assessed yet.