Save-Script
SYNOPSIS
Saves a script.
SYNTAX
NameAndPathParameterSet (Default)
Save-Script [-Name] <String[]> [-MinimumVersion <Version>] [-MaximumVersion <Version>]
[-RequiredVersion <Version>] [-Repository <String[]>] -Path <String> [-Proxy <Uri>]
[-ProxyCredential <PSCredential>] [-Credential <PSCredential>] [-Force] [-WhatIf] [-Confirm]
[<CommonParameters>]
NameAndLiteralPathParameterSet
Save-Script [-Name] <String[]> [-MinimumVersion <Version>] [-MaximumVersion <Version>]
[-RequiredVersion <Version>] [-Repository <String[]>] -LiteralPath <String> [-Proxy <Uri>]
[-ProxyCredential <PSCredential>] [-Credential <PSCredential>] [-Force] [-WhatIf] [-Confirm]
[<CommonParameters>]
InputOjectAndLiteralPathParameterSet
Save-Script [-InputObject] <PSObject[]> -LiteralPath <String> [-Proxy <Uri>] [-ProxyCredential <PSCredential>]
[-Credential <PSCredential>] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
InputOjectAndPathParameterSet
Save-Script [-InputObject] <PSObject[]> -Path <String> [-Proxy <Uri>] [-ProxyCredential <PSCredential>]
[-Credential <PSCredential>] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
The Save-Script cmdlet saves the specified script.
EXAMPLES
Example 1: Save a script and validate it
PS C:\> Save-Script -Name "Fabrikam-ClientScript" -Repository "Local01" -Path "D:\ScriptSharingDemo"
PS C:\> Test-ScriptFileInfo -Path "D:\ScriptSharingDemo\Fabrikam-ClientScript.ps1"
Version Name Author Description
------- ---- ------ -----------
2.5 Fabrikam-ClientScript pattif Description for the Fabrikam-ClientScript script
The first command saves the script Fabrikam-ClientScript from the Local01 repository to the local folder D:\ScriptSharingDemo.
The second command uses the Test-ScriptFileInfo cmdlet to validate the script.
PARAMETERS
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Credential
@{Text=}
Type: PSCredential
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Force
Forces the command to run without asking for user confirmation.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-InputObject
{{Fill InputObject Description}}
Type: PSObject[]
Parameter Sets: InputOjectAndLiteralPathParameterSet, InputOjectAndPathParameterSet
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
-LiteralPath
Specifies a path to one or more locations. Unlike the Path parameter, the value of the LiteralPath parameter is used exactly as entered. No characters are interpreted as wildcards. If the path includes escape characters, enclose them in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.
Type: String
Parameter Sets: NameAndLiteralPathParameterSet, InputOjectAndLiteralPathParameterSet
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-MaximumVersion
Specifies the maximum, or newest version of the script to save. The MaximumVersion and RequiredVersion parameters are mutually exclusive; you cannot use both parameters in the same command.
Type: Version
Parameter Sets: NameAndPathParameterSet, NameAndLiteralPathParameterSet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-MinimumVersion
Specifies the minimum version of the script to find. The MinimumVersion and the RequiredVersion parameters are mutually exclusive; you cannot use both parameters in the same command.
Type: Version
Parameter Sets: NameAndPathParameterSet, NameAndLiteralPathParameterSet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Name
Specifies an array of names of scripts to save.
Type: String[]
Parameter Sets: NameAndPathParameterSet, NameAndLiteralPathParameterSet
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Path
Specifies a path to one or more locations. Wildcards are permitted. The default location is the current directory (.).
Type: String
Parameter Sets: NameAndPathParameterSet, InputOjectAndPathParameterSet
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Proxy
@{Text=}
Type: Uri
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-ProxyCredential
@{Text=}
Type: PSCredential
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Repository
Specifies the friendly name of a repository that has been registered by running Register-PSRepository.
Type: String[]
Parameter Sets: NameAndPathParameterSet, NameAndLiteralPathParameterSet
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 save.
Type: Version
Parameter Sets: NameAndPathParameterSet, NameAndLiteralPathParameterSet
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: 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 (http://go.microsoft.com/fwlink/?LinkID=113216).