/build/static/layout/Breadcrumb_cap_w.png

Script to Copy .exe from KACE to PC Not Working

Hello!

I'm looking for help with a script that doesn't seem to be working for me.  The goal is to copy & replace an .exe on a workstation with a new version of that .exe I have saved as a dependency in KACE.  The script seems to end the processes but I can't figure out why the copy/replace isn't completing.  I've tried this as a batch file as well.  I have run this as the local SYSTEM user as well as with the local administrator credentials.

Here is essentially what I've got, though I've tried several variations:

The new .exe is set as a dependency

Task 1

Verify the directory exists
Verify the file exists
Verify process isn't running

On Success
Launch C:\Windows\System32\cmd.exe with params xcopy $(KACE_DEPENDENCY_DIR)\newfile.exe c:\Program Files\Existing Directory /q /y.

Remediation
Kill process

On Remediation Success
Launch C:\Windows\System32\cmd.exe with params xcopy $(KACE_DEPENDENCY_DIR)\newfile.exe c:\Program Files\Existing Directory /q /y.
Log "Success" to output

On Remediation Failure
Log "failure" to output

2 Comments   [ + ] Show comments
  • why don't you use Distribution|File Synchronization for that? - Nico_K 6 years ago
    • I looked into that but I'm not very familiar with how it works. I think I've set things up correctly, but how do I run that on a test machine to ensure it works?

      I only see a "schedule" I can set with hourly windows. Is there a way to push this out immediately? - jasti 6 years ago
      • for Scripts: use the Run Now
        for File Sync: force inventory (or run c:\program files (x86)\quest\kace\runkbot 6 0, that not a full inventory but only the file sync and MI is running) - Nico_K 6 years ago
  • Thanks Nico! One more question...I DID get it to work with File Sync, but what happens when the file is in use? Any idea how I should go about killing a process prior to running this file sync? - jasti 6 years ago

Answers (1)

Posted by: chucksteel 6 years ago
Red Belt
1
When running cmd.exe to execute a command you need to specify the /c flag. This:
Launch C:\Windows\System32\cmd.exe with params xcopy $(KACE_DEPENDENCY_DIR)\newfile.exe c:\Program Files\Existing Directory /q /y

Should be:
Launch C:\Windows\System32\cmd.exe with params “/c xcopy "$(KACE_DEPENDENCY_DIR)\newfile.exe" "c:\Program Files\Existing Directory" /q /y

I think that your quotes for the xcopy command might have also been off. 
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