Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [powershell-extensions]

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

0
votes
2answers
60 views

How to get ALL specific child-items in a folder using fast query?

I have here a sample content. Now I want to get all the Article Template under the Folder. Sitecore Content Folder Article1 Article2 NewsFolder1 ...
0
votes
0answers
49 views

How to create a Sitecore Module WDP packge **WITH** Sitecore items?

I was following the official documentation on the subject here https://doc.sitecore.com/developers/sat/20/sitecore-azure-toolkit/en/web-deploy-packages-for-a-module.html and realized that it looks ...
1
vote
0answers
31 views

Unable to elevate 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 ...
1
vote
1answer
24 views

How to get the descendants of the values/folder in `Read-Variable` command using `Fast` query?

I have here a Read-Variable command that will make you select any content folder. $root= Get-Item master:\content\home $selectFolder= Read-Variable -Parameters @{ Name = "root"; Title="Start ...
-1
votes
1answer
23 views

How to check an array of items if it has a page layout and output only the page item and exclude its subitems using Powershell? [closed]

I have an array of items stored in $mylist. I'm trying to check items with layout and output them. Here's the script that I have tried: for ($i = 0; $i -le $mylist.count; $i++) { $i = $...
0
votes
1answer
69 views

How to get items from both master and web Context in PowerShell Extensions without using Get-Item?

I want to get all the items from both master and web database using Find-Item cmdlet and run in one Powershell script. I'd also rather not use Get-Item cmdlet for performance reasons. Any inputs will ...
2
votes
1answer
54 views

How can I get the renderings when using the Find-Item command?

I used Find-Item to get the items on my sitecore_master_index. Now, I want to get the presentation details of each item. How can I do get each rendering/presentation details?
2
votes
1answer
29 views

How can I filter or show only one of the duplicates in the results when using Find-Item command?

I used Find-Item to get the items on my sitecore_master_index. However, the results contains same ID but with different languages. I have found out that this item has many language versions in the ...
1
vote
1answer
45 views

Adding new version for each item

I was trying to add new version for each item in sitecore: $root = "master:\content\home" @(Get-Item -Path $root) + @(Get-ChildItem -Path $root) -Recurse | Add-ItemLanguage -Language "en-us" -...
0
votes
1answer
49 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 ...
3
votes
2answers
206 views

How can I specify a specific log file to write to from a Sitecore Powershell script?

I have some scripts where I'd like to separate their log output from the standard Sitecore Powershell log (SPE.log). Is there a parameter which I can use on Write-Log to output to a named log file?
2
votes
1answer
118 views

Inherit child template to the parent template using Powershell

I have 2 templates: Template A: PersonalTemplate Template B: PrivateTemplate Here I want to inherit Template B in Template A using the PowerShell script.
2
votes
1answer
37 views

SPE's Download for media files not working - can't find zip file

We have a problem where the Download script used as a right-click menu option is throwing an error. Looking into the script, the problem appears to be how the value [Sitecore.Configuration.Settings]::...
-4
votes
2answers
296 views

Session Timeout in sitecore powershell

[![Ideal Session Timeout in Powershell console][1]][1] I have noticed this few times before & I have intentionally recreated today to confirm on how console would respond when there is a session ...
1
vote
1answer
47 views

Installing SPE 4.7.2/5.0 on Sitecore XP 9

I am trying to install SXA 1.8.0 on Sitecore 9.1 environment (my local pc as testing) but I cannot install Sitecore Powershell Extension 4.7.2/5.0 which is required to be installed before SXA ...
0
votes
1answer
25 views

How to save a file with a custom name using Show-ListView function?

I want to save a file with a custom name while using Show-ListView function. Right now, when I am trying to save the file it is returning in this format "report-2019-02-25_095656.csv". This is the ...
1
vote
1answer
35 views

Sitecore Powershell Extension installation fails

I have to environments test and prod with the same codebase and content installed, and I have installed SPE on the Test system all fine and dandy, but when I try to do it on our production environment ...
1
vote
2answers
97 views

Sitecore Powershell Extensions not returning field source value

I'm trying to write a simple Powershell script that finds all General Link fields and outputs the value of their Source field. $fields = Get-ChildItem -Path "master://sitecore/templates/user defined" ...
0
votes
0answers
53 views

How to replace an item with another item by ID in Treelist field using Powershell?

I want to replace an item with another item in a Treelist. Basically, the items I want to replace are broken links. Suppose, There are two items A and B. A is used in a Treelist field, so I want to ...
0
votes
1answer
45 views

PowerShell exception at Receive-File dialog

I have a PowerShell code like this Import-Function Validate-PowerShell Test-PowerShell Try { $ctx = get-item . Import-Function Import-RedirectMappings $file = Receive-File (get-item "...
0
votes
1answer
88 views

PowerShell script to update field with IDs to media items

Trying to update media item field through script .In the csv file I have item name for uploaded images that needs to be updated in the Imagefield script: $AllPhotoGallery = Get-ChildItem -Path "...
0
votes
0answers
77 views

Error installing Sitecore PowerShell Extensions 5.0 on Sitecore 9.1 instance ['packageinstall:items:ended' event]

I got this error when trying to install SPE 5.0 on my Sitecore 9.1 instance. [![enter image description here][1]][1] I was able to get more details checking the log files: ManagedPoolThread #3 08:...
1
vote
0answers
62 views

Can I automate the PowerShell Extension package installation?

Is it possible to automate the installation of the package that everybody is using to automate the other packages installation? My goal would be having a script which I can use to install SPE on a ...
1
vote
0answers
24 views

Removing publication restrictions - publication targets

Does anyone know or have a PowerShell script which can remove the checkbox in publication restrictions specific to publication targets for Sitecore items? We need to achieve (2) as below since some ...
0
votes
2answers
59 views

Powershell script to update displayname error

When I try to update the display name of the item am getting the following error. Please let me know how to fix this? Working Please wait, working... unlike you! 'DisplayName' ...
1
vote
1answer
103 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 ...
0
votes
1answer
26 views

Setting Page Design field in Sitecore pages

I'd like to set the Page Design field in certain pages of a certain template to a value in sitecore using powershell script. I tried the following but it didn't work. I also tried the name of the page ...
0
votes
1answer
177 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
6
votes
1answer
113 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 ...
3
votes
0answers
17 views

Restoring marketing taxonomies with Sitecore powershell extenstion

I am trying to automate Sitecore upgrade from 8.1 to 9.0.1. In Upgrade steps, There is one step restoring deleted marketing taxonomies, which can easily be done with Url navigation and click button on ...
1
vote
1answer
134 views

How do you publish with the Publishing Service using SPE?

The Publish-Item command appears to use the older API for publishing (slow). When I run the script below, I do not see the publishing job appear in the Publishing Service dashboard. $item = Get-Item ...
4
votes
2answers
864 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 ...
5
votes
1answer
77 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/...
2
votes
1answer
147 views

How to get detailed installation log while the update package is being installed remotely using SPE?

I'm using SPE to install the TDS .update package file. How do I get detailed installation log remotely in the script below? Current PowerShell Script: $SitecoreInstanceUri = "https://helixsite....
2
votes
1answer
64 views

How do I get the raw date value in my SPE report?

While trying to create a report compatible with the SPE Data Importer, I noticed that the date is formatted rather than the raw value. How do I change this script to give me the date in the proper ...
1
vote
0answers
60 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....
5
votes
1answer
348 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 ...
3
votes
1answer
235 views

How to copy multiple items to a new location

Got over 200 items in various folders in one location that would like to copy to a new location while retaining the same folder structure. Each item has more than one version and would like to retain ...
1
vote
1answer
143 views

Reading a CSV file from media library through power shell script

This is working fine $global:ProductPath = "/sitecore/content/Home/Content_Pages/ " $csv = Import-CSV "C:\inetpub\wwwroot\mysample\Book1.csv" $bulk = New-Object "Sitecore.Data.BulkUpdateContext" try ...
2
votes
2answers
75 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 ...
4
votes
2answers
324 views

Powershell command to get lower directory

I currently have a script that puts a file in a directory the website but would rather create it in the Data directory. The powershell script has the below: $FilePath = $AppPath + "Temp_files\...
0
votes
2answers
119 views

Getting all items using a Specific Sublayout using Sitecore Powershell Extensions

I have to get data of rendering parameters used by a specific sub-layout. Is there a way to get all items which are using a particular Sublayout. Example: I have a Sublayout "SiteHeader" and it has a ...
5
votes
2answers
241 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 ...
4
votes
3answers
156 views

How to disable Publishing Temporarily?

During certain periods we have the requirement to disable publishing for a period of time. The current approach for this is pretty brute-force. Delete the Publishing Targets and then restore them from ...
0
votes
1answer
308 views

Sitecore PowerShell RemoveLinks() using Broken Links Report

I am currently using the Sitecore Powershell Broken Links Report to find and delete broken links. Using the Broken Links Report, I have been able to locate the broken links. I can't seem to delete ...
0
votes
3answers
303 views

Traverse to parent item that matches the given template id using Sitecore Powershell Extension

I want to find the ancestor of an item that matches the given template id using Powershell. Can anyone help me in achieving this? Scenario: I'm on Item A, I get the current item details using gi .. ...
6
votes
1answer
47 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 ...
3
votes
1answer
54 views

Determining whether item has been published

Is there an easy way using SPE to determine whether an item has been published?
3
votes
1answer
58 views

Using Show-ListView to Display a Dynamic Number of Columns in Sitecore Powershell

My goal is to use the Show-ListView function available in Sitecore Powershell to show a dynamic number of columns. I'm currently executing the Show-ListView function as follows: $table | Show-...
2
votes
1answer
43 views

Setting Presentation Aliases with Sitecore Powershell Extensions

In Sitecore 9, in the Content Editor and under the Presentation tab, there's an option to set Aliases on an item. Assuming you already have the desired item stored in variable $item, how would you set ...