Questions tagged [powershell-extensions]

Anything related to the Sitecore PowerShell Extensions (SPE) module or general Windows PowerShell.

Filter by
Sorted by
Tagged with
40
votes
5answers
2k views

How can I programmatically add a rendering to all of my content items?

I need to add a rendering to all of the pages in my Sitecore tree (i.e., items that have renderings, have a layout set, and live under /sitecore/Content). Content items that don't have renderings or a ...
13
votes
3answers
2k views

Sitecore Powershell query for big images of a certain size

Can someone help me with the Sitecore Powershell query which I can use for finding the images more than the given size.
11
votes
2answers
610 views

Can you run Sitecore Powershell without triggering Sitecore events?

I want to write a script which could potentially clean up a load of unused assets, but I would like it not to trigger events (index rebuilds etc). Is there a way to say "do this silently" in a ...
11
votes
4answers
2k views

Copy final layout to shared layout

Our content authors, makes a lot of mistake when whey work in Experience Editor. Quite often they do some changes on final layout, but expect to have it on shared layout. Is is any tool exist that ...
11
votes
1answer
689 views

Update all users in the Administrator Role

I want to be able to update all users who have the Administrator checkbox selected without manually going through each of the user. In the same script I would like to add them to another Role. This ...
10
votes
2answers
916 views

How to pass arguments to SPE's Invoke-RemoteScript

I want to pass some arguments to a script block that will be run on a remote Sitecore instance via SPE remoting. I wrote this script as a test, but it's not working. $session = New-ScriptSession -...
10
votes
2answers
1k views

Updating Workflow for all the Items in Sitecore Instance

I would like to update a workflow (any Standard Field) for all existing items. new items. What is the best way to do this? Can I use Sitecore Rocks or Sitecore Powershell Extensions? Any other ...
9
votes
2answers
2k views

Create new language version for content branch

Is there a way in Sitecore Powershell Extensions to create new language versions of a branch in the content tree? I need it to copy exactly the presentation details set on the current language to the ...
9
votes
3answers
372 views

Where should I install Powershell module for SXA?

Solution can be installed on many environments - QA, Staging, Prod. In every of these environments Sitecore instances have different roles - CD, CM, Job, Publishing and etc. Should I install ...
9
votes
1answer
727 views

Update same rendering of several templates using SPE

