-
Make sure you have PowerShell 5 installed.
$PSVersionTable.PSVersion
-
Run as administrator in PowerShell:
# Install a module to local repository. Hit <Enter> to approve NuGet installation. Install-Module Saritasa.WinRM -Force # Run script to configure WinRM. Install-WinrmHttps
You may install NuGet package provider in advance.
Install-PackageProvider NuGet -Force
One-line command:
Install-PackageProvider NuGet -Force; Install-Module Saritasa.WinRM -Force; Install-WinrmHttps
PowerShell 5 is installed already.
Run as administrator in PowerShell:
# Install Chocolatey.
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
# Update WMF and PowerShell to version 5.
cinst powershell -y
# Restart server to apply PowerShell updates.
Restart-Computer
Run as administrator in PowerShell:
Set-ExecutionPolicy RemoteSigned
# Install Chocolatey.
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Update .NET Framework.
cinst dotnet4.5.2 -y
# Update WMF and PowerShell to version 5.
cinst powershell -y
# Restart server to apply PowerShell updates.
Restart-Computer
-
Run following commands:
dism /online /enable-feature:NetFx2-ServerCore dism /online /enable-feature:MicrosoftWindowsPowerShell dism /online /enable-feature:NetFx2-ServerCore-WOW64
-
Start PowerShell 2.0:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
-
Install ServerManager cmdlets:
Dism.exe /Online /Enable-Feature /FeatureName:ServerManager-PSH-Cmdlets
-
Run in PowerShell:
# Install .NET 4.5.2. $path = "$env:TEMP\NDP452.exe" (New-Object System.Net.WebClient).DownloadFile("http://download.microsoft.com/download/E/2/1/E21644B5-2DF2-47C2-91BD-63C560427900/NDP452-KB2901907-x86-x64-AllOS-ENU.exe", $path) Start-Process -NoNewWindow -Wait $path '/Passive' # Install Chocolatey. Set-ExecutionPolicy RemoteSigned $env:chocolateyUserWindowsCompression = 'false' iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) # Update WMF and PowerShell to version 5. cinst powershell -y # Restart server to apply PowerShell updates. Restart-Computer
-
Run as administrator in PowerShell:
Install-WinrmHttps -Force
-
Run if you need to update Web Management service certificate:
Import-Module WebAdministration $fqdn = [System.Net.Dns]::GetHostByName('localhost').Hostname Get-ChildItem -Path Cert:\LocalMachine\My | Where-Object { $_.Subject -EQ "CN=$fqdn" } | Sort-Object -Descending NotBefore | Select-Object -First 1 | Set-Item IIS:\SslBindings\0.0.0.0!8172
-
Run as administrator on a build server:
psake trust-host -properties "@{ServerHost='example.com'}"
-
Listen certificates:
ls Cert:\LocalMachine\My
-
Use desired thumbprint in a command:
Install-WinrmHttps -CertificateThumbprint XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -Force
-
Update Web Management service certificate:
Get-Item Cert:\LocalMachine\My\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | Set-Item IIS:\SslBindings\0.0.0.0!8172