Add-SCSQLScriptCommand

Add-SCSQLScriptCommand

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

構文

Parameter Set: Default
Add-SCSQLScriptCommand -ApplicationDeployment <ApplicationDeployment> -DeploymentOrder <Int32> -SQLScript <Script> -SQLScriptType <SQLScriptCommandType> {PreInstall | PostInstall | PreService | PostService | PreUninstall | PostUninstall} [-CommandParameters <String> ] [-DatabaseName <String> ] [-EncryptConnection <Boolean]> ] [-ExecutionTimeoutSeconds <Int32> ] [-JobVariable <String> ] [-LoginTimeoutSeconds <Int32> ] [-OutputFilePath <String> ] [-PROTipID <Guid]> ] [-RunAsAccount <VMMCredential> ] [-RunAsynchronously] [-SQLAuthenticationType <String> ] [-WarnAndContinueOnError <Boolean]> ] [ <CommonParameters>]

詳細説明

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

パラメーター

-ApplicationDeployment<ApplicationDeployment>

Specifies an application deployment object.

エイリアス

none

必須?

true

位置は?

named

既定値

none

パイプライン入力を許可する

True (ByValue)

ワイルドカード文字を許可する

false

-CommandParameters<String>

Specifies the parameters for a script or executable program.

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-DatabaseName<String>

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

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-DeploymentOrder<Int32>

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

エイリアス

none

必須?

true

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-EncryptConnection<Boolean]>

Specifies whether the SQL Server connection is encrypted.

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-ExecutionTimeoutSeconds<Int32>

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

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-JobVariable<String>

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

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-LoginTimeoutSeconds<Int32>

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

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-OutputFilePath<String>

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

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-PROTipID<Guid]>

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

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-RunAsAccount<VMMCredential>

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

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-RunAsynchronously

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

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-SQLAuthenticationType<String>

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

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-SQLScript<Script>

Specifies a SQL Server script.

エイリアス

none

必須?

true

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-SQLScriptType<SQLScriptCommandType>

Specifies a SQL Server script type. Valid values are:

-- PreInstall
-- PostInstall
-- PreService
-- PostService
-- PreUninstall
-- PostUninstall

エイリアス

none

必須?

true

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-WarnAndContinueOnError<Boolean]>

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

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

<CommonParameters>

このコマンドレットは次の共通パラメーターをサポートします。-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、-OutVariable.詳細については、以下を参照してください。 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。

入力

入力型は、コマンドレットにパイプできるオブジェクトの型です。

出力

出力型は、コマンドレットによって生成されるオブジェクトの型です。

  • SQLScriptCommand

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

The first command gets the application profile object named SvcWebAppProfile01, and then 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 variable.

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 runs.

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

関連トピック

Get-SCSQLScriptCommand

Remove-SCSQLScriptCommand

Set-SCSQLScriptCommand

Get-SCApplicationProfile

New-SCScriptCommandSetting