QnA - Disable Powershell 2.0 in Windows #25413
Replies: 1 comment
|
Yes — the legacy 2.0 engine is safe to disable on modern Windows, and you can check what might depend on it first. 1. Check the feature state Get-WindowsOptionalFeature -Online | Where-Object FeatureName -like '*PowerShell*' |
Select-Object FeatureName, StateOn Windows 10/11 you'll see 2. Find anything still using the 2.0 engine Look for processes started with Get-CimInstance Win32_Process -Filter "Name = 'powershell.exe'" |
Where-Object { $_.CommandLine -match '-[Vv]ersion\s+2\b' } |
Select-Object ProcessId, CommandLineAlso check legacy scheduled tasks and services that reference Get-ScheduledTask | Where-Object {
($_.Actions | ForEach-Object Execute) -match 'powershell' -and
($_.Actions | ForEach-Object Arguments) -match '-[Vv]ersion\s+2\b'
}3. Disable it From an elevated PowerShell: Disable-WindowsOptionalFeature -Online -FeatureName MicrosoftWindowsPowerShellV2RootThis disables the whole subtree; a reboot may be required. It only removes the 2.0 engine — your 4. Verify Get-WindowsOptionalFeature -Online | Where-Object FeatureName -like '*PowerShell*'Both features should now report |
Uh oh!
There was an error while loading. Please reload this page.
Is there any way to check for potential issues i.e., what Windows processes still use this really old feature or can we disable and forget about it. Because Powershell 5.1 works fine as alternative.
Thanks
All reactions