powershell 2.0 do not support -notin operator.

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.

https://dba.stackexchange.com/questions/112961/what-can-i-use-for-the-powershell-notin-operator-in-v2-0

Check Powershell version in powershell command:

$PSVersionTable

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.

https://www.microsoft.com/en-us/download/details.aspx?id=34595

https://docs.microsoft.com/en-us/skypeforbusiness/set-up-your-computer-for-windows-powershell/download-and-install-windows-powershell-3-0

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.

https://www.microsoft.com/en-us/download/details.aspx?id=5842

https://serverfault.com/questions/591904/unable-to-install-powershell-4

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

原文地址:https://www.cnblogs.com/quinn-yann/p/9689108.html

时间: 2024-11-24 06:23:10

powershell 2.0 do not support -notin operator.的相关文章

在Windows Server 2008 R2上安装 PowerShell 5.0

在Windows Server 2008 R2上安装 PowerShell 5.0 安装.NET Framework 4.6.2 下载NDP462-KB3151800-x86-x64-AllOS-ENU.exe,安装 安装PowerShell 4.0(5.0依赖4.0) 下载Windows6.1-KB2819745-x64-MultiPkg.msu,安装. 安装PowerShell5.0 下载Win7AndW2K8R2-KB3134760-x64.msu,安装. 完成后,重启服务器.

在 Windows 7 和 Windows Server 2008 R2 上安装 Windows PowerShell 3.0

在 Windows 7 和 Windows Server 2008 R2 上安装 Windows PowerShell 3.0 Windows 7 和 Windows Server 2008 R2 内核版本同为6.1,以下步骤说明如何在运行 Windows 7 SP1 和 Windows Server 2008 R2 SP1 的机器上安装 Windows PowerShell 3.0. 安装准备 1. 在安装Windows Management Framework 3.0之前,卸载任何Windo

Windows XP 的 Windows PowerShell 1.0 本地化安装

用于 Windows XP 的 Windows PowerShell 1.0 本地化安装程序包 (KB926140) http://www.microsoft.com/zh-cn/download/details.aspx?id=9591 .NET Framework 各版本介绍和下载链接汇总 http://blog.xieyc.com/dotnetfx-versions-summary/ PS C:\Documents and Settings\Administrator> $a=123 PS

基于PowerShell 3.0的web接口测试

对于web接口测试,做一下总结. 接口测试总结 1. 接口url格式:http://www.xxx.com/a/bbb.html: 2. 接口url后面接的参数格式:“?参数名=参数值&参数名=参数值”: 3. 要清楚不同的参数名分别对应有多少种参数值: 4. 要清楚不同的参数值组合分别对应有多少种接口返回结果(即访问url后返回的json对象). 比如:有一个参数名为userName,一个userName的参数值对应的就是数据库表中一条用户记录的userName字段值,所以为了能够有足够的参数

解决 VM with version 2.1.0 has multidex support ; VM has multidex support, MultiDex support library is disabled.问题

发布打包完之后,android studio提示 VM with version 2.1.0 has multidex support I/MultiDex: installI/MultiDex: VM has multidex support, MultiDex support library is disabled. 解决方案:更新gradle 版本为2.1.0.

1分钟试用PowerShell 5.0新功能PowerShellGet安装Script Browser和Script Analyzer

微软PowerShell 产品组上周发布了PowerShell 5.0 PowerShellGet功能.有了它,IT 人员可以方便地搜索,安装,更新PowerShell Module.在这篇博客中,我将演示如果使用PowerShellGet安装微软ScriptBrowser和ScriptAnalyzer应用程序. 首先,你需要下载和安装PowerShell 5.0 http://go.microsoft.com/fwlink/?LinkId=398175 安装完成后,启动PowerShell I

3分钟带你了解PowerShell发展历程——PowerShell各版本资料整理

本文带你了解PowerShell发展历程,顺便整理了一点资料,方便大家查询. Windows PowerShell? 是基于任务的命令行管理程序和脚本语言,专为进行系统管理而设计. 在 .NET Framework 的基础上构建的 Windows PowerShell 可帮助 IT 专业人士和高级用户控制和自动执行 Windows 操作系统以及在 Windows 上运行的应用程序的管理. UNIX 系统一直有着功能强大的脚本(shell),Windows PowerShell 的诞生就是要提供功

使用NuGet安装EntityFramework4.2

使用NuGet安装EntityFrameWork4.2 1.下载NuGet 有两种方式下载NuGet 第一种:在微软的档案库下载,下载地址为:http://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c?SRC=VSIDE 弟二种:在vs2010的Tools中Extension Manager->OnlineGallery 中搜索NuGet并下载安装 2.安装NuGet 在安装NuGet时,遇

升级PowerShell至4.0版本

为了更好的使用Cmder v1.2,不得不升级PowerShell为4.0. 不知道Cmder的,可以点击这里:https://github.com/cmderdev/cmder 和 逆天神器 cmder. Powershell是运行在Windows机器上实现系统和应用程序管理自动化的命令行脚本环境. 需要.NET环境的支持, 同时支持.NET对象.当前PowerShell有5个版本,分别为1.0.2.0.3.0.4.0.5.0 如果系统是Windows 7或者Windows Server 20