icacls command not working through OnlineKScript - but works through CMD
I am trying to swap curl.exe. Will be taking the latest version of curl from dependency directory and then copying it over to system32 directory.
In order to do this, I must first make Administrators the owner, copy over the new file, then switch back the owner to NT Service/TrustedInstaller.
But I swear to God, it's just not working through KACE, but works great through cmd.
I use "launch a program" for the tasks with the first one being:
%WINDIR%\sysnative\powershell.exe with params Start-Process cmd.exe -Verb RunAs; takeown /F ”c:\Windows\sysnative\curl.exe“ /A
%WINDIR%\sysnative\powershell.exe with params Start-Process cmd.exe -Verb RunAs; icacls c:\Windows\sysnative\curl.exe /grant Administrators:f
Both commands work great, I copy the file over, then this next command just does nothing:
%WINDIR%\sysnative\powershell.exe with params “Start-Process cmd.exe -Verb RunAs; icacls c:\Windows\sysnative\curl.exe /setowner ”NT Service\TrustedInstaller”.
Please assist, I've been stumped on this for days. Apologies if I am in the wrong place, but I thought it might be the way I inputted it into KACE since it works through CMD.
Answers (1)
Run it as an admin user in the KACE.
The agent by default uses SYSTEM credentials with SYSTEM rights. This means, all functions which need an ADMINISTRATOR have not enough rights.
Also if you want to modify an USERs profile SYSTEM cannot do this, since the SYSTEM has not the variables set you need.
Comments:
-
I got it to work just fine - had to just switch up a few things on my side. Forcing powershell to run cmd as an admin helped with changing needed permissions. Was able to complete it sucessfully with all permissions being reverted back. thanks... - mvlli 1 year ago