Skip to content

Instantly share code, notes, and snippets.

@marcduiker
marcduiker / Update workflow and state on content items.ps1
Created May 5, 2016 23:58
Sitecore Powershell script to update the workflow and state on content items which do not have a workflow set on them.
<#
.SYNOPSIS
Updates the Workflow and Workflow state fields of content items with the given $workflowID and $workflowStateID values.
.DESCRIPTION
This script can be used when existing content is not assigned to a workflow and workflow state while it should be.
This scenario usually occurs when a workflow is assigned to a template but there is already content created based on a previous version of that template (where the workflow was not yet assigned).
@poojarsn
poojarsn / Code-Snippet-1
Last active July 7, 2016 02:12
Sitecore Powershell Extension: Create User defined Template Item
##--INPUT --##
$customTemplateName = "test6";
$baseTemplate="{1930BBEB-7805-47158AC7CF696}|{B7B41C45-2A6-E377DE778095}|{96224572-74-AE7E-DE43F0F6BFD9}";
$layoutRenderings=
'<r xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<d id="{FE5D7FDF-89C0-4D99-9AA3-B5FBD009C9F3}" l="{19432667-2790-44EC-9673-ACAE93AE0519}">
<r id="{7915EF7B--7B0D39137443}" ph="metaheader" uid="{D36E7AFC-08B5-433C13-554B20BE9569}" />
<r id="{016A19CB837-E81F2B510E72}" ph="breadcrumb" uid="{2ABC1220-6C40-426-B0A2-F594EEC98D7E}" />
<r id="{C5CF5F45-F21BAE6-52DBC568E33A}" ph="navheader" uid="{DA646F0700E-B09A26C8}" />
<r id="{93FA9D3A-590A-467C-872F-830C1D17E147}" ph="banner" uid="{8B8E75580AF0C-32620B307B5C}" />
@johnkors
johnkors / GetToken.ps1
Last active June 12, 2024 08:34
Fetch an accesstoken from IdentityServer3 using PowerShell 3
<#
.SYNOPSIS
Fetches an access token using the IdentityServer3 token endpoint
.DESCRIPTION
Modify the parameters so it matches your IdentityServer3 instance.
.NOTES
File Name : GetToken.ps1
Author : John Korsnes (@johnkors, johnkors)
Prerequisite : PowerShell V3
.LINK
<#
Author(s): Bruce Lee, Grant Killian, Kelly Rusk, Jimmy Rudley
Created Date: August 4, 2016
Modified Date: May 3, 2017
This is the Rackspace Managed Services for Sitecore (https://www.rackspace.com/digital/sitecore) script for security hardening a Sitecore environment
If the Execution Policy does not allow execution, you may need to run the following interactively to allow a scoped session bypass.
This is secure as it requires interaction on server and cannot be executed from a script:
@jammykam
jammykam / CreateUsers.ps1
Last active April 4, 2022 18:22
Create Users and Add to specified roles from CSV file using Sitecore PowerShell Extensions
$VerbosePreference = "Continue"
$newUsersFile = Receive-File -Path "C:\temp\upload" -CancelButtonName "No, I will do it using MS Excel instead"
$newUsers = Import-Csv -Path $newUsersFile
foreach($user in $newUsers) {
Write-Verbose "Creating User: $($user.Username)"
New-User -Identity $($user.Username) -Enabled -Password $($user.Password) -Email $($user.Email) -FullName "$($user.Name)"
$($user.Roles).Split(",") | ForEach {
@peplau
peplau / SitecoreRoleConfigurator - Diffs.ps1
Last active September 23, 2016 21:57
Powershell: SitecoreRoleConfigurator - Diffs.ps1
<#
.SYNOPSIS
The following script prompts the user for a Sitecore server role, then shows the files that are not matching the spreadsheet.
Based on Michael West's "SitecoreRoleConfigurator.ps1" - https://gist.github.com/michaellwest/d1124a459cb1fb47486f87d488ecfab8
Important: you will need the CSV file provided by Michael at https://gist.github.com/michaellwest/d1124a459cb1fb47486f87d488ecfab8#file-config_enable-disable_sitecore_8-1_upd3-csv
Now it supports multiple Env Roles separated by comma thanks to @mhwelander feedback
.NOTES
Rodrigo Peplau
2016-09-23
@AdamNaj
AdamNaj / Read-Variable Field Validation.png
Last active October 22, 2016 03:24
Read-Variable field validation
Read-Variable Field Validation.png
@michaellwest
michaellwest / FindExifRotation.ps1
Last active February 20, 2023 19:15
Get the blob stream of a media item using Sitecore PowerShell Extensions.
$exifOrientationId = 0x112
if(!$items) {
$items = Get-ChildItem -Path "master:" -ID "{5D50B0FD-AB2B-4872-88E5-463D6E2B31F2}" -Recurse | Where-Object { $_.TemplateId -eq "{DAF085E8-602E-43A6-8299-038FF171349F}" }
}
$records = [System.Collections.ArrayList]@()
$processedCounter = 0
$totalCounter = $items.Count
foreach($item in $items) {
$processedCounter++
@SidShetye
SidShetye / wget.ps1
Last active March 27, 2024 15:16
Powershell script to download files on Windows Server Nano where Invoke-Webrequest/wget are natively missing
<#
.SYNOPSIS
Downloads a file
.DESCRIPTION
Downloads a file
.PARAMETER Url
URL to file/resource to download
.PARAMETER Filename
file to save it as locally
.EXAMPLE