How to Skip tasks in PS Script for Sitecore Commerce 10 Installation (without modifying Master_SingleServer.json)

This is another blog on Sitecore Commerce 10 Installation. There is so much hidden (read as issues!) in the Sitecore Commerce Installation that the more you dig, you get newer insights and ideas about parameters and ways to do the same thing differently. Although I have written a blog about how to run a cut-down list of tasks , the blog involved removing modules from Master_SingleServer.json. 

In this blog, I'm going to cover how to remove tasks while running the install PS script without touching the Master_SingleServer.json file. The install script offers a parameter named $TasksToSkip for the same. Note that the $TasksToSkip param is part of both Sitecore Commerce 9.3 and Sitecore Commerce 10 install scripts. The trick here is in finding how to pass the task names since multiple modules can use the same task/file.

First, let's check the Master_SingleServer.json file:

You can get the module names from Master_SingleServer.json. The highlighted ones are all examples of module names:


Since the module name points to individual files, each of those individual files have a set of tasks. For instance, if you open Common.InstallWdpModule.json located in .\Configuration\Commerce\Common\, you will find these tasks:



But, the catch here is, the same task name is used by multiple modules if you again check the module list in Master_SingleServer.json file. So, this is where a unique naming convention is used by JSON and Powershell task execution. 

If I have to find tasks that will execute for Module-HabitatImages module, the task names will be uniquely identified as follows:

<Module name>_<Task name>

1. Module-HabitatImages_InstallWDPModuleMasterCore

2. Module-HabitatImages_InstallWDPModuleMaster

3. Module-HabitatImages_InstallWDPModuleCore

Similarly in case of Module-AdventureWorksImages module, the same tasks will be referenced as follows:

4. Module-AdventureWorksImages_InstallWDPModuleMasterCore

5. Module-AdventureWorksImages_InstallWDPModuleMaster

6. Module-AdventureWorksImages_InstallWDPModuleCore

The same concept is applicable for all other modules and tasks to make the task names unique during execution.

Now, if you have to skip these tasks from the Powershell Script execution, just add these module concatenated task names (delimited by commas) to $TasksToSkip as follows:

$TasksToSkip="Module-HabitatImages_InstallWDPModuleMasterCore,Module-HabitatImages_InstallWDPModuleMaster,Module-HabitatImages_InstallWDPModuleCore"

Note that these tasks would not be right away excluded from the total task count when the installation starts but they won't execute at the step in which they are supposed to execute. 

When will task skipping be useful?

Check this blog for one such scenario. The quick answer is, the default PS install script provided by Sitecore is not capable of handling all install scenarios. One such situation is explained in the blog link provided. In such cases, you might have to decide and pass names of tasks to skip during installation.

Try it when you can!





Comments