| external help file | Microsoft.PowerShell.PSResourceGet.dll-Help.xml |
|---|---|
| Module Name | Microsoft.PowerShell.PSResourceGet |
| ms.custom | 1.1.1 |
| ms.date | 10/31/2024 |
| online version | https://learn.microsoft.com/powershell/module/microsoft.powershell.psresourceget/update-psscriptfileinfo?view=powershellget-3.x&WT.mc_id=ps-gethelp |
| schema | 2.0.0 |
This cmdlet updates the comment-based metadata in an existing script .ps1 file.
Update-PSScriptFileInfo [-Author <String>] [-CompanyName <String>] [-Copyright <String>]
[-Description <String>] [-ExternalModuleDependencies <String[]>]
[-ExternalScriptDependencies <String[]>] [-Guid <Guid>] [-IconUri <String>] [-LicenseUri <String>]
[-Path] <String> [-PrivateData <String>] [-ProjectUri <String>] [-ReleaseNotes <String>]
[-RemoveSignature] [-RequiredModules <Hashtable[]>] [-RequiredScripts <String[]>]
[-Tags <String[]>] [-Version <String>] [<CommonParameters>]
This cmdlet updates the comment-based metadata in an existing script .ps1 file. This is similar to
Update-ModuleManifest.
In this example, a script is created with Version set to 1.0.0.0. Update-PSScriptFileInfo
changes the Version' to 2.0.0.0. The Get-Content cmdlet shows the updated contents of the
script.
$parameters = @{
FilePath = "C:\Users\johndoe\MyScripts\test_script.ps1"
Version = "1.0.0.0"
Description = "this is a test script"
}
New-PSScriptFileInfo @parameters
$parameters.Version = "2.0.0.0"
Update-PSScriptFileInfo @parameters
Get-Content $parameters.FilePath<#PSScriptInfo
.VERSION 2.0.0.0
.GUID 6ec3934e-a2e0-495b-9a9c-480e555ad1d1
.AUTHOR johndoe
.COMPANYNAME
.COPYRIGHT
.TAGS
.LICENSEURI
.PROJECTURI
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
.PRIVATEDATA
#>
<#
.DESCRIPTION
this is a test script
#>
The name of the author of the script.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe name of the company owning the script.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe copyright information for the script.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe description of the script.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe list of external module dependencies taken by this script.
Type: System.String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe list of external script dependencies taken by this script.
Type: System.String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe unique identifier for the script in GUID format.
Type: System.Guid
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseA Uniform Resource Identifier (URI) pointing to the icon associated with the script.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe URI pointing to the license agreement file associated with the script.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe filename and location of the script.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe private data associated with the script.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe URI pointing to the project site associated with the script.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe release notes for the script.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseRemoves the signature from a signed .ps1 file, allowing you to update the script. You should
re-sign the after updating the file.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseThe parameter takes an array of module specification hashtables. A module specification is a hashtable that has the following keys.
ModuleName- Required Specifies the module name.GUID- Optional Specifies the GUID of the module.- It's also Required to specify at least one of the three below keys.
ModuleVersion- Specifies a minimum acceptable version of the module.MaximumVersion- Specifies the maximum acceptable version of the module.RequiredVersion- Specifies an exact, required version of the module. This can't be used with the other Version keys.
Type: System.Collections.Hashtable[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe list of scripts required by the script.
Type: System.String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe tags associated with the script. Tag values are strings that shouldn't contain spaces. For more information, see Tag details.
Type: System.String[]
Parameter Sets: (All)
Aliases: Tag
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe version of the script.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
The New-PSScriptFileInfo and Update-PSScriptFileInfo cmdlets place the #requires statements
for required modules between the <#PSScriptInfo and comment-based help blocks of the help file.
The Get-PSScriptFileInfo expects #requires statements to be placed somewhere before the
comment-based help block. Any #requires statements placed after the comment-based help block are
ignored by Get-PSScriptFileInfo and Publish-PSResource.
PowerShellGallery Publishing Guidelines and Best Practices
Package manifest values that impact the PowerShell Gallery UI