Skip to content

Instantly share code, notes, and snippets.

View RobsonAutomator's full-sized avatar

Ro Se RobsonAutomator

View GitHub Profile
@RobsonAutomator
RobsonAutomator / sitecore-on-azure-sas-token.ps1
Created July 2, 2017 16:24
How to use shared access signatures (SAS) in an automated way during Sitecore deployment with Azure Toolkit.
#Requires -Modules Azure
# #############################################################################
# Get SAS tokents
#
# AUTHOR: Robert Senktas
# BLOG: http://lets-share.senktas.net/2017/07/sitecore-on-azure-sas-token.html
#
# COMMENT:
# #############################################################################
@RobsonAutomator
RobsonAutomator / pssolrservice.ps1
Created November 13, 2017 10:13
Install Solr as Windows Service without dependencies
#
# PSSolrService.ps1
#
<# region Description
###############################################################################
# #
# File name PSService.ps1 #
# #
# Description A sample service in a standalone PowerShell script #
# #
@RobsonAutomator
RobsonAutomator / restoreDB.sql
Last active March 29, 2021 16:42
restore RDS database from S3
-- Change [bucket] with your bucket name
exec msdb.dbo.rds_restore_database
@restore_db_name='Sitecore_Analytics',
@s3_arn_to_restore_from='arn:aws:s3:::[bucket]/Sitecore_Analytics.bak';
exec msdb.dbo.rds_restore_database
@restore_db_name='Sitecore_Core',
@s3_arn_to_restore_from='arn:aws:s3:::[bucket]/Sitecore_Core.bak';
@RobsonAutomator
RobsonAutomator / export-custom-user-properties.ps1
Created February 3, 2017 22:20
export-custom-user-properties
$property = @(
@{Name='Email';Expression={ $PSItem.Profile.GetCustomProperty('Email') }},
@{Name='FirstName';Expression={ $PSItem.Profile.GetCustomProperty('FirstName') }},
@{Name='LastName';Expression={ $PSItem.Profile.GetCustomProperty('LastName') }},
@{Name='Title';Expression={ $PSItem.Profile.GetCustomProperty('Title') }},
@{Name='Company';Expression={ $PSItem.Profile.GetCustomProperty('Company') }},
@{Name='Country';Expression={ $PSItem.Profile.GetCustomProperty('Country') }},
@{Name='ZipCode';Expression={ $PSItem.Profile.GetCustomProperty('ZipCode') }},
@{Name='Department';Expression={ $PSItem.Profile.GetCustomProperty('Department') }},
@{Name='Street';Expression={ $PSItem.Profile.GetCustomProperty('Street') }},
@RobsonAutomator
RobsonAutomator / fix-size-field-in-media-items.ps
Last active March 11, 2020 15:30
Update value in the Size field in Sitecore media items.
#
# Fix value '123 x 123' in Size field to the proper image size (bytes).
# Author: Robert Senktas
#
$sitecorePath = "master:/sitecore/media library"
$processedItems = Get-ChildItem -Path $sitecorePath -Recurse | ForEach-Object {
if ( $_.Size -match "x" ) {
$mediaItem = New-Object "Sitecore.Data.Items.MediaItem" $_
@RobsonAutomator
RobsonAutomator / Convert-ScriptItemToFile.ps1
Created February 7, 2020 16:25
Convers a Sitecore Powershell Extension item to a file on disk.
function Convert-ScriptItemToFile {
<#
.SYNOPSIS
Convers a SPE item to a file on disk.
.NOTES
Autor: Robert Senktas (@RobsonAutomator)
#>
@RobsonAutomator
RobsonAutomator / set-contentdefaultlanguage.ps1
Created December 13, 2019 14:39
Setup default content language in Sitecore for Content Author
# Author: Robert Senktas vel @RobsonAutomator
# Scritp to use with Sitecore PowerShell Extension
$user = Get-User -Identity $me -Authenticated
$options = [ordered]@{};
$languages = Get-ChildItem -Path 'master:/sitecore/system/Languages/'
foreach( $language in $languages )
{
$options.Add($language.Name, $language.Name);
@RobsonAutomator
RobsonAutomator / Set-UAC4SPE.ps1
Last active October 19, 2019 20:49
Set User Access Control for SPE
function Get-DefaultSpeConfig()
{
# $AppPath is SPE console variable, see Variables on https://doc.sitecorepowershell.com/interfaces.html
if( $AppPath -ne $null )
{
return Join-Path -Path $AppPath -ChildPath "App_Config\Include\Cognifide.PowerShell.config"
}
}
function Set-UAC4SPE
@RobsonAutomator
RobsonAutomator / export-dictionary
Created April 4, 2017 14:28
Export Sitecore dictionary items for selected language.
# Author: Robert Senktas
# Description: Export Sitecore dictionary items for selected language.
$parentItem = {DC0FC646-AAB3-4D7A-B265-7AC5CDC73905}
$dialog = Read-Variable -Parameters `
@{ Name = "language"; Title = "Language"; Source="DataSource=/sitecore/system/Languages" ; Editor="droplist"} `
-Description "This script will export Dictionary data into file." `
-Width 800 -Height 600 `
-Title "Simple Dictionary Export Utility" `
@RobsonAutomator
RobsonAutomator / create-zip-performance-tests.ps1
Created July 12, 2019 13:31
Performance tests for create a zip archive with PowerShell
$archivePath = "E:\Test"
$folderToArchive = "E:\Temp\FolderToCompress"
# prepare output folder
mkdir $archivePath -Force
Clear-Host
for( $i = 0; $i -lt 10; $i++ )
{
$measureExtract = Measure-Command {