PowerShell remoting and upgrading to Windows 2012
I have a number of virtual machines running Windows 2008 R2 and I upgraded one of them to Windows 2012 – an over the top upgrade rather than a format and clean install
I found that Get-PSSession –Computername didn’t work against that machine.
This parameter now looks at the remote machine endpoint and gets all remoting sessions connected to the machine. I verified that the command worked correctly against a clean install of Windows 2012. This pointed to a WSMAN configuration issue.
I found two issues:
- PSversion remained on 2.0 after the upgrade
- SDKversion remained on 1 after the upgrade
You can’t just do a blanket upgrade on SDKversion because some of the endpoints remain on 1 even in a clean Windows 2012 install.
This is what I ended up doing:
Set-Item -Path wsman:\localhost\plugin\microsoft.powershell\InitializationParameters\PSVersion -Value 3.0
Set-Item -Path wsman:\localhost\plugin\microsoft.ServerManager\InitializationParameters\PSVersion -Value 3.0
Set-Item -Path wsman:\localhost\plugin\Microsoft.PowerShell32\InitializationParameters\PSVersion -Value 3.0
Set-Item -Path wsman:\localhost\plugin\Microsoft.PowerShell32\SDKVersion -Value 2
Set-Item -Path wsman:\localhost\plugin\Microsoft.PowerShell\SDKVersion -Value 2
Restart-Service winrm
That didn’t completely fix it so I restarted the remote machine then ran:
Disable-PSRemoting –Force
Enable-PSRemoting –Force
That seemed to fix the problem.
At the moment all seems to be working BUT I’ve more testing to do before I’m 100% happy with this. This isn’t a procedure I’d recommend unless you exactly what you are doing and why.
Don’t try this at home until you are sure you need to.