Forum Discussion
Intune | Powershell Script
Hi,
When we add and run a script via Intune, so does it run with an administrator privilege or with normal user privilege.
Actually I need to uninstall an application from few of the endpoints for which the script needs to be run only with administrator privilege.
Also what is the difference when we set the parameter for running the script:
Run this script using the logged on credentials:
Yes: (run the script with the user's credentials on the device)
No: (script is required to run in the system context)
Does running the script here in system context will make the script run with admin privileges?
Hi AnuragSrivastava,
I can't add more to the execution context except of the UAC question, which comes up quite often here. In system context you don't have to worry about UAC. You are system and can do whatever you want then.
Last thing to mention is the different context, as already described, results also in different resolving of environment variables like %username% is not the logged on user it is the user SYSTEM then. Or take %userprofile% it will result in C:\Windows\System32\Config\systemprofile.
best,
Oliver
- joel_grangierBrass Contributor
Hi AnuragSrivastava;
Yes, the system context will make the script runs with admin privileges. The "Local System" account is used and this account has always admin privileges on a device.But in that case, the script will be executed in an other context as the one of the logged on user. So, if you want, for example, to uninstall an application which has been installed per-user (in the user context), you have to adapt your script accordingly.
Hi AnuragSrivastava,
I can't add more to the execution context except of the UAC question, which comes up quite often here. In system context you don't have to worry about UAC. You are system and can do whatever you want then.
Last thing to mention is the different context, as already described, results also in different resolving of environment variables like %username% is not the logged on user it is the user SYSTEM then. Or take %userprofile% it will result in C:\Windows\System32\Config\systemprofile.
best,
Oliver
- AnuragSrivastavaIron Contributor
Oliver Kieselbach Thanks Oliver, this helps.