Encountering an error "failed for MoveFile"

The following action script works fine when run on Fixlet Debugger:

createfile until _eof
	Remove-item -Path "C:\Program Files\Delete" -Force -Recurse
_eof
	
delete __Download\powershell.ps1
move __createfile __Download\powershell.ps1

runhidden cmd /K powershell.exe -ExecutionPolicy Bypass __Download\powershell.ps1

But when run via fixlet, it encounters the following error:

Command succeeded action parameter query “Folder” with description “Please enter complete folder location” (action:78270)
Command succeeded action parameter query “Confirm” with description “Proceed with folder deletion? Y or N?” (action:78270)
Command succeeded delete No ‘C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite__Download\powershell.ps1’ exists to delete, no failure reported (action:78270)
At 19:01:28 +0800 -
Retry error, attempt 9 failed for MoveFile (C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite__createfile ,C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite__Download\powershell.ps1)
At 19:01:28 +0800 - actionsite (http://SW730EUTILPA001.visa.com:52311/cgi-bin/bfgather.exe/actionsite)
Command failed (Move of ‘C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite__createfile’ to ‘C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite__Download\powershell.ps1’ failed (2)) copy __createfile __Download\powershell.ps1 (action:78270)

Try using copy instead of move. The __createfile is managed by the client anyway so you don’t really need to move it.

Are you trying to delete a folder with all its contents? You could try native actionscript for that instead of PowerShell

folder delete "C:\Program Files\Delete"

Another way to do this would be to use PowerShell and pass the PS commands to the runhidden command, remembering to escape the quotes. That way to dont need to create the script file.

runhidden powershell.exe -ExecutionPolicy Bypass Remove-item -Path \"C:\Program Files\Delete\" -Force -Recurse

1 Like

Thanks for the response Rob. The powershell script is just for testing purposes. I’m just trying out how to use createfile since it is for multiple lines of script compared to appendfile.

I also tried to use copy instead of move and still encountered the same issue.

What you are showing as your script is not what the log is reflecting. These are two different scripts. Can you post the script, or an excerpt of it, matching the log?

The log does not show any createfile command. The ‘move’ is failing because no __createfile was generated.

1 Like

Hi Jason. Thanks for pointing that out. I was looking at a different part of the log. The action script above without a parameter query actually works fine. The error was from a different action that has a parameter query.