Set-SCScriptCommand
設定指令碼命令。
Syntax
Set-SCScriptCommand
[-ScriptCommand] <SCScriptCommand>
[-Executable <String>]
[-CommandParameters <String>]
[-ScriptCommandSetting <SCScriptCommandSetting>]
[-ScriptType <ScriptCommandType>]
[-TimeoutSeconds <Int32>]
[-StandardInput <String>]
[-LibraryResource <CustomResource>]
[-RunAsAccount <VMMCredential>]
[-JobGroup <Guid>]
[-DeploymentOrder <Int32>]
[-RunAsynchronously]
[-PROTipID <Guid>]
[-JobVariable <String>]
[<CommonParameters>]
Description
Set-SCScriptCommand Cmdlet 會設定指令碼命令。
範例
範例 1:將自訂資源新增至指令碼命令
PS C:\> $AppProfile = Get-SCApplicationProfile -Name "SvcWebAppProfile01"
PS C:\> $ScriptCommand = Get-SCScriptCommand -ApplicationProfile $AppProfile | where {$_.Name -eq "PreInstall"}
PS C:\> $Resource = Get-SCCustomResource -Name "CustomResource.cr"
PS C:\> Set-SCScriptCommand -ScriptCommand $ScriptCommand -LibraryResource $Resource
第一個命令會取得名為 SvcWebAppProfile01 的應用程式佈建檔物件,並將物件儲存在$AppProfile變數中。
第二個命令會取得名為 PreInstall 的指令碼命令物件,並將物件儲存在$ScriptCommand變數中。
第三個命令會取得名為 CustomResource 的資源物件,並將物件儲存在$Resource變數中。
最後一個命令會將儲存在 $Resource 中的資源物件新增至儲存在 $ScriptCommand 中的指令碼命令物件。
參數
-CommandParameters
指定腳本或可執行程式的參數。
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 |
-Executable
指定可執行程式的名稱。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-JobGroup
指定一系列命令的識別碼,這些命令會在包含相同作業群組識別碼的執行的最後一個命令之前,以集合的形式執行。
Type: | Guid |
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 |
-LibraryResource
指定儲存在 VMM 程式庫中的資源。
Type: | CustomResource |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PROTipID
指定觸發此動作 (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 |
-ScriptCommand
指定指令碼命令物件。
Type: | SCScriptCommand |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ScriptCommandSetting
指定指令碼命令設定物件。
Type: | SCScriptCommandSetting |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ScriptType
指定腳本類型。 此參數可接受的值為:
- 預先安裝
- PostInstall
- SaveState
- RestoreState
- PreService
- PostService
- PreUninstall
- PostUninstall
Type: | ScriptCommandType |
Accepted values: | PreService, PostService, SaveState, RestoreState, PreInstall, PostInstall, PreUninstall, PostUninstall, OrderedCommand, BareMetalPostWinPERegistration, OnProvisionFirst, OnProvisionRest, OnDeleteLast, OnDeleteRest, Install, BareMetalPostConfiguration, BareMetalPostUnattend |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-StandardInput
指定檔案的路徑,其中包含要與指令碼命令搭配使用的標準輸入資訊。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-TimeoutSeconds
指定進程在逾時前等候的時間量,以秒為單位。
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
輸出
ScriptCommand
此 Cmdlet 會傳回 ScriptCommand 物件。