Get-Verb
获取已批准的 PowerShell 谓词。
语法
Default (默认值)
Get-Verb
    [[-Verb] <String[]>]
    [[-Group] <String[]>]
    [<CommonParameters>]
	说明
              Get-Verb 函数获取批准在 PowerShell 命令中使用的谓词。
建议 PowerShell cmdlet 和函数名称具有 Verb-Noun 格式,并包含已批准的谓词。 这种做法使命令名称更加一致、可预测且更易于使用。
使用未经批准的谓词的命令仍在 PowerShell 中运行。 但是,当你导入包含名称中带有未经批准的谓词的命令的模块时,Import-Module 命令会显示一条警告消息。
注释
              Get-Verb 返回的谓词列表可能不完整。 有关带说明的已批准 PowerShell 谓词的更新列表,请参阅 已批准的谓词。
示例
示例 1 - 获取所有谓词的列表
Get-Verb
	示例 2 - 获取以“un”开头的已批准谓词列表
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
	示例 3 - 获取安全组中的所有已批准谓词
Get-Verb -Group Security
Verb      AliasPrefix Group    Description
----      ----------- -----    -----------
Block     bl          Security Restricts access to a resource
Grant     gr          Security Allows access to a resource
Protect   pt          Security Safeguards a resource from attack or loss
Revoke    rk          Security Specifies an action that does not allow access to a resource
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
	示例 4 - 查找模块中具有未批准的谓词的所有命令
Get-Command -Module Microsoft.PowerShell.Utility | Where-Object Verb -NotIn (Get-Verb).Verb
CommandType     Name            Version    Source
-----------     ----            -------    ------
Cmdlet          Sort-Object     3.1.0.0    Microsoft.PowerShell.Utility
Cmdlet          Tee-Object      3.1.0.0    Microsoft.PowerShell.Utility
	参数
-Group
仅获取指定的组。 输入组的名称。 不允许通配符。
此参数是在 PowerShell 6.0 中引入的。
参数属性
| 类型: | String[]  | 
| 默认值: | All groups | 
| 接受的值: | Common, Communications, Data, Diagnostic, Lifecycle, Other, Security | 
| 支持通配符: | False | 
| 不显示: | False | 
参数集
(All)
| Position: | 1 | 
| 必需: | False | 
| 来自管道的值: | True | 
| 来自管道的值(按属性名称): | True | 
| 来自剩余参数的值: | False | 
-Verb
仅获取指定的谓词。 输入谓词或名称模式的名称。 允许通配符。
参数属性
| 类型: | String[]  | 
| 默认值: | All verbs | 
| 支持通配符: | True | 
| 不显示: | False | 
参数集
(All)
| Position: | 0 | 
| 必需: | False | 
| 来自管道的值: | True | 
| 来自管道的值(按属性名称): | True | 
| 来自剩余参数的值: | False | 
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。
输入
None
不能用管道将对象传送到此 cmdlet。
输出
VerbInfo
备注
PowerShell 谓词根据最常用的用途分配给组。 这些组旨在使谓词易于查找和比较,而不是限制其使用。 可以对任何类型的命令使用任何批准的谓词。
每个 PowerShell 谓词都分配给以下组之一。
- 常见:定义可应用于几乎所有 cmdlet 的泛型操作,例如 Add。
 - 通信:定义适用于通信的操作,例如 Connect。
 - 数据:定义应用于数据处理的操作,例如备份。
 - 诊断:定义适用于诊断的操作,例如调试。
 - 生命周期:定义应用于 cmdlet 生命周期的操作,例如 Complete。
 - 安全性:定义应用于安全性的操作,例如 Revoke。
 - 其他:定义其他类型的操作。
 
一些随 PowerShell 一起安装的 cmdlet(如 Tee-Object 和 Where-Object)使用未经批准的谓词。 这些 cmdlet 是历史性的例外,其谓词被归类为保留 。