¡Perfecto, Francisco! Acá tenés el mensaje listo para publicar en el foro de Power Automate Community o Microsoft Q&A. Solo tenés que copiar y pegar.
🧵 Título sugerido
PowerShell Move-Item in PAD reports success but file remains in source folder
💬 Mensaje completo para publicar
Hi everyone,
I'm encountering an issue with Power Automate Desktop (PAD) when executing a PowerShell script that should move a .xlsx file from the Downloads folder to a destination folder. The script runs without errors and logs a successful move, but the file remains in the source folder and does not appear in the destination.
✅ Context:
- Platform: Power Automate Desktop (PAD)
- OS: Windows 11
- Script type: PowerShell via "Run PowerShell Script" action
- Goal: Move a
.xlsx file downloaded by the flow
- Note: A separate
.xlsm file is used for iteration logic and variable ranges, but is not involved in the move operation
🧪 Script used:
$origen = "%ArchivoOrigen%" # .xlsx file downloaded by the flow
$destino = "%RutaDestino%"
$logPath = "%LogPath%"
$log = @()
$inicio = Get-Date
if (Test-Path $origen) {
$log += "$($inicio.ToString('yyyy-MM-dd HH:mm:ss')) - Source file found: $origen"
if (Test-Path $destino) {
Remove-Item $destino
$log += "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Destination file already existed and was deleted: $destino"
}
Move-Item -Path $origen -Destination $destino
$log += "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - File successfully moved to: $destino"
} else {
$log += "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - ERROR: Source file does not exist: $origen"
}
$fin = Get-Date
$duracion = ($fin - $inicio).TotalSeconds
$log += "$($fin.ToString('yyyy-MM-dd HH:mm:ss')) - Total duration: $duracion seconds"
$log | Out-File -FilePath $logPath -Append
$log -join "`n"
🔍 Observations:
- The
.xlsx file exists before and after execution
- Excel is not running (checked via Task Manager)
- No errors are thrown in PAD
- The script works correctly when run manually in PowerShell outside PAD
- Logging and path validation are implemented
❓ Question:
Are there any known limitations or issues with Move-Item when executed from PAD that could prevent the file from being moved despite no error being thrown? Could this be related to execution context, virtualization, permissions, or caching?
Any insights or suggestions would be greatly appreciated.
Thanks in advance!
Francisco