2

I am trying to install Sitecore Experience Commerce 9 on my Windows 10 machine with the help of script https://github.com/asmagin/sitecore-installation-scripts.

Here is my script..

<#
.SYNOPSIS
    Installs the Sitecore Commerce Platform to the machine where this script is executed.
.DESCRIPTION
    Installs the Sitecore Commerce Platform to the machine where this script is executed.
    First make sure you have installed all the pre-requisites for SC9 from the Installation Guide
    Then make sure you walk through 2.2 Download the Sitecore XC release package and prerequisites of the SC9 Installation Guide, before running this script  
.EXAMPLE(S)
    C:\PS> Deploy-Sitecore-Commerce.ps1
.NOTES
    Author(s):  Alex Smagin
                Robbert Hock
#>

#Requires -Version 3

#parameters
param(
    [string]$Prefix = "sc9u1",
    [string]$SiteName = "sc9u1.sc", 
    [string]$SiteHostHeader = "storefront.local",   
    [string]$SqlDbPrefix = $Prefix,
    [string]$CommerceSearchProvider = "SOLR",
    [string]$CommerceSiteName = "$Prefix.commerce",
    [string]$Drive = $($Env:SYSTEMDRIVE),
    [string]$XConnectSiteHostHeaderName = "$($Prefix).xconnect",
    [string]$SolrUrl = "https://localhost:8984/solr",
    [string]$SolrInstallDir = "C:\Sitecore9\solr-6.6.2\",
    [string]$SolrService = "SOLR",
    [string]$SqlServer = "DESKTOP-O8SPMPV\SQLEXPRESS",
    [string]$SitecoreUsername = "sitecore\admin",
    [string]$SitecoreUserPassword = "b",
    [string]$CommerceServerUserName = "CSRuntimeUser",
    [string]$CommerceServerUserPassword = "vagrant"
)

# Hide progress bar to speed up installation
$global:ProgressPreference = 'silentlyContinue'
Clear-Host

# Import additional modules
$global:DEPLOYMENT_DIRECTORY = Split-Path $MyInvocation.MyCommand.Path
$modulesPath = ( Join-Path -Path $DEPLOYMENT_DIRECTORY -ChildPath "Modules" )
if ($env:PSModulePath -notlike "*$modulesPath*") {
    $p = $env:PSModulePath + ";" + $modulesPath
    [Environment]::SetEnvironmentVariable("PSModulePath", $p)
}

