Hi. Sorry for the confusion here. I definitely need to add some info to the docs on creating packages that touches on this. Let me try to explain the difference.
If you have an Invoke-Reboot in your script without any condition, then the script will always reboot, start from the beginning and then reboot again when it gets to the Invoke-Reboot again. Using Invoke-Reboot is really only necessary if you are doing something
that Boxstarter does not already intercept and you know needs a reboot in order to continue successfully. Boxstarter intercepts all calls to chocolatey's installer and also calls to windows update if you use the Install-WindowsUpdate command.
When you omit the Invoke-Reboot, Boxstarter determines if a reboot is pending when it gets to your second cinst and reboots. After a reboot, when the Chocolatey installer of your first package is called, Chocolatey notices that package has already been installed
and so moves on to the next without installing again.
This is not always the right course of action for Windows roles/features but there is a better way to handle this.
Instead of wrapping calls to the ServerManager module or DISM inside of a separate package, Chocolatey supports a "WindowsFeature" feed. For example, using:
CINST IIS-WebServerRole -source windowsfeatures
Installs the IIS-WebserverRole features. Simply use the same feature name you would normally use with DISM.exe.
The advantage of doing this is that Chocolatey uses a slightly different strategy for checking if the feature is installed. Instead of simply looking to see if you have installed the package before, Chocolatey inspects the "State" of the feature and
only skips it if it is "Enabled" or "Enable Pending." If you are using windows 8/2012 or higher, Chocolatey uses the "/ALL" switch in DISM which will install any dependent features of the feature you are installing.
Hope this clarifies things.