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", "...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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
...
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 ...
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 = ...
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 ...
6
votes
How to get path property of Sitecore item using PowerShell
You can get item properties using this command.
$itemID = "{8A87AC2B-210D-49F2-93FC-215918085418}" #Mention your Item ID
# Use Format-Table if you want to show results in the table view.
...
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 ...
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 ...
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"]...
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 ...
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 ...
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
...
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
...
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 ...
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]$...
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
$...
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 -...
5
votes
Accepted
Moving item using in Powershell
You can also use ID for both source and destination. So the query will be something like this.
$itemID = "{8A87AC2B-210D-49F2-93FC-215918085418}" # Mention your Item ID to move
$...
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 ...
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/...
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 ...
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 ...
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 ...
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 "...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
powershell × 183powershell-extensions × 77
sitecore-install-framework × 14
sxa × 10
installation × 10
docker × 10
sitecore-client × 8
solr × 6
sitecore-commerce × 6
azure × 6
content-editor × 5
presentation × 3
workflow × 3
deployment × 3
automation × 3
sitecore-api × 2
wffm × 2
media-library × 2
indexing × 2
publishing × 2
personalization × 2
templates × 2
sitecore-query × 2
role-management × 2
ribbon × 2