Service Manager Authoring Tool 工作流程活動參考Service Manager Authoring Tool workflow activity reference

重要

此版本的 Service Manager 已達到終止支援,建議您 升級至 Service Manager 2019This version of Service Manager has reached the end of support, we recommend you to upgrade to Service Manager 2019.

本節提供適合資訊技術 (IT) 開發人員的資訊,使其能建立自訂的 Windows Workflow Foundation (WF) 活動,供 IT 專業人員用來建立 IT 程序專屬的 WF 工作流程。This section provides guidance for information technology (IT) developers so that they can create custom Windows Workflow Foundation (WF) activities that IT pros can use to build WF workflows that are specific to their IT processes. 自訂 WF 活動會延伸活動程式庫,也就是隨 Service Manager Authoring Tool 發佈的活動。Custom WF activities extend the Activity Library-the activities that are distributed with the Service Manager Authoring Tool. 本文件的<工作流程活動參考資料>一節提供活動程式庫中預設 WF 活動的詳細資料。The Workflow Activity Reference section of this document provides details of the default WF activities in the Activity Library. 這些資訊的目的在於協助開發人員 (或擔任開發人員的 IT 專業人員) 根據需求建立自訂 WF 活動。This information is intended to help developers (or IT pros acting as developers) create custom WF activities, as needed.

如需如何搭配 Service Manager 使用 WF 活動和 WF 工作流程的相關資訊,請參閱使用 工作流程自動化 IT程式。For information about how to use WF activities and WF workflows with Service Manager, see Automating IT Processes with Workflows.

Active Directory 活動Active Directory activities

使用 Active Directory Domain Services (AD   DS) 活動,讓 Active Directory 函式成為   Service Manager 中工作流程的一部分。Use Active Directory Domain Services (AD DS) activities to make Active Directory functions part of your workflow in Service Manager.

Service Manager Authoring Tool 在 [活動工具箱] 窗格的 [ Active Directory 活動] 群組中提供兩個預設 Service Manager 活動。The Service Manager Authoring Tool provides two default Service Manager activities in the Active Directory Activities group in the Activities Toolbox pane. 本節中的主題將說明這些活動。The topics in this section describe these activities.

將 AD DS 電腦新增至群組活動Add AD DS Computer to a Group activity

此活動會將電腦新增至 Service Manager 中 Active Directory Domain Services (AD DS) 的安全性群組   。This activity adds a computer to a security group in Active Directory Domain Services (AD DS) in Service Manager. 電腦和群組必須屬於相同的網域,且網域中的所有容器都能被搜尋。The computer and the group must belong to the same domain, and all containers in the domain are searched.

設計階段必要條件Design time prerequisites

無。None.

執行時間必要條件Run time prerequisites

當您使用此活動時,請確定 Service Manager 工作流程帳戶具有足夠的許可權可以修改 AD DS 中的安全性群組   。When you use this activity, make sure that the Service Manager Workflow account has sufficient permissions to modify security groups in AD DS.

屬性Properties

[ 將 AD DS 電腦新增至群組 ] 活動會使用下表所述的輸入屬性。The Add AD DS Computer to Group activity uses the input properties that are described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 描述Description
電腦網域Computer Domain ComputerDomainComputerDomain StringString Yes 電腦所在位置的完整 DNS 網域名稱 (例如 contoso.com)The fully qualified DNS domain name where the computer is located (for example, contoso.com)
電腦名稱Computer Name FullyQualifiedComputerNameFullyQualifiedComputerName StringString Yes 電腦的名稱。The name of the computer.
群組名稱Group Name FullyQualifiedGroupNameFullyQualifiedGroupName StringString Yes Active Directory 網域服務群組的名稱。The name of the Active Directory Domain Services group.

[ 將 AD DS 電腦新增至群組 ] 活動會產生下表所述的輸出。The Add AD DS Computer to Group activity generates the output that is described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 描述Description
輸出Output 輸出Output 布林值Boolean 作業的結果:如果加入成功則 為 True ,如果失敗,則為 FalseThe result of the operation: True if the addition succeeded, False if it failed.

錯誤和例外狀況Errors and exceptions

無。None.

備註Remarks

無。None.

範例Example

無。None.

將 AD DS 使用者新增至群組活動Add AD DS User to Group activity

此活動會將使用者新增至 Service Manager 中 Active Directory Domain Services (AD DS) 的安全性群組   。This activity adds a user to a security group in Active Directory Domain Services (AD DS) in Service Manager. 使用者和群組必須屬於相同網域,且網域中的所有容器中都能被搜尋。The user and the group must belong to the same domain, and all the containers in the domain are searched.

設計階段必要條件Design time prerequisites

無。None.

執行時間必要條件Run time prerequisites

當您使用此活動時,請確定 Service Manager 工作流程帳戶具有足夠的許可權可以修改 AD DS 中的安全性群組   。When you use this activity, make sure that the Service Manager Workflow account has sufficient permissions to modify security groups in AD DS.

屬性Properties

[ 將 AD DS 使用者新增至群組 ] 活動會使用下表所列的輸入屬性。The Add AD DS User to Group activity uses the input properties that are listed in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 描述Description
使用者網域User Domain UserDomainUserDomain StringString Yes 使用者完整的網域名稱 (FQDN)。The fully qualified domain name (FQDN) of the user.
使用者名稱User Name UserNameUserName StringString Yes 使用者的登入名稱。The logon name of the user.
群組名稱Group Name FullyQualifiedGroupNameFullyQualifiedGroupName StringString Yes 群組的 FQDN。The FQDN of the group.

[ 將 AD DS 使用者新增至群組 ] 活動會產生下表所述的輸出。The Add AD DS User to Group activity generates the output that is described in the following table.

顯示名稱Display Name 內部名稱Internal Name 類型Type 描述Description
輸出Output 輸出Output 布林值Boolean 作業的結果:如果加入成功則 為 True ,如果失敗,則為 FalseThe result of the operation: True if the addition succeeded, False if it failed.

錯誤和例外狀況Errors and exceptions

無。None.

備註Remarks

無。None.

範例Example

無。None.

控制流程活動Control Flow activities

使用控制流程活動為 Service Manager 中的工作流程提供結構分支、迴圈或計時器延遲。Use control flow activities to provide structure-branches, loops, or timer delays-for your workflow in Service Manager.

Authoring Tool 在 [活動工具箱] 窗格的 [控制流程] 群組中提供四個預設控制流程活動。The Authoring Tool provides four default control flow activities in the Control Flow group in the Activities Toolbox pane.

Delay 活動Delay activity

此活動會在 Service Manager 的工作流程中的活動之間引進延遲。This activity introduces a delay between activities in a workflow in Service Manager. Delay活動衍生自 Microsoft .Net   Framework DelayActivity類別。The Delay activity is derived from the Microsoft .NET Framework DelayActivity class.

設計階段必要條件Design time prerequisites

無。None.

執行時間必要條件Run time prerequisites

無。None.

屬性Properties

Delay活動會使用下表所列的輸入屬性。The Delay activity uses the input properties that are listed in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 描述Description
初始化 TimeoutDurationInitialize TimeoutDuration InitializeTimeoutDurationInitializeTimeoutDuration 內部Internal 指定初始化 TimeoutDuration 屬性的處理常式。Specifies a handler to initialize the TimeoutDuration property.
TimeoutDurationTimeoutDuration TimeoutDurationTimeoutDuration TimespanTimespan Yes 延遲的持續時間。Duration of the delay.

Delay活動不會產生 output 屬性。The Delay activity does not produce an output property.

錯誤和例外狀況Errors and exceptions

無。None.

備註Remarks

如需此活動的詳細資訊,請參閱 .NET Framework 類別庫中的 DelayActivity 類別   。For more information about this activity, see DelayActivity Class in the .NET Framework Class Library.

範例Example

無。None.

For Each Loop 活動For Each Loop activity

