Questions tagged [powershell-extensions]

Anything related to the Sitecore PowerShell Extensions (SPE) module

Filter by
Sorted by
Tagged with
42 votes
5 answers
5k 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 ...
Corey Smith's user avatar
  • 2,708
13 votes
3 answers
4k 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.
Prakash's user avatar
  • 1,059
11 votes
2 answers
1k 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 ...
Owen Niblock's user avatar
  • 1,512
11 votes
4 answers
5k 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 ...
Arbejdsglæde's user avatar
11 votes
1 answer
1k 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 ...
ASura's user avatar
  • 2,363
10 votes
6 answers
16k 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 ...
Percy's user avatar
  • 285
10 votes
3 answers
26k 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 ...
James Walford's user avatar
10 votes
2 answers
2k 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 -...
Ben Golden's user avatar
  • 3,303
10 votes
2 answers
3k 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 ...
Prakash's user avatar
  • 1,059
9 votes
3 answers
3k 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 ...
Matthew Dresser's user avatar
9 votes
3 answers
476 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 ...
Dmitry Harnitski's user avatar
9 votes
1 answer
853 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 ...
Diego's user avatar
  • 5,678
9 votes
1 answer
718 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 ...
Matthew Dresser's user avatar
8 votes
2 answers
2k views

Issue elevating SPE Console in 9.1 Azure PaaS

I have a relatively clean install of Sitecore PowerShell Extensions v 5.0 in my environment, which is running Sitecore 9.1 on Azure PaaS. As far as I can tell, everything in the install seems to be ...
Bic's user avatar
  • 530
8 votes
2 answers
1k 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 ...
Kapil Naker's user avatar
8 votes
2 answers
2k 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 ...
Harsh Baid's user avatar
  • 1,994
8 votes
2 answers
764 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 ...
novicecoder's user avatar
8 votes
1 answer
643 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 ...
Cody Watkins 's user avatar
8 votes
1 answer
765 views

Sitecore Powershell SPE 5.1 "Could not validate access using the provided credentials" error

I have written the SPE powershell script in my local Sitecore 9.1.1 sandbox environment and trying to execute, it is asking session elevate privilege to enter credentials. Even though I am entering ...
Prabhu Ranganathan's user avatar
7 votes
2 answers
3k 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 ...
vandsh's user avatar
  • 1,651
7 votes
3 answers
4k 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 ...
Nil Pun's user avatar
  • 2,283
7 votes
2 answers
1k 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, ...
jdylanmc's user avatar
  • 1,482
7 votes
2 answers
1k 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?
Vicent Galiana's user avatar
7 votes
1 answer
2k 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 ...
Filip Verswijver's user avatar
7 votes
1 answer
1k 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 ...
Ben Golden's user avatar
  • 3,303
7 votes
2 answers
1k 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 (...
Christopher Jones's user avatar
7 votes
1 answer
1k 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 ...
Diego's user avatar
  • 5,678
7 votes
1 answer
1k 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 ...
Jason Booth's user avatar
7 votes
1 answer
255 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 ...
Nick's user avatar
  • 171
7 votes
1 answer
477 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 built into Sitecore but sometimes the UI was ...
Barsonax's user avatar
  • 173
6 votes
4 answers
3k views

SPE to Unlock all items locked by a specific user

Is there a quick way to unlock all the items locked by a specific user from an admin account?
SitecoreNoob's user avatar
6 votes
3 answers
2k 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["{...
Harsh Baid's user avatar
  • 1,994
6 votes
3 answers
8k 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 ...
Slrg's user avatar
  • 289
6 votes
2 answers
817 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. ...
Mathew's user avatar
  • 88
6 votes
1 answer
640 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-...
Troels Aaberg's user avatar
6 votes
1 answer
2k 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 ...
Michael West's user avatar
6 votes
2 answers
327 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'. ...
Gluip's user avatar
  • 366
6 votes
2 answers
581 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?
Melvinr's user avatar
  • 183
6 votes
1 answer
682 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 ...
SumitK's user avatar
  • 741
6 votes
1 answer
184 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 ...
George Jaray's user avatar
6 votes
1 answer
1k 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 $...
James Walford's user avatar
6 votes
1 answer
889 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 ...
Santosh Poojari's user avatar
6 votes
1 answer
349 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 ...
David Hake's user avatar
6 votes
1 answer
745 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 ...
Ariana's user avatar
  • 61
6 votes
1 answer
255 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 ...
Karthik's user avatar
  • 61
6 votes
1 answer
191 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....
C B's user avatar
  • 61
5 votes
4 answers
2k views

Sitecore PowerShell extensions module compatibility with Sitecore 9.2

I am trying to install the Sitecore PowerShell extensions module in Sitecore 9.2. While installing this module, I received a w3wp crash error as: When I try to run any script, I am receiving "...
SurendrA SharmA's user avatar
5 votes
1 answer
2k 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 ...
Diego's user avatar
  • 5,678
5 votes
1 answer
161 views

How do you add a custom context menu to run an SPE script not in the scripts section?

I would like to have a custom context menu like the following: Since this menu item does not follow the typical integration points for SPE, how would I go about making it work with a script?
Michael West's user avatar
5 votes
1 answer
413 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-...
Levi Wallach's user avatar
  • 1,075

1
2 3 4 5
10