This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Find field data not associated with an item. | |
SELECT Id FROM SharedFields f | |
WHERE NOT EXISTS (SELECT ID FROM Items i WHERE i.ID = f.ItemId) | |
SELECT Id FROM UnversionedFields f | |
WHERE NOT EXISTS (SELECT ID FROM Items i WHERE i.ID = f.ItemId) | |
SELECT Id FROM VersionedFields f | |
WHERE NOT EXISTS (SELECT ID FROM Items i WHERE i.ID = f.ItemId) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#$provider = [Sitecore.DependencyInjection.ServiceLocator]::ServiceProvider.GetService([Sitecore.XA.Foundation.Abstractions.Configuration.IConfiguration[Sitecore.XA.Foundation.Search.SearchConfiguration]]).GetConfiguration().QueryMaxItems | |
$query = "+template:{51ed5851-1a61-4dae-b803-6c7fae6b43d8};+sxa:SameFirstTagAsCurrentPage|SxaTags;custom:EventStartDate|[NOW TO *];custom:EventEndDate|[NOW TO *];sort:eventstartdate;sort:isfeatured[desc]" | |
$modelList = [Sitecore.ContentSearch.Utilities.SearchStringModel]::ParseDatasourceString($query) | |
$contextItem = Get-Item -Path "master:" -ID "{31318AEE-310B-4EE4-84DA-4B84471E0FCA}" | |
[Sitecore.DependencyInjection.ServiceLocator]::ServiceProvider.GetService([Sitecore.XA.Foundation.Search.Services.ISearchQueryTokenResolver]).Resolve($modelList, $contextItem) | |
class CustomSearchResultItem : SearchResultItem | |
{ | |
[Sitecore.ContentSearch.IndexField("eventstartdate_tdt")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sql = @" | |
SELECT DISTINCT i.* FROM [dbo].[Items] i | |
INNER JOIN [dbo].[VersionedFields] v | |
ON i.ID = v.ItemId | |
WHERE v.[Language] = '' | |
--SELECT COUNT(*) AS COUNT FROM [VersionedFields] WHERE [Language] = '' | |
--DELETE FROM [VersionedFields] WHERE [Language] = '' | |
"@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a ScopeQuery item found in SXA. You don't have to use this. | |
$scopeItem = Get-Item -Path "master:" -ID "{648F4C3A-C9EA-4FCF-82A3-39ED2AC90A06}" | |
# If not using SXA, you can replace this with the string from the QueryBuilder field type. | |
$scopeQuery = $scopeItem.ScopeQuery | |
$props = @{ | |
Index = "sitecore_sxa_master_index" | |
ScopeQuery = $scopeQuery | |
} | |
$referenceList = Find-Item @props |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Management.Automation; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Kamsar.WebConsole; | |
using Rainbow.Model; | |
using Rainbow.Storage.Sc.Deserialization; | |
using Sitecore.Data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$watch = [System.Diagnostics.Stopwatch]::StartNew() | |
# BLOCK 1: Create and open runspace pool, setup runspaces array with min and max threads | |
$pool = [RunspaceFactory]::CreateRunspacePool(1, [int]$env:NUMBER_OF_PROCESSORS+1) | |
$pool.Open() | |
$runspaces = $results = @() | |
# BLOCK 2: Create reusable scriptblock. This is the workhorse of the runspace. Think of it as a function. | |
$scriptblock = { | |
param ( | |
[string]$Data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use this report to export current access | |
$users = Get-User -Filter * | Where-Object { $_.Roles.Count -gt 0 } | |
$records = [System.Collections.ArrayList]@() | |
foreach($user in $users) { | |
$record = [PSCustomObject]@{ | |
"Username" = $user.Name | |
"Roles" = ($user.Roles | Select-Object -ExpandProperty Name) -join "," | |
} | |
$records.Add($record) > $null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Function -Name Invoke-SqlCommand | |
$connection = [Sitecore.Configuration.Settings]::GetConnectionString("master") | |
$query = @" | |
DELETE FROM [Sitecore.Masterx].[dbo].[Publishing_ActivationLock] | |
DELETE FROM [Sitecore.Masterx].[dbo].[Publishing_Data_Params_FieldIds] | |
DELETE FROM [Sitecore.Masterx].[dbo].[Publishing_Data_Params_Languages] | |
DELETE FROM [Sitecore.Masterx].[dbo].[Publishing_JobManifest] | |
DELETE FROM [Sitecore.Masterx].[dbo].[Publishing_JobMetadata] |