Search This Blog

Wednesday, September 20, 2017

a quick and dirty solution for running power shell scripts

Found myself trying to execute my first power shell script and unable to run it because of Power Shell's restrictive execution policy. Found a quick and dirty solution for running power shell scripts
which is not too horrible for develop or test environments, as long as we assume they are properly secure and are willing to ignore all the lectures regarding the need to stop the negligence in which
security is handled in development and testing environments... which I am , at 00:06 at night, wishing
to see the fruits of my labor and being quite frustrated with Microsoft's annoying approach regarding self certificates in older windows environments (I'm working on an older Power Shell version and the recommended solution for this version has been deprecated....)

So, with no further introductions, the quick and dirty solution:

1) run power shall as admin
2) see current execution policy by
    Get-ExecutionPolicy
3) enable running locally developed scripts by:
    Set-ExecutionPolicy RemoteSigned
4) remember at end of session
    Set-ExecutionPolicy Restricted
(so we'll get back to maximum security)

source:
WindowsITPro - running powershell scripts 

No comments:

Post a Comment