Skip to content

Instantly share code, notes, and snippets.

View Brad-Christie's full-sized avatar

Brad Christie Brad-Christie

View GitHub Profile
@harshbaid
harshbaid / Renew.Sitecore.and.XConnect.Certs.ps1
Created September 26, 2019 15:46
Steps to update expired Sitecore SSL cert, XConnect site SSL cert, and XConnect Client cert
<#
Steps to update expired Sitecore SSL cert, XConnect site SSL cert, XConnect client cert
- Remove existing expired certs and client certs including root certs
- Download SIF scripts from https://github.com/Sitecore/Sitecore.HabitatHome.Utilities/
- Use Add-SSLSiteBindingWithCertificate.ps1 to generate SSL cert for Sitecore and XConnect IIS site
- Comment everything else in install-xp0.ps1 except the part that generates client cert for xconnect
- Use install-xp0.ps1 to generate Client cert for XConnect cert authentication
- Ensure root cert, cert and client cert are installed correctly using certlm.msc
- Update IIS Site bindings to use new certs
@RomelSan
RomelSan / Powershell-Certificates-BRIEF.ps1
Last active May 2, 2024 02:43
Powershell Self Signed Certificate
#-------------------------------------------------------------------------------------
# Create Self signed root certificate
# -dnsname -DnsName domain.example.com,anothersubdomain.example.com
# -Subject "CN=Patti Fuller,OU=UserAccounts,DC=corp,DC=contoso,DC=com"
$cert = New-SelfSignedCertificate -Type Custom -KeySpec Signature `
-Subject "CN=P2SRootCert" `
-KeyExportPolicy Exportable `
-HashAlgorithm sha256 -KeyLength 4096 `
-CertStoreLocation "Cert:\CurrentUser\My" `
-KeyUsageProperty Sign `
@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"
)
@Jaykul
Jaykul / New-RootSignedCert.ps1
Created February 3, 2017 00:20
Generate a self-signed root certificate, and then an SSL cert signed by that root
#.Synopsis
# Generate a self-signed root certificate and then generate an SSL certificate signed by it.
#.Description
# Generates a self-signed root certificate and an SSL certificate signed by it.
# Puts the root public key in a .pem file for adding to PHP's CAcert.pem
param(
# Used as the CN for the Root certificate
$RootName = "NO LIABILITY ACCEPTED - Test Root $(get-date -f "yyyy-MM-dd")",
# Used as the CN for the SSL certificate
$Subject = "${Env:ComputerName}.${Env:UserDnsDomain}",
@afscrome
afscrome / InstallSolr.ps1
Created November 28, 2016 23:26
Script for installing solr as a windows service
#Requires -Version 3.0
<#
.Description
Installs Apache Solr
.Example
.\ServiceInstall.ps1
Installs Apache Solr as the 'solr' service running on port 8983.
@bsara
bsara / git-ssh-auth-win-setup.md
Last active November 14, 2024 08:25
Setup SSH Authentication for Git Bash on Windows

Setup SSH Authentication for Git Bash on Windows

Prepararation

  1. Create a folder at the root of your user home folder (Example: C:/Users/uname/) called .ssh.
  2. Create the following files if they do not already exist (paths begin from the root of your user home folder):
  • .ssh/config
@davidfowl
davidfowl / Example1.cs
Last active September 2, 2024 12:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@kamsar
kamsar / Install Solr.ps1
Last active February 26, 2019 14:30
Sitecore Solr Cannon
# This script will set up (and install if needed) Apache Solr for a Sitecore instance.
# This does NOT configure Sitecore to use Solr,
# just the Solr server and cores for Sitecore to connect to once it is set up to use Solr.
# So, what does it do?
#
# * Installs SOLR, if needed, from the Bitnami SOLR stack: https://bitnami.com/stack/solr/installer
# * Creates a SOLR config set for the cores to share (shared schema)
# * Creates SOLR cores for all Sitecore indexes, including secondary cores to support online reindexing (Switch on Rebuild)
@echohack
echohack / powershell_null_coalescing.ps1
Created July 20, 2015 19:00
Powershell Null Coalescing
($PhysicalPath, "c:\inetpub\wwwroot" -ne $null)[0] # null coalescing
# Based on the order of operations, this works in following order:
# The , operator creates an array of values to be tested.
# The -ne operator filters out any items from the array that match the specified value--in this case, null. The result is an array of non-null values in the same order as the array created in Step 1.
# [0] is used to select the first element of the filtered array.
# Simplifying that:
@HarmJ0y
HarmJ0y / gist:fd98c4f16575ba28c091
Last active April 27, 2023 13:56
Powershell ADSI tricks
# Add a domain user to a remote server local group, if your current user has admin over the remote machine
powershell -c ([ADSI]'WinNT://SERVER/Administrators,group').add('WinNT://DOMAIN/USER,user')
# Get all local groups on a remote server
powershell -c "([ADSI]'WinNT://SERVER,computer').psbase.children | where { $_.psbase.schemaClassName -eq 'group' } | foreach { ($_.name)[0]}"
# Find members of the local Administrators group on a remote server
powershell -c "$([ADSI]'WinNT://SERVER/Administrators,group').psbase.Invoke('Members') | foreach { $_.GetType().InvokeMember('ADspath', 'GetProperty', $null, $_, $null).Replace('WinNT://', '') }"
# Enable the local Administrator account on a remote server