Hi Soheil
To change the default PowerShell version in Windows Server Core, you can follow these steps:
Open a Command Prompt or PowerShell session on your Windows Server Core machine.
Run the following command to set the default version of PowerShell:
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\PowerShellCore\7' -Name 'PowerShellVersion' -Value '7.3.4'
This command updates the registry to set PowerShell version 7.3.4 as the default.
Restart the machine to apply the changes.
After restarting, the default version of PowerShell should be set to 7.3.4. You can verify this by opening a new PowerShell session and checking the version with the following command:
$PSVersionTable.PSVersion
It should display the PowerShell version as 7.3.4.
Please note that changing the default PowerShell version affects all users on the machine. If you want to use a different PowerShell version for specific tasks or applications, you can specify the path to the desired PowerShell version executable when running commands, like you did with .\pwsh.exe in your example.
If you encounter any issues or if the changes don't take effect, ensure that you have the correct installation of PowerShell 7.3.4 and administrative privileges to modify the registry.