Set-SCSQLScriptCommand
Applies To: System Center 2012 - Virtual Machine Manager
Set-SCSQLScriptCommand
Modifies the properties of a SQL Server script.
Syntax
Parameter Set: Default
Set-SCSQLScriptCommand [-SQLScriptCommand] <SCSQLScriptCommand> [-CommandParameters <String> ] [-DatabaseName <String> ] [-DeploymentOrder <Int32> ] [-EncryptConnection <Boolean> ] [-ExecutionTimeoutSeconds <Int32> ] [-JobVariable <String> ] [-LoginTimeoutSeconds <Int32> ] [-OutputFilePath <String> ] [-PROTipID <Guid> ] [-RunAsAccount <VMMCredential> ] [-RunAsynchronously] [-SQLAuthenticationType <String> ] [-SQLScript <Script> ] [-SQLScriptType <SQLScriptCommandType> ] [-WarnAndContinueOnError <Boolean> ] [ <CommonParameters>]
Detailed 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
-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? |
false |
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? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-SQLScriptCommand<SCSQLScriptCommand>
Specifies a SQL Server script command object.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-SQLScriptType<SQLScriptCommandType>
Specifies a SQL Server script type. Valid values are: PreInstall, PostInstall, PreService, PostService, PreUninstall, PostUninstall.
Aliases |
none |
Required? |
false |
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: Modify a SQL Server script command.
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
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"