Skip to main content

Questions tagged [powershell-extensions]

Anything related to the Sitecore PowerShell Extensions (SPE) module

Filter by
Sorted by
Tagged with
11 votes
2 answers
3k 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
  • 560
10 votes
6 answers
18k 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
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
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
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
6 votes
2 answers
919 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
4 votes
1 answer
2k views

One time delete of old versions

Master database has more than 500 items that have more than 10 item versions. Some content items have more than 100 versions. According to recommendation to limit 10 item versions I want to perform a ...
Alex S's user avatar
  • 327
3 votes
3 answers
960 views

Archive Sitecore items using Sitecore PowerShell Extention

I need to archive Sitecore items using Sitecore PowerShell. Any commnand that can be used to achieve this.?
pasan samarakoon's user avatar
3 votes
1 answer
1k views

Turning on Index Viewer for SPE

I have really given it a go before I posted here, but I am trying to turn on the Index Viewer for SPE. The gitbook doco says it exists, shows it not being in the menu, but no info on how to put it in ...
Chris Auer's user avatar
  • 13.1k
3 votes
3 answers
1k views

Unlocking items via Sitecore PowerShell Extensions scheduled task

I'm using Sitecore Powershell Extensions to unlock items that have been locked for an extended period of time. The script is stored in the script library: $item = Get-Item -Path master:\content\ $...
Rondel's user avatar
  • 493
2 votes
1 answer
322 views

Where are my SXA items?

Running 10.2, I followed the SXA installation instructions and installed: Powershell Extensions 6.3 Sitecore Experience Accelerator 10.2.0 rev. 04247 If I go into /templates, then SXA stuff is there,...
MStodd's user avatar
  • 284
1 vote
1 answer
443 views

In Powershell how to enable/show options like Select All | DeSelect All for Multilist field type

Good day!! anyone know how to show the option like Select all and Deselect All for Multilist field type in powershell. Similar kind of functionality available for checklist field type but not ...
Karthik 's user avatar
1 vote
1 answer
1k views

Sitecore powershell script to delete selected items from results

Below is the Sitecore Powershell Script to delete selected items from Powershell script result - foreach($Item in $selectedData) { if($Item -ne $null) { $Item | Remove-Item } } ...
NewbieHere's user avatar
43 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,718
11 votes
2 answers
2k 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
3 answers
27k 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,313
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,293
6 votes
3 answers
9k 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
1 answer
709 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
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
5 votes
1 answer
463 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,085
5 votes
1 answer
2k 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 ...
James Walford's user avatar
4 votes
2 answers
3k views

Create Sitecore Link with Powershell

I'm working on some reports using Sitecore Powershell Extensions. One requirement is to provide the public URL for various Sitecore items. I'm thinking this isn't really possible via Link Manager ...
Jason Booth's user avatar
4 votes
2 answers
1k views

Export of script results to Excel not working

When I get a ListView with script results and want to export the results to Excel etc., nothing happens when I click on the buttons. I do however get an error in the developer tools console: Failed ...
WulfgarDK's user avatar
  • 303
4 votes
2 answers
2k views

Using Powershell Extensions to remove empty <p> tags from all rich text fields

I need to remove empty <p> tags from all rich text fields in the content tree: <p>&nbsp;</p> I've done nothing myself with Sitecore Powershell Extensions so far, so I am not ...
squadwuschel's user avatar
  • 1,165
4 votes
1 answer
1k views

Getting an item using Powershell having only the URL

Is it possible to get a Sitecore item via Powershell script having only the public URL? Something like an overload of the Get-Item function that receives the URL would be ideal Thanks in advance
Mario Hugo Gallardo's user avatar
4 votes
1 answer
1k views

Item.Editing.EndEdit() is not triggering save event when called from Powershell extension

We have written one rule for bucket items and it gets triggered when a bucket item is created or the item is saved. for creating a bucket item we use below code $updatedItem=New-Item -Path "$...
Kapil Naker's user avatar
4 votes
1 answer
93 views

How to switch to another item from context item using SPE?

I have an SPE script which content team runs from the script context menu. The script deletes the current context item. Once the item is deleted, and I close the script pop-up. I get another pop-up ...
Shaurya's user avatar
  • 457
3 votes
3 answers
1k views

OKClick method through reflection is not allowed error with SPE

We are upgrading our Sitecore version from 8.2 to 10.2. At the moment we are having an issue with Sitecore PowerShell Extension (version 6.4) with the below snippet $uploadDirectory = Join-Path -Path $...
Yos's user avatar
  • 33
3 votes
1 answer
239 views

Cannot add a User to a Role where the User name contains the "@" sign using PSE

I have to bulk-add a large number of users to a role, to this extent I am using the Add-RoleMember cmdlet. If I run Add-RoleMember -Identity "<role name>" -Members "name.lastname" it works ...
Emanuele Ciriachi's user avatar
2 votes
3 answers
2k views

Running PowerShell scripts without using Sitecore PowerShell Extensions module

We are facing some issues with Lucene during installation of PowerShell Extensions module (SPE). Is there any option to run Sitecore scripts from Windows PowerShell? I mean that I will just add ...
Martin Fric's user avatar
2 votes
0 answers
535 views

