Поделиться через


Find-Script

Finds a script.

Синтаксис

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>]

Описание

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

This is a proxy cmdlet for the Find-PSResource cmdlet in the Microsoft.PowerShell.PSResourceGet. For more information, see Find-PSResource.

Примеры

Example 1: Find a script by name

Find-Script -Name "Start-WFContosoServer"

This command find the script named Start-WFContosoServer.

Example 2: 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 3: 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 4: 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 5: 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 6: 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 7: 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 8: 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.

Параметры

-AllowPrerelease

Includes in the results scripts marked as a prerelease.

The proxy cmdlet maps this parameter to the Prerelease parameter of Find-PSResource.

Свойства параметра

Тип:SwitchParameter
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-AllVersions

Indicates that this operation finds all script versions.

The proxy cmdlet transforms this parameter to -Version * before calling Find-PSResource.

Свойства параметра

Тип:SwitchParameter
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-Command

The proxy cmdlet ignores this parameter since it's not supported by the NameParameterSet of Find-PSResource.

Свойства параметра

Тип:

String[]

Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-Credential

Specifies a user account that has permission to access the repository to search for scripts.

Свойства параметра

Тип:PSCredential
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:True
Значение из оставшихся аргументов:False

-Filter

The proxy cmdlet ignores this parameter since it's not supported by the NameParameterSet of Find-PSResource.

Свойства параметра

Тип:String
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-IncludeDependencies

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

Свойства параметра

Тип:SwitchParameter
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-Includes

The proxy cmdlet ignores this parameter since it's not supported by the NameParameterSet of Find-PSResource.

Свойства параметра

Тип:

String[]

Default value:None
Допустимые значения:Function, Workflow
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-MaximumVersion

The proxy cmdlet uses the value of this parameter to create a NuGet version search string for use with the Version parameter of Find-PSResource.

Свойства параметра

Тип:String
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:True
Значение из оставшихся аргументов:False

-MinimumVersion

The proxy cmdlet uses the value of this parameter to create a NuGet version search string for use with the Version parameter of Find-PSResource.

Свойства параметра

Тип:String
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:True
Значение из оставшихся аргументов:False

-Name

Specifies an array of names of scripts to find.

Свойства параметра

Тип:

String[]

Default value:None
Поддерживаются подстановочные знаки:True
DontShow:False

Наборы параметров

(All)
Position:0
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:True
Значение из оставшихся аргументов:False

-Proxy

The proxy cmdlet ignores this parameter since it's not supported by the NameParameterSet of Find-PSResource.

Свойства параметра

Тип:Uri
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:True
Значение из оставшихся аргументов:False

-ProxyCredential

The proxy cmdlet ignores this parameter since it's not supported by the NameParameterSet of Find-PSResource.

Свойства параметра

Тип:PSCredential
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:True
Значение из оставшихся аргументов:False

-Repository

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

Свойства параметра

Тип:

String[]

Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов:False

-RequiredVersion

The proxy cmdlet uses the value of this parameter to create a NuGet version search string for use with the Version parameter of Find-PSResource.

Свойства параметра

Тип:String
Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:True
Значение из оставшихся аргументов:False

-Tag

Specifies an array of tags.

Свойства параметра

Тип:

String[]

Default value:None
Поддерживаются подстановочные знаки:False
DontShow:False

Наборы параметров

(All)
Position:Named
Обязательно:False
Значение из конвейера:False
Значение из конвейера по имени свойства:False
Значение из оставшихся аргументов: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.

Входные данные

String

String

Uri

PSCredential

Выходные данные

PSRepositoryItemInfo

Примечания

The PowerShell Gallery no longer supports Transport Layer Security (TLS) versions 1.0 and 1.1. You must use TLS 1.2 or higher. Use the following command to ensure you are using TLS 1.2:

[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12