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
Dependancies:
-samsam.bat
Tasks
Task 1
On Success
1. Launch "$(KACE_DEPENDENCY_DIR)\samsam.bat" with params "".
Any help would be greatly appreciated!
Answers (1)
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"
https://www.samlogic.net/articles/sysnative-folder-64-bit-windows.htm
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.
Thank you for the suggestion. - josabraham 4 years ago