How to run the intune remediation script for the Particular user

Venkata Lakshmi Priyanka Gontla 0 Reputation points
2025-04-09T07:53:57.1133333+00:00

Hi All,

I have a device managed through Intune with multiple user profiles (typically one admin account and two standard user accounts). I need to create a remediation script to clean up the Microsoft Teams cache for the standard user accounts only.

I've created a remediation script in Intune with the "Run this script using the logged on credentials" option enabled. My questions are:

  1. In which user context will this script execute - SYSTEM or the currently logged-in user?
  2. If a device has multiple user profiles, will the script only target the currently logged-in user's Teams cache or can it access all user profiles?
  3. How can I ensure the script only clears the Teams cache for standard user accounts while skipping administrator accounts?
  4. Is there a better approach to accomplish selective Teams cache cleanup across multiple user profiles on the same device?

Any insights or suggestions would be greatly appreciated.

Thank you!

Microsoft Intune Configuration
Microsoft Intune Configuration
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Configuration: The process of arranging or setting up computer systems, hardware, or software.
2,063 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Prathista Ilango 255 Reputation points Microsoft Employee
    2025-04-11T15:33:40.82+00:00

    Hello Venkata Lakshmi Priyanka Gontla,

    When "Run this script using the logged-on credentials" is used, the script runs under the current user context.

    The behavior depends on how the script is configured to clear the cache and the kind of permissions the logged-on user has.

    For example, if the script clears the cache for any/all users and it is set to run using logged-on credentials, then it might clear for all users if the logged-on user has permission. If the logged-on user doesn't have permission for other users' cache, it will clear only the cache of the current user only.

    The best way to approach this is to create the script with the necessary conditions to check and clear the cache of logged in or standard users, and not admin accounts.

    Hope that helps!

    If you found the information above helpful, please Click Yes. This will assist others in the community who encounter a similar issue, enabling them to quickly find the solution and benefit from the guidance provided.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.