使用 Service Manager Authoring Tool 管理工作流程Manage workflows with the Service Manager Authoring Tool

重要

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

若要在 Service Manager Authoring Tool 中使用工作流程讓程序自動執行,您必須定義工作流程應該執行的工作、預定執行的時間,以及它所需要的資訊。To use a workflow to automate a process in the Service Manager Authoring Tool, you must define what the workflow should do, when it should run, and what information it needs. 您可以開始使用一般定義,然後加以調整,直到您擁有可在 Service Manager 中使用的詳細資料。You can start with general definitions and then refine them until you have details that you can work with in Service Manager.

請使用本節中的程序,在 Service Manager Authoring Tool 中建立或刪除工作流程。Use the procedures in this section to create or delete workflows in the Service Manager Authoring Tool. Authoring Tool 提供可協助您建立工作流程的 wizard。The Authoring Tool provides a wizard to help you create workflows.

所有工作流程都是在 Service Manager 工作流程帳戶的安全性內容下執行。All workflows run under the security context of the Service Manager Workflow account.

建立新的工作流程Create a new workflow

請在 Service Manager Authoring Tool 中使用建立工作流程精靈來建立新的工作流程。Use the Create Workflow Wizard to create a new workflow in the Service Manager Authoring Tool. 建立工作流程之後,您可以如 Adding or Removing Workflow Activities所述,在工作流程中填入活動。After you create the workflow, you can populate the workflow with activities, as described in Adding or Removing Workflow Activities.

重要

所有工作流程都是在 Service Manager 工作流程帳戶的安全性內容下執行。All workflows run under the security context of the Service Manager Workflow account.

下列程序將引導您完成建立新工作流程的程序:The following procedures guide you through the process of creating a new workflow:

  • 如果您想建立根據排程或固定時間間隔執行的工作流程,請使用<若要建立由計時器或排程觸發的新工作流程>程序。If you want to create a workflow that runs according to a schedule or a fixed time interval, use the procedure "To create a new workflow triggered by a timer or schedule."
  • 如果您要建立回應 Service Manager 資料庫變更而執行的工作流程,請使用<若要建立由計時器或排程觸發的新工作流程>程序。If you want to create a workflow that runs in response to a change in the Service Manager database, use the procedure "To create a new workflow triggered by a database change." 在 Woodgrove Bank 的自訂案例中,Ken 就是使用這個程序來建立名為 AddComputertoADGroupWF的工作流程。In the Woodgrove Bank customization scenario, Ken uses this procedure to create a workflow named AddComputertoADGroupWF.

重要

完成精靈之後,您就不能變更工作流程使用的觸發程序類型。After you have completed the wizard, you cannot change the type of trigger that the workflow uses. 例如,在您建立使用計時器觸發程序的工作流程之後,便無法將它變更為改用資料庫觸發程序。For example, after you create a workflow that uses a timer trigger, you cannot change it to use a database trigger instead.

