Run the CMD with two USER privilege's

Dear Team,

we have the script for uninstalling the product & remove registry entry for that one package required admin privilege and another one must be run as a current user.

CMD 1(Admin rights needed): MsiExec.exe /X {CA62DF9E-CC50-4931-9088-AFD70C64D937} XPSWD=Qazmk0#154987R

CMD 2(Need to be Run as Current User): REG DELETE “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings” /v AutoConfigURL /f

Regards
Vicky

You would need to look into override of existent actionscript commands (wait/run/etc). They have options to enable run as admin and run as current user.

Perfectly possible to have a fixlet with two actions that each need different overrides.

My question, in this case, would be around the relevance that would make the fixlet applicable/not applicable on each client.

I haven’t tried but I am inclined to try two overrides within the same action - I don’t see a reason why it wouldn’t work… It sounds to me that the two steps are a part of the same requirement to remove the application, so why split it up into multiple actions (and worry about different relevances and whatnot) when it should be done a part of the same action. Something along the lines of:

override wait
completion=job
hidden=true
asadmin=true
wait cmd /C MsiExec.exe /X {{CA62DF9E-CC50-4931-9088-AFD70C64D937} XPSWD=Qazmk0#154987R

override wait
completion=job
hidden=true
runas=currentuser
wait cmd /C REG DELETE “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings” /v AutoConfigURL /f

1 Like

Yes, we also prefer one action only and it should run with two different privileges due to Admin rights required for uninstall & registry entry available under the current user.

If we run both as an administrator then registry entry won’t available.

if we create two separate actions my system won’t connect to the internet after we uninstall the application and it left the registry setting also then again manually we need to remove it.

We are currently doing WFH so we must complete the action in one shot.

Regards
Vicky

Ahh - 1 script, two actions, I misunderstood that.

If this is for users WFH then my concern about relevance is overcome, but for shared workstations the registry value will still potentially be there for additional users.

@ageorgiev suggestion above switches security context in the middle of the action script.

use Override twice - once for System and once for CurrentUser. You can do that inside of a single Action Script.

1 Like