Save-ScriptSave-Script

O cmdlet Save-Script permite examinar o arquivo de script salvando-o em um local especificado.Save-Script cmdlet lets you to review the script file by saving it to a specified location.

DescriçãoDescription

O cmdlet Save-Script salva o script especificado.The Save-Script cmdlet saves the specified script.

Sintaxe do cmdletCmdlet syntax

Get-Command -Name Save-Script -Module PowerShellGet -Syntax

Referência da ajuda online sobre cmdletsCmdlet online help reference

Save-ScriptSave-Script

Comandos de exemploExample commands

Exemplo 1: Salvar um script de um repositórioExample 1: Save a script from a repository

Este comando salva a versão mais recente do script Fabrikam-ClientScript do repositório GalleryINT na pasta local C:\ScriptSharingDemoThis command saves the latest version of the script Fabrikam-ClientScript from GalleryINT repository to the local folder C:\ScriptSharingDemo

Save-Script -Name Fabrikam-ClientScript -Repository GalleryINT -Path C:\ScriptSharingDemo

Exemplo 2: Salvar uma versão de um script por tubulação do cmdlet Find-ScriptExample 2: Save a version of a script by piping from the Find-Script cmdlet

O primeiro comando localiza a versão 1.5 de Fabrikam-ClientScript do repositório GalleryINT e a salva na pasta C:\ScriptSharingDemoThe first command finds version 1.5 of Fabrikam-ClientScript from the repository GalleryINT and saves it to the folder C:\ScriptSharingDemo

O segundo comando valida os metadados do script salvo.The second command validates the saved script metadata.

Find-Script -Name Fabrikam-ClientScript -Repository GalleryINT -RequiredVersion 1.5 | Save-Script -Path C:\\ScriptSharingDemo
Test-ScriptFileInfo C:\\ScriptSharingDemo\\Fabrikam-ClientScript.ps1

Version Name Author Description
------- ---- ------ -----------
1.5 Fabrikam-ClientScript manikb Description for the Fabrikam-ClientScript script