SPE Object reference not set to an instance of an object

In Sitecore 9.02 I get this error running any script in Powershell ISE. Console works fine. Stack trace: [NullReferenceException: Object reference not set to an instance of an object.] Cognifide....
Lex Raaphorst's user avatar
2 votes
2 answers
717 views

Is it possible to edit the InsertItems of an item

I have managed to get a list of items that use a specific template. I now want to add an Insert option to each of those items. I understand that I can edit the template Insert options and update the ...
Percy's user avatar
  • 285
2 votes
1 answer
2k views

Unable to export query result to a file from Sitecore Powershell scirpt with Out-Download command

I have a simple powershell script which uses Out-Download command to export the query result to .xlsx file. However, it doesn't seem working. The same scenario as well if I used the download button ...
arseny's user avatar
  • 181
2 votes
1 answer
2k views

Bulk create Media Items

Is it possible to bulk create media items from an array of System.IO.FileInfo without needing to install the remote powershell extension package to use the Upload-SitecoreFile command? Notes - The ...
Ben Sewards's user avatar
1 vote
1 answer
1k views

Sitecore Powershell script to filter the users based on custom roles

we have custom roles in sitecore role manager and assigned them to sitecore users. I am writing a Sitecore PowerShell script to filter the users based on my custom role 'Buyer'. below is my script. i ...
Shrad's user avatar
  • 303
1 vote
1 answer
221 views

How to copy selected items to a Data folder using powershell script?

We have a requirement for bulk workflow approval. Where we need to add items(with or without children) similar to this image, Following this article, https://www.sitecorenutsbolts.net/2015/12/14/...
Visva Kiruthika Muthuraj's user avatar
1 vote
1 answer
1k views

Sitecore Powershell script to find items that break inheritance

I need to write a Powershell script to find items that refer to a specific composite component and break inheritance for presentation. If I go to the Navigation Tab in the Content Editor and click ...
Shelley Benhoff's user avatar
1 vote
1 answer
2k views

How to connect to a Sitecore instance with Windows PowerShell?

I have reviewed the GitBook and the two blog articles (original and v2) about remoting with SPE, but I've not been successful in executing any commands. Here's an example script I've been trying to ...
Dan Sinclair's user avatar
  • 5,394
1 vote
1 answer
2k views

Adding Items to Multilist Field using powershell

Can any please explain me how to add multiple items to the multilist field. For me only last item is getting selected. $item.Editing.BeginEdit() $allItems = Get-ChildItem -Path '/sitecore/content/...
Gokilavani R's user avatar
1 vote
1 answer
374 views

Attempting to Export Creative Exchange through script web api

I'm attempting to follow the documentation for SXA in a CI/CD process. Configuration Details: Sitecore 9.1 (Standalone Config - My Local Dev) SXA 1.8 initial release PowerShell 5 Running on Windows ...
Derek Port's user avatar
1 vote
1 answer
1k views

Out-Download access denied to user anonymous

I have a custom SPE script that is executed from the Reporting Tools on the Sitecore start menu. The script writes a csv file to the app_data\temp directory, then calls Get-Item $filePath | Out-...
LCM's user avatar
  • 97
1 vote
1 answer
620 views

Sitecore PowerShell Extensions Remoting variables not working in Octopus Deploy

I'm having issues with variables when using SPE Remoting with OctopusDeploy, where method-local variables can't be used. I get this error The value of the using variable '$using:propertyTableKey' ...
Sean Holmesby's user avatar
1 vote
1 answer
945 views

How can I copy personalization rules to a rendering in Sitecore Powershell?

I'm copying a rendering from one item to another using Sitecore Powershell Extensions. All is working well, except that the personalization rules for the rendering aren't copied over. I can get/set ...
James Walford's user avatar
1 vote
2 answers
3k views

PowerShell script to compare latest version number of master and web DB in sitecore

Can Anyone help writing a PS script to get the item list where the latest version on web db is different than master
D J's user avatar
  • 385
0 votes
1 answer
1k views

How to delete Sitecore items without reference using PowerShell script?

We have multi-site application, want to delete items which are not referencing anywhere in content tree. Following are categories: 1) DataSource items 2) Template 3) Media items 4) Renderings How ...
Abhishek Malaviya's user avatar
0 votes
1 answer
1k views

Import Excel module installation issues in Sitecore Powershell Extentions

We are trying to enable excel data extraction in a machine where MS office is not present. While doing that we are facing issues to enable the Import-Excel module in SPE. We are facing the below ...
Thamizh's user avatar
  • 327
0 votes
1 answer
2k views

Copy data from en language version to other language version

I need to copy item field data from en language to all other available languagesin all versions. Any powershell script of achieving this.
kartik's user avatar
  • 11
0 votes
1 answer
405 views

Powershell Reports menu not appearing

We upgraded a Sitecore site from 9.1 to 10.2. After the upgrade we installed the latest SPE. Everything works as expected except the SPE Reports submenu; it doesn't show, even for the admin user. We ...
TamerM's user avatar
  • 1,682