Skip to content

Instantly share code, notes, and snippets.

@Wesley-Lomax
Wesley-Lomax / choco-machinesetup.ps1
Created February 17, 2022 10:24
Windows Laptop Dev / Azure Setup
ECHO Installing apps
ECHO Configure chocolatey
choco feature enable -n allowGlobalConfirmation
choco install visualstudiocode
choco install notepadplusplus
choco install jabra-direct
#choco install wox
choco install 7zip
@Wesley-Lomax
Wesley-Lomax / AppInitialization.config
Last active July 9, 2021 12:30
App Initialization for Sitecore PaaS prevent cold start up
<?xml version="1.0"?>
<applicationInitialization
doAppInitAfterRestart="true"
skipManagedModules="true"
remapManagedRequestsTo="WarmUp.html"
>
<!--This initialization in essential for autoscaling/swapping.
List the pages that need to be warmed up before traffic is allowed in the webapp. NOTE:No duplicate entries allowed-->
<add initializationPage="/" />
@Wesley-Lomax
Wesley-Lomax / AzureRegions.txt
Last active May 13, 2021 10:00
Update all regions of the Azure Calculator to the specified region
//Allowed Azure Regions
asia-pacific-east
asia-pacific-southeast
australia-central
australia-central-2
australia-east
australia-southeast
brazil-south
canada-central
canada-east
@Wesley-Lomax
Wesley-Lomax / ListAllItemsWithAClone.ps1
Created June 20, 2019 15:45
Lists all items in a Sitecore branch with a clone
# HasTooManyRenderings determines if the specified item has more than the specified number of renderings.
$startItem = Get-Item -Path master:\content\
$resultsPageSize = 30
$props = @{
Title = "Find item clones"
Description = "This report will analyse the branch and will tell you which items clones ."
Width = 450
Height = 300
@Wesley-Lomax
Wesley-Lomax / FindHighRenderings.ps1
Last active June 14, 2019 11:21
Find Sitecore items with renderings greater than provided parameter
# HasTooManyRenderings determines if the specified item has more than the specified number of renderings.
$startItem = Get-Item -Path master:\content\
$maxRenderings = 30
$resultsPageSize = 30
$props = @{
Title = "Count renderings on items"
Description = "This report will analyse the branch and will tell you which items have a renderings count greater than the provided parameters ."
Width = 450
@Wesley-Lomax
Wesley-Lomax / CountComponents.ps1
Created June 13, 2019 13:41
Get count of Sitecore components on layout / page
$item = gi "/sitecore/content/Habitat Sites/Habitat Home/home" -Language 'en'
$sharedLayoutField = $item.Fields[[Sitecore.FieldIDs]::LayoutField]
$finalLayoutField = $item.Fields[[Sitecore.FieldIDs]::FinalLayoutField]
$sharedLayoutXml = [Sitecore.Data.Fields.LayoutField]::GetFieldValue($sharedLayoutField)
$finalLayoutXml = [Sitecore.Data.Fields.LayoutField]::GetFieldValue($finalLayoutField)
$sharedLayout = [Sitecore.Layouts.LayoutDefinition]::Parse($sharedLayoutXml)
$finalLayout = [Sitecore.Layouts.LayoutDefinition]::Parse($finalLayoutXml)
@Wesley-Lomax
Wesley-Lomax / Sitecore.Debug.LoggingLevel.config
Created May 7, 2019 09:13
Sitecore Logging Level Patch Config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<log4net>
<root>
<priority set:value="DEBUG" />
</root>
</log4net>
</sitecore>
</configuration>
@Wesley-Lomax
Wesley-Lomax / Web.CD.config
Created October 15, 2018 14:41
Web.CD.config Transform CM config to CD for Sitecore 9
<?xml version="1.0" encoding="utf-8"?>
<!--
NOTE : Using this xdt file sets up the web.config for CD servers,
regular web.config file is set up for CM servers.
Applying transform through VSTS using XDT Tranform task before CD App Service install
-->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<location path="sitecore/api" xdt:Transform="InsertBefore(/configuration/system.web)">
<system.web>
<authorization>
@Wesley-Lomax
Wesley-Lomax / web-request-loop.ps1
Created June 26, 2018 13:24
Fire web request at server with loop
$targetSite = "https://hostname"
Write-Host "Requesting " $targetSite
while($true)
{
Invoke-WebRequest -TimeoutSec 120 -method head -Uri $targetSite | Select-Object StatusCode, StatusDescription
Start-Sleep -Seconds 60
}
@Wesley-Lomax
Wesley-Lomax / CreateSitecorePackageOfPageAndAllItems.ps1
Last active April 19, 2018 08:38
Creates a Sitecore package for an item include the item, its templates and base templates, renderings and their datasource items and templates.
function AddItemToCollection($itemId)
{
$itemCollection.Add($itemId)
}
function GetRenderings()
{
Get-Rendering -Item $startItem -FinalLayout | Foreach-Object {
if($_.ItemID)