For Each 迴圈活動會以陣列 () 集合的形式來進行輸入,並針對集合中的每個物件,重複迴圈內的一組活動。The For Each Loop activity takes as an input an array (collection) of objects and repeats the set of activities within the loop for each object in the collection. 例如,如果輸入集合有五個物件,迴圈會逐一查看五次。For example, if the input collection has five objects, the loop iterates five times. 如果集合是空的,迴圈則不會逐一查看。If the collection is empty, the loop does not iterate. 集合中的物件數目沒有上限。There is no upper limit to the number of objects in the collection. For Each Loop活動一律會在工作流程執行所在的電腦上執行。The For Each Loop activity always runs on the computer on which the workflow runs.

For Each 迴圈活動是具有兩個活動容器的複合活動:The For Each Loop activity is a composite activity with two containers for activities:

  • 輸入容器:此活動會設定迴圈並定義輸入集合。Input Container: This activity sets up the loop and defines the input collection. 您可以使用此角色中的 Get 事件取得虛擬機器 活動。You can use the Get Incident or the Get Virtual Machine activity in this role.

  • 迴圈容器:名為 ForEachChildActivity,此活動包含迴圈活動。Loop Container: Named ForEachChildActivity, this activity contains the loop activities. 您放在此容器中的大多數 Windows Workflow Foundation (WF) 活動都有兩個額外屬性: 目前專案 和要系結的 屬性Most Windows Workflow Foundation (WF) activities that you place in this container have two additional properties: Current Item and Property to Bind. 針對迴圈容器內的每個活動,設定這些內容如下:For each activity within the loop container, set these properties as follows:

    1. 將 [目前專案] 設定為 [ ForEach ] 活動之 [迴圈容器] 活動的 [目前專案] 屬性。Set Current Item to the Current Item property of the Loop Container activity of the ForEach activity. 請注意,如果此活動是 [ For Each 迴圈 ] 活動中的第一個活動,則會自動設定 [ 目前專案 ]。Note that if this activity is the first activity in the For Each Loop activity, Current Item is set automatically.

    2. 將屬性的值設定 [系結屬性] 設定為目前活動(使用 目前的專案 值)的屬性值。Set the value of the Property to Bind property to the value of the property of the current activity that uses the Current Item value.

有兩種類型的活動不會取得 目前的專案屬性來 系結屬性,因此無法使用輸入集合中的物件:Two types of activities do not get the Current Item and Property to Bind properties and therefore cannot use the objects in the input collection:

  • 編寫活動的腳本,例如 Windows PowerShell 腳本 活動。Script activities, such as the Windows PowerShell Script activity.

  • 未繼承自 WorkflowActivityBase 類別的自訂活動或其他活動。Custom activities or other activities that do not inherit from the WorkflowActivityBase class. 這類活動包括以 活動 基類為基礎的活動,例如原生 Visual Studio 活動。Such activities include those activities that are based on the Activity base class, such as native Visual Studio activities.

設計階段必要條件Design time prerequisites

無。None.

執行時間必要條件Run time prerequisites

無。None.

屬性Properties

For Each 迴圈活動會使用下表所述的輸入屬性。The For Each Loop activity uses the input properties that are described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 描述Description
輸入集合Input Collection InputCollectionInputCollection 陣列/物件Array/Object N/AN/A 要傳遞給 For Each 迴圈 活動內活動的物件集合(一次一個)。A collection of objects to be passed, one at a time, to the activities within the For Each Loop activity. 如果位於輸入容器中的活動產生物件陣列做為其輸出屬性,則 輸入集合 會自動設定為該屬性。If the activity that resides in the input container produces an array of objects as its output property, Input Collection is automatically set to that property. 若要查看此屬性目前的值,請以滑鼠右鍵按一下 [迴圈] 容器,然後按一下 [ 屬性]。To view the current value of this property, right-click the loop container, and then click Properties.
目前項目Current Item CurrentItemCurrentItem ObjectObject N/AN/A 迴圈內活動可以用來做為輸入屬性之 輸入集合 的索引。An index into Input Collection that activities within the loop can use as an input property. 對於迴圈容器中的第一個活動,會自動設定這個屬性。For the first activity in the loop container, this property is set automatically.

錯誤和例外狀況Errors and exceptions

For Each 迴圈活動會使用 Service Manager 所提供的自訂追蹤服務,來記錄活動執行時的錯誤和例外狀況。The For Each Loop activity uses the custom tracking service that is supplied by Service Manager to log errors and exceptions when the activity runs. 在下列情況下,活動會產生錯誤或例外狀況︰The activity generates errors or exceptions under the following conditions:

  • 如果 ForEachLoop 活動中發生任何錯誤,而不是子活動,則工作流程會終止。If any error occurs in the ForEachLoop activity and that is not with the child activities, the workflow terminates.

  • 如果子活動中發生任何錯誤,則工作流程會終止,除非 ContinueOnError= true。If any error occurs within the child activities, the workflow terminates unless ContinueOnError=true.

  • 如果任何輸入屬性為 null。If any of the input properties are null. 活動不會逐一查看。The activity does not iterate.

    [ For Each 迴圈 ] 活動內的每個活動都必須將本身的錯誤或例外狀況寫入自訂追蹤服務。Each activity within the For Each Loop activity must write its own errors or exceptions to the custom tracking service. For Each Loop活動本身並沒有這麼做。The For Each Loop activity does not do so itself.

備註Remarks

無。None.

範例Example

無。None.

IfElse 活動IfElse activity

此活動可根據布林值 (True/False) 條件控制工作流程內的活動序列。This activity controls the sequence of activities within a workflow based on a Boolean (True/False) condition. 您可以使用前面活動 (例如指令碼活動) 的結果作為條件。You can use the outcome of a previous activity, such as a script activity, for the condition.

IfElse活動是使用規則和條件的 Visual Studio 活動。The IfElse activity is a Visual Studio activity that uses rules and conditions. 如需在 Windows Workflow Foundation (WF) 中使用規則和條件的詳細資訊,請參閱 MSDN Library 中的 教學課程:在 wf 中使用規則和條件For more information about using rules and conditions in Windows Workflow Foundation (WF), see Tutorial: Use Rules and Conditions in WF in the MSDN Library.

設計階段必要條件Design time prerequisites

無。None.

執行時間必要條件Run time prerequisites

無。None.

屬性Properties

無。None.

錯誤和例外狀況Errors and exceptions

無。None.

備註Remarks

如需 IfElse 活動的詳細資訊,請參閱 .net Framework 4 類別庫中的 IfElseActivity 類別     。For more information about the IfElse activity, see IfElseActivity Class in the .NET Framework 4 Class Library.

範例Example

無。None.

平行活動Parallel activity

此活動可將活動順序分成兩個同時進行的活動序列分支。This activity forks the sequence of activities into two simultaneous sequences of activities. Parallel活動是 Visual Studio 活動。The Parallel activity is a Visual Studio activity. 如需 ParallelActivity 類別的詳細資訊,請參閱 .Net Framework 類別庫中的 ParallelActivity 類別   。For more information about the ParallelActivity class, see ParallelActivity Class in the .NET Framework Class Library.

設計階段必要條件Design time prerequisites

無。None.

執行時間必要條件Run time prerequisites

無。None.

屬性Properties

無。None.

錯誤和例外狀況Errors and exceptions

無。None.

備註Remarks

無。None.

範例Example

無。None.

Virtual Machine Manager 活動Virtual Machine Manager activities

使用 Service Manager 中的虛擬機器管理活動建立工作流程,以允許建立和更新虛擬機器。Use virtual machine management activities in Service Manager to build workflows that allow for creating and updating virtual machines. 虛擬機器管理活動支援 System Center Virtual Machine Manager。The virtual machine management activities support System Center Virtual Machine Manager.

Service Manager Authoring Tool 在 [活動工具箱] 窗格的 [ VMM 活動] 群組中提供下列五個預設虛擬機器管理活動。The Service Manager Authoring Tool provides the following five default virtual machine management activities in the VMM Activities group in the Activities Toolbox pane.

取得 VM 活動Get VM activity

Service Manager 中的這項活動會從 Virtual Machine Manager (VMM) 程式庫中取得一或多個虛擬機器識別碼的清單。This activity in Service Manager retrieves a list of one or more virtual machine IDs from a Virtual Machine Manager (VMM) Library.

