Skip to main content

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

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

}


That did it. Thanks!


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


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.


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