Table of Contents
Introduction
Powershell has evolved over the years, with some old functionality not working in later versions.
If you have created a script in Powershell v1 or v2, it might not work with Powershell v3 or later. It is possible using a simple command to change the version of Powershell.
Which version of Powershell you are running depends on the installed Windows version.
The general recommendation is to update your environment to the latest version of Powershell, so all scripts are created for the same version. Talking from experience, failure to do so will cause a lot of issues.
In this blog post, I cover how to run the Powershell window using another version.
Powershell versions for each Windows OS
Here is a table of the different Powershell versions that come shipped with each version of Windows:
| Version | Released | Windows OS |
| Powershell 1.0 | November 2006 | Windows Server 2008 |
| Powershell 2.0 | October 2009 | Windows Server 2008 R2 (SP1), Windows 7 (SP1) |
| Powershell 3.0 | September 2012 | Windows Server 2012, Windows 8 |
| Powershell 4.0 | October 2013 | Windows Server 2012 R2, Windows 8.1 |
| Powershell 5.0 | February 2016 | Windows 10 |
| Powershell 5.1 | January 2017 | Windows Server 2016, Windows 10 Anniversary Update |
| Powershell Core 6.0 | January 2018 | Windows 10, macOS, Linux, Windows Server 2019 |
| Powershell Core 6.1 | September 2018 | Windows 10, macOS, Linux, Windows Server 2019 |
| Powershell Core 6.2 | March 2019 | Windows 10, macOS, Linux, Windows Server 2019 |
| Powershell 7 | Upcoming | Upcoming |
How to check the version of Powershell
To check the Powershell version, open a Powershell command prompt, and enter:
$PSVersionTable

Above, you can see that the command returns the version of Powershell.
How to change to another version of Powershell
To change the version to v2, enter this command on a machine:
powershell -version 2.0
Update environment to latest Powershell version
Unless you have a good reason not to, I highly recommend upgrading all your machines in your environment to the latest Powershell version.
One way of doing this is through MEMCM (SCCM). Just create an application with the latest Windows Management Framework (WMF), and deploy it to your clients.
Conclusion
Changing the version of Powershell will be required in some cases, but in most cases you should upgrade all clients to the latest version of Powershell.
I hope that you have found the blog post helpful. Let me know if I’ve missed anything!
Are you able to assist?
I am trying to figure out Hyper-V ‘s application for private VLAN, promiscuous, isolated & community mode using PowerShell.
Current PowerShell version 5, 6, nor 7 doesn’t support but whereas version 4 does, the following commandlets 1 & 2 setting the nic to trunk initially then promiscuous mode.
1. Set trunk mode and set Primary VLAN ID and Allowed VLAN list
Example PowerShell ver. 4 commandlet:
Set-VMNetworkAdapterVlan -VMName srv1 -Trunk -AllowedVlanIdList “55,10,11” -NativeVlanId 55
* PowerShell command is supported by Windows Server 2012 R2 and Windows 10, 11 & Server 2019.
2. Set promiscuous mode on the trunk just created from step 1 while assigning Primary VLAN ID and secondary VLAN IDs
Example PowerShell ver. 4 commandlet:
Set-VMNetworkAdapterVlan -VMName -Promiscuous -PrimaryVlanId 55 -SecondaryVlanIdList 10-11
* PowerShell commandlet is supported by Windows Server 2012 R2 or Windows 8.
* PowerShell commandlet is not supported by Windows 10, 11 & Server 2019 – Error Occurs.
I figured out isolated & community mode, but the promiscuous mode commandlet doesn’t function.
I tried the following microsoft resource as to accomplish promiscuous mode on the trunk nic.
URL: https://learn.microsoft.com/en-us/powershell/module/hyper-v/set vmnetworkadaptervlan?view=windowsserver2022-ps
Title: Set-VMNetworkAdapterVlan
Purpose: Configures the virtual LAN settings for the traffic through a virtual network adapter.
Syntax: Set-VMNetworkAdapterVlan
[-Trunk]
[-Isolated]
[-Community]
[-Promiscuous]
Error received trying to set a trunk mode to promiscuous mode:
Error Occurs – (PowerShell Output):
( —————- Beginning of Error —————- )
Set-VMNetworkAdapterVlan -VMName srv1 -Promiscuous
\-PrimaryVlanId 55 -SecondaryVlanIdList 10-11
Set-VMNetworkAdapterVlan : The operation failed.
Failed while applying switch port settings ‘Ethernet Switch Port VLAN
Settings’ on switch ‘Ext1.Switch’: The parameter is incorrect. (0x80070057).
At line:1 char:1
\+ Set-VMNetworkAdapterVlan -VMName srv1 -Promiscuous -PrimaryVlanId 55 …
\+ \~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~
\+ CategoryInfo : InvalidArgument: (:)
\[Set-VMNetworkAdapterVlan\], VirtualizationException
\+ FullyQualifiedErrorId :
InvalidParameter,Microsoft.HyperV.PowerShell.Commands.SetVMNetworkAdapterVlan
( —————- End of Error —————- )