設計階段必要條件Design time prerequisites

無。None.

執行時間必要條件Run time prerequisites

  • Virtual Machine Manager 主控台和 Service Manager 都必須安裝在同一部伺服器上。The Virtual Machine Manager console and Service Manager must both be installed on the same server.

  • 確認 Service Manager 工作流程帳戶具有足夠的許可權可修改 Active Directory 網域服務中的安全性群組   (AD   DS) 。Ensure that the Service Manager Workflow account has sufficient permissions to modify security groups in Active Directory Domain Services (AD DS).

屬性Properties

取得 VM活動會使用下表中的輸入屬性。The Get VM activity uses the input properties in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 描述Description
參數集Parameter Set ParameterSetParameterSet StringString 存在預設值為 [ 連接]。No; the default is Connection. 指定針對特定用途而組織的參數子集。Specifies a subset of parameters, organized for a particular purpose. 針對 [ 取得 VM ] 活動,您可以選取下列其中一個參數集:For the Get VM activity, you can select one of the following parameter sets:

- 全部: 搜尋所有可用的虛擬機器。- All: Search for all of the available virtual machines.
- 識別碼: 搜尋具有已知識別碼的虛擬機器。- ID: Search for a virtual machine with a known ID.
- 連接: 搜尋連接 Virtual Machine Manager 至 VMMServer 屬性所指定 (VMM) 伺服器的虛擬機器。- Connection: Search for virtual machines that are connected to the Virtual Machine Manager (VMM) server that is designated by the VMMServer property.
- VMHostGroup: 搜尋連線至虛擬機器主機(由 VM 主機 屬性指定)的虛擬機器。- VMHostGroup: Search for virtual machines that are connected to the virtual machine host that is designated by the VM Host property.
發生錯誤時仍繼續Continue On Error ContinueOnErrorContinueOnError BooleanBoolean 否。No. (預設值為 True。)(The default setting is True.) 決定此活動失敗時,工作流程是否應該繼續執行。Determines whether the workflow should continue running if the activity fails.
發生錯誤Has Error HasErrorHasError N/AN/A 指定此活動是否有錯誤集。Specifies if the activity has an error set. (唯讀)(Read-only)
全部All 全部All BooleanBoolean 否。No. (預設值為 True。)(The default setting is True.) 如果 參數設定 為 [ 全部],則可使用。Available if the Parameter Set is All. 如果設定為 True,則 [ 取得 VM ] 活動會傳回所有可用虛擬機器的虛擬機器識別碼清單。If it is set to True, the Get VM activity returns a list of the virtual machine IDs of all of the available virtual machines.
識別碼ID 識別碼ID StringString 如果 參數集ID,則為必要項。Required if Parameter Set is ID. 如果 參數集ID,則為可用。Available if the Parameter Set is ID. 如果設定為 True,則 [ 取得 VM ] 活動會傳回所有虛擬機器的虛擬機器識別碼清單,其中所有虛擬機器的虛擬機器識別碼都符合指定之識別碼值的全部或部分。If it is set to True, the Get VM activity returns a list of the virtual machine IDs of all of the virtual machines whose virtual machine IDs match all or part of the specified ID value.
管理群組Management Group ManagementGroupManagementGroup StringString No 指定將執行此活動的管理群組。Specifies the management group in which this activity will run. 設定為 localhostSet to localhost. (唯讀)(Read-only)
指令碼伺服器Script Server 目標Target StringString Yes 指定執行 Service Manager 主控台之伺服器的網域名稱系統 (DNS) 名稱。Specifies the Domain Name System (DNS) name of the server that runs the Service Manager console. 請勿使用 localhostDo not use localhost.
指令碼時間限制Script Time Limit TimeoutSecondsTimeoutSeconds 整數Integer 否。No. (預設設定為 300 秒。)(The default setting is 300 seconds.) 指定允許執行活動的秒數上限。Specifies the maximum number of seconds to allow for the activity to run.
VM 主機VM Host VMHostVMHost StringString 如果參數集VMHostGroup ,則為必要項Required if the Parameter Set is VMHostGroup 如果 參數集VMHostGroup,則可使用。Available if the Parameter Set is VMHostGroup. 如果選取此參數集,則 取得 VM 活動會傳回在指定的主機上執行之所有虛擬機器的虛擬機器識別碼清單。If this parameter set is selected, the Get VM activity returns a list of the virtual machine IDs of all of the virtual machines running on the specified host.
虛擬機器名稱VM Name VMNameVMName StringString No 指定要搜尋之虛擬機器的名稱或部分名稱。Specifies the name or part of a name of the virtual machine to search for. 如果字串為名稱的一部分,則活動會擷取包含此字串的所有虛擬機器的識別碼。If the string is part of a name, the activity retrieves the IDs of all virtual machines that contain the string.
VMMServerVMMServer VMMServerVMMServer StringString Yes 指定管理虛擬機器的 System Center Virtual Machine Manager (VMM) 伺服器名稱。Specifies the name of the System Center Virtual Machine Manager (VMM) server that manages the virtual machines.

取得 VM活動會產生下表所述的輸出。The Get VM activity generates the output that is described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 註解Comments
VM 識別碼VM IDs VMIDListVMIDList 字串陣列Array of strings 指定名稱符合 VM 名稱 字串全部或部分的虛擬機器識別碼清單。Specifies the list of the IDs of virtual machines with names that match all or part of the VM Name string.

錯誤和例外狀況Errors and exceptions

取得 VM活動會使用 Service Manager 所提供的自訂追蹤服務,來記錄活動執行時的錯誤和例外狀況。The Get VM activity uses the custom tracking service that is supplied by Service Manager to log errors and exceptions when the activity runs. 如果無法解析任何指令碼屬性,則活動會產生適當的錯誤或例外狀況。The activity generates errors or exceptions as appropriate if any of the script properties cannot be resolved.

備註Remarks

無。None.

範例Example

無。None.

移動 VM 活動Move VM activity

Service Manager 中的這項活動會將虛擬機器從 Virtual Machine Manager 的 (VMM) 程式庫移到維護主機。This activity in Service Manager moves a virtual machine from the Virtual Machine Manager (VMM) Library to a maintenance host.

設計階段必要條件Design time prerequisites

無。None.

執行時間必要條件Run time prerequisites

  • Virtual Machine Manager 主控台和 Service Manager 都必須安裝在同一部伺服器上。The Virtual Machine Manager console and Service Manager must both be installed on the same server.

  • 確認 Service Manager 工作流程帳戶具有足夠的許可權可修改 Active Directory 網域服務中的安全性群組   (AD   DS) 。Ensure that the Service Manager Workflow account has sufficient permissions to modify security groups in Active Directory Domain Services (AD DS).

屬性Properties

