Skip to main content
21 votes
Accepted

How to package a Helix solution using powershell

You might want to consider psake. It is a task based build system written in Powershell. A good starting point would be this piece of code: # Let's define layers here $layers = @( "Foundation", "...
Szymon Kuzniak's user avatar
14 votes
Accepted

Why does Register-SitecoreInstallExtension appear to do nothing?

It's a small thing which I'm hoping to have fixed soon so that things are a little clearer, sorry this isn't as straight-forward as it should be! Calling Register-SitecoreInstallExtension outside of ...
Kieranties's user avatar
13 votes
Accepted

pywintypes.error: (2, 'CreateFile', 'The system cannot find the file specified while installing Sitecore Docker images

This has happened because "Docker Desktop" was not running on my machine. I started "Docker Desktop" and execute the script again. I was able to install a sample project for ...
Arvind Gehlot's user avatar
11 votes
Accepted

Installation Error - Cannot validate argument on parameter 'Source'

Just observed that in Solr 7.1.0 the folder structure is quite different than 6.6.2. Hence the power shell script is unable to find the required folders. In my case the script is looking for ...
Amitabh Vyas's user avatar
  • 2,554
10 votes
Accepted

New-SCWebDeployPackage is not recognized

'New-SCWebDeployPackage' cmdlet will be available after importing assembly Sitecore.Cloud.Cmdlets.dll By default, loading an assembly from a network path in PowerShell console is disabled, It can be ...
VIJAY RAAVI's user avatar
9 votes
Accepted

SItecore 10 docker build solution issue - Invoke-Expression

The solution for this issue was to add SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] before first RUN ...
Kamil C's user avatar
  • 521
8 votes
Accepted

Creating new items using powershell from csv

Should be fairly simple. You can use the PowerShell Import-CSV command to load a CSV file in: $importRows = Import-CSV "C:\path-to-your-file\import-data.csv" Then you can enumerate through that and ...
Richard Seal's user avatar
  • 20.6k
7 votes
Accepted

Commerce PowerShell Error SQL Provider is not installed

I found the Answer ,download the file below only if you have "SQL SERVER 2017" https://gitlab.com/viet.hoang/workshop/raw/master/Scripts%20for%20Sitecore%20Commerce%20901/DeployCommerceDatabase.psm1 ...
Jose Neto's user avatar
  • 1,015
7 votes

Getting 401 unauthorized exception while importing Powershell Reports

We had the same issue and solution was to enable Spe.IdentityServer.config at \inetpub\wwwroot\website\App_Config\Include\Spe. OOTB this file comes with Sitecore Powershell module as disabled. Just ...
Gaurav Agarwal's user avatar
7 votes
Accepted

Failed to call the method because [Sitecore.Data.Items.Item] does not contain a method named "op_Addition"

Marek's answer is correct and addresses the error, but it's worth bearing in mind that in the situation posted, you have a simpler option available to you: $path = "/sitecore/content/home" $items = ...
Kasaku's user avatar
  • 4,184
6 votes
Accepted

Is it good to update item values in web database in sitecore?

It's never recommended to perform any updates in web database directly. If you do this without running exactly the same updates in master database If publish anything in master database later, you'll ...
Marek Musielak's user avatar
  • 23.9k
5 votes
Accepted

How to install zip file package from Installation Wizard using Powershell DSC?

You can install packages via DSC - but I don't think automating the UI is the right way to go about it. When I worked through this issue I dealt with it by creating an endpoint that DSC can push the ...
JermDavis's user avatar
  • 847
5 votes
Accepted

Sidekick Error on Sitecore and/or PowerShell

To answer your questions: There is no requirement that the Sitecore environments be on different servers, you could have any amount of Sitecore instances available for content consumption. Changing ...
Jeff Darchuk's user avatar
5 votes

Reading a CSV file from media library through power shell script

# get media item $media = Get-Item -Path "/sitecore/media library/Default Website/FL_insurance_sample" # get stream and save content to variable $content [System.IO.Stream]$body = $media.Fields["Blob"]...
Alan Płócieniak's user avatar
5 votes

How to copy multiple items to a new location

You have 2 ways - if you can connect up Sitecore Rocks, that has an option to multi-select items and move them around in Visual Studio and rename etc... The second option would be to use Sitecore ...
Richard Seal's user avatar
  • 20.6k
