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

Optional features

Check available optional features: DISM /Online /Get-Capabilities Install an optional feature: DISM /Online /Add-capability /capabilityname:Media.MediaFeaturePack~~~~0.0.1.0

Read More »

AD retention period

Check AD retention tombstone value: Import-Module ActiveDirectory $ADForestconfigurationNamingContext = (Get-ADRootDSE).configurationNamingContext $DirectoryServicesConfigPartition = Get-ADObject -Identity “CN=Directory Service,CN=Windows NT,CN=Services,$ADForestconfigurationNamingContext” -Partition $ADForestconfigurationNamingContext -Properties *

Read More »