Tuesday 25 May 2021

Install-SitecoreConfiguration : Cannot retrieve the dynamic parameters for the cmdlet. Unrecognized escape sequence

 If facing below issue at the time of Sitecore instance setup


Install-SitecoreConfiguration : Cannot retrieve the dynamic parameters for the cmdlet. Unrecognized escape sequence.


Then would suggest to update files for

xconnect-xp0.json

sitecore-XP0.json

scinstall.ps1 (in your case, installation script file name may be different)


by searching '\' in above files and replace with "\\" in file path

for example: 

earlier setting was 

$PSScriptRoot\Sitecore 9.0.2 rev. 180604 (OnPrem)_single.scwdp.zip

and replaced with 

$PSScriptRoot\\Sitecore 9.0.2 rev. 180604 (OnPrem)_single.scwdp.zip


and once all settings updated in script, then execute again.


Hope this will help.


Wednesday 12 May 2021

How to remove all data from Sitecore Solr index ?

Challenge:

Few days back, was working on sitecore solr search related issue that 


From solr portal, was able to retrieve data from index even deleted items (solr index caching issue).

But in the code getting null value for item's properties.


Tried many alternatives to resolve issue (IISRESET, config review, code debug, index rebuild), but no luck.


Approach to fix above issue:

After removing all data from solr index, and then index rebuild issue was resolved.




Steps:

1. From browser open hosted solr portal

2. choose index

3. go to document tab


or copy below URL and hit

1. https://localhost:8987/solr/your_index_name/documents


after this


choose Document Type as Solr command (raw xml or JSON)

then paste query

<delete><query>*:*</query></delete>

and Submit document.

Wednesday 5 May 2021

How to get license details for a Sitecore instance using Sitecore PowerShell script ?

Since I was trying to get license details for a Sitecore instance, so thought to share with all.


below are ways to get Sitecore license details using Sitecore PowerShell script as

$licensePath = [Sitecore.Configuration.Settings]::LicenseFile
[xml]$licenseDocument = Get-Content -Path $licensePath
$licenseDocument.signedlicense.Signature.Object.license |Format-Table -AutoSize



Tuesday 4 May 2021

How to read list data from file, using Sitecore PowerShell script

Challenge:

There were scenario, where I was trying to get list of strings from text file and tried as below

[string[]]$ItemIdList = Get-Content -Path 'D:\ItemIds.txt'

but getting issue as file not found.


Approach to resolve:


With below lines of script, trying to first upload at temp/upload path (it will create directories if not exist).

And then reading list of strings from text file.

$dataFolder = [Sitecore.Configuration.Settings]::DataFolder
$tempFolder = $dataFolder + "\temp\upload"
$filePath = Receive-File -Path $tempFolder -overwrite'
[string[]]$ItemIdList = Get-Content -Path $filePath