New-SCSMWorkflow
New-SCSMWorkflow
Creates a new workflow in Service Manager.
Syntax
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>]
Detailed Description
The New-SCSMWorkflow cmdlet creates a new workflow in Service Manager.
Parameters
-Class<String>
Specifies the name of the class that will start the workflow when it changes. This can be one of the following values: Configuration, Change, Incident, ManualActivity, ReviewActivity, and DeploymentActivity.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ComputerName<String[]>
Specifies the name of the computer on which the System Center Data Access service is running.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
localhost |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-Credential<PSCredential>
Specifies the credential to use when connecting to the System Center Data Access service. If this is not provided or null, the current user context will be used.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-Criteria<String>
Specifies an object that represents criteria to restrict the result set.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Description<String>
Provides a unique descriptive text for the workflow.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-DisplayName<String>
Specifies the name of the workflow to create.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Enable<Boolean>
Enables the workflow.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
True |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-EnableNotification<Boolean>
Enables or disables notifications from the workflow. Specify $true to enable notifications, or $false to disable them.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Event<WorkflowEvent>
Specifies the condition under which the workflow will be started. Specify Create or Update.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
Created |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ManagementPack<ManagementPack>
Specifies the management pack in which to store the new workflow. If the specified management pack is sealed, a terminating error of InvalidOperation is generated.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
The default management pack |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Notification<Hashtable[]>
Specifies a hash table of users and templates to be used for notifications from the workflow.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-PassThru
Specifies the output object that represents the new workflow object. This output object can be passed to other cmdlets.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-SCSession<Connection[]>
Specifies an object that represents a session to a Service Manager management server.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-Template<ManagementPackObjectTemplate>
Specifies the template to be applied to the objects which are affected by the workflow.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before running the cmdlet.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
None.
You cannot pipe input to this cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
None.
This cmdlet does not generate any output.
Examples
-------------------------- EXAMPLE 1 --------------------------
This command creates a new workflow which can be used when a manual activity is created. Because no criteria is provided, 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 --------------------------
This command creates a new workflow which can be used when a manual activity is created. First, criteria is defined for the manual activity to select only those manual activities that were created by the user "Haven Ford".
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>Haven Ford</Value>
>> </ValueExpression>
>> </SimpleExpression>
>> </Expression>
>> </Criteria>
>> '@
PS C:\>$mp = Get-SCSMManagementPack -name MyWorkflows
PS C:\> $arguments = @{
>> DisplayName = "My new manual activity workflow"
>> Description = "This is a description"
>> Event = "Create"
>> Enable = $false
>> Criteria = $CriteriaString
>> Class = "ManualActivity"
>> ManagementPack = $mp
>> 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