Powershell Get-Verb安装缺少某些功能

时间:2020-05-30 01:41:10

标签: powershell windows-10

使用Windows 10上的默认安装对Powershell完全陌生。

在我的系统上,运行Get-Verb会给我:

> Get-Verb un*                                                                                                                                                                                                                              
Verb       Group
----       -----
Undo       Common
Unlock     Common
Unpublish  Data
Uninstall  Lifecycle
Unregister Lifecycle
Unblock    Security
Unprotect  Security

与我正在(在Pluralsight上)和Microsoft docs上观看的教程不同:

> Get-Verb un*
Verb       AliasPrefix Group     Description
----       ----------- -----     -----------
Undo       un          Common    Sets a resource to its previous state
Unlock     uk          Common    Releases a resource that was locked
Unpublish  ub          Data      Makes a resource unavailable to others
Uninstall  us          Lifecycle Removes a resource from an indicated location
Unregister ur          Lifecycle Removes the entry for a resource from a repository
Unblock    ul          Security  Removes restrictions to a resource
Unprotect  up          Security  Removes safeguards from a resource that were added to prevent it from attack or loss

我还注意到某些其他功能似乎丢失了,例如某些属性。我收到错误消息:

> Get-Verb -Group Security | Format-List

Get-Verb : A parameter cannot be found that matches parameter name 'Group'.
At line:1 char:10
+ get-verb -Group Security | format-list
+          ~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-Verb], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Get-Verb

在手册页和教程中,使用-Group选项是有效的。我的联机帮助页似乎缺少-Group选项,即看起来像这样(与文档中的版本比较):

> man Get-Verb

NAME
    Get-Verb

SYNOPSIS


SYNTAX
    Get-Verb [[-verb] <String[]>] [<CommonParameters>]


DESCRIPTION


RELATED LINKS
    https://go.microsoft.com/fwlink/?LinkID=160712

REMARKS
    To see the examples, type: "get-help Get-Verb -examples".
    For more information, type: "get-help Get-Verb -detailed".
    For technical information, type: "get-help Get-Verb -full".
    For online help, type: "get-help Get-Verb -online"

造成差异的原因是什么?

其他详细信息(可能相关或可能不相关):

  • 我最近安装了.NET Core和RSAT工具,但我认为它们不会引起此问题。
  • 我正在使用Windows 10 Education N。
  • $PSVersionTable的输出:

    Name                           Value
    ----                           -----
    PSVersion                      5.1.18362.752
    PSEdition                      Desktop
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
    BuildVersion                   10.0.18362.752
    CLRVersion                     4.0.30319.42000
    WSManStackVersion              3.0
    PSRemotingProtocolVersion      2.3
    SerializationVersion           1.1.0.1
    

1 个答案:

答案 0 :(得分:1)

我相信Get-Verb的更具描述性的输出用于PowerShell Core(6+)。 Windows PowerShell(默认情况下安装在Windows上的Windows PowerShell; 5.1或更低版本)不提供该功能。

不幸的是,文档站点上似乎存在差异。如果使用下拉菜单切换到PS 5.1,则不能正确使用。