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
class BaseItem { | |
[Sitecore.Data.Items.Item]$Item | |
} | |
class LinkItem : BaseItem { | |
[Sitecore.Data.Fields.LinkField]$LinkField | |
} | |
class TextItem : BaseItem { | |
[Sitecore.Data.Fields.HtmlField]$TextField |
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
<# | |
.SYNOPSIS | |
There is an issue with the authentication ticket cleanup for certain versions of Sitecore. Run this script as a scheduled task. | |
.LINK | |
https://kb.sitecore.net/articles/615926 | |
$ticketIds = [Sitecore.Web.Authentication.TicketManager]::GetTicketIDs() | | |
ForEach-Object { $_.Replace("_", "") } |
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") | |
$text = '%' + 'Ã' + '%' | |
$query = @" | |
select [ItemID], [FieldID], LEN([Value]) AS [FieldLength] from [SharedFields] WITH (NOLOCK) where [Value] like @0 | |
"@ | |
$shared = Invoke-SqlCommand -Connection $connection -Query $query -Parameters @{"@0"=$text} | |
$query = @" |
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
$linkItems = Get-ChildItem -Path "master:" -ID "{66FD3C09-517C-4691-82AF-E300AC6BA329}" -Recurse -Depth 2 | | |
Where-Object { $_.TemplateId -eq "{41BAA575-6B15-4356-8F25-9CEE8F9D6D95}" } | |
foreach($linkItem in $linkItems) { | |
try { | |
[Sitecore.Xml.XmlUtil]::GetXmlNode($linkItem.NavigationLink) > $null | |
} catch { | |
$linkItem | |
} | |
} |
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
<# | |
.SYNPOSIS | |
Convert a PrivateKey from the certificate store into a PKCS8 formatted file. | |
.LINK | |
Found C# version here https://gist.github.com/chenrui1988/6b104a010172786dbcbc0aafc466d291/ | |
.NOTES | |
Michael West | |
#> |
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
<# | |
.SYNOPSIS | |
Lists all the items locked by the specified user. | |
.NOTES | |
Adam Najmanowicz, Michael West | |
#> | |
Import-Function -Name Invoke-SqlCommand |
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
DECLARE @BlobID uniqueidentifier; | |
SELECT @BlobID = '{FF8A2D01-8A77-4F1B-A966-65806993CD31}'; | |
WITH [BlobFields] ([fieldid]) | |
AS (SELECT [sharedfields].[itemid] | |
FROM [sharedfields] | |
WHERE [sharedfields].[fieldid] = @BlobID | |
AND [sharedfields].[value] = 1 | |
UNION | |
SELECT [versionedfields].[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
$items = [Sitecore.Diagnostics.Statistics]::RenderingStatistics | |
$props = @{ | |
Property = @( | |
@{Label="Rendering"; Expression={$_.TraceName} }, | |
@{Label="Site"; Expression={$_.SiteName} }, | |
@{Label="Count"; Expression={$_.RenderCount} }, | |
@{Label="From cache"; Expression={$_.UsedCache} }, | |
@{Label="Avg. time (ms)"; Expression={$_.AverageTime.TotalMilliseconds} }, | |
@{Label="Avg. items"; Expression={$_.AverageItemsAccessed} }, | |
@{Label="Max. time"; Expression={$_.MaxTime.TotalMilliseconds} }, |
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
# Solution for https://github.com/SitecoreSupport/Sitecore.Support.94909 | |
# Cannot login in Sitecore CMS due to multiple same users already logged in | |
# Saved to /sitecore/system/Modules/PowerShell/Script Library/[CUSTOM_MODULE_NAME]/Pipelines/LoggedIn/Remove Multiple Sessions | |
$pipelineArgs = Get-Variable -Name pipelineArgs -ValueOnly | |
$username = $pipelineArgs.UserName | |
if(!$username) { return } | |
$sessionId = [System.Web.HttpContext]::Current.Session.SessionID | |
Write-Log "The current session Id is $($sessionId) for user $($username)" |