Skip to content

Instantly share code, notes, and snippets.

$item = Get-Item master:/content/home
$newTemplate = [Sitecore.Configuration.Factory]::GetDatabase("master").Templates["Sample/Sample Item"];
$item.ChangeTemplate($newTemplate)
@suryagahlot
suryagahlot / SPERemoting-SimpleRemoteInstall.ps1
Created September 7, 2019 22:31 — forked from michaellwest/SPERemoting-SimpleRemoteInstall.ps1
Simple example to installing a module package on a remote Sitecore instance. The package already exists on the server.
Import-Module -Name SPE -Force
$packageName = "$($SitecorePackageFolder)\[PACKAGE].zip"
$session = New-ScriptSession -Username "admin" -Password "b" -ConnectionUri "http://remotesitecore"
Test-RemoteConnection -Session $session -Quiet
$jobId = Invoke-RemoteScript -Session $session -ScriptBlock {
[Sitecore.Configuration.Settings+Indexing]::Enabled = $false
Get-SearchIndex | ForEach-Object { Stop-SearchIndex -Name $_.Name }
Import-Package -Path "$($SitecorePackageFolder)\$($using:packageName)" -InstallMode Merge -MergeMode Merge
@suryagahlot
suryagahlot / QueryCleanupQueueCounts.sql
Created September 7, 2019 22:31 — forked from michaellwest/QueryCleanupQueueCounts.sql
Queries the queue tables and counts the number of records using Sitecore PowerShell Extensions.
$sql = @"
USE {0}
SELECT COUNT(*) FROM [SCSitecore_Master].[dbo].[EventQueue]
SELECT COUNT(*) FROM [SCSitecore_Master].[dbo].[PublishQueue]
SELECT COUNT(*) FROM [SCSitecore_Master].[dbo].[History]
"@
Import-Function Invoke-SqlCommand
foreach($db in Get-Database | Where-Object {"filesystem" -notcontains $_ }) {
@suryagahlot
suryagahlot / OutputMultipleFiles.tt
Created May 1, 2018 13:23 — forked from seankearney/OutputMultipleFiles.tt
This TDS Code Generation template is an example of how you can generate a multiple files that contains a single class in each.
<#@ template language="C#" hostSpecific="true" #>
<#@ import namespace="System" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="HedgehogDevelopment.SitecoreProject.VSIP.CodeGeneration.Models" #>
<#@ parameter name="Model" type="HedgehogDevelopment.SitecoreProject.VSIP.CodeGeneration.Models.SitecoreItem" #>
<#@ parameter name="DefaultNamespace" type="System.String" #>
<#
/************************************************************
@suryagahlot
suryagahlot / frontendDevlopmentBookmarks.md
Created March 10, 2017 19:51 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.