Trouble copying an uploaded file

It seems like this should be simple, but I’m having trouble figuring out the remediation code to simply copy a file I’ve uploaded to the worklet to a local directory on remote PC’s. I can see the file hitting in the amagent folder of the remote device, but once it’s transferred over, it just deletes and doesn’t copy to the directory.
I’ve used all kinds of variations for the script, but no luck. Here’s the remediation code I’m using , which at least gets the file to the remote PC.

copy-item -FilePath ‘.\StopUPH_EWL.bat’ -Destination c:\temp

Any suggestions?

Jeff

1 Like

I used this syntax in a worklet and it works for the file copy:
Copy-Item Bginfo64.exe -Destination “c:\Bginfo64.exe”

so maybe put double quotes around the destination and include the file name in the destination?

Also make sure C:\temp already exists on the affected devices. Or add a step to create it something like:

if (-not(Test-Path -Path C:\temp)) {
    New-Item -Path C:\temp -ItemType Directory
}
1 Like

That did it. Thanks!

Replied to the wrong post. This syntax worked. Thanks again!

1 Like

Glad that did the trick! Once you’ve got your worklet polished and working, feel free to share it on the community in the worklets section if you think it would be useful for other Automox users.