Set-SCSQLScriptCommand
修改SQL Server脚本的属性。
语法
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>]
说明
Set-SCSQLScriptCommand cmdlet 修改与应用程序部署关联的SQL Server脚本的属性。
示例
示例 1:修改SQL Server脚本命令
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"
第一个命令获取名为 SvcWebAppProfile01 的应用程序配置文件对象,然后将其存储在$AppProfile变量中。
第二个命令为存储在 $ApplicationProfile 中的应用程序配置文件获取名为 SQLDataTierApp01 的应用程序部署对象,然后将该对象存储在$AppDeployment变量中。
第三个命令获取与存储在$AppDeployment中的应用程序部署关联的第一个 PreInstall SQL Server 脚本对象,然后将该对象存储在$SQLScript变量中。 该 cmdlet 通过指定 1 的部署顺序和 PreInstall 的脚本类型来选择正确的对象。
最后一个命令修改存储$SQLScript SQL Server脚本将对其运行的数据库。
参数
-CommandParameters
指定脚本或可执行程序的参数。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DatabaseName
指定SQL Server脚本的数据库的名称。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DeploymentOrder
指定部署计算机层、应用程序主机或应用程序的顺序。
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-EncryptConnection
指示是否加密SQL Server连接。
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ExecutionTimeoutSeconds
指定SQL Server脚本命令在超时之前等待的时间量(以秒为单位)。
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-JobVariable
指定在其中跟踪和存储作业进度的变量。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-LoginTimeoutSeconds
指定SQL Server登录名在超时之前等待的时间量(以秒为单位)。
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-OutputFilePath
指定一个文件路径,用于存储来自SQL Server脚本的输出数据。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PROTipID
指定触发此操作 (PRO 提示) 的性能和资源优化提示的 ID。 此参数允许审核 PRO 提示。
Type: | Guid |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RunAsAccount
指定一个运行方式帐户,该帐户包含具有执行此操作权限的凭据。
Type: | VMMCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RunAsynchronously
指示作业异步运行,以便控件立即返回到命令 shell。
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SQLAuthenticationType
指定SQL Server身份验证类型。 有效值为:SQLServerAuthentication 和 WindowsAuthentication。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SQLScript
指定SQL Server脚本。
Type: | Script |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SQLScriptCommand
指定SQL Server脚本命令对象。
Type: | SCSQLScriptCommand |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-SQLScriptType
指定SQL Server脚本类型。 此参数的可接受值为:
- 预安装
- PostInstall
- PreService
- PostService
- PreUninstall
- PostUninstall
Type: | SQLScriptCommandType |
Accepted values: | PreInstall, PostInstall, PreService, PostService, PreUninstall, PostUninstall |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WarnAndContinueOnError
指示脚本是否警告用户,并在运行SQL Server脚本时遇到错误时继续。
Type: | Boolean |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
输出
SQLScriptCommand
此 cmdlet 返回 SQLScriptCommand 对象。