Deleting Files/Folder shows Successful in KACE but folder still exist


I have a script to delete a folder called C:\Program Files\osquery.  Inside this folder, there are subfolders and a few files that did not get deleted during the uninstall of the software.

The result of the KACE script showed "Successful" but the folder "osquery" and all its subfolders/files are still there.  How can I delete the "osquery" folder?  The batch file command is:

@echo off

rmdir "C:\Program Files\osquery" /s /q


I have also tried cmd /c and running rmdir "path" /s /q and KACE returns a successful attempt.  But the folder still exist.


Thank you,


0 Comments   [ + ] Show comments

Answers (2)

Answer Summary:
Posted by: Nico_K 9 months ago
Red Belt

rmdir cannot go recursively as you need. rd should do the trick.
Hint: if you want to use the functions as native as possible, run it in a cmd environment like:
Launch $(KACE_SYS_DIR)\cmd.exe with params /c rd c:\windows\temp\* /s /q
the variable $(KACE_SYS_DIR) is the system directory of the client device. (you can find all variables for scripting if you click on the mario block next to Tasks in scripting and in the admin guide)

  • Sometimes it pays to be “oldschool” right Nico ;o) - Hobbsy 9 months ago
Posted by: dinah.david 9 months ago
Senior White Belt

Thank you.  I got it working after I posted this on ITNinja.  Thanks for the reply.

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