Skip to content

Instantly share code, notes, and snippets.

View peplau's full-sized avatar

Rodrigo Peplau peplau

View GitHub Profile
@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
Function Deployer-Prepare {
Param($source,$target,$anti)
# Pre-validations
$sourceExists = Test-Path $source
if ($sourceExists -eq $false){
Write-Output "Source directory is wrong - $source"
return $false
}
$targetExists = Test-Path $target
Update-Package <package_name> -ProjectName MyProject -reinstall
Eg: Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -ProjectName YourCLient.YourProject -reinstall
@peplau
peplau / Create new XConnect client SSL certificate.ps1
Last active January 12, 2021 17:42
Create new XConnect client SSL certificate
#define parameters
$prefix = "DevAspenDentalSitecore"
$PSScriptRoot = "D:\Upgrade\Sitecore 10.0.0 rev. 004346 (WDP XP0 packages)\XP0 Configuration files 10.0.0 rev. 004346"
#install client certificate for xconnect
$certParams = @{
Path = "$PSScriptRoot\createcert.json"
CertificateName = "$prefix.xconnect_client"
ExportPassword = "Test123!"
}
procdump -ma 3360 -c 80 -a -r
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Register-PSRepository -Default -Verbose
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
Get-Childitem cert:\LocalMachine\root -Recurse | Where-Object {$_.Issuer -ne $_.Subject}
If the above brings entries, we need to remove them with:
Get-Childitem cert:\LocalMachine\root -Recurse | Where-Object {$_.Issuer -ne $_.Subject} | Move-Item -Destination Cert:\LocalMachine\CA
Source: https://getfishtank.ca/blog/sitecore-9-xconnect-status-403-forbidden-certificate-error
@peplau
peplau / Update-PackagesFile.ps1
Last active November 2, 2021 01:43
Updates a packages.config file into your desired version of Sitecore to help automatize upgrades with the aid of the CSV provided by Jan Bluemink: http://www.stockpick.nl/english/sitecore-nuget-dependencies-in-sitecore-101/
<#
.Synopsis
Provides NuGet commands to updates a packages.config file into your desired version of Sitecore to help automatize upgrades
with the aid of the CSV provided by Jan Bluemink: http://www.stockpick.nl/english/sitecore-nuget-dependencies-in-sitecore-101/
.Description
The script uses a CSV file to scan the existing packages.config file and generate NuGet commands to update the project
.Example
.\Update-PackagesFile.ps1 -Csv "C:\temp\NuGet Sitecore.Platform.Assemblies 10.1.0 rev. 005207.csv" -Packages "D:\Git\myproject\packages.config" -ProjectName "Altudo.SitecoreMarketingAutomation.Connector.Common"
#>
[CmdletBinding(DefaultParameterSetName = "None", SupportsShouldProcess = $true)]
@peplau
peplau / SPE: Quick Download Tree as Package (Advanced)
Last active November 10, 2022 20:39
SPE: Advanced Quick Download Tree as Package - Allows the user to pick and choose among Linked Items to include in the package as well
Line 1 - Changed the Import-Function Name to Setup-PackageGeneratorAdvanced
Line 5 - Removed as the $path variable was not used
Lines 20-22 - Updated to always show the Links tab, which is now a radiobox
Line 74 - Replaced by the block from lines 75 to 149
Lines 76 to 87 - Replaced by the block from lines 151 to 162
@peplau
peplau / ParseCsv.cs
Last active December 28, 2022 22:33
(C# code) Parse CSV into memory as a List of Dynamic Objects, with properties named accordingly to the CSV header. This code uses Sitecore Powershell Extensions to run a PS command that does the translation to Dynamic Objects.
using Spe.Core.Host;
using System.Reflection;
/// <summary>
/// Load CSV string to memory as array of dynamic objects
/// </summary>
/// <param name="csvContent"></param>
/// <returns>Array of dynamic objects</returns>
public dynamic ParseCsv(string csvContent) {
using (var scriptSession = ScriptSessionManager.NewSession("Default",true)) {