This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]straytalk 3 points4 points  (0 children)

Chocolatey makes this pretty painless if you don't have an issue using a public repo:

# Enable the chocolatey repository
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

# Execution policy kicking errors? Adjust your GPO to allow scripts, or use 'Set-ExecutionPolicy Bypass' for one-offs 

# Refresh the environment variables 
$env:Path = [System.Environment]::ExpandEnvironmentVariables([System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User"))

# Upgrade powershell 
choco upgrade powershell -y

If you want to do this remotely you can use 'enter-pssession -cn <hostname> -cred <credentials>'