Change and view the current PowerShell execution policies.
Its requesting the Powershell ExecutionPolicy for LocalMachine then it sets this in a variable to later be recalled in the echo command.
There we are requesting the %executionpolicyLM% and printing it in the colour cyan.
Say ExecutionPolicy FOR /F "tokens=* USEBACKQ" %%F IN (`Powershell Get-ExecutionPolicy LocalMachine`) DO ( SET executionpolicyLM=%%F ) echo %ESC%[97mCurrent ExecutionPolicy Local Machine: %ESC%[96m%executionpolicyLM%
Opens powershell with no profile bypassing the executing policy.
Then it will open a new powershell with admin and use the following command Set-ExecutionPolicy Restricted -Force -Scope LocalMachine
This sets the ExecutionPolicy to Restricted for the LocalMachine
Set ExecutionPolicy PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList 'Set-ExecutionPolicy Restricted -Force -Scope LocalMachine' -Verb RunAs}"