Windows PowerShell command on Get-command Find-Command
MyWebUniversity

Windows PowerShell command on Get-command Find-Command

NAME

Find-Command

SYNOPSIS

Finds PowerShell commands in modules.

SYNTAX

Find-Command [[-Name] ] [-AllVersions] [-Filter ] [-MaximumVersion ] [-MinimumVersion

] [-ModuleName ] [-Proxy ] [-ProxyCredential ] [-Repository ]

[-RequiredVersion ] [-Tag ] []

DESCRIPTION

The Find-Command cmdlet finds PowerShell commands such as cmdlets, aliases, functions, and workflows. Find-Command

searches modules in registered repositories. For each command that this cmdlet finds, it returns a PSGetCommandInfo object. You can pass a PSGetCommandInfo

object to the Install-Module cmdlet to install the module that contains the command.

PARAMETERS

-AllVersions []

Indicates that this cmdlet gets all versions of a module. Required? false Position? named Default value False Accept pipeline input? False Accept wildcard characters? false

-Filter

Finds modules based on the PackageManagement provider-specific search syntax. For NuGet, this is the

equivalent of using the search bar on the PowerShell Gallery website. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false

-MaximumVersion

@{Text=} Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false

-MinimumVersion

Specifies the minimum version of the module to include in results. The MinimumVersion and the RequiredVersion parameters are mutually exclusive; you cannot use both parameters in the same command. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false

-ModuleName

Specifies the name of the module in which to search for commands. The default is all modules. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false

-Name

Specifies an array of names of commands to search for. Required? false Position? 0 Default value None Accept pipeline input? False Accept wildcard characters? false

-Proxy

@{Text=} Required? false Position? named Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false

-ProxyCredential

@{Text=} Required? false Position? named Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false

-Repository

Specifies an array of registered repositories in which to search. The default is all repositories. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false

-RequiredVersion

Specifies the version of the module to include in the results. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false

-Tag

Specifies an array of tags. Required? false Position? named Default value None Accept pipeline input? False Accept wildcard characters? false This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

OUTPUTS

NOTES

Example 1: Find all commands in a specified repository

PS C:\>Find-Command -Repository "INT" | Select-Object -First 10

Name Version ModuleName Repository

---- ------- ---------- ----------

Get-RequiredModule4 2.5 RequiredModule4 INT

Get-RequiredModule5 2.5 RequiredModule5 INT

Get-NestedRequiredModule4 2.5 NestedRequiredModule4 INT

Get-NestedRequiredModule5 2.5 NestedRequiredModule5 INT

Enable-AzureRmDataCollection 1.0.4 AzureRM.Profile INT

Disable-AzureRmDataCollection 1.0.4 AzureRM.Profile INT

Remove-AzureRmEnvironment 1.0.4 AzureRM.Profile INT

Get-AzureRmEnvironment 1.0.4 AzureRM.Profile INT

Set-AzureRmEnvironment 1.0.4 AzureRM.Profile INT

Add-AzureRmEnvironment 1.0.4 AzureRM.Profile INT

This command finds commands in modules in the INT repository, and uses the pipeline operator to pass the results

to Select-Object to select the first 10 commands.

Example 2: Find a command by name

PS C:\>Find-Command -Repository "INT" -Name "Get-ContosoClient"

Name Version ModuleName Repository

---- ------- ---------- ----------

Get-ContosoClient 2.5 ContosoClient INT

This command finds the command named Get-ContosoClient in the INT repository. The command is contained in the

ContosoClient module.

Example 3: Find commands by name and install them

PS C:\>Find-Command -Repository "INT" -Name "Get-ContosoClient,Get-ContosoServer" | Install-Module

PS C:\> Get-InstalledModule

Version Name Type Repository Description

------- ---- ---- ---------- -----------

2.5 ContosoClient Module INT ContosoClient module 2.5 ContosoServer Module INT ContosoServer module The first command finds the specified commands in the INT repository, and then uses the pipeline operator to pass

them to Install-Module to install them.

The second command uses Get-InstalledModule to verify the modules from the prior command are installed.

Example 4: Find a command and save its module

PS C:\>Find-Command -Name "Get-NestedRequiredModule4" -Repository "INT" | Save-Module -Path "C:\temp\" -Verbose

This command finds the specified command, and then passes it to Save-Module to save it to the C:\temp folder.

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkId=822318



Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 OurUNIX.com ™