Skip to content

Instantly share code, notes, and snippets.

View harshbaid's full-sized avatar

Harsh Baid harshbaid

View GitHub Profile
@MartinMiles
MartinMiles / Demo-UploadPicture.ps1
Last active April 20, 2024 17:28
Demo of uploading a media item to XM Cloud using Authoring GraphQL API
# before starting, make sure env variable "Sitecore_GraphQL_ExposePlayground" is set to "true"
$FileToUpload = "C:\Users\Martin\Pictures\man2x.png"
$MediaDestination = "Default Website/new media"
$Hostname = "xmc-perficient-introduction-158.sitecorecloud.io"
# First, obtain TWT using authorized data from user.json
$JWT = .\Request-Token.ps1
# Next, get the upload URL from Authoring GraphQL endpoint
@kpatil-hi
kpatil-hi / removeitemsfromworkflow.ps1
Created January 8, 2021 18:38
Remove from Workflow
$props = @{
InfoTitle = "Remove workflows"
PageSize = 10000000
}
Write-Host "Starting work in the context of the 'master' database, under /Home item."
Set-Location -Path "master:/sitecore/content/<YOURNODE>"
# Set up variables
$workflowState1 = "{13FDC8BC-60B9-44E1-ADCC-CED02E0392A9}" #ID of the workflow states. DRAFT
@michaellwest
michaellwest / CleanupTables.sql
Last active August 29, 2024 18:10
Remove entries in the Sitecore Publishing Service queue using PowerShell.
Import-Function -Name Invoke-SqlCommand
$connection = [Sitecore.Configuration.Settings]::GetConnectionString("master")
$query = @"
DELETE FROM [Sitecore.Masterx].[dbo].[Publishing_ActivationLock]
DELETE FROM [Sitecore.Masterx].[dbo].[Publishing_Data_Params_FieldIds]
DELETE FROM [Sitecore.Masterx].[dbo].[Publishing_Data_Params_Languages]
DELETE FROM [Sitecore.Masterx].[dbo].[Publishing_JobManifest]
DELETE FROM [Sitecore.Masterx].[dbo].[Publishing_JobMetadata]
@MartinMiles
MartinMiles / TestSitecorePowerShellRemoting.ps1
Last active February 10, 2021 15:46
SPE Remoting (1. Install Sitecore module; 2. Install remoting module into $PSHome\Modules; 3. Weaken security ie. ShieldsDown.config )
Set-ExecutionPolicy RemoteSigned
Import-Module -Name SPE
$session = New-ScriptSession -Username admin -Password b -ConnectionUri https://platform
Invoke-RemoteScript -ScriptBlock {
Get-Item -Path "master:\content\Home"
} -Session $session
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:env="http://www.sitecore.net/xmlconfig/env/">
<!--
Author: https://twitter.com/epetrashen
Details: https://sitecorepc.wordpress.com/2020/08/12/supercharge-your-local-sitecore-instance-with-these-tips/
-->
<sitecore env:require="Local">
<hooks>
<hook type="Sitecore.Diagnostics.HealthMonitorHook, Sitecore.Kernel">
<patch:delete />
</hook>
@michaellwest
michaellwest / ReadExif.ps1
Created May 16, 2020 03:59
Read EXIF orientation using Sitecore PowerShell Extensions.
# https://exiftool.org/TagNames/EXIF.html
# https://stackoverflow.com/questions/27835064/get-image-orientation-and-rotate-as-per-orientation
# http://fredericiana.com/2013/05/23/imagetwist-exif-rotation-addon/
# https://www.cyotek.com/blog/handling-the-orientation-exif-tag-in-images-using-csharp
enum ExifOrientation {
RotateNoneFlipNone = 1
Rotate90FlipX = 5
Rotate90FlipNone = 6
}
#[System.Drawing.RotateFlipType]::Rotate90FlipNone
@dylanyoung-dev
dylanyoung-dev / Sitecore Docker Cheatsheet
Last active April 27, 2021 05:07
Docker Cheatsheet for getting setup with Sitecore Docker folder and then how to manage my docker images locally.
## Sitecore Docker Repository (Clone Locally)
git clone https://github.com/Sitecore/docker-images/
## Change Directory to Root of Cloned Repository
cd docker-images
## Run Build.ps1 (with default tags)
.\Build.ps1
## Set Path for License File
@jermdavis
jermdavis / Install-Solr.ps1
Last active November 23, 2021 13:30
A PowerShell script to help installing Solr as a service - See https://blog.jermdavis.dev/posts/2017/low-effort-solr-installs for details
Param(
$solrVersion = "6.6.2",
$installFolder = "c:\solr",
$solrPort = "8983",
$solrHost = "solr",
$solrSSL = $true,
$nssmVersion = "2.24",
$JREVersion = "1.8.0_151"
)
@thinkfreshnick
thinkfreshnick / InstallSitecoreInstallFramework.ps1
Last active May 23, 2019 05:52
Install latest version of the Sitecore Install Framework and remove any previously installed versions
Import-Module SitecoreInstallFramework
$Module = Get-Module SitecoreInstallFramework
Remove-Module $Module.Name
Remove-Item $Module.ModuleBase -Recurse -Force
Register-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2
Set-PSRepository -Name SitecoreGallery -InstallationPolicy Trusted
Install-Module SitecoreInstallFramework
Get-Module -Name SitecoreInstallFramework -ListAvailable
@michaellwest
michaellwest / Config_Enable-Disable_Sitecore_8.1_upd3.csv
Last active June 20, 2024 12:45
The following script imports the specified Sitecore Role configuration csv and automatically enables or disables the configs.
Product Filepath Filename DefaultExtension Provider CD CM PRC CMP RPT
Platform \website\ Web.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ Commands.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ ConnectionStrings.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ ConnectionStringsOracle.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ FieldTypes.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ Icons.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ LanguageDefinitions.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ MimeTypes.config config Enable Enable Enable Enable Enable
Platform \website\App_Config\ Portraits.config config Enable Enable Enable Enable Enable