Hello, 1st time poster.
I am trying to deploy a batch file using the provisioning aspect of the Workspace One UEM.
when i deploy the batch file using the "systems' context the batch script to clear both Edge (chromium) browser and Google Chrome Browser does close both browsers but when it runs the command within the batch to clear the browser cache it does not do this.
Running the batch manually does clear the cached files. I am lost as to why one aspect of the batch script runs but does not run the rest of the script.
context of script is below:
taskkill /F /IM "chrome.exe">nul 2>&1
set ChromeDir=C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default\Cache\Cache_Data
del /q /s /f "%ChromeDir%"
rd /s /q "%ChromeDir%"
exit
I think that variable %USERNAME% in the "set ChromeDir ..." line is assigned "SYSTEM" when using "system" as user context.
So I think the batch tries to delete C:\Users\SYSTEM\AppData\Local\Google\Chrome\User Data\Default\Cache\Cache_Data and so the path corresponding to the real user is not deleted.
this makes a lot of sense now that you put it that way.
The only issue is if I user Current User as the context so the script acts on the correct folder is that the powershell script fails.
On the administrator Context it prompts UAC and admin username and password (which our users don't have)
Is there a way to make an argument to allow this to go through?
Can you try this one? Works in my lab. No Admin rights needed. Works for current user.
Remove-Item -path "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Cache\*" -Recurse -Force -EA SilentlyContinue -Verbose (NOT Copy/Paste this but write it again in Powershell)
