Skip to content

Latest commit

 

History

History
245 lines (178 loc) · 5.47 KB

File metadata and controls

245 lines (178 loc) · 5.47 KB
external help file PSModule-help.xml
Locale en-US
Module Name PowerShellGet
ms.date 07/09/2019
online version https://learn.microsoft.com/powershell/module/powershellget/update-script?view=powershellget-1.x&WT.mc_id=ps-gethelp
schema 2.0.0
title Update-Script

Update-Script

SYNOPSIS

Updates a script.

SYNTAX

All

Update-Script [[-Name] <String[]>] [-RequiredVersion <Version>] [-MaximumVersion <Version>]
 [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-Credential <PSCredential>] [-Force] [-WhatIf]
 [-Confirm] [<CommonParameters>]

DESCRIPTION

The Update-Script cmdlet updates a script that is installed on the local computer. The updated script is downloaded from the same repository as the installed version.

EXAMPLES

Example 1: Update the specified script

This example updates an installed script and displays the updated version.

Update-Script -Name UpdateManagement-Template -RequiredVersion 1.1
Get-InstalledScript -Name UpdateManagement-Template
Version   Name                       Repository   Description
-------   ----                       ----------   -----------
1.1       UpdateManagement-Template  PSGallery    This is a template script for Update Management...

Update-Script uses the Name parameter to specify the script to update. The RequiredVersion parameter specifies the script version. Get-InstalledScript displays the updated version of the script.

PARAMETERS

-Credential

Specifies a user account that has permission to update a script.

Type: System.Management.Automation.PSCredential
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Force

Forces Update-Script to run without asking for user confirmation.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-MaximumVersion

Specifies the maximum, or newest, version of the script to update. The MaximumVersion and RequiredVersion parameters can't be used in the same command.

Type: System.Version
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Name

Specifies one script name or an array of script names to update.

Type: System.String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Proxy

Specifies a proxy server for the request rather than connecting directly to an internet resource.

Type: System.Uri
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ProxyCredential

Specifies a user account that has permission to use the proxy server specified by the Proxy parameter.

Type: System.Management.Automation.PSCredential
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-RequiredVersion

Specifies the exact version number of the script to update. The MinimumVersion and RequiredVersion parameters can't be used in the same command.

Type: System.Version
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running Update-Script.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if Update-Script runs. The cmdlet isn't run.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String[]

System.Version

System.Uri

System.Management.Automation.PSCredential

OUTPUTS

System.Object

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.

RELATED LINKS

Find-Script

Install-Script

Publish-Script

Save-Script

Uninstall-Script