In my opinion, non-admins should not change entries in the registry.
If the cache cleaning has to be done again, there are two options from my point of view.
- 1. create a script in Intune that deletes the registry key again before you run the script on the user again. This command would then be:
Get-Item HKCU:Software\Microsoft\MSB365_Teams_clear_cache_Tool | Remove-Item -Force -Verbose
- 2. you take the sctipt, which is available for download on GitHub, and adapt line 103. There you change the name of the item property.
I hope this helps you.
PS:
Regarding the question whether a reg key can be created in the context of the user: Yes, as it concerns the HKCU area. In general, this is possible.