Set-SCSQLScriptCommand
修改SQL Server腳本的屬性。
Syntax
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
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 的應用程式部署相關聯的第一個預先安裝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 提示 (PRO 提示的識別碼) 。 此參數可讓您稽核 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
表示作業會以非同步方式執行,讓控制項立即返回命令殼層。
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 物件。