Powershell 7 Remoting defaults

When installing Powershell 7 on a Windows server you can’t install it using “winget” but you can use the msi package instead.

You then have Powershell 5 and 7 running in parallell installations.

When you enable WinRM remoting using the “enable-psremoting” comand you are set on the target server in a domain.

It is allways the client connecting that defines the default Powershell version you will connect to.

You check the current version by checking the variable $PSversiontable

 

On the client you can define version 7 by using the “-configurationname” parameter like this:

				
					Invoke-Command -ComputerName ServerName -ScriptBlock { $PsVersionTable.PSVersion } -ConfigurationName Powershell.7
				
			

If you want to set your client to use PS7 by default when connecting Remote, you can change the Powershell variable on your client 

				
					# When remoting, default to running PowerShell Core v7.x on the
# the target machines:
$PSSessionConfigurationName = 'PowerShell.7'
				
			

You can set this in your Powershell profile as the default. -when you want to go back to using PS5 by default:

				
					$PSSessionConfigurationName = 'http://schemas.microsoft.com/powershell/Microsoft.PowerShell'
				
			

More articles

Dynamic botnet filter

We can utilize dynamic botnet filters on firewalls and specific services can be called upon dynamically. On Github there are several

Read More »