Skip to content

Instantly share code, notes, and snippets.

View apandrade's full-sized avatar
🏠
Working from home

André Andrade apandrade

🏠
Working from home
View GitHub Profile
$rootPath = ""master:/sitecore/content/SiteRoot"
Write-Host "Root Path: $($rootPath)"
Get-ChildItem -Path $rootPath -Recurse | Foreach-Object{
$id = $_.ID
$item = Get-Item -Path master: -ID $id
Write-Host "Checking item $($item.Name)-$($id)"
Get-ChildItem -Path $item.Parent.Paths.FullPath | Where-Object{ $_.ID.Guid -ne $id.Guid -and $_.Name -eq $item.Name } | Foreach-Object {
Write-Host "DUPLICATED - $($_.Paths.FullPath) - $($_.ID.Guid.ToString())"
}
}
@apandrade
apandrade / CreateDatabaseFromFile.sql
Created March 14, 2024 00:17
Create Database from .mdf file
USE [master]
GO
CREATE DATABASE [database_name] ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Data\<database name>.mdf' ),
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Data\<database name>.ldf' )
FOR ATTACH ;
GO
@apandrade
apandrade / delete-sc-services.ps1
Created March 13, 2024 15:16
Delete Sitecore services in Windows
sc delete sc1031xconnect.dev.local-MarketingAutomationService
sc delete sc1031xconnect.dev.local-ProcessingEngineService
sc delete sc1031xconnect.dev.local-IndexWorker
@apandrade
apandrade / CreateSelfSignedCertificate.ps1
Last active March 13, 2024 15:14
Sometimes in a Sitecore installation you can't use TLS 3.0 protocol and you have to recreate the installed certificates with KeyUsage as DigitalSignature
New-SelfSignedCertificate -FriendlyName self.signed.sc93sc.dev.local -DnsName self.signed.sc93sc.dev.local -CertStoreLocation Cert:\LocalMachine\My -KeyUsage DigitalSignature
@apandrade
apandrade / GetInstalled.NETFramework.ps1
Last active March 13, 2024 15:12
Use it to figure out what version of .NET Framework is installed
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse | Get-ItemProperty -Name version -EA 0 | Where { $_.PSChildName -Match '^(?!S)\p{L}'} | Select PSChildName, version
@apandrade
apandrade / your-site-name.dev.local.config
Last active March 13, 2024 15:10
XML file used to define a new website in a multisite Sitecore solution. This file should be placed in the App_Config/Include/your-site-name folder.
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<sites>
<site name="your-site-name"
patch:after="site[@name='modules_website']"
targetHostName="your-site-name.dev.local"
enableTracking="true"
virtualFolder="/"
physicalFolder="/"