5 votes
Accepted

How can I get the renderings when using the Find-Item command?

The output of Find-Item command is a SearchResultItem object. You need to call GetItem() on it first and then you can run commands which will return presentation details. I'm not sure exactly what you ...
Marek Musielak's user avatar
  • 23.9k
5 votes
Accepted

Display save actions for a WFFM form in Sitecore PowerShell

You can use the script below. Just set the root directory which holds your forms to $formsRoot variable. The script: gets all the forms from the root gets ids of all the save actions in the system ...
Marek Musielak's user avatar
  • 23.9k
5 votes
Accepted

How can I rebuild the Solr indexes via Powershell?

To rebuild indexes from sitecore powershell you can use below script which will re-index all indexes one by one using namespace Sitecore.ContentSearch $indexes = [ContentSearchManager]::Indexes ...
Surya Narayan's user avatar
5 votes

Find-Item -Index Get latest version

If you want to use _latestVersion with Find-Item command then you will need to use -Criteria instead of -Where because -Where uses SearchResultItem class to map the properties whereas -Criteria work ...
Surya Narayan's user avatar
5 votes
Accepted

Find-Item -Index Get latest version

If you are using SPE 6.0 this might work for you. Introduced with this issue. class ExtendedSearchResultItem : SearchResultItem { [Sitecore.ContentSearch.IndexField("_latestversion")] [bool]$...
Michael West's user avatar
  • 18.3k
5 votes

Retrieve Rules field using Powershell script in readable format

I managed to get it working using this approach: $item = Get-Item -Path "master:{F4819743-C9D5-48A4-911B-017F8BA1415C}" # Change the name 'ShowRule' to whatever your rule field is called $...
Michael West's user avatar
  • 18.3k
5 votes
Accepted

How to check if item language version exists in Sitecore PowerShell?

You had this almost correct. Instead of checking if current version of your item is 1 (version index) you should check number of versions (and pick these where it's not equal 0) ? { $_.Versions.Count -...
Alan Płócieniak's user avatar
5 votes
Accepted

How to take item package of particular time period using Sitecore Powershell?

You can go through this link - https://www.nishtech.com/Blog/2020/April/Advanced-content-packaging-with-Powershell Step 1 - Use Powershell Reports to get the modified items CSV file To find the ...
Gaurav Agarwal's user avatar
5 votes

Powershell script to get the list of items created/modified on particular day

When you install the Sitecore PowerShell, there is already a similar script that performs the task you required. It is found at the following path: /sitecore/system/Modules/PowerShell/Script Library/...
Hishaam Namooya's user avatar
4 votes

Certificate does not contain Private Key exception while executing Sitecore 9 installation script on Windows 2012 R2

The certificate which is used for XConnect must contain a "special" private key. Not any private key will do it. If you take a closer look at the SIF files, you'll notice, that the Self-Signed ...
Ramon Bruelisauer's user avatar
4 votes

Running PowerShell scripts without using Sitecore PowerShell Extensions module

There is an option of performing the minimal installation, which does not make use of Sitecore items. You can find more details on the security page in the book. The Sitecore Marketplace has the ...
Michael West's user avatar
  • 18.3k
4 votes

Powershell Script to update Date

As far as editing an item, your script looks to be doing what it needs to, but I'm guessing the actual date value is not something Sitecore recognized for a Date type field. Depending on the date ...
vandsh's user avatar
  • 1,651
4 votes

Powershell script to update displayname error

You will need to update the following line: $row.DisplayName="fff" and replace it with: $row."__Display Name"="fff" You should also probably update your Write-Host line as follows: Write-Host "...
Dan Sinclair's user avatar
  • 5,395
4 votes
Accepted

How to get ALL specific child-items in a folder using fast query?

As Micheal West said, using fast query is not a recommended option. Answer for your question is $query = "fast:/sitecore/content/Folder//*[@@TemplateID='{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}']" ...
Siva Kumar's user avatar
4 votes

Failed to call the method because [Sitecore.Data.Items.Item] does not contain a method named "op_Addition"

Your code works ok when there are multiple items returned from Get-ChildItem command. If only 1 item is returned, SPE returns single item object instead of an array. You can work around the issue by ...
Marek Musielak's user avatar
  • 23.9k

Only top scored, non community-wiki answers of a minimum length are eligible