Continuation of the
article , where we talk about the stages of the portal development process on the example of one of our customers.

After a positive result, the requested application and the computer are checked for automatic installation:
- Is there a collection ID in the CMDB?
- Is the computer thin client?
Automated Software deployment workflow process:
')

Let us analyze the diagram in stages, starting from the Start block and ending with the End.
1) We put down the appropriate - understandable status for the Service Desk agent and the user. In our case, Work in Progress
2) To avoid a parallel change of the record, a debug timer has been added, since in addition to the workflow, there are Business rule.
3) The script is launched on the mid server, Service Now sends the following variables to the script:
var script = C: \\ Scripts \\ add.ps1 '+ current.variables.u_computer.name + "" + current.variables.u_software.u_install_id;
- Computer name
- Collection ID
The script adds the computer to the application installation collection and immediately receives a Success (Yes) or Failed (No) response.
Here is a living example.
4) Let's give SCCM time to install the application, say 4 hours. What happens at this time:
a. The SCCM client on the computer periodically requests from the policy server.
b. Gets information about the application designated for installation.
c. Initiates the download process from the distribution point.
d. Runs the application installation and returns the installation status.




5) The second script is launched, with the same parameters, but the result is the installation status. If Successfully installed, then the end of the workflow
6) Checks the installation status, if Failed, then goes to step 9.
7) Check the installation status, if Reboot pending, then go to step 10.
8) Global timeout of the process, in order to avoid a cycle.
9) Creates a task for the Service Now support team to resolve an error or delayed installation. When the task is closed, the process starts from the beginning, from point 3, but instead of being added to the collection, it checks for the presence of a computer in the collection.
10) Applicable for applications requiring a reboot. Sends a letter asking you to reboot at a convenient time.
Stage 3. Post-implementation
After introduction into production, during the week all requests were analyzed, with a new workflow, about 300, as well as their status. The result was as follows:

Several bugs and gaps were found that were fixed;
- wrong Collection ID: spaces and wrong characters crept in during import, fixed.
- wrong computer name: Accuracy CMDB - the computers were created manually with the wrong name. Fixed as errors occurred.
After correction, the picture was such

As a result, the main mass of the non-installed application was the banal absence of a computer on the network for various reasons, or simply the computer was turned off. Also, many users work through vpn and have restrictions on downloading and installing packages, in order to save bandwidth.
Stage 4. Tuning
After successful implementation, the tuning process is in progress, the functionality is added by:
- uninstall / update the application;
- adding a Citrix policy to the process.
The concept itself is exactly the same as installing the application.
Well, as a conclusion a few words about the problems encountered and the necessary dependencies.
Problems:- Since ServiceNow is a cloud system, and the customer’s infrastructure is usually closed from external connections, you need to install a ServiceNow MID-server (or its equivalent for other ITSM systems)
- Method of checking the result: not all automation systems allow you to get the result of installing the application through the API. In the most non-trivial cases, you will need access to the database.
- Not all applications are installed by one tool.
- Computers can be connected via VPN / Home Office, while SCCM does not always have access to the agent installed on the computer. But this is a purely network problem and should be solved by other tools.
Dependencies:To accurately determine the end machine, the CMDB must be up to date. But automatic CMDB filling is a completely different task ...
Authors:
vkuptsov ,
siaint ,
shamseg