I wrote a powershell script that I'm going to deploy to 50 devices using Intune. The script deletes the browser cache data in Chrome. I have not deployed through Intune yet. On a test machine, I placed the script in a directory and executed it. I got the following error:
File C:\scripts\deleteGoogleCache.ps1 cannot be loaded because running scripts is
disabled on this system. For more
information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?
LinkID=135170.
+ CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnauthorizedAccess
So, I search for a solution. I'm supposed to run PowerShell as an administrator. Obviously, I'm not going to each device and run powershell as an administrator. So, I found another tip by issuing this command:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
and I got the following response.
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the
execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution
policy?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"):
Obviously, I'm not physically going to every device and press [A] for Yes to all.
Any help will be greatly appreciated, I'm new to Powershell.