< Back

Invoke-DevartExecuteScript

Mon Jan 13, 2020 7:06 pm

NAME Invoke-DevartExecuteScript



SYNOPSIS

Automates executing the scripts.





SYNTAX

Invoke-DevartExecuteScript -Connection <object> -Input <string> [-Database <string>] [-Encoding <string>]

[-IgnoreError <SwitchParameter>] [-ZipPassword <string>] [<CommonParameters>]





DESCRIPTION

If -Input is a folder, the scripts are executed in alphabetical order (subfolders are ignored).





PARAMETERS

-Connection <object>

Specifies a connection to the server where to execute the script.



This can be:



an instance of a DevartDatabaseConnectionInfo object produced by the New-DevartSqlDatabaseConnection cmdlet.



a database connection string.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Input <string>

This switch is used to specify an SQL or ZIP file with the script to execute or a folder with SQL or ZIP files.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Database <string>

Specifies a database to execute the script to.



Databases specified in the script before will be ignored.



It does not affect the objects specified with fully qualified names.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Encoding <string>

Specifies the encoding which should be applied to open and execute the script.



Usage: /encoding:<codepage|encoding name>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ZipPassword <string>

Specifies the password to protected archive with password.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-IgnoreError <SwitchParameter>

Use this parameter to continue executing scripts in the folder despite errors.



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

System.Boolean





---------- EXAMPLE 1 ----------



Invoke-DevartExecuteScript -Connection $connection -Database AdventureWorks -Input script.sql



---------- EXAMPLE 2 ----------



Invoke-DevartExecuteScript -Connection $connection -Database AdventureWorks -Input script.zip -ZipPassword ***



---------- EXAMPLE 3 ----------



Invoke-DevartExecuteScript -Connection $connection -Database AdventureWorks -Input D:\\ScriptFolder -IgnoreError





RELATED LINKS

Online help:

https://docs.devart.com/devops-automati ... cript.html