Windows – update PowerShell / WinRM / WinMF via command line

windowswindows-server-2012-r2

Taking a new Windows Server 2012 installation, I need to get it fit for hosting and automation.

That means getting it ready for remote PowerShell and DSC, which means installing the latest version of the Windows Management Framework, and then configuring WinRM for HTTPS and Basic Authentication.

I've not really 'engineered' Windows since 2008, but it seems that solving this egg-chicken problem requires a mouse and a browser.

And yet a couple of non-GUI footprints of Windows Server exist today, so what's the quick solution to getting these basics setup (at a command line) so that I can move on to automating the more advanced configuration of the host?

It kinda strikes me that there should be a single CmdLet in-the-box to get this fundamental stuff up and going.

Is there?

Best Answer

I actually gave up. Here's how far I got. From PowerShell:

PS> iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
PS> choco install powershell

Reboot.

From elevated Command Prompt:

> winrm quickconfig
> winrm set winrm/config/service/auth @{Basic="true"}
> winrm set winrm/config/service @{AllowUnencrypted="false"}

And then I realised I'd need to make a certificate somehow and that would require makecert and that would require automating the installation of the Windows SDK, then I'd have to install the certificate, and some other documentation said something about WinRM not working with self-signed certificates and then thinking that after spending a week getting all that working only to discover that WinRM won't work anyway and then I lost the will to live.

I'm a programmer. I wanted to have a development Windows Server box for testing some PS DSC scripts out on but don't have an installation key to install it locally in Hyper-V and Microsoft haven't figured out to just give Windows Server away for free for developers yet, so I thought I'd use my free Azure time and setup a free VM and just use that over the web, but that requires HTTPS and so we're back to the problems above.

Hopefully my contract won't be renewed and I can just use .NET Core and Linux and Docker on the next job.

Edit

Stumbled randomly across this gem of a post about setting up SSL but without makecert:

https://4sysops.com/archives/powershell-remoting-over-https-with-a-self-signed-ssl-certificate/