参考文章https://blogs.technet.microsoft.com/heyscriptingguy/2012/05/16/use-the-get-command-powershell-cmdlet-to-find-parameter-set-information/


我们知道Get-process可以获得计算机的进程,每一个进程都是一个对象。既然是对象那么就拥有属性和方法;

Get-process | get-member 可以获得具体对象具备的属性和方法。

如下图所示:

Use the Get-Command PowerShell Cmdlet to Find Parameter Set Information_Powershell


我们选取其中一些属性进行查看,如下图

Use the Get-Command PowerShell Cmdlet to Find Parameter Set Information_Powershell_02


既然Get-process获取到的每一个进程是一个对象,他们具备了属性和方法;那么Get-process这个命令的本身是否也具备属性和方法呢?答案是有的,我们需要使用get-command get-process | get-member 来获取这个命令本身具备的属性和方法,如下图

Use the Get-Command PowerShell Cmdlet to Find Parameter Set Information_Powershell_03

我们查看下命令本身每个属性对应的信息,如下图

Use the Get-Command PowerShell Cmdlet to Find Parameter Set Information_Powershell_04

我们查看下Definition这个属性,这个属性中有很多的参数信息

Use the Get-Command PowerShell Cmdlet to Find Parameter Set Information_Powershell_05


假如,我现在想知道Powershell所有命令中包含“Module”参数的命令有哪些,那么我们就可以输入如下信息

Use the Get-Command PowerShell Cmdlet to Find Parameter Set Information_Powershell_06