Compartilhar via


Set-SCSQLScriptCommand

Modifies the properties of a SQL Server script.

Syntax

Default (Default)

Set-SCSQLScriptCommand
    [-SQLScriptType <SQLScriptCommandType>]
    [-DeploymentOrder <Int32>]
    [-LoginTimeoutSeconds <Int32>]
    [-ExecutionTimeoutSeconds <Int32>]
    [-RunAsAccount <VMMCredential>]
    [-SQLAuthenticationType <String>]
    [-SQLScriptCommand] <SCSQLScriptCommand>
    [-SQLScript <Script>]
    [-CommandParameters <String>]
    [-OutputFilePath <String>]
    [-EncryptConnection <Boolean>]
    [-DatabaseName <String>]
    [-WarnAndContinueOnError <Boolean>]
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [<CommonParameters>]

Description

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

Examples

Example 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 then 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 that object in the $AppDeployment variable.

The third command gets the first PreInstall SQL Server script object associated with the application deployment stored in $AppDeployment, and then stores the object in the $SQLScript variable. The cmdlet selects the correct object by specifying a deployment order of 1 and a script type of PreInstall.

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

Parameters

-CommandParameters

Specifies the parameters for a script or executable program.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DatabaseName

Specifies the name of a database for a SQL Server script.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DeploymentOrder

Specifies the order in which a computer tier, application host, or application is deployed.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EncryptConnection

Indicates whether the SQL Server connection is encrypted.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ExecutionTimeoutSeconds

Specifies the amount of time, in seconds, that the SQL Server script command waits before it times out.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-JobVariable

Specifies a variable in which job progress is tracked and stored.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-LoginTimeoutSeconds

Specifies the amount of time, in seconds, that a SQL Server login waits before it times out.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-OutputFilePath

Specifies a file path to store output data from a SQL Server script.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PROTipID

Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RunAsAccount

Specifies a Run As account that contains credentials with permission to perform this action.

Parameter properties

Type:VMMCredential
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SQLAuthenticationType

Specifies the SQL Server authentication type. Valid values are: SQLServerAuthentication and WindowsAuthentication.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SQLScript

Specifies a SQL Server script.

Parameter properties

Type:Script
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SQLScriptCommand

Specifies a SQL Server script command object.

Parameter properties

Type:SCSQLScriptCommand
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-SQLScriptType

Specifies a SQL Server script type. The acceptable values for this parameter are:

  • PreInstall
  • PostInstall
  • PreService
  • PostService
  • PreUninstall
  • PostUninstall

Parameter properties

Type:SQLScriptCommandType
Default value:None
Accepted values:PreInstall, PostInstall, PreService, PostService, PreUninstall, PostUninstall
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WarnAndContinueOnError

Indicates whether the script warns the user and continues if the SQL Server script encounters an error while it runs.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

SQLScriptCommand

This cmdlet returns a SQLScriptCommand object.