Skip to content
PowerShell Commands

Update-Script

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

The Update-Script cmdlet updates the specified script from the repository from which it was previously installed.

Parameters

-Confirm [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Prompts you for confirmation before running the cmdlet.

-Credential <PSCredential>

  • Default value is None
  • Accepts pipeline input ByPropertyName

@{Text=}

-Force [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Forces the command to run without asking for user confirmation.

-MaximumVersion <Version>

  • Default value is None
  • Accepts pipeline input ByPropertyName

Specifies the maximum, or newest, version of the script to update. The MaximumVersion and RequiredVersion parameters are mutually exclusive; you cannot use both parameters in the same command.

-Name <String[]>

  • Default value is None
  • Accepts pipeline input ByPropertyName

Specifies an array of names of scripts to update.

-Proxy <Uri>

  • Default value is None
  • Accepts pipeline input ByPropertyName

@{Text=}

-ProxyCredential <PSCredential>

  • Default value is None
  • Accepts pipeline input ByPropertyName

@{Text=}

-RequiredVersion <Version>

  • Default value is None
  • Accepts pipeline input ByPropertyName

Specifies the exact version number of the script to update. The MinimumVersion and RequiredVersion parameters are mutually exclusive; you cannot use both parameters in the same command.

-WhatIf [<SwitchParameter>]

  • Default value is False
  • Accepts pipeline input False

Shows what would happen if the cmdlet runs. The cmdlet is not run.

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Examples
  1. Update the specified script:
    PS C:\> Update-Script -Name "Fabrikam-Script" -RequiredVersion 1.5
    PS C:\>  Get-InstalledScript -Name "Fabrikam-Script"
    
       Version    Name                                Type       Repository           Description
       -------    ----                                ----       ----------           -----------
       1.5        Fabrikam-Script                     Script     local1               Description for the Fabrkiam-Script 
       script

    The first command updates the script Fabrikam-Script to version 1.5.

    The second command gets Fabrikam-Script and displays the results.

Additional Notes

This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.

PowerShell Commands