Hi Handian Sudianto,
Has your problem been solved? If it has, please hit Accept the answer to support me. If it has not, please tell me more about your issues, I will help you.
Thank you so much!!
QQ.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
If we have old powershell version 5 and new version 7, then can we set version 7 as default
Hi Handian Sudianto,
Has your problem been solved? If it has, please hit Accept the answer to support me. If it has not, please tell me more about your issues, I will help you.
Thank you so much!!
QQ.
Dear Handian Sudianto,
Thank you for your question regarding PowerShell versions. Windows includes Windows PowerShell 5.1 by default, and it cannot be removed because it is part of the operating system. However, you can install PowerShell 7 side‑by‑side and configure it as the default shell for your environment. To do this, you may update shortcuts, change the default terminal profile in Windows Terminal, or adjust Group Policy/registry settings so that PowerShell 7 launches instead of 5.1. For scripts and automation, you can explicitly call pwsh.exe (PowerShell 7) rather than powershell.exe (PowerShell 5.1). This ensures that users and tasks run on PowerShell 7 by default while still keeping 5.1 available for compatibility.
If this guidance helps you successfully set PowerShell 7 as your default, we kindly ask that you mark this response as “Accept the answer”, so that other administrators can quickly find the solution.
Thank you so much!!!
Kind regards,
QQ.
AI answer
You can set PowerShell version 7 as the default by modifying your system's environment variables or by creating a shortcut that points to the PowerShell 7 executable. However, it's important to note that PowerShell 7 installs side-by-side with Windows PowerShell 5.1, meaning you can choose which version to run based on how you invoke PowerShell.
For example, you can create a shortcut on your desktop that points to the PowerShell 7 executable (usually located in C:\Program Files\PowerShell\7\pwsh.exe). This way, when you use that shortcut, it will open PowerShell 7 by default.
Additionally, if you are using scripts or automation tools, you may need to specify which version of PowerShell to use in those contexts, as some tools may default to the older version unless specified otherwise.
For more detailed guidance on using PowerShell 7 alongside Windows PowerShell 5.1, you can refer to the migration documentation.