I have a bunch of templates that have a Coveo Search Box View rendering associated with the standard values. I need to update the property "Reveal Advanced Query Suggestions" of all of them(a lot of ...
8
votes
2answers
10k views

How to check an item exists with powershell without raising an error?

In Sitecore Powershell extensions I can use If ( Get-Item ...) to return true if an item exists or false if it doesn't, but if the item isn't found then it outputs an error message as well. Is ...
8
votes
1answer
244 views

SPE How to add multiple items to package source

I'm writing a SPE script to package up all unused media library items under a specific folder (prior to deletion). I've found New-Package and New-ItemSource methods and know how to use them (to some ...
8
votes
1answer
321 views

Upgrade path from Integrated Dynamic Placeholders to Sitecore 9 Dynamic Placeholders (OOTB)

Does anyone have a SPE script that could be used to upgrade the rendering parameters of existing content to the new dynamic placeholder style required for Sitecore 9 Dynamic placeholders? We used to ...
7
votes
3answers
2k views

How to get list of all the renderings that has been configured to use data source

We are almost complete with a large project. I am trying to find out which rendering in the page has been configured to use data source using a Powershell script. So that we can run in both UAT and ...
7
votes
2answers
552 views

How to hide ribbon in Sitecore

We have created a ribbon in Sitecore that have few command buttons and few PowersSell command buttons. We want them to be visible only when an author hits specific items in the Content Editor. So we ...
7
votes
2answers
841 views

Sitecore Powershell: Is it possible to prompt user for their password?

I'm creating a Context Menu script to allow deletion of languages on my content tree. When the user elects to run this script, I want to prompt them for their password as a confirmation mechanism, ...
7
votes
2answers
789 views

How to create Sitecore Context Item to copy Item Path using SPE?

How to create Sitecore Context Item to copy Item Path using Sitecore PowerShell Extensions. Like in below screen we have for Layout Copy Renderings and Quick download package. Sometimes it requires ...
7
votes
2answers
529 views

PowerShell Extensions reports: Is it possible to pass / choose parameters?

I have created my first report, now I'd like to make it reusable. Is there any way I could read parameters from "somewhere" after the user clicks the report's name?
7
votes
2answers
449 views

How to copy an item to multiple locations

What is the easiest and quickest way to copy an item to various locations? I have about 100 multisites in a solution and I have created a new template. I need to create a new item inheriting this ...
7
votes
1answer
600 views

Sitecore Powershell Extensions - Reports Authorization

I've created some PSE scripts to give our client some reports on their content. I created them under the proper convention of Script Module and Script Library so that the reports show up under ...
7
votes
1answer
307 views

Exporting database-based media to the file system

There's a great article (Sitecore 8.2 - Convert disk media to database) on converting disk media to the database, but I'm trying to do the opposite, temporarily at least. I want to optimize images (...
6
votes
3answers
1k views

How to reset DisplayName to empty using Sitecore PowerShell Extensions?

I wanted to know better way to reset Display Name to empty using PowerShell scripts. I have written below script.. $item = Get-Item "/sitecore/content/home" $item.Editing.BeginEdit() $item["{...
6
votes
2answers
3k views

Powershell get all items that use a template

The title pretty much says it all - I've looked at the docs but I just keep finding Get-Item and Get-ItemTempate. Lets say I have a template with id 123456, I want to get all items that are using ...
6
votes
2answers
225 views

Compare items between two instances

We upgraded Sitecore 8.2 project to 9.1. Upgrade took around 1 month to finish and during this period, authors created/updated some items in old instance and they didn't make a note of those items. ...
6
votes
1answer
286 views

Getting “Current Sitecore database cannot be established” using Sitecore Powershell Extensions

I'm trying to get my feet wet in Sitecore Powershell. I need to list renderings on a list of items. Some of the script works, like getting the items and outputting the name, but when calling Get-...
6
votes
1answer
671 views

PowerShell ISE: Function of Abort button?

I have noticed that clicking the Abort button in the PowerShell ISE doesn't actually cause the background job to terminate. I guess I shouldn't be surprised since arbitrarily terminating a thread that ...
6
votes
1answer
847 views

Set Powershell script language

I would like to know if there's a way to set the current script's context language through code. I know there's a way to set it in the ISE but I need some code that could override it and force a ...
6
votes
2answers
183 views

Sitecore ISE powershell inconsistent results

I am running a script in Sitecore powershell to find items bases on a regular expression on a custom field ('Subkey'). This script sometimes shows results and sometimes shows 'No items available'. ...
6
votes
2answers
326 views

Getting locked items SPE

I have a multisite Sitecore instance and I would like to get all locked items from all different sites and users and unlock them, is it possible to do this job using Sitecore Powershell Extensions?
6
votes
1answer
657 views

How do you change the sort order of items using PowerShell

I have some items created using New-Item but they are automatically sorted alphabetically. I would much prefer these items to be sorted by Created date. How do you change the sort order of items ...
6
votes
1answer
135 views

Upload Files (Advanced) randomly removing dashes

I'm working on a SPE script that uses the standard media library upload tool to take a file then uses the built in unzipper to unzip it. Upon unzipping the media items sometimes it removes dashes from ...
6
votes
1answer
489 views

How to escape a query in Sitecore PowerShell

This PowerShell query breaks, if the item name contains query operators such as "and" or "child". How should I escape it, so that they don't break it? $SourceItemPath = $SourceItem.Paths.path $...
6
votes
1answer
723 views

Updating parameters using SPE

I'm running a script in which I want to mark as checked all renderings of a specific template with the Vary By Data parameter. But running the script it is adding to the Additional Parameters the ...
6
votes
1answer
571 views

Unable to get value of $_.Source using SPE

I have a rich text field in my user defined template and I want to replace the source value of the rich text field. Below is my query where I'm able to read Name, type etc, however $_.source is ...
6
votes
1answer
275 views

Setting up automated role creation for various SXA sites

The challenge I am trying to solve is to create dynamic roles for an SXA site, knowing that my client will be creating multiple SXA sites over time, and thinking that possibly the best way to ...
6
votes
1answer
191 views

Broken Links Report Options Powershell vs. Fast Query?

I am currently trying to find and delete broken links in the Sitecore master database. I am using a version of this script. The problem I am having is that the number of items in the content tree is ...
6
votes
1answer
70 views

How to determine whether an editor is using the Desktop Content Editor or Launchpad Content Editor?

I've been doing a lot more SPE report implementations and noticed that the functionality of loading the ListView is dependent on whether the editor is using the Content Editor from Launchpad or the ...
6
votes
1answer
109 views

Good workflow for SXA powershell scripts

I am trying to find a good way to work with PowerShell scripts that we use for SXA such as for scaffolding. I have tried the PowerShell ISE client that was build into Sitecore but sometimes the UI ...
5
votes
2answers
2k views

Deleting an Item with a null Template

Thru a series of unfortunate events (most likely missing a template in a package between servers/instances) I found myself having issues inserting links thru the General Link field. Tracked it down ...
5
votes
3answers
1k views

Update fields using Sitecore Powershell Extensions

I'm using the following script to update a specific field in all the children of the item right-clicked in my content tree. It works but the update is not applied to the item clicked with my context ...
5
votes
1answer
889 views

Compare item versions with Sitecore PowerShell Extension

I'm looking for an option to compare programatically using SPE all the fields of an item that have changed from the latest version x the version prior to that and highlight what changed. Have anyone ...
5
votes
1answer
85 views

Run powershell script when new user is created

So, I've been successful in creating a powershell script that modifies the MyToolbar to what we need based on the user's domain: $ribbonCommands = "{1DDBC2B7-69B4-44A0-AAF9-895AB51B1F00}|{D87FDF3B-...
5
votes
1answer
425 views

What is the call depth limit in Sitecore PowerShell and can it be overridden?

I have a recursive script that hits a System.Management.Automation.ScriptCallDepthException exception. What is the call depth limit in Sitecore PowerShell and can it be overridden? Note: Yes, I can ...
5
votes
1answer
97 views

Performance issue with Sitecore Powershell Script

I am working on SPE (Sitecore.PowerShell.Extensions-5.1) with Sitecore 9.0.1 where I have one script which creates a report of items in approved workflow state. But the execution of the script is ...
5
votes
1answer
295 views

Can a Sitecore LaunchPad button be attached to a Sitecore Powershell script?

I am working on connecting a Sitecore LaunchPad button to a Sitecore Powershell script so I can use the script to perform the desired action. Any examples of how I should do that ?
5
votes
1answer
91 views

Are locally scoped objects in Sitecore Powershell released from memory when out of scope?

I'm writing some scripts that will process a large quantity of items and have naturally split out some parts of it to functions. Within these functions I'll get a Sitecore item in a local variable, do ...
5
votes
1answer
138 views

How to use multiple words in Quick filter box in Sitecore powershell Show-Listview

I am new for Sitecore Powershell, In the script I am using Show-Listview to display the result and it is providing option to Filter the result data. Powershell doc stating we can use multiple words in ...
5
votes
1answer
148 views

8.1 stopped working after content node deletion. NullReferenceException, Powershell Pipeline Issue?

8.1 won't let us log back in. While attempting to delete a node with ~16k sub-items we couldn't tell whether 8.1 was frozen or still trying to delete. We restarted site/app pool & now can't log in....
5
votes
2answers
673 views

Getting and setting the order of renderings/sublayouts on a page

I have written a PowerShell script that replaces sublayouts with renderings across all pages in a Sitecore site. Everything is working well except for the order of the renderings. The order always ...
5
votes
1answer
159 views

Add Placeholder To Presentation Details Using Sitecore Powershell

I'm attempting to use Sitecore Powershell Extensions to automate Step 2 of the following upgrade guide for a Sitecore accelerator known as SCORE: https://brainjocks.atlassian.net/wiki/spaces/SDD/...