Skip to content

Instantly share code, notes, and snippets.

View nehemiahj's full-sized avatar

Nehemiah Jeyakumar nehemiahj

View GitHub Profile
@nehemiahj
nehemiahj / Rsync
Last active August 29, 2015 14:27
rsync -avzh --progress root@192.168.21.20:/backup/site1 /data/site1/
@nehemiahj
nehemiahj / Create and Import Sitecore Database.ps1
Created September 16, 2020 20:32
Create and Import Sitecore 9.3 Database using DacPac and Powershell
#Get the DAC assemly Location
$DacFxLocation = "C:\Program Files (x86)\Microsoft SQL Server\140\DAC\bin"
#Get the Dac File Location
$DacFileLocation = "C:\Sitecore9.3\DBs"
#Get SQL Server Name
$sqlserver = Read-Host 'What is the SQL servername?' #'nlgsusnpscmi1'
#Get SQL Server Username
@nehemiahj
nehemiahj / nuget_profile.ps1
Last active May 8, 2021 02:44
Update Sitecore NuGet Packages For All Projects
function UpdateSitecorePackagesForAllProjects([string] $OldVersion = "9.3.0", [string] $NewVersion = "10.1.0", [string] $Source = "https://sitecore.myget.org/F/sc-packages/api/v3/index.json") {
Write-Host "Old Sitecore Package Version - $OldVersion" -BackgroundColor Magenta
Write-Host "New Sitecore Package Version - $NewVersion" -BackgroundColor Magenta
$projectsList = Get-Package Sitecore. | Select ProjectName -Unique
foreach($projNameObject in $projectsList) {
$projName = $projNameObject.ProjectName
Write-Host "Start inpsecting project - $projName" -BackgroundColor Green
$pkgs = Get-Package Sitecore. -ProjectName $projName
@nehemiahj
nehemiahj / ScPwsh-items-by-lookup-items.ps1
Created September 17, 2021 18:38
Sitecore PowerShell - List all referenced items by lookup items
<#
.SYNOPSIS
Lists all referenced items by lookup items.
.NOTES
NEHEMIAH JEYAKUMAR
#>
#
# INPUT / CONFIGURATION
#
@nehemiahj
nehemiahj / UpdateDotNetTargetVersion.ps1
Last active November 5, 2021 09:33
Update .NET Framework Target Version in Legacy and SDK Project Formats
# This script updates .NET Target Framework version in both SDK and Legacy Project format types.
using namespace System.Collections.Generic
# Provide the src folder where the csproj files are located.
# This script can check the child folders as well.
$dir = "C:\Helix\src"
# Provide the target framework version
$legacyTargetFrameworkVersion = "v4.7.2";
@nehemiahj
nehemiahj / scPwsh-GetAllUsersWithProperties.ps1
Created December 7, 2021 18:58
Sitecore PowerShell - Get All Sitecore Users with Properties
[System.Web.Security.Membership]::GetAllUsers() |
Select-Object -Property @{Name = 'FullName'; Expression = {(Get-User -Identity $_.UserName).Profile.FullName}},
@{Name="User Name"; Expression={ $_.UserName} },
@{Name="Email"; Expression={ $_.Email} },
@{Name="Is Admin"; Expression={ (Get-User -Identity $_.UserName).IsAdministrator} },
@{Name="Is Online"; Expression={ $_.IsOnline} },
@{Name="Is Enabled"; Expression={ $_.IsApproved} },
@{Name="Is Locked"; Expression={ $_.IsLockedOut } },
@{Name="Domain"; Expression={ $_.ProviderName} },
@{Name="Created Date"; Expression={ $_.CreationDate} },
@nehemiahj
nehemiahj / sitedefinition.aspx
Last active January 15, 2022 21:26
Sitecore Site Definition Viewer Admin Page
<%@ Page Language="C#" AutoEventWireup="false" Debug="true" %> <%@ Import Namespace="Sitecore.Sites" %> <%@ Import Namespace="Sitecore.Text" %> <%@ Import Namespace="System.Linq" %>
<script runat="server" language="c#">
public SiteCollection siteCollection;
public Site selectedSiteObj;
/// <summary>
/// Page Load event handler.
/// </summary>
protected override void OnLoad(EventArgs e)
@nehemiahj
nehemiahj / context.aspx
Created February 8, 2022 04:03
To view the request and context data for troubleshooting
<%@ Page Language="C#" AutoEventWireup="true" Debug="true" %>
<html>
<head>
<title> CMS Context Information</title>
</head>
<body>
<h1 style="text-align: center">
CMS Context Information</h1>
<div>
@nehemiahj
nehemiahj / userscript.js
Created February 9, 2022 19:20
UserScript to load the latest Sitecore Document Version
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.tampermonkey.net/index.php?version=4.14&ext=dhdg&updated=true
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant none
// @include https://doc.sitecore.com/*
@nehemiahj
nehemiahj / listTemplateFieldsList.sql
Last active April 20, 2022 20:43
Get the list of Template Fields which are corrupt (Shared, Unversioned)
SELECT DISTINCT fieldid
FROM versionedfields
WHERE fieldid IN (SELECT [itemid]
FROM sharedfields s
WHERE s.fieldid = '{BE351A73-FCB0-4213-93FA-C302D8AB4F51}'
AND s.value = '1'
UNION
SELECT [itemid]
FROM sharedfields s
WHERE s.fieldid = '{39847666-389D-409B-95BD-F2016F11EED5}'