Bat script deployment help

I'm trying to deploy a bat script that deletes a file from System32 directory from all of our company users. The script itself works locally however when deployed out with KACE, it is shown successful however the file is not deleted.

If Exist "C:\Windows\System32\*_publicKey.keyxml" (

echo %computername%%userdnsdomain% %DATE% %TIME%>> "\\int******\ireg\Install\RedCloak\samsam.txt"

DEL "C:\Windows\System32\*_publicKey.keyxml"

) ELSE (

echo %computername%%userdnsdomain% %DATE% %TIME% "samsam remnant not present" >> "\\int******\ireg\Install\RedCloak\samsamclean.txt"


If Not Exist  "C:\Windows\System32\*_publicKey.keyxml" (

echo %computername%%userdnsdomain% %DATE% %TIME% "samsam remnant not present" >> "\\int******\ireg\Install\RedCloak\samsamclean.txt"


The script included here also logs the computers that have the file and those that don't on to a network share we have

KACE Configuration:

Windows Run As

- Local System




Task 1

On Success

1. Launch "$(KACE_DEPENDENCY_DIR)\samsam.bat" with params "".

Any help would be greatly appreciated!

1 Comment   [ + ] Show comment
  • I'm no batch expert, so what I do in these situations is to set the task to be "visible" (checkbox when configuring "Launch a program" in KACE script). Then I add a "PAUSE" between every line in the bat so I can "step through" the code to see if I can notice anything wrong. - JasonEgg 2 years ago
    • Thank you for the quick reply. The script itself has no issues as it works locally. I will however try PAUSE as for the log in KACE.

      Thank you for the suggestion. - josabraham 2 years ago

Answers (1)

Posted by: Channeler 2 years ago
Red Belt

Did you solve that one?

The KACE SMA agent is a 32bit software, so targeting C:\Windows\System32\  folder may not work.

If you need to run\target a program\file that's located in the C:\Windows\System32 directory on a 64-bit Windows system, you must use the /SysNative wildcard.

This is an article from the early Win7 Era, but the author is keeping it up to date with new OS versions.
Check the part where it says "The Sysnative folder"

Also it helps if the script is being executed on the device with local admin credentials(the SMA lets you add them).... I've seen domain admins fail to tamper around with System32.

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