I’ve been tinkering with the concept of a rollback script for Sitecore 9 and I’ve had to add a bit more functionality to SIF to handle this. This can be done by adding in custom modules to SIF, which, once you get the hang of it, is pretty easy.  The SIF Guide has some good starters and I’ve heard more is coming.

Here’s a custom module written to remove a folder:

I wanted to call special attention to line 20. This is the actual command that loads the module to be accessible via SIF.  Your SIF Config file looks something like this:

The important thing for flexibility here is the relative pathing in the Modules section.  The first code snippet is encapsulated in “Invoke-RemoveFolderTask.psm1” which is located in the same folder as the JSON Config.