Skip to main content

Trouble copying an uploaded file


Forum|alt.badge.img

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

6 replies

Nic-Automox
  • Former Automox Employee
  • 832 replies
  • June 5, 2020

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?


Rich-Automox
  • Automox Employee
  • 29 replies
  • June 5, 2020

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

}


Forum|alt.badge.img
  • Author
  • Rookie
  • 2 replies
  • June 5, 2020

That did it. Thanks!


Forum|alt.badge.img
  • Author
  • Rookie
  • 2 replies
  • June 5, 2020

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


Nic-Automox
  • Former Automox Employee
  • 832 replies
  • June 5, 2020

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.


  • Novice
  • 14 replies
  • February 23, 2022

Good afternoon, I stumbled upon this post as I am having the same difficulty the OP had.  I am trying to copy a small xml file to a specific location on a computer (directory names have spaces) and cannot get it to work properly.  I got as far as it creating the directory on the pc but it wouldn't install the uploaded file.  I’m completely new to Powershell so Google is helping me.  Can anyone tell me the easiest entries for the evaluation and remediation code?  Assume the file is called test.xml and the directory does not exist on the PC.  It is called c:\Program Files\Test Data\VPN Client.

 

Thanks to anyone that chooses to help.

-Dave  


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings