< Back

Find-Script

Wed Jan 30, 2019 5:57 pm

NAME Find-Script



SYNOPSIS

Finds a script.





SYNTAX

Find-Script [[-Name] <String[]>] [-AllVersions] [-Command <String[]>] [-Credential <PSCredential>] [-Filter <String>] [-IncludeDependencies] [-Includes

{Function | Workflow}] [-MaximumVersion <Version>] [-MinimumVersion <Version>] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-Repository <String[]>]

[-RequiredVersion <Version>] [-Tag <String[]>] [<CommonParameters>]





DESCRIPTION

The Find-Script cmdlet finds a specified script in registered repositories.





PARAMETERS

-AllVersions [<SwitchParameter>]

Indicates that this operation finds all script versions.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Command <String[]>

Specifies an array of commands to find in scripts. A command can be a function or workflow.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Credential <PSCredential>

@{Text=}



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Filter <String>

Finds scripts based on the PackageManagement provider-specific search syntax.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-IncludeDependencies [<SwitchParameter>]

Indicates that this operation gets all scripts that are dependent upon the script specified in the Name parameter.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Includes <String[]>

Specifies type of script to get. The acceptable values for this parameter are: Function, Workflow.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-MaximumVersion <Version>

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.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-MinimumVersion <Version>

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.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Name <String[]>

Specifies an array of names of scripts to find.



Required? false

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Proxy <Uri>

@{Text=}



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ProxyCredential <PSCredential>

@{Text=}



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Repository <String[]>

Specifies the friendly name of a repository that has been registered by running Register-PSRepository.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-RequiredVersion <Version>

Specifies the exact version number of the script to find.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Tag <String[]>

Specifies an array of tags.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

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

PSRepositoryItemInfo







NOTES









Example 1: Find all available scripts



PS C:\\>Find-Script

Version Name Type Repository Description

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

2.5 Fabrkiam-ClientScript Script LocalRepo1 Description for the Fabrkiam-ClientScript script

2.5 Fabrkiam-Script Script LocalRepo1 Description for the Fabrkiam-Script script

2.5 Fabrkiam-ServerScript Script LocalRepo1 Description for the Fabrkiam-ServerScript script

2.5 Required-Script1 Script LocalRepo1 Description for the Required-Script1 script

2.5 Required-Script2 Script LocalRepo1 Description for the Required-Script2 script

2.5 Required-Script3 Script LocalRepo1 Description for the Required-Script3 script

2.0 Script-WithDependencies1 Script LocalRepo1 Description for the Script-WithDependencies1 script

2.0 Script-WithDependencies2 Script LocalRepo1 Description for the Script-WithDependencies2 script

2.0 Start-WFContosoServer Script LocalRepo1 Start-WFContosoServer Script example

2.1 Test-Script1 Script LocalRepo1 Test-Script1 Script example

2.0 Test-Script2 Script LocalRepo1 Test-Script2 Script example

1.0 TestRunbook Script LocalRepo1 Contoso Script example



This command finds all available scripts.

Example 2: Find a script by name



PS C:\\>Find-Script -Name "Start-WFContosoServer"

Version Name Type Repository Description

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

2.0 Start-WFContosoServer Script LocalRepo1 Start-WFContosoServer Script example



This command find the script named Start-WFContosoServer.

Example 3: Find a script by name, required version, and from a specified repository



PS C:\\>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



PS C:\\>Find-Script -Name "Required-Script2" -RequiredVersion 2.0 -Repository "LocalRepo1" | Format-List * -Force

Name : Required-Script2

Version : 2.0

Type : Script

Description : Description for the Required-Script2 script

Author : pattif

CompanyName : Microsoft Corporation

Copyright : ????????? 2015 Microsoft Corporation. All rights reserved.

PublishedDate : 8/14/2015 2:37:01 PM

LicenseUri : http://required-script2.com/license

ProjectUri : http://required-script2.com/

IconUri : http://required-script2.com/icon

Tags : {, Tag1, Tag2, Tag-Required-Script2-2.0...}

Includes : {Function, DscResource, Cmdlet, Command}

PowerShellGetFormatVersion :

ReleaseNotes : Required-Script2 release notes

Dependencies : {}

RepositorySourceLocation : C:\\MyLocalRepo

Repository : LocalRepo01

PackageManagementProvider : NuGet



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



PS C:\\>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



PS C:\\>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 dependent modules and scripts



PS C:\\>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 it dependencies.

Example 8: Find scripts with the specified tag



PS C:\\>Find-Script -Tag "Tag1" -Repository "LocalRepo1"

Version Name Type Repository Description

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

1.0 Fabrkiam-ClientScript Script LocalRepo1 Description for the Fabrkiam-ClientScript script



This command finds scripts that have the tag Tag1 in the LocalRepo1 repository

Example 9: Find scripts with specified command name



PS C:\\>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



PS C:\\>Find-Script -Includes "Workflow" -Repository "LocalRepo1"

Version Name Type Repository Description

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

2.5 Fabrkiam-ClientScript Script LocalRepo1 Description for the Fabrkiam-ClientScript script

1.0 Fabrkiam-Script Script LocalRepo1 Description for the Fabrkiam-Script script



This command finds workflow scripts in the LocalRepo1 repository.

Example 11: Find scripts using wildcards



PS C:\\>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.



RELATED LINKS

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

Install-Script

Publish-Script

Save-Script

Uninstall-Script

Update-Script