Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Add-SCSQLScriptCommand

Updated: September 27, 2012

Applies To: System Center 2012 - Virtual Machine Manager

Add-SCSQLScriptCommand

Adds a SQL Server script to a SQL Server application deployment.

Syntax

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




Detailed Description

The Add-SQLScriptCommand cmdlet adds a SQL Server script to a SQL Server application deployment.

For more information about Add-SQLScriptCommand, type: "Get-Help Add-SQLScriptCommand -online".

Parameters

-ApplicationDeployment<ApplicationDeployment>

Specifies an application deployment object.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-CommandParameters<String>

Specifies the parameters for a script or executable program.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DatabaseName<String>

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DeploymentOrder<Int32>

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


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-EncryptConnection<Boolean>

Specifies whether the SQL Server connection is encrypted.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ExecutionTimeoutSeconds<Int32>

Specifies the amount of time, in seconds, that the SQL Server script command (SQL statement) will wait before timing out.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobVariable<String>

Specifies that job progress is tracked and stored in the variable named by this parameter.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LoginTimeoutSeconds<Int32>

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OutputFilePath<String>

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PROTipID<Guid>

Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsAccount<VMMCredential>

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsynchronously

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SQLAuthenticationType<String>

Specifies the SQL Server authentication type. Valid valus are: SQLServerAuthentication, WindowsAuthentication.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SQLScript<Script>

Specifies a SQL Server script.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SQLScriptType<SQLScriptCommandType>

Specifies a SQL Server script type. Valid values are: PreInstall, PostInstall, PreService, PostService, PreUninstall, PostUninstall.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WarnAndContinueOnError<Boolean>

Indicates whether the script should warn the user and continue if the SQL Server script encounters an error while running.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • SQLScriptCommand

Examples

1: Add a SQL Server script to an application deployment.

The first command gets the application profile object named SvcWebAppProfile01 and stores the object in the $AppProfile variable.

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

The third command gets the SQL Server script object named ConfigureDB.sql, release 1.0, from the VMM library and stores the object in the $Script varaible.

The last command adds the SQL Server script stored in $Script to the application deployment stored in $AppDeployment and sets the script type, deployment order, and database against which the script will run.


PS C:\> $AppProfile = Get-SCApplicationProfile -Name "SvcWebAppProfile01"PS C:\> $AppDeployment = Get-SCApplicationDeployment -ApplicationProfile $AppProfile -Name "SQLDataTierApp01"PS C:\> $SQLScript = Get-SCScript -Name "ConfigDB.sql" -Release "1.0"PS C:\> Add-SCSQLScriptCommand -ApplicationDeployment $AppDeployment -SQLScriptType "PreInstall" -DeploymentOrder 1 -DatabaseName "MSSQLSERVER" -SQLScript $SQLScript

Related topics

 
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.