移動 VM活動會使用下表中的輸入屬性。The Move VM activity uses the input properties in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 描述Description
發生錯誤時仍繼續Continue On Error ContinueOnErrorContinueOnError BooleanBoolean 否。No. (預設值為 True。)(The default setting is True.) 決定此活動失敗時,工作流程是否應該繼續執行。Determines whether the workflow should continue running if the activity fails.
發生錯誤Has Error HasErrorHasError N/AN/A 指定此活動是否有錯誤集。Specifies whether the activity has an error set. (唯讀)(Read-only)
主機忙碌時封鎖 LMBlock LM If Host Busy BlockLMIfHostBusyBlockLMIfHostBusy BooleanBoolean 否。No. (預設值為 False。)(The default setting is False.) 如果 Hyper-V 即時移轉因為來源主機或目的主機已經參與其他即時移轉而失敗,則封鎖重試該移轉。Blocks retrying a Hyper-V live migration if the migration failed because the source host or the destination host is already participating in another live migration.
作業群組Job Group JobGroupJobGroup Guid (字串)Guid (string) No 指定一系列命令的識別碼,這些命令會以集合的方式執行。Specifies an identifier for a series of commands that will run as a set.
作業變數Job Variable JobVariableJobVariable StringString No 指定追蹤工作進度,並將工作進度存放在這個參數命名的變數中。Specifies that job progress is tracked and stored in the variable named by this parameter.
管理群組Management Group ManagementGroupManagementGroup StringString No 指定將執行此活動的管理群組。Specifies the management group in which this activity will run. 設定為 localhostSet to localhost. (唯讀)(Read-only)
路徑Path 路徑Path StringString No 指定維護主機上虛擬機器的目的地。Specifies the destination of the virtual machine on the maintenance host.
PROTipIDPROTipID PROTipIDPROTipID GuidGuid No 指定觸發此動作的效能與資源最佳化 (PRO) 提示識別碼。Specifies the ID of the Performance and Resource Optimization (PRO) tip that triggered this action. 允許 PRO 提示的未來稽核。Allows for future auditing of PRO tips.
以非同步方式執行Run Asynchronously RunAsynchronouslyRunAsynchronously BooleanBoolean 否。No. (預設值為 False。)(The default setting is False.) 指定工作以非同步的方式執行,讓控制權立即交還命令殼層。Specifies that the job runs asynchronously so that control returns to the command shell immediately.
指令碼伺服器Script Server 目標Target StringString Yes 指定執行 Service Manager 主控台之伺服器的網域名稱系統 (DNS) 名稱。Specifies the Domain Name System (DNS) name of the server that runs the Service Manager console. 請勿使用 localhostDo not use localhost.
指令碼時間限制Script Time Limit TimeoutSecondsTimeoutSeconds 整數Integer 否。No. (預設設定為 300 秒。)(The default setting is 300 seconds.) 指定允許執行活動的秒數上限。Specifies the maximum number of seconds to allow for the activity to run.
在目標上啟動 VMStart VM On Target StartVMOnTargetStartVMOnTarget BooleanBoolean 否。No. (預設值為 False。)(The default setting is False.) 指定虛擬機器抵達其目的主機時立即啟動。Specifies that a virtual machine starts as soon as it reaches its destination host.
使用叢集Use Cluster UseClusterUseCluster BooleanBoolean 否。No. (預設值為 False。)(The default setting is False.) 不論叢集是否支援 Hyper-V 即時移轉,皆強制使用 Windows Server 2008 叢集移轉,將處於儲存狀態的虛擬機器轉移到主機。Forces the use of Windows Server 2008 Cluster Migration for the transfer of a virtual machine that is in a saved state to a host, even if the cluster supports Hyper-V live migration.
使用 LANUse LAN UseLanUseLan BooleanBoolean 否。No. (預設值為 False。)(The default setting is False.) 強制透過區域網路 (LAN) 轉移,即使可以使用更快速的方法,例如存放區域網路 (SAN) 轉移。Forces a transfer over the local area network (LAN) even if a faster transfer mechanism, such as a storage area network (SAN) transfer, is available.
VM 主機VM Host VMHostNameVMHostName StringString Yes 指定虛擬機器將要移至的維護主機名稱。Specifies the name of the maintenance host to which the virtual machine will be moved.
VM 識別碼VM ID VMIDVMID StringString Yes 指定要移動之虛擬機器的唯一識別碼。Specifies the unique ID of the virtual machine to be moved.
VMM 伺服器VMM Server VMMServerVMMServer StringString Yes 指定管理虛擬機器的 System Center Virtual Machine Manager (VMM) 伺服器名稱。Specifies the name of the System Center Virtual Machine Manager (VMM) server that manages the virtual machines.

移動 VM活動會產生下表所述的輸出。The Move VM activity generates the output that is described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 註解Comments
VM 識別碼VM ID VMIDVMID StringString 指定已移動之虛擬機器的唯一識別碼。Specifies the unique ID of the virtual machine that was moved. 輸入 VM 識別碼 和輸出 vm 識別碼 都相等,除非活動找不到 VM 識別碼 符合輸入 vm 識別碼的虛擬機器。The input VM ID and the output VM ID are equal unless the activity failed to find a virtual machine with a VM ID that matches the input VM ID. 在此情況下,輸出 VM 識別碼 會設為 Null。In that case, the output VM ID is set to Null.

錯誤和例外狀況Errors and exceptions

移動 VM活動會使用 Service Manager 所提供的自訂追蹤服務,來記錄活動執行時的錯誤和例外狀況。The Move VM activity uses the custom tracking service that is supplied by Service Manager to log errors and exceptions when the activity runs. 如果無法解析任何指令碼屬性,則活動會產生適當的錯誤或例外狀況。The activity generates errors or exceptions as appropriate if any of the script properties cannot be resolved.

備註Remarks

無。None.

範例Example

無。None.

關閉 VM 活動Shutdown VM activity

Service Manager 中的這項活動會關閉虛擬機器上的客體作業系統。This activity in Service Manager shuts down the guest operating system on a virtual machine.

只有在虛擬機器上已安裝虛擬化來賓服務時,您才能在 Windows 主機 (Hyper-v 主機或 Virtual Server 主機) 的虛擬機器上使用「 關閉 VM 」活動。You can use the Shutdown VM activity on a virtual machine on a Windows-based host (a Hyper-V host or a Virtual Server host) only if virtualization guest services are installed on the virtual machine. 對於部署在 Hyper-V 主機上的虛擬機器,虛擬化來賓服務稱為「整合元件」。For a virtual machine that is deployed on a Hyper-V host, the virtualization guest service is called Integration Components. 對於部署在 Virtual Server 主機上的虛擬機器,虛擬化來賓服務稱為 Virtual Machine Additions。For a virtual machine that is deployed on a Virtual Server host, the virtualization guest service is called Virtual Machine Additions.

設計階段必要條件Design time prerequisites

無。None.

執行時間必要條件Run time prerequisites

  • Virtual Machine Manager 主控台和 Service Manager 都必須安裝在同一部伺服器上。The Virtual Machine Manager console and Service Manager must both be installed on the same server.

  • 確認 Service Manager 工作流程帳戶具有足夠的許可權可修改 Active Directory 網域服務中的安全性群組   (AD   DS) 。Ensure that the Service Manager Workflow account has sufficient permissions to modify security groups in Active Directory Domain Services (AD DS).

屬性Properties

關機 VM活動會使用下表所述的輸入屬性。The Shutdown VM activity uses the input properties that are described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 描述Description
發生錯誤時仍繼續Continue On Error ContinueOnErrorContinueOnError BooleanBoolean 否。No. (預設值為 True。)(The default setting is True.) 決定此活動失敗時,工作流程是否應該繼續執行。Determines whether the workflow should continue running if the activity fails.
發生錯誤Has Error HasErrorHasError N/AN/A 指定此活動是否有錯誤集。Specifies whether the activity has an error set. (唯讀)(Read-only)
作業變數Job Variable JobVariableJobVariable StringString No 指定追蹤工作進度,並將工作進度存放在這個參數命名的變數中。Specifies that job progress is tracked and stored in the variable that is named by this parameter.
管理群組Management Group ManagementGroupManagementGroup StringString No 指定將執行此活動的管理群組。Specifies the management group in which this activity will run. 設定為 localhostSet to localhost. (唯讀)(Read-only)
PROTipIDPROTipID PROTipIDPROTipID GuidGuid No 指定觸發此動作的效能與資源最佳化 (PRO) 提示識別碼。Specifies the ID of the Performance and Resource Optimization (PRO) tip that triggered this action. 允許 PRO 提示的未來稽核。Allows for future auditing of PRO tips.
以非同步方式執行Run Asynchronously RunAsynchronouslyRunAsynchronously BooleanBoolean 否。No. (預設值為 False。)(The default setting is False.) 指定工作以非同步的方式執行,讓控制權立即交還命令殼層。Specifies that the job runs asynchronously so that control returns to the command shell immediately.
指令碼伺服器Script Server 目標Target StringString Yes 指定執行 Service Manager 主控台之伺服器的網域名稱系統 (DNS) 名稱。Specifies the Domain Name System (DNS) name of the server that runs the Service Manager console. 請勿使用 LocalhostDo not use Localhost.
指令碼時間限制Script Time Limit TimeoutSecondsTimeoutSeconds 整數Integer 否。No. (預設設定為 300 秒。)(The default setting is 300 seconds.) 指定允許執行活動的秒數上限。Specifies the maximum number of seconds to allow for the activity to run.
VM 識別碼VM ID VMIDVMID StringString Yes 指定要關閉之虛擬機器的唯一識別碼。Specifies the unique ID of the virtual machine to be shut down.
VMMServerVMMServer VMMServerVMMServer StringString Yes 指定管理虛擬機器的 System Center Virtual Machine Manager (VMM) 伺服器名稱。Specifies the name of the System Center Virtual Machine Manager (VMM) server that manages the virtual machines.

