Update-ScriptFileInfo

Updates information for a script.

语法

PathParameterSet (默认值)

Update-ScriptFileInfo
    [-Path] <String>
    [-Version <String>]
    [-Author <String>]
    [-Guid <Guid>]
    [-Description <String>]
    [-CompanyName <String>]
    [-Copyright <String>]
    [-RequiredModules <Object[]>]
    [-ExternalModuleDependencies <String[]>]
    [-RequiredScripts <String[]>]
    [-ExternalScriptDependencies <String[]>]
    [-Tags <String[]>]
    [-ProjectUri <Uri>]
    [-LicenseUri <Uri>]
    [-IconUri <Uri>]
    [-ReleaseNotes <String[]>]
    [-PrivateData <String>]
    [-PassThru]
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

LiteralPathParameterSet

Update-ScriptFileInfo
    [-LiteralPath] <String>
    [-Version <String>]
    [-Author <String>]
    [-Guid <Guid>]
    [-Description <String>]
    [-CompanyName <String>]
    [-Copyright <String>]
    [-RequiredModules <Object[]>]
    [-ExternalModuleDependencies <String[]>]
    [-RequiredScripts <String[]>]
    [-ExternalScriptDependencies <String[]>]
    [-Tags <String[]>]
    [-ProjectUri <Uri>]
    [-LicenseUri <Uri>]
    [-IconUri <Uri>]
    [-ReleaseNotes <String[]>]
    [-PrivateData <String>]
    [-PassThru]
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

说明

The Update-ScriptFileInfo cmdlet updates a script's property values. For example, the values for version, author, or description.

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

示例

Example 1: Update the version of a script file

In this example, an existing script file is updated with new property values.

Splatting is used to pass parameters to the Update-ScriptFileInfo cmdlet. For more information, see about_Splatting.

$Parms = @{
  Path = "C:\Test\Temp-Scriptfile.ps1"
  Version = "2.0"
  Author = "bob@contoso.com"
  CompanyName = "Contoso"
  Description = "This is the updated description"
  }
Update-ScriptFileInfo @Parms -PassThru
<#PSScriptInfo

.VERSION 2.0

.GUID 4609f00c-e850-4d3f-9c69-3741e56e4133

.AUTHOR bob@contoso.com

.COMPANYNAME Contoso

.COPYRIGHT

.TAGS

.LICENSEURI

.PROJECTURI

.ICONURI

.EXTERNALMODULEDEPENDENCIES

.REQUIREDSCRIPTS

.EXTERNALSCRIPTDEPENDENCIES

.RELEASENOTES

.PRIVATEDATA

#>

<#

.DESCRIPTION
This is the updated description

#>
Param()

$Parms stores the parameter values for Path, Version, Author, CompanyName, and Description. Update-ScriptFileInfo gets the parameter values from @Parms and updates the script. The PassThru parameter displays the script's contents in the PowerShell console.

参数

-Author

Specifies the script author.

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-CompanyName

Specifies the company or vendor who created the script.

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Confirm

The proxy cmdlet ignores this parameter since it's not supported by Update-PSScriptFileInfo.

参数属性

类型:SwitchParameter
默认值:False
支持通配符:False
不显示:False
别名:cf

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

Specifies a copyright statement for the script.

类型:String
默认值:None
支持通配符:False
不显示:False
(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Description

Specifies a description for the script.

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ExternalModuleDependencies

Specifies an array of external module dependencies.

参数属性

类型:

String[]

默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ExternalScriptDependencies

Specifies an array of external script dependencies.

参数属性

类型:

String[]

默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Force

The proxy cmdlet ignores this parameter since it's not supported by Update-PSScriptFileInfo.

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Guid

Specifies a unique ID for a script.

参数属性

类型:Guid
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-IconUri

Specifies the URL of an icon for the script. The specified icon is displayed on the gallery web page for the script.

参数属性

类型:Uri
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-LicenseUri

Specifies the URL of licensing terms.

参数属性

类型:Uri
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-LiteralPath

Specifies a path to one or more locations. The LiteralPath parameter's value is used exactly as it's entered. No characters are interpreted as wildcards. If the path includes escape characters, enclose them in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences.

The proxy cmdlet maps this parameter to the Path parameter of Update-PSScriptFileInfo.

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False
别名:PSPath

参数集

LiteralPathParameterSet
Position:0
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-PassThru

The proxy cmdlet ignores this parameter since it's not supported by Update-PSScriptFileInfo.

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Path

Specifies the script file's ___location. Wildcards are permitted.

参数属性

类型:String
默认值:None
支持通配符:True
不显示:False

参数集

PathParameterSet
Position:0
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-PrivateData

Specifies the private data for the script.

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ProjectUri

Specifies the URL of a web page about this project.

参数属性

类型:Uri
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ReleaseNotes

Specifies a string array that contains release notes or comments that you want available for this version of the script.

参数属性

类型:

String[]

默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-RequiredModules

Specifies modules that must be in the global session state. If the required modules aren't in the global session state, PowerShell imports them.

参数属性

类型:

Object[]

默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-RequiredScripts

Specifies an array of required scripts.

参数属性

类型:

String[]

默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Tags

Specifies an array of tags.

参数属性

类型:

String[]

默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Version

Specifies the script's version.

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-WhatIf

The proxy cmdlet ignores this parameter since it's not supported by Update-PSScriptFileInfo.

参数属性

类型:SwitchParameter
默认值:False
支持通配符:False
不显示:False
别名:wi

参数集

(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

输出

Object

备注

Use the Test-ScriptFileInfo cmdlet to validate a script's metadata. Scripts must include values for Version, GUID, Description, and Author.