$params = @{
    Path                                     = Resolve-Path '.\Configuration\Commerce\Master_SingleServer.json'

    # General configurations
    CommerceSearchProvider                   = $CommerceSearchProvider
    RootCertFileName                         = "SitecoreRootCert"

    # SOLR
    SolrCorePrefix                           = $Prefix
    SolrInstallDir                           = $SolrInstallDir
    SolrSchemasDir                           = ( Join-Path -Path $DEPLOYMENT_DIRECTORY -ChildPath "SolrSchemas" )
    SolrServiceName                          = $SolrService
    SolrUrl                                  = $SolrUrl

    # Azure Search
    AzureSearchIndexPrefix                   = $Prefix
    AzureSearchServiceName                   = ""
    AzureSearchAdminKey                      = ""
    AzureSearchQueryKey                      = ""

    # CM instance and XConnect settings
    SiteName                                 = $SiteName
    SiteHostHeader                           = $siteHostHeader
    SiteInstallDir                           = "$($Drive)\inetpub\wwwroot\$Prefix.local"
    XConnectInstallDir                       = "$($Drive)\inetpub\wwwroot\$Prefix.xconnect"

    # SQL
    SqlCommerceServicesDbName                = "$($Prefix)_SitecoreCommerce_SharedEnvironments"
    SqlCommerceServicesDbServer              = $SqlServer    #OR "SQLServerName\SQLInstanceName"
    SqlCommerceServicesGlobalDbName          = "$($Prefix)_SitecoreCommerce_Global"
    SqlSitecoreCoreDbName                    = "$($Prefix)_Core"
    SqlSitecoreDbServer                      = $SqlServer    #OR "SQLServerName\SQLInstanceName"

    # Commerce Services
    CommerceAuthoring                        = "$CommerceSiteName-authoring"
    CommerceAuthoringCertificateDnsName      = "*.$Prefix.local"
    CommerceAuthoringCertificateName         = "all.$Prefix.local"
    CommerceAuthoringDir                     = "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\$CommerceSiteName-authoring"
    CommerceAuthoringHostHeader              = "commerce-authoring.$SiteName"
    CommerceAuthoringServicesPort            = "443"

    CommerceMinions                          = "$CommerceSiteName-minions"
    CommerceMinionsCertificateDnsName        = "*.$Prefix.local"
    CommerceMinionsCertificateName           = "all.$Prefix.local"
    CommerceMinionsDir                       = "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\$CommerceSiteName-minions"
    CommerceMinionsHostHeader                = "commerce-minions.$SiteName"
    CommerceMinionsServicesPort              = "443"

    CommerceOps                              = "$CommerceSiteName-ops"
    CommerceOpsCertificateDnsName            = "*.$Prefix.local"
    CommerceOpsCertificateName               = "all.$Prefix.local"
    CommerceOpsDir                           = "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\$CommerceSiteName-ops"
    CommerceOpsHostHeader                    = "commerce-ops.$SiteName"
    CommerceOpsServicesPort                  = "443"

    CommerceShops                            = "$CommerceSiteName-shops"
    CommerceShopsCertificateDnsName          = "*.$Prefix.local"
    CommerceShopsCertificateName             = "all.$Prefix.local"
    CommerceShopsDir                         = "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\$CommerceSiteName-shops"
    CommerceShopsHostHeader                  = "commerce-shops.$SiteName"
    CommerceShopsServicesPort                = "443"

    SitecoreIdentityServer                   = "$CommerceSiteName-identity"
    SitecoreIdentityServerCertificateDnsName = "*.$Prefix.local"
    SitecoreIdentityServerCertificateName    = "all.$Prefix.local"
    SitecoreIdentityServerDir                = "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\$CommerceSiteName-identity"
    SitecoreIdentityServerHostHeader         = "identity.$SiteName"
    SitecoreIdentityServerServicesPort       = "443"

    SitecoreBizFx                            = "$CommerceSiteName-bizfx"
    SitecoreBizFxCertificateDnsName          = "*.$Prefix.local"
    SitecoreBizFxCertificateName             = "all.$Prefix.local"
    SitecoreBizFxDir                         = "$($Env:SYSTEMDRIVE)\inetpub\wwwroot\$CommerceSiteName-bizfx"
    SitecoreBizFxHostHeader                  = "bizfx.$SiteName"
    SitecoreBizFxServicesPort                = "443"

    CommerceServicesPrefix                   = $Prefix
    CommerceEngineCertificatePath            = "c:\certificates\$CommerceSiteName.crt"
    CommerceEngineCertificateName            = $CommerceSiteName

    # Packages
    PackageAdventureWorksImagesPath          = Resolve-Path -Path "..\Adventure Works Images.zip"
    PackageCEConnectPath                     = Resolve-Path -Path "..\Sitecore.Commerce.Engine.Connect*.update"
    PackageCommerceConnectPath               = Resolve-Path -Path "..\Sitecore Commerce Connect*.zip"
    PackageCommerceEngineDacPacPath          = Resolve-Path -Path "..\Sitecore.Commerce.Engine.SDK.2.1.10\Sitecore.Commerce.Engine.DB.dacpac"
    PackageHabitatImagesPath                 = Resolve-Path -Path "..\Sitecore.Commerce.Habitat.Images-*.zip"
    PackagePowerShellExtensionsPath          = Resolve-Path -Path "..\Sitecore PowerShell Extensions-4.7.2 for Sitecore 8.zip"
    PackageSitecoreBizFxServicesContentDir   = Resolve-Path -Path "..\Sitecore.BizFX.1.1.9"
    PackageSitecoreCommerceEnginePath        = Resolve-Path -Path "..\Sitecore.Commerce.Engine.2.*.zip"
    PackageSitecoreIdentityServerPath        = Resolve-Path -Path "..\Sitecore.IdentityServer.1.*.zip"
    PackageSXACommercePath                   = Resolve-Path -Path "..\Sitecore Commerce Experience Accelerator 1.*.zip"
    PackageSXAPath                           = Resolve-Path -Path "..\Sitecore Experience Accelerator 1.7 rev. 180410 for 9.0.zip"
    PackageSXAStorefrontCatalogPath          = Resolve-Path -Path "..\Sitecore Commerce Experience Accelerator Habitat Catalog*.zip"
    PackageSXAStorefrontPath                 = Resolve-Path -Path "..\Sitecore Commerce Experience Accelerator Storefront 1.*.zip"
    PackageSXAStorefrontThemePath            = Resolve-Path -Path "..\Sitecore Commerce Experience Accelerator Storefront Themes*.zip"

    # Tools
    ToolsSiteUtilitiesDir                    = ( Join-Path -Path $DEPLOYMENT_DIRECTORY -ChildPath "SiteUtilityPages" )
    ToolsMergeToolPath                       = Resolve-Path -Path "..\Microsoft.Web.XmlTransform.dll"

    # Accounts
    SitecoreUsername                         = $SitecoreUsername
    SitecoreUserPassword                     = $SitecoreUserPassword

    UserAccount                              = @{
        Domain   = $Env:COMPUTERNAME
        UserName = $CommerceServerUserName
        Password = $CommerceServerUserPassword
    }

    BraintreeAccount                         = @{
        MerchantId = ''
        PublicKey  = ''
        PrivateKey = ''
    }
}