關機 VM活動會產生下表所述的輸出。The Shutdown VM activity generates the output that is described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 註解Comments
VM 識別碼VM ID VMIDVMID StringString 指定已關閉之虛擬機器的唯一識別碼。Specifies the unique ID of the virtual machine that was shut down. 輸入 VM 識別碼 和輸出 vm 識別碼 都相等,除非活動找不到 VM 識別碼 符合輸入 vm 識別碼的虛擬機器。The input VM ID and the output VM ID are equal unless the activity failed to find a virtual machine with a VM ID that matches the input VM ID. 在此情況下,輸出 VM 識別碼 會設為 Null。In that case, the output VM ID is set to Null.

錯誤和例外狀況Errors and exceptions

關機 VM活動會使用 Service Manager 所提供的自訂追蹤服務,來記錄活動執行時的錯誤和例外狀況。The Shutdown VM activity uses the custom tracking service that is supplied by Service Manager to log errors and exceptions when the activity runs. 如果無法解析任何指令碼屬性,則活動會產生適當的錯誤或例外狀況。The activity generates errors or exceptions as appropriate if any of the script properties cannot be resolved.

備註Remarks

無。None.

範例Example

無。None.

啟動 VM 活動Start VM activity

Service Manager 中的此活動會啟動已停止或已暫停的虛擬機器。This activity in Service Manager starts a stopped or paused virtual machine.

設計階段必要條件Design time prerequisites

無。None.

執行時間必要條件Run time prerequisites

無。None.

屬性Properties

啟動 VM活動會使用下表中的輸入屬性。The Start VM activity uses the input properties in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 描述Description
發生錯誤時仍繼續Continue On Error ContinueOnErrorContinueOnError BooleanBoolean 否。No. (預設值為 True。)(The default setting is True.) 決定此活動失敗時,工作流程是否應該繼續執行。Determines whether the workflow should continue running if the activity fails.
發生錯誤Has Error HasErrorHasError N/AN/A 指定此活動是否有錯誤集。Specifies whether the activity has an error set. (唯讀)(Read-only)
作業變數Job Variable JobVariableJobVariable StringString No 指定追蹤工作進度,並將工作進度存放在這個參數命名的變數中。Specifies that job progress is tracked and stored in the variable that is named by this parameter.
管理群組Management Group ManagementGroupManagementGroup StringString No 將執行此活動的管理群組。The management group in which this activity will run. 設定為 localhostSet to localhost. (唯讀)(Read-only)
PROTipIDPROTipID PROTipIDPROTipID GuidGuid No 指定觸發此動作的效能與資源最佳化 (PRO) 提示識別碼。Specifies the ID of the Performance and Resource Optimization (PRO) tip that triggered this action. 允許 PRO 提示的未來稽核。Allows for future auditing of PRO tips.
以非同步方式執行Run Asynchronously RunAsynchronouslyRunAsynchronously BooleanBoolean 否。No. (預設值為 False。)(The default setting is False.) 指定工作以非同步的方式執行,讓控制權立即交還命令殼層。Specifies that the job runs asynchronously so that control returns to the command shell immediately.
指令碼伺服器Script Server 目標Target StringString Yes 指定執行 Service Manager 主控台之伺服器的網域名稱系統 (DNS) 名稱。Specifies the Domain Name System (DNS) name of the server that runs the Service Manager console. 請勿使用 localhostDo not use localhost.
指令碼時間限制Script Time Limit TimeoutSecondsTimeoutSeconds 整數Integer 否。No. (預設設定為 300 秒。)(The default setting is 300 seconds.) 指定允許執行活動的秒數上限。Specifies the maximum number of seconds to allow for the activity to run.
VM 識別碼VM ID VMIDVMID StringString Yes 指定要啟動之虛擬機器的唯一識別碼。Specifies the unique ID of the virtual machine to be started.
VMMServerVMMServer VMMServerVMMServer StringString Yes 指定管理虛擬機器的 System Center Virtual Machine Manager (VMM) 伺服器名稱。Specifies the name of the System Center Virtual Machine Manager (VMM) server that manages the virtual machines.

啟動 VM活動會產生下表所述的輸出。The Start VM activity generates the output that is described in the following table.

顯示名稱Display Name 內部名稱Internal Name 類型Type 註解Comments
VM 識別碼VM ID VMIDVMID StringString 指定已啟動之虛擬機器的唯一識別碼。Specifies the unique ID of the virtual machine that was started. 輸入 VM 識別碼 和輸出 vm 識別碼 都相等,除非活動找不到 VM 識別碼 符合輸入 vm 識別碼的虛擬機器。The input VM ID and the output VM ID are equal unless the activity failed to find a virtual machine with a VM ID that matches the input VM ID. 在此情況下,輸出 VM 識別碼 會設為 Null。In that case, the output VM ID is set to Null.

錯誤和例外狀況Errors and exceptions

啟動 VM活動會使用 Service Manager 所提供的自訂追蹤服務,來記錄活動執行時的錯誤和例外狀況。The Start VM activity uses the custom tracking service that is supplied by Service Manager to log errors and exceptions when the activity runs. 如果無法解析任何指令碼屬性,則活動會產生適當的錯誤或例外狀況。The activity generates errors or exceptions as appropriate if any of the script properties cannot be resolved.

備註Remarks

無。None.

範例Example

無。None.

儲存狀態 VM 活動Save State VM activity

Service Manager 中的這項活動會儲存虛擬機器的狀態,然後停止虛擬機器。This activity in Service Manager saves the state of a virtual machine and then stops the virtual machine.

設計階段必要條件Design time prerequisites

無。None.

執行時間必要條件Run time prerequisites

  • Virtual Machine Manager 主控台和 Service Manager 必須同時安裝在同一部伺服器上。The Virtual Machine Manager console and Service Manager must be both installed on the same server.

  • 確認 Service Manager 工作流程帳戶具有足夠的許可權可修改 Active Directory 網域服務中的安全性群組   (AD   DS) 。Ensure that the Service Manager Workflow account has sufficient permissions to modify security groups in Active Directory Domain Services (AD DS).

屬性Properties

