New-SCSMWorkflow

New-SCSMWorkflow

Creates a workflow in Service Manager.

構文

Parameter Set: Default
New-SCSMWorkflow [-DisplayName] <String> -Class <String> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-Criteria <String> ] [-Description <String> ] [-Enable <Boolean> ] [-EnableNotification <Boolean> ] [-Event <WorkflowEvent> ] [-ManagementPack <ManagementPack> ] [-Notification <Hashtable[]> ] [-PassThru] [-SCSession <Connection[]> ] [-Template <ManagementPackObjectTemplate> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

詳細説明

The New-SCSMWorkflow cmdlet creates a workflow in Service Manager.

パラメーター

-Class<String>

Specifies the name of the class that starts the workflow when it changes. Valid values are:

-- Configuration
-- Change
-- Incident
-- ManualActivity
-- ReviewActivity
-- DeploymentActivity

エイリアス

なし

必須?

true

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-ComputerName<String[]>

Specifies the name of the computer on which the System Center Data Access service runs. The user account that is specified in the Credential parameter must have access rights to the specified computer.

エイリアス

なし

必須?

false

位置は?

named

既定値

localhost

パイプライン入力を許可する

true (ByValue)

ワイルドカード文字を許可する

false

-Credential<PSCredential>

Specifies the credentials that this cmdlet uses to connect to the server on which the System Center Data Access service runs. The specified user account must have access rights to that server.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

true (ByValue)

ワイルドカード文字を許可する

false

-Criteria<String>

Specifies an object that represents criteria to restrict the result set.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Description<String>

Specifies a description for the workflow.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-DisplayName<String>

Specifies the name of the workflow to create.

エイリアス

なし

必須?

true

位置は?

1

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Enable<Boolean>

Indicates whether this cmdlet enables or disables the workflow.

エイリアス

なし

必須?

false

位置は?

named

既定値

True

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-EnableNotification<Boolean>

Indicates whether this cmdlet enables or disables notifications from the workflow.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Event<WorkflowEvent>

Specifies the condition under which the workflow starts. Valid values are:

-- Create
-- Update

エイリアス

なし

必須?

false

位置は?

named

既定値

Created

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-ManagementPack<ManagementPack>

Specifies the management pack in which to store the workflow. Do not specify a sealed management pack.

エイリアス

なし

必須?

false

位置は?

named

既定値

The default management pack

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Notification<Hashtable[]>

Specifies a hash table of users and templates to be used for notifications from the workflow.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-PassThru

Specifies the output object that represents the workflow object. This output object can be passed to other cmdlets.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-SCSession<Connection[]>

Specifies an object that represents a session to a Service Manager management server.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

true (ByValue)

ワイルドカード文字を許可する

false

-Template<ManagementPackObjectTemplate>

Specifies the template to be applied to the objects which are affected by the workflow.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Confirm

コマンドレットを実行する前に、ユーザーに確認を求めます。

必須?

false

位置は?

named

既定値

false

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-WhatIf

コマンドレットを実行するとどのような結果になるかを表示します。コマンドレットは実行されません。

必須?

false

位置は?

named

既定値

false

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

<CommonParameters>

このコマンドレットは次の共通パラメーターをサポートします。-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、-OutVariable.詳細については、以下を参照してください。 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。

入力

入力型は、コマンドレットにパイプできるオブジェクトの型です。

  • None.

    You cannot pipe input to this cmdlet.

出力

出力型は、コマンドレットによって生成されるオブジェクトの型です。

  • None.

    This cmdlet does not generate any output.

Example 1: Create a workflow for manual activity creation

This script creates a workflow which can be used when a manual activity is created. Because the script specifies no criteria, this workflow applies to any creation of a manual activity.

PS C:\>$Arguments = @{
>>  DisplayName = "My new manual activity workflow"
>>  Description = "This is a description"
>>  Event = "Create"
>>  Enable = $True
>>  Class = "ManualActivity"
>>  Template = Get-SCSMObjectTemplate -Name "DefaultManualActivityTemplate"
>>  Notification = @{ 
>>          User = "Reviewers"
>>          Template = Get-SCSMObjectTemplate -Name AssignedToUserNotificationTemplate
>>      },@{ 
>>          User = "Affected User"
>>          Template = Get-SCSMObjectTemplate -Name DefaultReviewActivityTemplate 
>>      }
>>  }
PS C:\>New-SCSMWorkflow @Arguments

Example 2: Create a workflow for manual activity creation for a user

This script creates a workflow which can be used when a manual activity is created. First, a criteria string is defined for the manual activity to select only those manual activities that were created by the user Evan Narvaez.

PS C:\>$CriteriaString = @'
>>  <Criteria>
>>   <Expression>
>>    <SimpleExpression>
>>     <ValueExpression>
>>      <Property State="Post">
>>  $Context/$Path[Relationship='System.WorkItem.Library!System.WorkItemCreatedByUser' TypeConstraint='System!System.Domain.User']/Property[Type='System!System.Domain.User']/UserName$
>>      </Property>
>>     </ValueExpression>
>>     <Operator>Equal</Operator>
>>     <ValueExpression>
>>      <Value>Evan Narvaez</Value>
>>     </ValueExpression>
>>    </SimpleExpression>
>>   </Expression>
>>  </Criteria>
>>  '@
PS C:\> $Management = Get-SCSMManagementPack -Name "Workflows"
PS C:\> $Arguments = @{
>>  DisplayName = "My new manual activity workflow"
>>  Description = "This is a description"
>>  Event = "Create"
>>  Enable = $False
>>  Criteria = $CriteriaString
>>  Class = "ManualActivity"
>>  ManagementPack = $ManagementPack
>>  Template = Get-SCSMObjectTemplate -Name "DefaultManualActivityTemplate"
>>  Notification = @{ 
>>          User = "Reviewers"
>>          Template = Get-SCSMObjectTemplate -Name AssignedToUserNotificationTemplate
>>      },@{ 
>>          User = "Affected User"
>>          Template = Get-SCSMObjectTemplate -Name DefaultReviewActivityTemplate 
>>      }
>>  }
PS C:\> New-SCSMWorkflow @Arguments

関連トピック

Get-SCSMWorkflow

Remove-SCSMWorkflow

Update-SCSMWorkflow