若要建立由計時器或排程觸發的新工作流程To create a new workflow triggered by a timer or schedule

  1. 在 Authoring Tool 中,開啟您要儲存此工作流程的管理元件。In the Authoring Tool, open the management pack where you want to store this workflow.
  2. 在 [ Management Pack Explorer] 中,以滑鼠右鍵 - 按一下 [ 工作流程],然後按一下 [ 建立]。In the Management Pack Explorer, right-click Workflows, and then click Create.
  3. 在 [建立工作流程嚮導] 的 [ 一般 ] 頁面上,輸入工作流程的名稱。On the General page of the Create Workflow Wizard, enter a name for the workflow. 名稱中只能包含英數字元或底線字元、長度不能超過 50 個字元、開頭必須是字母或底線字元,而且不能包含空格。The name must include only alphanumeric or underscore characters, have 50 or fewer characters, and start with an alphabetical or underscore character, and it cannot have spaces. 例如,請輸入 AddComputerToADGroupWFFor example, enter AddComputerToADGroupWF.
  4. 如果您要新增工作流程的描述,請將它輸入 [描述] **** 方塊中。If you want to add a description of the workflow, type it in the Description box. 請注意,雖然這段文字沒有長度限制,但是在 ( 嚮導的 [ 摘要 ] 頁面上,某些視圖(例如工作流程的屬性清單) ) 可能只會顯示前200個字元。Note that, although there is no limit on the length of this text, some views (such as the list of the workflow's properties on the Summary page of the wizard) might only display the first 200 characters.
  5. 如果要變更工作流程重試間隔和執行時間上限的預設值,請在 [一般] **** 頁面上按一下 [進階] ****。If you want to change the default values for the workflow retry interval and the maximum time to run, on the General page, click Advanced. 在 [進階] **** 對話方塊中,為 [間隔] **** 和 [執行工作流程的時間上限] **** 設定新的值,然後按一下 [確定] ****。In the Advanced dialog box, set new values for Interval and for Maximum time to run the workflow, and then click OK. 請注意,執行時間上限的值必須大於 60 秒,但小於 24 小時。Note that the value for the maximum time to run must be more than 60 seconds, but less than 24 hours.
  6. 在 [觸發條件] **** 頁面上,如果您想讓觸發程序在特定時間執行或依特定間隔執行,請使用預設設定 [計時] ****,然後按 [下一步] ****。On the Trigger Condition page, if you want the trigger to run at a specific time or at a specific interval, use the default setting Timer, and then click Next.
  7. 在 [觸發條件] 頁面上,設定 ( 每週其他間隔執行工作流程的間隔 ) :On the Trigger Criteria page, configure the interval at which to run the workflow (either Weekly or Other Interval):
    1. 若要將工作流程設定成在一週的特定幾天執行,請按一下 [每週] ****。To set the workflow to run on specific days of the week, click Weekly. 請使用 [開始時間] **** 撥盤控制來設定規則的開始時間。Use the Start time dial control to set a start time for the rule. 若要設定 [小時]、[分鐘] 或 [00:00] - 24:00 值,請按一下 [值],然後按一下向上箭號或向下箭號。To set the hour, minutes, or 00:00-24:00 values, click the value, and then click the up arrow or down arrow. 接著,請選取您要執行規則的每一個日子的核取方塊。Then, select the check boxes for each day that you want the rule to run.

      注意

      您所設定的時間是執行工作流程 Service Manager 伺服器上的時間,而不是執行 Authoring Tool 的伺服器上的本機時間。The time that you set is the time on the Service Manager server that runs the workflow, not the local time on the server that runs the Authoring Tool.

      -or--or-
      若要將工作流程設定成在經過特定時間後重複執行,請按一下 [其他間隔] ****。To set the workflow to repeat after a specific time, click Other Interval. 在 [頻率] 方塊中輸入整數值,然後選取間隔 ( 天數小時分鐘數的類型 ) 。In the Frequency box, enter an integer value, and then select the type of interval (Days, Hours, Minutes, or Seconds).

    2. 設定工作流程的間隔之後,請按 [下一步] ****。After you have set the interval for the workflow, click Next.

  8. 在 [摘要] **** 頁面上檢閱新工作流程的設定,然後按一下 [建立] ****。On the Summary page, review the settings for the new workflow, and then click Create. 在精靈完成後,按一下 [關閉] ****。After the wizard is completed, click Close.

若要建立由資料庫變更觸發的新工作流程To create a new workflow triggered by a database change

  1. 在 Authoring Tool 中,開啟您要儲存此工作流程的管理元件。In the Authoring Tool, open the management pack where you want to store this workflow.
  2. 在 [ Management Pack Explorer] 中,以滑鼠右鍵 - 按一下 [ 工作流程],然後按一下 [ 建立]。In the Management Pack Explorer, right-click Workflows, and then click Create.
  3. 在 [建立工作流程精靈] **** 的 [一般] **** 頁面上,輸入工作流程的名稱。On the General page of the Create Workflow wizard, enter a name for the workflow. 名稱中只能包含英數字元或底線字元、長度不能超過 50 個字元、開頭必須是字母或底線字元,而且不能包含空格。The name must include only alphanumeric or underscore characters, have 50 or fewer characters, and start with an alphabetical or underscore character, and it cannot have spaces. 例如,請輸入 AddComputerToADGroupWFFor example, enter AddComputerToADGroupWF.
  4. 如果您要新增工作流程的描述,請將它輸入 [描述] **** 方塊中。If you want to add a description of the workflow, type it in the Description box. 請注意,雖然這段文字沒有長度限制,但是在 ( 嚮導的 [ 摘要 ] 頁面上,某些視圖(例如工作流程的屬性清單) ) 可能只會顯示前200個字元。Note that, although there is no limit on the length of this text, some views (such as the list of the workflow's properties on the Summary page of the wizard) might only display the first 200 characters.
  5. 如果要變更工作流程重試間隔和執行時間上限的預設值,請在 [一般] **** 頁面上按一下 [進階] ****。If you want to change the default values for the workflow retry interval and the maximum time to run, on the General page, click Advanced. 在 [進階工作流程限制] **** 對話方塊中,為這些選項設定新的值,然後按一下 [確定] ****。In the Advanced Workflow Limits dialog box, set new values for these options, and then click OK. 請注意,執行時間上限的值必須大於 60 秒,但小於 24 小時。Note that the value for the maximum time to run must be more than 60 seconds, but less than 24 hours.
  6. 在 [觸發條件] **** 頁面上,按一下 [只在資料庫物件符合指定條件時執行] ****,然後按 [下一步] ****。On the Trigger Condition page, click Run only when a database object meets specified conditions, and then click Next.
  7. 在 [觸發準則] **** 頁面上,若要選取 [類別名稱] ****,請按一下 [瀏覽] ****。On the Trigger Criteria page, to select a Class name, click Browse. 在 [類別內容] **** 對話方塊中,選取工作流程要與其互動的物件類別,然後按一下 [確定] ****。In the Class Property dialog box, select the class of object with which the workflow will interact, and then click OK. 例如,選取 [ 自動化活動:新增電腦至 AD 群組]。For example, select Automated Activity: Add Computer To AD Group.
  8. 若要選取 變更事件,請按一下下拉式 - 清單,選取其中一個選項,然後按 [下一步]To select a Change event, click the drop-down list, select one of the options, and then click Next. 例如,按一下下拉式 - 清單,然後按一下 [當類別的實例更新時]。For example, click the drop-down list, and then click When an instance of the class is updated.
  9. (選擇性) 在 [將準則新增至此觸發程序] **** 底下,按一下 [其他準則] **** 來設定進階準則,例如當活動狀態從 [擱置] **** 變更為 [進行中] **** 時。Optionally, under Add Criteria to this trigger, click Additional Criteria to set advanced criteria, such as when the activity status changes from Pending to In Progress.
  10. 在 [摘要] **** 頁面上檢閱新工作流程的設定,然後按一下 [建立] ****。On the Summary page, review the settings for the new workflow, and then click Create. 在精靈完成後,按一下 [關閉] ****。After the wizard is completed, click Close.

儲存並建立工作流程Save and build a workflow

每當您儲存管理組件時,也會一併儲存工作流程。Workflows are saved whenever you save the management pack. 此外,當您儲存管理元件時,Service Manager Authoring Tool 會自動識別 ( ) 與管理元件中工作流程資訊相關聯的 Windows Workflow Foundation WF 工作流程檔案,並將其建立到工作流程元件中。In addition, when you save a management pack, the Service Manager Authoring Tool automatically identifies the Windows Workflow Foundation (WF) workflow files that are associated with the workflow information in the management pack and builds them into workflow assemblies. (每個 WF 工作流程可能會有多個原始檔案。 ) 此工具會為每個工作流程建立一個元件。(Each WF workflow may have multiple raw files.) The tool builds one assembly per workflow.

若要儲存並建置工作流程To save and build workflows

  • 在 [ 管理元件瀏覽器] 中,以滑鼠右鍵 - 按一下管理元件,然後按一下 [ 儲存]。In the Management Pack Explorer, right-click the management pack, and then click Save.

複製工作流程Copy a workflow

請在 Service Manager Authoring Tool 中使用此程序,即可建立工作流程的複本。Use this procedure to create a copy of a workflow in the Service Manager Authoring Tool. 複製工作流程之後,您可以編輯複本或原始的屬性。After you copy the workflow, you can edit the properties of either the copy or the original.

若要複製工作流程To copy a workflow

  • 在 [ 管理元件瀏覽器] 中,展開 [ 工作流程],以滑鼠右鍵 - 按一下您要複製的工作流程,然後按一下 [ 複製]。In the Management Pack Explorer, expand Workflow, right-click the workflow you want to copy, and then click Copy.
    Authoring Tool 會建立工作流程的複本,並為其提供由原始工作流程名稱和「複製」所組成的名稱 _ 。The Authoring Tool creates a copy of the workflow and gives it a name that consists of the original workflow name and "_Copy."

編輯工作流程的詳細資料Edit a workflow's details

請在 Service Manager Authoring Tool 中使用此程序來編輯工作流程詳細資料。Use this procedure to edit workflow details in the Service Manager Authoring Tool.

若要編輯工作流程詳細資料To edit workflow details

  1. 在 [ 管理元件 Explorer] 中,展開 [ 工作流程],以滑鼠右鍵 - 按一下工作流程,然後按一下 [ 詳細資料]。In the Management Pack Explorer, expand Workflow, right-click the workflow, and then click Details. 如果您已經在編輯工作流程,請 - 在 [撰寫中] 窗格的背景上按一下滑鼠右鍵,然後按一下 [ 詳細資料]。If you are already editing the workflow, right-click the authoring pane background, and then click Details.

  2. 如果您想要編輯工作流程描述,請在詳細資料窗格中,按一下 [描述] 方塊並輸入新的描述,或按一下省略號 ( ... ) 按鈕,開啟 [工作流程屬性] 對話方塊。If you want to edit the workflow description, in the Details pane, click the Description box and type a new description, or click the ellipsis (...) button to open the Workflow Properties dialog box. 按一下 [ 描述 ] 方塊,然後編輯描述。Click the Description box, and then edit the description.

  3. 如果您想要編輯其他任何工作流程詳細資料,請在詳細資料窗格中,按一下任何詳細資料,然後按一下省略號 ( ... ) 按鈕,開啟 [工作流程屬性] 對話方塊。If you want to edit any of the other workflow details, in the Details pane, click any of the details, and then click the ellipsis (...) button to open the Workflow Properties dialog box. 您可以編輯下列詳細資料:You can edit the following details:

    • 名稱:在 [ 一般 ] 索引標籤上,按一下 [ 名稱],然後編輯工作流程名稱。Name: On the General tab, click Name, and then edit the workflow name.

    • 重試和超時限制:在 [ 一般 ] 索引標籤上,按一下 [ Advanced],然後編輯適當的值。Retry and timeout limits: On the General tab, click Advanced, and then edit the appropriate values.

    • 以計時器為基礎之 - 工作流程的觸發條件:在 [排程器] 索引卷 標上, 編輯適當的值。Trigger condition for a timer-based workflow: On the Scheduler tab, edit the appropriate values.

    • 以查詢為基礎之 - 工作流程的觸發條件:在 [ 觸發 程式] 索引標籤上,編輯適當的值。Trigger condition for a query-based workflow: On the Trigger tab, edit the appropriate values.

      重要

      如果工作流程已在撰寫窗格中開啟,而您變更了工作流程的觸發類別,則會清除設定為使用觸發類別內容值的所有活動詳細資料。If you change the trigger class of the workflow while the workflow is open in the authoring pane, any activity details that were set to use values from properties of the trigger class are cleared. 在您將這些活動詳細資料重設為使用新觸發類別的值之前,工作流程都不會執行。The workflow does not run until you reset those activity details to use values from the new trigger class. 您不能變更工作流程使用的觸發程序類型。You cannot change the type of trigger that the workflow uses. 例如,在您建立使用計時器觸發程序的工作流程之後,便無法將它變更為改用查詢觸發程序。For example, after you create a workflow that uses a timer trigger, you cannot change it to use a query trigger instead.

刪除工作流程Delete a workflow

在 Service Manager Authoring Tool 中使用此程序,即可刪除工作流程。Use this procedure to delete a workflow in the Service Manager Authoring Tool.

若要刪除工作流程To delete a workflow

  1. 在 [ 管理元件瀏覽器] 中,展開 [ 工作流程],以滑鼠右鍵 - 按一下您要刪除的工作流程,然後按一下 [ 刪除]。In the Management Pack Explorer, expand Workflow, right-click the workflow you want to delete, and then click Delete.
  2. 為了確保系統會永久刪除工作流程,請儲存管理組件。To make sure that the workflow is permanently deleted, save the management pack.

後續步驟Next steps

  • 讀取 新增或移除工作流程活動 ,將活動新增至工作流程;移除、複製和貼上活動;並設定專門的活動,以將 Windows PowerShell 腳本匯入工作流程中。Read Add or remove workflow activities to add activities to a workflow; remove, copy, and paste activities; and configure specialized activities to import Windows PowerShell scripts into your workflow.