[ 儲存狀態 VM ] 活動會使用下表所述的輸入屬性。The Save State VM activity uses the input properties that are described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 描述Description
發生錯誤時仍繼續Continue On Error ContinueOnErrorContinueOnError BooleanBoolean 否。No. (預設值為 True。)(The default setting is True.) 決定此活動失敗時,工作流程是否應該繼續執行。Determines whether the workflow should continue running if the activity fails.
發生錯誤Has Error HasErrorHasError N/AN/A 指定此活動是否有錯誤集。Specifies whether the activity has an error set. (唯讀)(Read-only)
作業變數Job Variable JobVariableJobVariable StringString No 指定追蹤工作進度,並將工作進度存放在這個參數命名的變數中。Specifies that job progress is tracked and stored in the variable that is named by this parameter.
管理群組Management Group ManagementGroupManagementGroup StringString No 指定將執行此活動的管理群組。Specifies the management group in which this activity will run. 設定為 localhostSet to localhost. (唯讀)(Read-only)
PROTipIDPROTipID PROTipIDPROTipID GuidGuid No 指定觸發此動作的效能與資源最佳化 (PRO) 提示識別碼。Specifies the ID of the Performance and Resource Optimization (PRO) tip that triggered this action. 允許 PRO 提示的未來稽核。Allows for future auditing of PRO tips.
以非同步方式執行Run Asynchronously RunAsynchronouslyRunAsynchronously BooleanBoolean 否。No. (預設值為 False。)(The default setting is False.) 指定工作以非同步的方式執行,讓控制權立即交還命令殼層。Specifies that the job runs asynchronously so that control returns to the command shell immediately.
指令碼伺服器Script Server 目標Target StringString Yes 指定執行 Service Manager 主控台之伺服器的網域名稱系統 (DNS) 名稱。Specifies the Domain Name System (DNS) name of the server that runs the Service Manager console. 請勿使用 localhostDo not use localhost.
指令碼時間限制Script Time Limit TimeoutSecondsTimeoutSeconds 整數Integer 否。No. (預設設定為 300 秒。)(The default setting is 300 seconds.) 指定允許執行活動的秒數上限。Specifies the maximum number of seconds to allow for the activity to run.
VM 識別碼VM ID VMIDVMID StringString Yes 指定要儲存之虛擬機器的唯一識別碼。Specifies the unique ID of the virtual machine to be saved.
VMM 伺服器VMM Server VMMServerVMMServer StringString Yes 指定管理虛擬機器的 System Center Virtual Machine Manager (VMM) 伺服器名稱。Specifies the name of the System Center Virtual Machine Manager (VMM) server that manages the virtual machines.

[ 儲存狀態 VM ] 活動會產生下表所述的輸出。The Save State VM activity generates the output that is described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 註解Comments
VM 識別碼VM ID VMIDVMID StringString 指定已儲存之虛擬機器的唯一識別碼。Specifies the unique ID of the virtual machine that was saved. 輸入 VM 識別碼 和輸出 vm 識別碼 都相等,除非活動找不到 VM 識別碼 符合輸入 vm 識別碼的虛擬機器。The input VM ID and the output VM ID are equal unless the activity failed to find a virtual machine with a VM ID that matches the input VM ID. 在此情況下,輸出 VM 識別碼 會設為 Null。In that case, the output VM ID is set to Null.

錯誤和例外狀況Errors and exceptions

[ 儲存狀態 VM ] 活動會使用 Service Manager 所提供的自訂追蹤服務,來記錄活動執行時的錯誤和例外狀況。The Save State VM activity uses the custom tracking service that is supplied by Service Manager to log errors and exceptions when the activity runs. 如果無法解析任何指令碼屬性,則活動會產生適當的錯誤或例外狀況。The activity generates errors or exceptions as appropriate if any of the script properties cannot be resolved.

備註Remarks

無。None.

範例Example

無。None.

腳本活動Script activities

使用 Service Manager 中的腳本活動,將腳本當作工作流程的一部分來執行。Use a script activity in Service Manager to run a script as part of a workflow.

指令碼活動會以獨立於工作流程的個別程序執行,不過,它們也是在 Service Manager 工作流程帳戶的安全性內容下執行。Script activities run as a separate process from the workflows; however, they also run under the security context of the Service Manager Workflow account.

Service Manager Authoring Tool 在 [活動工具箱] 窗格的 [腳本活動] 群組的 [泛型指令碼活動] 子群組中,提供下列三個預設腳本活動。The Service Manager Authoring Tool provides the following three default script activities in the Generic Script Activities subgroup of the Script Activities group in the Activities Toolbox pane.

命令腳本活動Command Script activity

此活動可執行命令列指令碼作為 Windows Workflow Foundation (WF) 工作流程的一部分。This activity runs a command-line script as part of a Windows Workflow Foundation (WF) workflow.

設計階段必要條件Design-time prerequisites

無。None.

執行時間必要條件Run-time prerequisites

無。None.

屬性Properties

命令腳本活動會使用下表所述的輸入屬性。The Command Script activity uses the input properties that are described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 描述Description
發生錯誤時仍繼續Continue On Error ContinueOnErrorContinueOnError BooleanBoolean 否。No. (預設值為 True。)(The default setting is True.) 決定此活動失敗時,工作流程是否應該繼續執行。Determines whether the workflow should continue running if the activity fails.
發生錯誤Has Error HasErrorHasError N/AN/A 指定此活動是否有錯誤集。Specifies whether the activity has an error set. (唯讀)(Read-only)
管理群組Management Group ManagementGroupNameManagementGroupName StringString No 指定指令碼伺服器所屬的管理群組。Specifies the management group to which the script server belongs. 根據預設,這會設定為 localhostBy default, this is set to localhost. (唯讀)(Read-only)
指令碼參數Script Parameters 參數Parameters 字典 <字串,字串>Dictionary <string,string> Yes 指定在指令碼執行時要傳遞至指令碼的命令列參數或參數/值組。Specifies command-line switches or switch/value pairs to be passed into the script when it runs.
指令碼主體Script Body ScriptBodyScriptBody StringString Yes 指定指令碼本身的文字。Specifies the text of the script itself.
指令碼伺服器Script Server 目標Target StringString No 指定執行 Service Manager 主控台之伺服器的網域名稱系統 (DNS) 名稱。Specifies the Domain Name System (DNS) name of the server that runs the Service Manager console. 請勿使用 localhostDo not use localhost.
指令碼時間限制Script Time Limit TimeoutSecondsTimeoutSeconds 整數Integer 否。No. (預設設定為 300 秒。)(The default setting is 300 seconds.) 指定允許執行指令碼的秒數上限。Specifies the maximum number of seconds to allow for the script to run.

錯誤和例外狀況Errors and exceptions

命令腳本活動會使用 Service Manager 所提供的自訂追蹤服務,來記錄活動執行時的錯誤和例外狀況。The Command Script activity uses the custom tracking service that is supplied by Service Manager to log errors and exceptions when the activity runs. 如果無法解析任何指令碼屬性,則活動會產生適當的錯誤或例外狀況。The activity generates errors or exceptions as appropriate if any of the script properties cannot be resolved.

備註Remarks

無。None.

範例Example

無。None.

Windows PowerShell 腳本活動Windows PowerShell Script activity

Service Manager 中的這項活動會將 Windows PowerShell 腳本作為 Windows Workflow Foundation (WF) 工作流程的一部分來執行。This activity in Service Manager runs a Windows PowerShell script as part of a Windows Workflow Foundation (WF) workflow.

設計階段必要條件Design-time prerequisites

Windows PowerShell 腳本 」活動相依于設計階段的下列必要條件:The Windows PowerShell Script activity depends upon the following prerequisites at design time:

  • Windows PowerShell 2.0Windows PowerShell 2.0

執行時間必要條件Run-time prerequisites

Windows PowerShell 2.0Windows PowerShell 2.0

屬性Properties

Windows PowerShell 腳本活動會使用下表所述的輸入屬性。The Windows PowerShell Script activity uses the input properties that are described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 描述Description
發生錯誤時仍繼續Continue On Error ContinueOnErrorContinueOnError BooleanBoolean 否。No. (預設值為 True。)(The default setting is True.) 決定此活動失敗時,工作流程是否應該繼續執行。Determines whether the workflow should continue running if the activity fails.
發生錯誤Has Error HasErrorHasError N/AN/A 指定此活動是否有錯誤集。Specifies whether the activity has an error set. (唯讀)(Read-only)
管理群組Management Group ManagementGroupNameManagementGroupName StringString No 指定指令碼伺服器所屬的管理群組。Specifies the management group to which the script server belongs. 根據預設,這會設定為 localhostBy default, this is set to localhost. (唯讀)(Read-only)
指令碼參數Script Parameters 參數Parameters 字典 <字串,字串>Dictionary <string,string> Yes 指定在指令碼執行時要傳遞至指令碼的參數名稱/值清單。Specifies the name/value list of parameters to be passed into the script when it runs.

您可以將參數值設定為下列任何管理組件參考︰You can set parameter values to any of the following management pack references:

-$Target/... $- $Target/...$
-$MPElement [...]- $MPElement[...]
-$Data/... $。- $Data/...$. $Data 參考只會於執行階段在參數中解析 (而不在指令碼本身中)。$Data references are resolved only at run time in the parameters (not in the script itself).

