Article From:

Error: You must provide a value expression on the right-hand side of the ‘-‘ operator.


The reason is :  the -notin operator isn’t supported on v2.0

 the -notin operator isn’t supported on v2.0  What is the best alternative to the -notin operator for v2.0? I’d prefer to minimize code refactoring, if possible.


Check Powershell version in powershell command:



Download new version and upgrade.

install powershell 3.0.

PowerShell 3.0. You can download Windows Management Framework 3.0, which includes Windows PowerShell 3.0, from the Microsoft Download Center.


Before installing Windows Management Framework 3.0:

    Make sure you have downloaded the correct version of the installation package. If you are running the 64-bit version of Windows 7, download the file Windows6.1-KB2506143-x64.msu. If you are running the 32-bit version of Windows 7, download the file Windows6.1-KB2506143-x86.msu.

    If you are running Windows 7 on your computer, make sure that you have installed Windows 7 Service Pack 1.

I am trying to install Windows Powershell 4.0. I use Windows 7 SP1 OS (x64 Bit).

I have downloaded & installed below packages already.

    1) .NET Framework 4.5. (NDP451-KB2858728-x86-x64-AllOS-ENU.exe)
    2) Windows Management Framework 4.0. (Windows6.1-KB2819745-x64-MultiPkg.msu)

Both the packages got installed without giving any error however when I go to Powershell prompt & type the following:

powershell -version 4

It throws an error:

    Cannot start Windows PowerShell version 4 because it is not correctly installed.

It looks like is .NET Framework 4.5.1 not compatible with Powershell V4. So, I have uninstalled .NET Framework 4.5.1 and Windows Management Framework 4.0. Then I installed .NET Framework 4.5 (dotnetfx45_full_x86_x64.exe) & re-installed WMF 4.0. And rebooted the computer. This time I saw Windows Update was running & it was updating OS. I knew that it was going well.

Now I have PowerShell 4.0 installed in my computer. If I type $PSVersionTable it will return the result as:

PS C:\Users\Admin> $PSVersionTable

—-        —–
PSVersion   4.0


Leave a Reply

Your email address will not be published. Required fields are marked *