Find-Script
Finds a script.
Syntax
Default (Default)
Find-Script
[[-Name] <String[]>]
[-MinimumVersion <String>]
[-MaximumVersion <String>]
[-RequiredVersion <String>]
[-AllVersions]
[-IncludeDependencies]
[-Filter <String>]
[-Tag <String[]>]
[-Includes <String[]>]
[-Command <String[]>]
[-Proxy <Uri>]
[-ProxyCredential <PSCredential>]
[-Repository <String[]>]
[-Credential <PSCredential>]
[-AllowPrerelease]
[<CommonParameters>]
Description
The Find-Script
cmdlet finds a specified script in registered repositories.
Examples
Example 1: Find all available scripts
Find-Script
This command finds all available scripts.
Example 2: Find a script by name
Find-Script -Name "Start-WFContosoServer"
This command find the script named Start-WFContosoServer.
Example 3: Find a script by name, required version, and from a specified repository
Find-Script -Name "Required-Script2" -RequiredVersion 2.0 -Repository "LocalRepo01"
This command finds a script by name and required version in the LocalRepo01 repository.
Example 4: Find a script and format the output as a list
Find-Script -Name "Required-Script2" -RequiredVersion 2.0 -Repository "LocalRepo1" | Format-List * -Force
This command finds Required-Script2 in the LocalRepo1 repository, and then passes the resulting
PSRepositoryItemInfo object to the Format-List
cmdlet.
Example 5: Find a script in the specified version range
Find-Script -Name "Required-Script2" -MinimumVersion 2.1 -MaximumVersion 2.5 -Repository "LocalRepo1"
Version Name Type Repository Description
------- ---- ---- ---------- -----------
2.5 Required-Script2 Script LocalRepo1 Description for the Required-Script2 script
This command finds all versions of RequiredScript2 between versions 2.1 and 2.5 in the LocalRepo1 respository.
Example 6: Find all versions of a script
Find-Script -Name "Required-Script02" -AllVersions
Version Name Type Repository Description
------- ---- ---- ---------- -----------
1.0 Required-Script2 Script LocalRepo1 Description for the Required-Script2 script
1.5 Required-Script2 Script LocalRepo1 Description for the Required-Script2 script
2.0 Required-Script2 Script LocalRepo1 Description for the Required-Script2 script
2.5 Required-Script2 Script LocalRepo1 Description for the Required-Script2 script
This command finds all versions of Required-Script02.
Example 7: Find a script and its dependencies
Find-Script -Name "Script-WithDependencies1" -IncludeDependencies -Repository "LocalRepo1"
Version Name Type Repository Description
------- ---- ---- ---------- -----------
1.0 Script-WithDependencies1 Script LocalRepo1 Description for the Script-WithDependencies1 script
2.0 RequiredModule3 Script LocalRepo1 RequiredModule3 module
2.5 Required-Script1 Script LocalRepo1 Description for the Required-Script1 script
2.5 Required-Script2 Script LocalRepo1 Description for the Required-Script2 script
This command finds a script and its dependencies.
Example 8: Find scripts with the specified tag
Find-Script -Tag "Tag1" -Repository "LocalRepo1"
Version Name Type Repository Description
------- ---- ---- ---------- -----------
1.0 Fabrikam-ClientScript Script LocalRepo1 Description for the Fabrikam-ClientScript script
This command finds scripts that have the tag Tag1 in the LocalRepo1 repository
Example 9: Find scripts with specified command name
Find-Script -Command Test-FunctionFromScript_Required-Script3 -Repository "LocalRepo1"
Version Name Type Repository Description
------- ---- ---- ---------- -----------
2.5 Required-Script3 Script LocalRepo1 Description for the Required-Script3 script
This command finds a script that contains the specified command name.
Example 10: Find scripts with workflows
Find-Script -Includes "Workflow" -Repository "LocalRepo1"
Version Name Type Repository Description
------- ---- ---- ---------- -----------
2.5 Fabrikam-ClientScript Script LocalRepo1 Description for the Fabrikam-ClientScript script
1.0 Fabrikam-Script Script LocalRepo1 Description for the Fabrikam-Script script
This command finds workflow scripts in the LocalRepo1 repository.
Example 11: Find scripts using wildcards
Find-Script -Name "Required-Script*" -Repository "LocalRepo1"
Version Name Type Repository Description
------- ---- ---- ---------- -----------
2.5 Required-Script1 Script local1 Description for the Required-Script1 script
2.5 Required-Script2 Script local1 Description for the Required-Script2 script
2.5 Required-Script3 Script local1 Description for the Required-Script3 script
This command uses the wildcard character (*
) to find scripts that begin with Required-Script.
Parameters
-AllowPrerelease
Includes in the results scripts marked as a prerelease.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-AllVersions
Indicates that this operation finds all script versions.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Command
Specifies an array of commands to find in scripts. A command can be a function or workflow.
Parameter properties
Type: | String[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Credential
Specifies a user account that has permission to access the repository to search for scripts.
Parameter properties
Type: | PSCredential |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-Filter
Finds scripts based on the PackageManagement provider-specific search syntax.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-IncludeDependencies
Indicates that this operation gets all scripts that are dependent upon the script specified in the Name parameter.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Includes
Specifies type of script to get. The acceptable values for this parameter are:
Function
Workflow
Parameter properties
Type: | String[] |
Default value: | None |
Accepted values: | Function, Workflow |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-MaximumVersion
Specifies the maximum, or newest, version of the script to find. The MaximumVersion and RequiredVersion parameters are mutually exclusive; you cannot use both parameters in the same command.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-MinimumVersion
Specifies the minimum version of the script to find. The MinimumVersion and RequiredVersion parameters are mutually exclusive; you cannot use both parameters in the same command.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-Name
Specifies an array of names of scripts to find.
Parameter properties
Type: | String[] |
Default value: | None |
Supports wildcards: | True |
DontShow: | False |
Parameter sets
(All)
Position: | 0 |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-Proxy
Specifies a proxy server for the request, rather than connecting directly to the Internet resource.
Parameter properties
Type: | Uri |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-ProxyCredential
Specifies a user account that has permission to use the proxy server that is specified by the Proxy parameter.
Parameter properties
Type: | PSCredential |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-Repository
Specifies the friendly name of a repository that has been registered by running
Register-PSRepository
.
Parameter properties
Type: | String[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-RequiredVersion
Specifies the exact version number of the script to find.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-Tag
Specifies an array of tags.
Parameter properties
Type: | String[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
String
String
Uri
PSCredential
Outputs
PSRepositoryItemInfo
Notes
Important
As of April 2020, the PowerShell Gallery no longer supports Transport Layer Security (TLS) versions 1.0 and 1.1. If you are not using TLS 1.2 or higher, you will receive an error when trying to access the PowerShell Gallery. Use the following command to ensure you are using TLS 1.2:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
For more information, see the announcement in the PowerShell blog.