使用這些參考的其中一個做為參數的唯一值,就會將該參數從 GetItemXML) 設定為代表輸入資料項目 (的 XML 字串。Using one of these references as the only value for a parameter sets that parameter to the XML string that represents the input data item (from GetItemXML).
指令碼主體Script Body ScriptBodyScriptBody StringString Yes 指定指令碼本身的文字。Specifies the text of the script itself.
嵌入式管理單元Snap-ins SnapInsSnapIns StringString No 列出可預先載入至運行空間的 Windows PowerShell 嵌入式管理單元。Lists Windows PowerShell snap-ins to preload into the runspace.
指令碼伺服器Script Server 目標Target StringString No 指定執行 Service Manager 主控台之伺服器的網域名稱系統 (DNS) 名稱。Specifies the Domain Name System (DNS) name of the server that runs the Service Manager console. 請勿使用 localhostDo not use localhost.
指令碼時間限制Script Time Limit TimeoutSecondsTimeoutSeconds 整數Integer 否。No. (預設設定為 300 秒。)(The default setting is 300 seconds.) 指定允許執行指令碼的秒數上限。Specifies the maximum number of seconds to allow for the script to run.

錯誤和例外狀況Errors and exceptions

Windows PowerShell 腳本活動會使用 Service Manager 所提供的自訂追蹤服務,來記錄活動執行時的錯誤和例外狀況。The Windows PowerShell Script activity uses the custom tracking service that is supplied by Service Manager to log errors and exceptions when the activity runs. 如果無法解析任何指令碼屬性,則活動會產生適當的錯誤或例外狀況。The activity generates errors or exceptions as appropriate if any of the script properties cannot be resolved.

備註Remarks

如需 Windows PowerShell 的詳細資訊,請參閱 Windows PowerShellFor more information about Windows PowerShell, see Windows PowerShell.

VBScript 腳本活動VBScript Script activity

Service Manager 中的這項活動會以 Windows Workflow Foundation (WF) 工作流程的一部分來執行 VBScript 腳本。This activity in Service Manager runs a VBScript script as part of a Windows Workflow Foundation (WF) workflow.

設計階段必要條件Design-time prerequisites

VBScript 腳本活動在設計階段取決於下列必要條件:The VBScript Script activity depends on the following prerequisites at design time:

無。None.

執行時間必要條件Run-time prerequisites

無。None.

屬性Properties

VBScript 腳本活動會使用下表所述的輸入屬性。The VBScript Script activity uses the input properties that are described in the following table.

顯示名稱Display Name 內部名稱Internal Name 類型Type 必要Required 描述Description
發生錯誤時仍繼續Continue On Error ContinueOnErrorContinueOnError BooleanBoolean 否。No. (預設值為 True。)(The default setting is True.) 決定此活動失敗時,工作流程是否應該繼續執行。Determines whether the workflow continues to run if the activity fails.
發生錯誤Has Error HasErrorHasError N/AN/A 指定此活動是否有錯誤集。Specifies whether the activity has an error set. (唯讀)(Read-only)
管理群組Management Group ManagementGroupNameManagementGroupName StringString No 指定指令碼伺服器所屬的管理群組。Specifies the management group to which the script server belongs. (預設會將此設定為 localhost) (唯讀) (By default, this is set to localhost) (Read-only)
指令碼參數Script Parameters 參數Parameters 字典 <字串,字串>Dictionary <string,string> Yes 標準參數以及此指令碼執行時所使用之任何相關值的清單。Provides the list of the standard switches and any associated values that this script uses when it runs.
指令碼主體Script Body ScriptBodyScriptBody StringString Yes 指定指令碼本身的文字。Specifies the text of the script itself.
指令碼伺服器Script Server 目標Target StringString No 指定執行 Service Manager 主控台之伺服器的網域名稱系統 (DNS) 名稱。Specifies the Domain Name System (DNS) name of the server that runs the Service Manager console. 請勿使用 localhostDo not use localhost.
指令碼時間限制Script Time Limit TimeoutSecondsTimeoutSeconds 整數Integer 否。No. (預設設定為 300 秒。)(The default setting is 300 seconds.) 指定允許執行指令碼的秒數上限。Specifies the maximum number of seconds to allow for the script to run.

錯誤和例外狀況Errors and exceptions

VBScript 腳本活動會使用 Service Manager 所提供的自訂追蹤服務,來記錄活動執行時的錯誤和例外狀況。The VBScript Script activity uses the custom tracking service that is supplied by Service Manager to log errors and exceptions when the activity runs. 如果無法解析任何指令碼屬性,則活動會產生適當的錯誤或例外狀況。The activity generates errors or exceptions as appropriate if any of the script properties cannot be resolved.

備註Remarks

無。None.

範例Example

無。None.

Service Manager 活動Service Manager activities

使用 Service Manager 中的 Service Manager 活動,讓 Service Manager 函式成為工作流程的一部分。Use Service Manager activities in Service Manager to make Service Manager functions part of your workflow.

Service Manager Authoring Tool 在 [活動工具箱] 窗格的 [ SM 活動] 群組中提供下列四個預設 Service Manager 活動。The Service Manager Authoring Tool provides the following four default Service Manager activities in the SM Activities group in the Activities Toolbox pane.

建立事件活動Create Incident activity

此活動會在 Service Manager 中建立並填入事件。This activity creates and populates an incident in Service Manager.

設計階段必要條件Design-time prerequisites

無。None.

執行時間必要條件Run-time prerequisites

無。None.

屬性Properties

建立事件活動會使用下表所列的輸入屬性。The Create Incident activity uses the input properties that are listed in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 註解Comments
事件識別碼Incident ID IncidentIDIncidentID StringString Yes 指定針對 事件 物件產生的唯一識別碼。Specifies the unique identifier who is generated for the Incident object.
動作記錄註解Action Log Comment ActionLogCommentActionLogComment StringString Yes 指定要包含在 事件 物件之動作記錄中的批註。Specifies the comment to include in the Incident object's action log.
受影響的使用者網域Affected User Domain AffectedUserDomainAffectedUserDomain StringString Yes 指定受此事件影響之主要使用者的網域名稱系統 (DNS) 網域名稱。Specifies the name of the Domain Name System (DNS) domain of the primary user who is affected by the incident.
受影響的使用者名稱Affected User Name AffectedUserNameAffectedUserName StringString Yes 指定受此事件影響之主要使用者的使用者名稱。Specifies the user name of the primary user who is affected by the incident.
類別Category 類別Category 整數Integer Yes 指定事件的類型,例如「網路」或「列印」。Specifies the type of incident, such as "Networking" or "Printing." 此值為 列舉的識別碼。The value is the ID of enum. (類別-列舉 資料欄位) (Category -enum data field)
發生錯誤時仍繼續Continue On Error ContinueOnErrorContinueOnError BooleanBoolean 否。No. (預設值為 True。)(The default setting is true.) 決定此活動失敗時,工作流程是否應該繼續執行。Determines whether the workflow should continue running if the activity fails.
影響Impact 影響Impact 整數Integer Yes 指定此事件對受影響的使用者的影響。Specifies the impact of the incident on the affected user or users. 此值為 列舉的識別碼。The value is the ID of enum. (影響-列舉 資料類型) (Impact -enum data type)
來源Source 來源Source 整數Integer No 指定事件相關資訊的來源,例如「電話」或「電子郵件」。Specifies the source of information about the incident, such as "Phone" or "E-mail". 此值為 列舉的識別碼。The value is the ID of enum. (來源-列舉 資料類型欄位) (Source -enum data type field)
總結Summary 總結Summary StringString Yes 指定描述事件的摘要文字。Specifies the summary text that describes the incident.
急迫性Urgency 急迫性Urgency 整數Integer Yes 指定解決事件的急迫性。Specifies the urgency of resolving the incident. 此值為 列舉的識別碼。The value is the ID of enum. (緊迫-列舉 資料類型欄位) (Urgency -enum data type field)

建立事件活動會產生下表所述的輸出。The Create Incident activity generates the output that is described in the following table.

名稱Name 類型Type 註解Comments
SM 事件SM Incident System.WorkItem.IncidentSystem.WorkItem.Incident 傳回建構的事件類別執行個體。Returns the constructed incident class instance.

錯誤和例外狀況Errors and exceptions

無。None.

備註Remarks

無。None.

範例Example

無。None.

取得事件活動Get Incident activity

此活動會在 Service Manager 中取得一或多個事件。This activity retrieves one or more incidents in Service Manager.

設計階段必要條件Design-time prerequisites

無。None.

執行時間必要條件Run-time prerequisites

無。None.

屬性Properties

取得事件活動會使用下表所列的輸入屬性。The Get Incident activity uses the input properties that are listed in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 註解Comments
受影響的使用者網域Affected User Domain AffectedUserDomainAffectedUserDomain StringString No 指定受此事件影響之主要使用者的網域名稱系統 (DNS) 網域名稱。Specifies the name of the Domain Name System (DNS) domain of the primary user who is affected by the incident.
受影響的使用者名稱Affected User Name AffectedUserNameAffectedUserName StringString No 指定受此事件影響之主要使用者的使用者名稱。Specifies the user name of the primary user who is affected by the incident.
類別Category 類別Category 整數Integer No 指定事件的類型,例如「網路」或「列印」。Specifies the type of incident, such as "Networking" or "Printing." 此值為 列舉的識別碼。The value is the ID of enum. (類別-列舉 資料欄位) (Category -enum data field)
發生錯誤時仍繼續Continue On Error ContinueOnErrorContinueOnError BooleanBoolean 否。No. (預設為 "True"。)(The default is true.) 決定此活動失敗時,工作流程是否應該繼續執行。Determines whether the workflow should continue running if the activity fails.
事件識別碼Incident ID IncidentIDIncidentID StringString No 指定針對事件物件產生的唯一識別碼。Specifies the unique identifier that is generated for the incident object.
搜尋類型Search Type SearchTypeSearchType 整數嗎?Integer? No 指定與活動搭配使用的搜尋類型標題。Specifies the title of the search type that is used with the activity.
狀態Status 狀態Status 整數Integer No 指定事件的狀態。Specifies the status of incident. 此值為 列舉的識別碼。The value is the ID of enum. (狀態-列舉 資料欄位) (Status -enum data field)
摘要文字Summary Text SummaryTextSummaryText StringString No 指定描述事件的摘要文字。Specifies the summary text that describes the incident.

取得事件活動會產生下表所述的輸出。The Get Incident activity generates the output that is described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 註解Comments
SM 事件SM Incidents SMIncidentsSMIncidents System.WorkItem.Incident 的陣列Array of System.Workitem.Incident 指定事件物件的陣列。Specifies an array of incident objects.

錯誤和例外狀況Errors and exceptions

無。None.

備註Remarks

取得事件活動有自己的驗證程式,可對輸入屬性執行錯誤驗證。The Get Incident activity has its own validator to perform error validation on input properties.

範例Example

無。None.

更新事件活動Update Incident activity

Service Manager 中的這項活動會將屬性變更儲存至一個 Service Manager 事件。This activity in Service Manager saves property changes to one Service Manager incident.

設計階段必要條件Design-time prerequisites

無。None.

執行時間必要條件Run-time prerequisites

無。None.

屬性Properties

更新事件活動會使用下表所述的輸入屬性。The Update Incident activity uses the input properties that are described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 描述Description
動作記錄註解Action Log Comment ActionLogCommentActionLogComment StringString No 指定要包含在事件物件之動作記錄中的批註。Specifies a comment to include in the Incident object's action log.
受影響的使用者網域Affected User Domain AffectedUserDomainAffectedUserDomain StringString No 指定受此事件影響之主要使用者的網域名稱系統 (DNS) 網域名稱。Specifies the name of the Domain Name System (DNS) domain of the primary user who is affected by the incident.
受影響的使用者名稱Affected User Name AffectedUserNameAffectedUserName StringString No 指定受此事件影響之主要使用者的使用者名稱。Specifies the user name of the primary user who is affected by the incident.
類別Category 類別Category 整數Integer No 指定事件的類型,例如「網路」或「列印」。Specifies the type of incident, such as "Networking" or "Printing." 此值為 列舉的識別碼。The value is the ID of enum. (類別-列舉 資料類型) (Category -enum data type)
發生錯誤時仍繼續Continue On Error ContinueOnErrorContinueOnError BooleanBoolean 否。No. (預設值為 True。)(The default setting is true.) 決定此活動失敗時,工作流程是否應該繼續執行。Determines whether the workflow should continue running if the activity fails.
影響Impact 影響Impact 整數Integer No 指定此事件對受影響的使用者的影響。Specifies the impact of the incident on the affected user or users. 此值為 列舉的識別碼。The value is the ID of enum. (影響-列舉 資料類型) (Impact -enum data type)
來源Source 來源Source 整數Integer No 指定事件相關資訊的來源,例如「電話」或「電子郵件」。Specifies the source of information about the incident, such as "Phone" or "E-mail." 此值為 列舉的識別碼。The value is the ID of enum. (來源-列舉 資料類型) (Source -enum data type)
Service Manager 事件Service Manager Incident SMIncidentSMIncident System.WorkItem.IncidentSystem.Workitem.Incident No 要更新的建構事件類別執行個體。The constructed incident class instance to be updated.
狀態Status 狀態Status 整數Integer No 指定產生活動之事件的狀態。Specifies the status of the incident that generated the activity. 此值為 列舉的識別碼。The value is the ID of enum. (狀態-列舉 資料類型) (Status -enum data type)
總結Summary 總結Summary StringString No 指定描述事件的摘要文字。Specifies the summary text that describes the incident.
急迫性Urgency 急迫性Urgency 整數Integer No 指定解決事件的急迫性。Specifies the urgency of resolving the incident. 此值為 列舉的識別碼。The value is the ID of enum. (緊迫-列舉 資料類型欄位) (Urgency -enum data type field)

更新事件活動會產生下表所述的輸出。The Update Incident activity generates the output that is described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 描述Description
SM 事件SM Incident SMIncidentSMIncident System.WorkItem.IncidentSystem.WorkItem.Incident 傳回事件類別執行個體的更新。Returns an update of the incident class instance. 輸入 Sm 事件 和輸出 SM 事件都相等,除非活動找不到 SM 事件The input SM Incident and the output SM Incidentare equal unless the activity failed to find the SM Incident. 在此情況下,輸出 SM 事件 會設定為 Null。In that case, the output SM Incident is set to Null.

錯誤和例外狀況Errors and exceptions

無。None.

備註Remarks

無。None.

範例Example

無。None.

將活動狀態設定為已完成活動Set Activity Status to Completed activity

此活動會更新 Service Manager 中自動化活動的狀態。This activity updates the status of an automated activity in Service Manager.

設計階段必要條件Design-time prerequisites

無。None.

執行時間必要條件Run-time prerequisites

無。None.

屬性Properties

[ 將活動狀態設定為已完成 ] 活動會使用下表所述的輸入屬性。The Set Activity Status to Completed activity uses the input properties that are described in the following table.

顯示名稱Display name 內部名稱Internal name 類型Type 必要Required 描述Description
活動識別碼Activity ID ActivityIDActivityID StringString Yes 指定 Service Manager 自動化活動物件的識別碼。Specifies the identifier of a Service Manager automated activity object.

錯誤和例外狀況Errors and exceptions

無。None.

備註Remarks

當您在 Service Manager 自動化活動所觸發的工作流程中使用這個活動時,請輸入 $Data/basemanagedentityid $ 做為此屬性的值。When you are using this activity in a workflow that is triggered by a Service Manager automated activity, enter $Data/BaseManagedEntityId$ as the value of this property. 此值適用于觸發工作流程執行的自動化活動的 [ 將活動狀態設定為已完成 ] 活動。This value applies to the Set Activity Status to Completed activity at the automated activity that triggered the workflow to run.

範例Example

無。None.