With Sitecore 9.1 a new SIF was released. SIF 2.0 is not compatible with the previous version of Sitecore. If you want to use Sitecore 9.1 and Sitecore 9.0.x in one environment, you have to install two SIF modules 1.2.1 and 2.0.0. Be default cmdlet Install-Module installs the newest version of the module. For Sitecore 9.1 and later we need the latest version of SIF, it means that we can use a standard module installation approach, shown below:
#region "SitecoreInstallFramework for Sitecore 9.1 and later" if( (Get-Module -Name SitecoreInstallFramework -ListAvailable) -eq $null ) { #If install-module is not available check https://www.microsoft.com/en-us/download/details.aspx?id=49186 Install-Module SitecoreInstallFramework -Scope AllUsers -Repository SitecoreGallery }
For Sitecore 9.0.x we need SIF with version 1.2.1, and we have to add more parameters to install specified module version. To choose version we have a parameter -RequiredVersion. To allow existence two different modules versions, we have to use parameter -AllowClobber. The full code snippet is shown on an image below:
#region "SitecoreInstallFramework for Sitecore 9.0.x" $sifModule = Get-Module -Name SitecoreInstallFramework -ListAvailable if( $sifModule -eq $null -or $sifModule.Version -ne '1.2.1' ) { #If install-module is not available check https://www.microsoft.com/en-us/download/details.aspx?id=49186 Install-Module SitecoreInstallFramework -Scope AllUsers -Repository SitecoreGallery -RequiredVersion 1.2.1 -AllowClobber } #endregion
When we have two different versions of SIF installed in one environment, we need a way to choose which one version we want to use during the Sitecore installation process. We can quickly implement module version selector with a #required statement. More about how to prevents a script from running without the required elements, you can read in my post. To choose module version just put this at the beginning of your Sitecore installation script.
#requires -modules @{ ModuleName="SitecoreInstallFramework"; ModuleVersion="1.2.1" }
#requires -modules @{ ModuleName="SitecoreInstallFramework"; ModuleVersion="2.0.0" }
If you are looking for more examples of how to improve Sitecore installation process, please check Sitecore Installation Extensions.
Powershell Sitecore SIF Sitecore 9