Created: 8/26/20
Updated: 8/23/21
A few commands I’ve been using more and more with powershell script are these two commands:
# Allows you to run unsigned scripts
Set-ExecutionPolicy -ExecutionPolicy bypass
I’d advise if you use it, use it with caution, as bypassing signed script can open you up to exploitation. After you run your scripts, be sure to re-enable the Execution Policy via:
# Default value makes all script to be remotely signed via their remote repository
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Another command I’m deploying recently is the TLS 1.2 command to update the Powershell Gallery local protocols. As of April 2020, the TLS 1.0 and 1.1 protocol were depreciated.
# Enable this to allow for the Install-Module
[Net.ServicePointManager]::SecurityProtocol = “tls12”
This recent command is useful too:
$TLS12Protocol = [System.Net.SecurityProtocolType] ‘Ssl3 , Tls12’ [System.Net.ServicePointManager]::SecurityProtocol = $TLS12Protocol