### --------- HACK IGNORE UNTRUSTED CERT IN PS -----------------------------------------------------
# if (-not ([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback').Type) {
#     $certCallback = @"
#     using System;
#     using System.Net;
#     using System.Net.Security;
#     using System.Security.Cryptography.X509Certificates;
#     public class ServerCertificateValidationCallback
#     {
#         public static void Ignore()
#         {
#             if(ServicePointManager.ServerCertificateValidationCallback ==null)
#             {
#                 ServicePointManager.ServerCertificateValidationCallback +=
#                     delegate
#                     (
#                         Object obj,
#                         X509Certificate certificate,
#                         X509Chain chain,
#                         SslPolicyErrors errors
#                     )
#                     {
#                         return true;
#                     };
#             }
#         }
#     }
# "@
#     Add-Type $certCallback
# }
# [ServerCertificateValidationCallback]::Ignore()
### --------------------------------------------------------------

### --------- HACK DISABLE PASSWORD COMPLEXITY -------------------
secedit /export /cfg c:\secpol.cfg
(gc C:\secpol.cfg).replace("PasswordComplexity = 1", "PasswordComplexity = 0") | Out-File C:\secpol.cfg
secedit /configure /db c:\windows\security\local.sdb /cfg c:\secpol.cfg /areas SECURITYPOLICY
rm -force c:\secpol.cfg -confirm:$false
### --------------------------------------------------------------

if ($commerceSearchProvider -eq "SOLR") {
    Install-SitecoreConfiguration @params
}
elseif ($commerceSearchProvider -eq "AZURE") {
    Install-SitecoreConfiguration @params -Skip InstallSolrCores
}

But i am getting below error on CreateWebsiteOps section, right after "Associating SSL certificate with site" step...

[------------------------------------- CreateWebAppPoolOps : ManageCommerceService -----------------------------------]
[CreateWebAppPoolOps]:[Create-WebAppPool] sc9u1.commerce-ops
Creating and starting the sc9u1.commerce-ops Services application pool
Creation of the sc9u1.commerce-ops Services application pool completed

[---------------------------------------- CreateWebsiteOps : ManageCommerceService -----------------------------------]
WARNING: Could not find Cert: *.sc9u1.local in cert:\LocalMachine\My
[CreateWebsiteOps]:[Create-Website] sc9u1.commerce-ops
Creating and starting the sc9u1.commerce-ops web site

Name             ID   State      Physical Path                  Bindings
----             --   -----      -------------                  --------
sc9u1.commerce-o 10   Started    C:\inetpub\wwwroot\sc9u1.comme http *:80:
ps                               rce-ops
Creation and startup of the sc9u1.commerce-ops Services web site completed

Using provided certificate:
Removing default HTTP binding
Removed default HTTP binding
Adding HTTPS binding
Added HTTPS binding
Associating SSL certificate with site
**********************
Command start time: 20180521165058
**********************
PS>TerminatingError(Invoke-ManageCommerceServiceTask): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Value does not fall within the expected range."
>> TerminatingError(Invoke-ManageCommerceServiceTask): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Value does not fall within the expected range."
Install-SitecoreConfiguration : Value does not fall within the expected range.
At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\Public\Install-SitecoreConfiguration.ps1:253 
char:21
+                     & $entry.Task.Command @paramSet | Out-Default
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration
Install-SitecoreConfiguration : Value does not fall within the expected range.
At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\Public\Install-SitecoreConfiguration.ps1:253
char:21
+                     & $entry.Task.Command @paramSet | Out-Default
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

[TIME] 00:01:35

Need any pointer to resolve this issue.

  • Is it possible to post configurations from .ps1 file? And also, please, post a bit more lines of a log before the error. – Alex Smagin May 21 '18 at 13:42
  • Sure @AlexSmagin, i have added both in my description. Thanks – Arvind Gehlot May 21 '18 at 14:50
  • It looks like you have a problem with certificates, they either not generated or generated with a different name. WARNING: Could not find Cert: *.sc9u1.local in cert:\LocalMachine\My I'll need to check scripts. – Alex Smagin May 21 '18 at 18:13
  • It looks like your certificates were not created or you do not have access to them. Did you get any errors during certificate creation? You suppose to see certificate *.sc9u1.local if you run Get-ChildItem Cert:\LocalMachine\My command in PowerShell. There also should be a file in c:\certificates called all.sc9u1.local based on your configurations. if you do not have this folder try to create it manually and restart the script. – Alex Smagin May 22 '18 at 5:02
  • I can see sc9u1.sc.crt, SitecoreRootCert.crt, storefront.local.crt and sc9u1.xconnect_client.crt in c:\certificates. I don't see all.sc9u1.local anywhere in the folder. – Arvind Gehlot May 22 '18 at 5:24
3

It looks like your certificates were not created or you do not have access to them. You suppose to see certificate *.sc9u1.local if you run Get-ChildItem Cert:\LocalMachine\My command in PowerShell. There also should be a file in c:\certificates called all.sc9u1.local based on your configurations. If you do not have this folder try to create it manually and restart the script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.