< Back
Save-Script
Post
NAME Save-Script
SYNOPSIS
Saves a script.
SYNTAX
Save-Script [-InputObject] <PSObject[]> [-Confirm] [-Credential <PSCredential>] [-Force] -LiteralPath <String> [-Proxy <Uri>] [-ProxyCredential
<PSCredential>] [-WhatIf] [<CommonParameters>]
Save-Script [-InputObject] <PSObject[]> [-Confirm] [-Credential <PSCredential>] [-Force] -Path <String> [-Proxy <Uri>] [-ProxyCredential <PSCredential>]
[-WhatIf] [<CommonParameters>]
Save-Script [-Name] <String[]> [-Confirm] [-Credential <PSCredential>] [-Force] -LiteralPath <String> [-MaximumVersion <Version>] [-MinimumVersion
<Version>] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-Repository <String[]>] [-RequiredVersion <Version>] [-WhatIf] [<CommonParameters>]
Save-Script [-Name] <String[]> [-Confirm] [-Credential <PSCredential>] [-Force] [-MaximumVersion <Version>] [-MinimumVersion <Version>] -Path <String>
[-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-Repository <String[]>] [-RequiredVersion <Version>] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The Save-Script cmdlet saves the specified script.
PARAMETERS
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Credential <PSCredential>
@{Text=}
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Force [<SwitchParameter>]
Forces the command to run without asking for user confirmation.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-InputObject <PSObject[]>
{{Fill InputObject Description}}
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName, ByValue)
Accept wildcard characters? false
-LiteralPath <String>
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.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-MaximumVersion <Version>
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.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-MinimumVersion <Version>
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.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Name <String[]>
Specifies an array of names of scripts to save.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Path <String>
Specifies a path to one or more locations. Wildcards are permitted. The default location is the current directory (.).
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Proxy <Uri>
@{Text=}
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-ProxyCredential <PSCredential>
@{Text=}
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Repository <String[]>
Specifies the friendly name of a repository that has been registered by running Register-PSRepository.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-RequiredVersion <Version>
Specifies the exact version number of the script to save.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
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.
RELATED LINKS
Online Version: http://go.microsoft.com/fwlink/?LinkId=822334
Find-Script
Install-Script
Publish-Script
Uninstall-Script
Update-Script
SYNOPSIS
Saves a script.
SYNTAX
Save-Script [-InputObject] <PSObject[]> [-Confirm] [-Credential <PSCredential>] [-Force] -LiteralPath <String> [-Proxy <Uri>] [-ProxyCredential
<PSCredential>] [-WhatIf] [<CommonParameters>]
Save-Script [-InputObject] <PSObject[]> [-Confirm] [-Credential <PSCredential>] [-Force] -Path <String> [-Proxy <Uri>] [-ProxyCredential <PSCredential>]
[-WhatIf] [<CommonParameters>]
Save-Script [-Name] <String[]> [-Confirm] [-Credential <PSCredential>] [-Force] -LiteralPath <String> [-MaximumVersion <Version>] [-MinimumVersion
<Version>] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-Repository <String[]>] [-RequiredVersion <Version>] [-WhatIf] [<CommonParameters>]
Save-Script [-Name] <String[]> [-Confirm] [-Credential <PSCredential>] [-Force] [-MaximumVersion <Version>] [-MinimumVersion <Version>] -Path <String>
[-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-Repository <String[]>] [-RequiredVersion <Version>] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The Save-Script cmdlet saves the specified script.
PARAMETERS
-Confirm [<SwitchParameter>]
Prompts you for confirmation before running the cmdlet.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Credential <PSCredential>
@{Text=}
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Force [<SwitchParameter>]
Forces the command to run without asking for user confirmation.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-InputObject <PSObject[]>
{{Fill InputObject Description}}
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName, ByValue)
Accept wildcard characters? false
-LiteralPath <String>
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.
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-MaximumVersion <Version>
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.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-MinimumVersion <Version>
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.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Name <String[]>
Specifies an array of names of scripts to save.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Path <String>
Specifies a path to one or more locations. Wildcards are permitted. The default location is the current directory (.).
Required? true
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Proxy <Uri>
@{Text=}
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-ProxyCredential <PSCredential>
@{Text=}
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Repository <String[]>
Specifies the friendly name of a repository that has been registered by running Register-PSRepository.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-RequiredVersion <Version>
Specifies the exact version number of the script to save.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
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.
RELATED LINKS
Online Version: http://go.microsoft.com/fwlink/?LinkId=822334
Find-Script
Install-Script
Publish-Script
Uninstall-Script
Update-Script