What's the deal with Deno? We talk with a major contributor to find out. Listen now.
6

Here is an example using Sitecore PowerShell Extensions to compare the first bit with a list of known values. $png = "89" $gif = "47" $bmp = "42" $jpg = "FF" $image = Get-Item -Path "master:" -ID "{88962785-4EE1-47F8-9CD1-028CAC9794AD}" $media = [Sitecore.Resources.Media.MediaManager]::GetMedia([Sitecore.Data.Items.MediaItem]$image) New-UsingBlock ($...


6

There are a few options included with SPE out-of-the-box which could aid in accomplishing this task. The detail below is produced with SPE 6.0 but much of it was available in previous versions. Reports There is a Content Report called Items last updated which can be used to find any items in the tree (typically content) that has changed after a specified ...


5

Welcome to Sitecore stackexchange. RAZL RAZL - can be used to compare the items between two different Sitecore Instances. Please note this is a "paid" software. Another option is to use Sitecore Courier - This open source module can compare sitecore serialized files in two folders and create a diff (update) package containing the differences. There is ...


5

You are always getting ALL items in final state through LinkDB first and then filtering them down by date. This query will continue to become slower and slower. What you can do is use the sitecore_master_index to query for your referring items: $criteria = @( @{Filter = "Equals"; Field = "__workflow_state"; Value = "c674d9dfb5ea4f3b8871f80b2f214f28" }, ...


5

You are trying to get Datasource from an item which is retrieved using Get-Item. Instead you should get datasource from Item retrived using Get-Rendering Change this code $Properties = @{ RenderingItemName = $renderingItem.Name RenderingItemID = $renderingItem.ID RenderingItemPath = $renderingItem....


4

You can simply remove the duplicate items from the array by using Sort-Object with the -Unique switch, It will combine sorting with the removal of duplicates. Alias of Sort-Object is sort - $YourItemArrayList | sort -unique


4

In this example, the item's FinalLayout contains the renderings. $defaultLayout = Get-LayoutDevice -Default $rootItem = Get-Item -Path "master:" -ID "{961563FC-3445-4558-BF3A-06DF06BA6298}" Get-Rendering -Item $rootItem -Device $defaultLayout -FinalLayout From here you can filter out renderings that have a Datasource specified. In cases where the value is ...


4

ExportDataProvider replaces newlines in the data from FormDataProvider to spaces. So you must get the data with FormDataProvider and format it manually. Here is an example of a fixed version: function Get-FormData($formId, $startDate, $endDate) { $provider = [Sitecore.DependencyInjection.ServiceLocator]::ServiceProvider.GetService([Sitecore....


3

You can get item by URL using below function. You may have to tweak it for resolving wildcard items. function GetItemByUrl($url){ $url = [System.Uri]::new($url); $siteContext = [Sitecore.Sites.SiteContextFactory]::GetSiteContext($url.Host, $url.PathAndQuery); $homePath = $siteContext.StartPath; if (!$homePath.EndsWith("/")){ ...


3

You can use the below function to query a defined GraphQL endpoint. function Invoke-GraphRequest { param( [string]$query, [Sitecore.Data.Items.Item]$siteRoot, [string]$apiPath ) $apiKeyItemPath = "/sitecore/system/Settings/Services/API Keys/key-name" $apiKeyItem = Get-Item -Path "master:$...


3

You can use Where-Object to exclude items in /sitecore/templates/System node like: Where-Object { ! $_.Paths.FullPath.StartsWith('/sitecore/templates/System') } So your full code would be $items = Get-ChildItem $selectedValues.SelectedFolderPath -Recurse | Where-Object { ! $_.Paths.FullPath.StartsWith('/sitecore/templates/System') }


3

You can try the below script: $items = Get-ChildItem -Path "master:/sitecore/content/home" -Recurse | Where-Object { $_.TemplateName -eq 'Your Template Name'} You can filter at two levels: At the -Path level where you can minimize the exposure to the particular list Where-Object where you can either match the TemplateIds/TemplateName with "-eq" or skip ...


2

The only issue I see with your script is that you are creating a variable for each template type. If you have a big list of templates then it would be difficult to manage the script. So, Instead of creating a variable for each template path you can use an array for template paths. Example - $templatePaths = "/sitecore/templates/System/Node", ...


2

You can use the below script to check for your values on the templates. It will check if the item path contains /sitecore/templates/System. $items = Get-ChildItem $selectedValues.SelectedFolderPath -Recurse foreach($item in $items){ if($item.Paths.FullPath -inotmatch "/sitecore/templates/System"){ Write-Host "Processing item $($item.Name) with ...


2

You will need to get the item from either from master or web database and after that need to remove it from the all data list and then need to update the list view - foreach($selectedItem in $selectedData) { $item = Get-Item -Path "master:" -ID $selectedItem.ID $item | Remove-Item $allData.Remove($selectedItem) } $allData | Update-ListView


2

This issue is a known bug and was reported with issue 1152. Scheduled to be released with SPE 6.1. The quickest way to get a fix is to apply the following changes to the script: /sitecore/system/Modules/PowerShell/Script Library/SPE/Tools/Data Management/Toolbox/Data Management/Data Importer #Old Value $itemPath = "$($destinationNode.ItemPath)/$($row.Name)...


2

The first issue is because the ID that you are trying to use is not in the proper format. One way to workaround this is to parse the id that you received without the { }. Please see code below $id = [Sitecore.Data.ID]::Parse("110D559FDEA542EA9C1C8A5DF7E70EF9") $item = Get-Item "master: -ID $id" $item The above code snippet will provide ...


2

In order to read the field type Checklist in Sitecore Powershell, you need to cast the field as a MultilistField. You can access field types allowing the user to select multiple items, including Checklist, Multilist, Treelist, and TreelistEx, by using the Sitecore.Data.Fields.MultilistField class. You can use the Sitecore.Data.Fields.MultilistField.GetItems(...


1

As Michael said in its comment, the item may be null. I did a quick test locally and below is the result I've used the Item Id of the default Home item and the result shows that the item is not null. $item = Get-Item -Path master -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}" if($item -ne $null){ Write-Host "Item is not null" } else{ ...


1

I would first start with the SPE documentation as seen here. Once you have demonstrated locally that you can connect and remotely run tasks then check out the sample maintenance scripts under the System Maintenance module. Example: Using the SPE Remoting module you can try something like this. Import-Module -Name SPE $session = New-ScriptSession -Username ...


1

I think the regex you're looking for is <!--\s*(<img[\w\W]+?>)\s*-->. I run the following script: $html = '<!-- <img src="-/media/67a6sahgshghs6as76.ashx" alt="" width="100%" height="auto" class="figure"> -->'; $regex = '<!--\s*(<img[\w\W]+?>)\s*-->'; $matches = ([regex]$...


1

I would first start with the following commands: Find-Item : Use this to query the index Initialize-Item : Use this to convert the data from the index into Sitecore items The items that come back can then be managed directly like seen here Example: The following example finds all items in the master index inheriting from the "Sample Item" template. Those ...


1

Spe uses the class ListViewComparer to handle the sorting. It appears as of 6.1 it sorts DateTime, int, and finally string. You can submit a feature request or a pull request if you would like to see more datatypes covered. public int Compare(String str1, String str2) { DateTime dateTime1, dateTime2; if (DateTime.TryParse(str1, out dateTime1) &&...


1

In theory you should just be able to do this: $item = Get-Item -Path "master:\sitecore\content\sites\abc" $item.Image = Get-Item -Path "master:\sitecore\media library\xyz\pqr\mno\infotumbnail410PD1" from this page: https://doc.sitecorepowershell.com/working-with-items But I couldn't figure out how to do that with fields with a space in them. So I did it ...


1

The primary hurdle was Azure DevOps. While I was using the native PowerShell command in my Release, it did not recreate the same execution cycle I witnessed when running the script directly on the VM. The solution was to create an additional runspace and to sleep prior to the execution of the status check Wait-RemoteScriptSession of SPE. The trimmed-down ...


1

Per Michael West's comment, the solution for my local instance was Rename this file removing the .disabled: \App_Config\Include\Cognifide.PowerShell.IdentityServer.config.disabled


1

I suggest you rebuild the link databases for the date filter issue and for the Never publish property add an else condition :- if($item.'__Never publish' -eq 1) { $addInList | Add-Member -type NoteProperty -name NeverPublished -Value 'True' } else{ $addInList | Add-Member -type NoteProperty -name NeverPublished -Value 'False' }


1

New-UsingBlock is analogous to the using block we use in C#. As per the definition in Sitecore PowerShell Doc, The New-UsingBlock command disposes of the provided input object after the specified scriptblock completes execution. You may find the data returned by the scriptblock is contained within the following object System.Collections.ObjectModel....


1

deserialize-item command requires 2 parameters - path - which is a path to the item on the drive but without .item extension. If the item does not exist in the Sitecore tree yet, you need to pass the parent item path. root - the directory which is the root of serialization. The trailing slash \ character is required In your case, you want to deserialize ...


1

You can try for loop instead of foreach loop if you want to update collection within the loop Example - for($index = $allData.Count-1; $index -ge 0; $index--) { $item = Get-Item -Path "master:" -ID $allData[$index].ID $item | Remove-Item $allData.RemoveAt($index) } If $allData is a collection of items then below script is enough to remove items ...


Only top voted, non community-wiki answers of a minimum length are eligible