Set-SCSQLScriptCommand

Modifies the properties of a SQL Server script.

Description

The Set-SCSQLScriptCommand cmdlet modifies the properties of a SQL Server script associated with an application deployment.

For more information about Set-SCSQLScriptCommand, type: "Get-Help Set-SCSQLScriptCommand -online".

Parameters

SQLScriptCommand

Required? true
Accept Pipeline Input? true (ByValue)
Position? 0
Specifies a SQL Server script command object.

CommandParameters

Required? false
Accept Pipeline Input? false
Position? named
Specifies the parameters for a script or executable program.

DatabaseName

Required? false
Accept Pipeline Input? false
Position? named
Specifies the name of a database for a SQL Server script.

DeploymentOrder

Required? false
Accept Pipeline Input? false
Position? named
Specifies the order in which a computer tier or application host is deployed.

EncryptConnection

Required? false
Accept Pipeline Input? false
Position? named
Specifies whether the SQL Server connection is encrypted.

ExecutionTimeoutSeconds

Required? false
Accept Pipeline Input? false
Position? named
Specifies the amount of time, in seconds, that the SQL Server script command (SQL statement) will wait before timing out.

JobVariable

Required? false
Accept Pipeline Input? false
Position? named
Specifies that job progress is tracked and stored in the variable named by this parameter. 

LoginTimeoutSeconds

Required? false
Accept Pipeline Input? false
Position? named
Specifies the amount of time, in seconds, that a SQL Server login waits before timing out.

OutputFilePath

Required? false
Accept Pipeline Input? false
Position? named
Specifies a file path to store output data from a SQL Server script.

PROTipID

Required? false
Accept Pipeline Input? false
Position? named
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

RunAsAccount

Required? false
Accept Pipeline Input? false
Position? named
Specifies a Run As account that contains credentials with permission to perform this action.

RunAsynchronously

Required? false
Accept Pipeline Input? false
Position? named
Indicates that the job runs asynchronously so that control returns to the command shell immediately. 

SQLAuthenticationType

Required? false
Accept Pipeline Input? false
Position? named
Specifies the SQL Server authentication type. Valid valus are: SQLServerAuthentication, WindowsAuthentication.

SQLScript

Required? false
Accept Pipeline Input? false
Position? named
Specifies a SQL Server script.

SQLScriptType

Required? false
Accept Pipeline Input? false
Position? named
Specifies a SQL Server script type. Valid values are: PreInstall, PostInstall, PreService, PostService, PreUninstall, PostUninstall.

WarnAndContinueOnError

Required? false
Accept Pipeline Input? false
Position? named
Indicates whether the script should warn the user and continue if the SQL Server script encounters an error while running.

Examples

1: Modify a SQL Server script command.
PS C:\> $AppProfile = Get-SCApplicationProfile -Name "SvcWebAppProfile01"
PS C:\> $AppDeployment = Get-SCApplicationDeployment -ApplicationProfile $AppProfile -Name "SQLDataTierApp01"
PS C:\> $SQLScript = Get-SCSQLScriptCommand -ApplicationDeployment $AppDeployment | where {$_.DeploymentOrder -eq "1" -and $_.SQLScriptType -eq "PreInstall"}
PS C:\> Set-SCSQLScriptCommand -SQLScriptCommand $SQLScript -DatabaseName "MSOrders"
The first command gets the application profile object named SvcWebAppProfile01 and stores it in the $AppProfile variable.

The second command gets the application deployment object named SQLDataTierApp01 for the application profile stored in $ApplicationProfile, and then stores the object in the $AppDeployment variable.

The third command gets the first PreInstall SQL Server script object (deployment order 1, sql script type PreInstall) associated with the application deployment stored in $AppDeployment, and then stores the object in the $SQLScript variable.

The last command modifies the database against which the SQL Server script stored $SQLScript will run

See Also