Hi Team, I have created an action script where a PowerShell file (.ps1) is executed first. This script generates a .txt output file in the same directory, deletes the .ps1 afterward, and then attempts to copy the resulting .txt file to a shared network folder. Everything is working as expected except for the final step, the .txt file is not getting copied to the shared folder.
Action Script
action uses wow64 redirection false
// Override to run as current user
waithidden powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Unblock-File -Path 'C:\Temp\Cisco\test-new.ps1'; Set-Location -Path 'C:\Temp\Cisco'; & 'C:\Temp\Cisco\test-new.ps1'"
action uses wow64 redirection {x64 of operating system}
Parameter "timeout" = "{now}"pause while {( now - parameter "timeout" as time ) < 5 * second}
delete "C:\temp\Cisco\test-new.ps1"
Parameter "timeout1" = "{now}"pause while {( now - parameter "timeout1" as time ) < 5 * second}
// PARAMETERS
parameter "srcDir" = "C:\Temp\Cisco"parameter "destDir" = "\\10.33.64.201\Jiten Chadha"
// VERIFY SOURCE FILE(S) EXIST
continue if {exists files whose (name of it starts with "source-" AND name of it ends with ".txt") of folder "C:\Temp\Cisco"}
// CREATE DESTINATION FOLDER (run as current user)
override wait
runas=currentuser
wait cmd.exe /c if not exist "{parameter "destDir"}" mkdir "{parameter "destDir"}"
// COPY FILES AS CURRENT USER (uses your SMB credentials)
override wait
runas=currentuser
wait cmd.exe /c robocopy "{parameter "srcDir"}" "{parameter "destDir"}" "source-*.txt" /R:2 /W:5 /NFL /NDL /NP