BigFix Action Executes but Fails to Copy Output File to Shared Folder

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

From a script perspective, everything looks fine. I assume you’ve already tested the final copy step locally and confirmed it works as expected.

A few things to keep in mind though:

  1. Make sure you’re calling robocopy using the full executable path, instead of just robocopy

  2. If you are using runas=currentuser the action will fail if no user is actively logged in at the time of execution.

  3. Even if a user is logged in, that user must have proper network access and write permissions to the shared folder.

  4. Also ensure that the session has access to UNC path, sometimes interactive access works, but non-interactive execution does not.

1 Like