Command to install new version of powershell
To install a new version of PowerShell on Windows, you can follow these steps:
Method 1: Using the Microsoft Store (Windows 10 and later)
- Open the Microsoft Store app.
- Search for "PowerShell" in the search bar.
- Click on the "PowerShell" result to open its page.
- Click the "Install" button to download and install the latest version of PowerShell.
Method 2: Using the Windows Update (Windows 10 and later)
- Go to Settings > Update & Security > Windows Update.
- Check for updates and install any available updates.
- PowerShell should be updated to the latest version as part of the Windows Update process.
Method 3: Using the PowerShell Installer (Windows 7 and later)
- Download the PowerShell installer from the official Microsoft website: https://aka.ms/pscore
- Run the installer and follow the prompts to install the latest version of PowerShell.
Method 4: Using the PowerShell (Latest) package from the Microsoft Package Manager (Windows 10 and later)
- Open the Microsoft Package Manager (also known as winget) by searching for it in the Start menu.
- Type
winget install PowerShell
and press Enter to install the latest version of PowerShell.
Note: If you are using PowerShell 7 or later, you can also use the winget install PowerShell/7
command to install a specific version of PowerShell.
After installing a new version of PowerShell, you may need to restart your system or run the following command to update the PowerShell version:
Get-ExecutionPolicy -List
This command will list the available PowerShell versions on your system. You can then use the Set-ExecutionPolicy
cmdlet to set the default PowerShell version. For example:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Default
This will set the default PowerShell version to the latest version installed on your system.