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", "...
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 ...
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 ...
user avatar
  • 2,534
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 ...
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 ...
user avatar
  • 171
8 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 ...
user avatar
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 ...
user avatar
  • 945
7 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 ...
user avatar
  • 18.8k
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 = ...
user avatar
  • 4,114
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 ...
user avatar
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 ...
user avatar
  • 837
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 ...
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"]...
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 ...
user avatar
  • 18.8k
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 ...
user avatar
5 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 ...
user avatar
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 ...
user avatar
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 $...
user avatar
  • 16.4k
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 ...
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 ...
user avatar
  • 16.4k
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 ...
user avatar
  • 1,651
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}']" ...
user avatar
4 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 ...
user avatar
4 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]$...
user avatar
  • 16.4k
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 ...
user avatar
4 votes
Accepted

Is this possible to modify existing PowerShell scripts for Sitecore?

You can manage all default scripts for sure. Especially scripts, that you ask for, are located under the following item: /sitecore/system/Modules/PowerShell/Script Library/SPE/Reporting/Content ...
user avatar
4 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 -...
user avatar
3 votes
Accepted

Sitecore Commerce Installation error 503 service unavailable

It seems that the local account user you have used for the application pool do not have sufficient access or the credentials are incorrectly entered for the user. Please refer this blog post for ...
user avatar
3 votes
Accepted

How can I change already created items to be under my newly created workflow?

To update the workflow for the current item’s descendants, you can use the below script $contentsToUpdate = Get-Item master: -Query "sitecore/content/ParentItem//*" -Language "en-GB" foreach($...
user avatar
3 votes
Accepted

SIF Installation throwing Password Validation Failed exception

Your database is complaining that the password you specified for the messaging user (SqlMessagingPassword parameter) is too "simple". SQL will enforce you to use stronger passwords for your users. ...
user avatar
  • 19.1k

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