ServiceNow provides ITSM solutions and products:
- Configuration Management Database
- Edge Encryption
- Knowledge Management
- Performance Analytics
- Service Catalog
- Service Portal Designer
- Subscription Management
- Visual Task Boards
The last feature is very interesting. Each workflow can contain “activities”. These activities can be Powershell scripts. If you have already written some Powershell scripts in a workflow the following tip will be useful.
Let’s go with an example.
In that example, the workflow is triggered when a user account entry in ServiceNow is changed by specifying a reset password is required. The tasks/activities are the following:
- test if the Active Directory user account is existing
- get the distinguishedname of the user account
- ask confirmation
- reset the user account password
The first activity tests if the user account exists by using the email address set in the ServiceNow user account entry
In that activity, a Powershell array is created ( $myarray ) and is converted to JSON. The JSON output is saved in the workflow scratchpad variable called exch_addn. The JSON output is like the following:
The next activity:
On that activity, you now understand the power of ServiceNow and Powershell. The JSON array created before has been translated to variables to be used in that script. The JSON objects SID and DistinguishedName are now real Powershell variables called $SID and $DistinguishedName.
It is now your turn to play with that feature !