Skip to content

Instantly share code, notes, and snippets.

View gillissm's full-sized avatar

Scott Gillis gillissm

View GitHub Profile
@gillissm
gillissm / Stop-DevServices
Created December 15, 2022 21:19
PowerShell to Stop All Dev Related Services. Be sure to run as Admin.
#Requires -RunAsAdministrator
if($(Get-Service W3SVC).Status -eq 'Running'){
Write-Host "W3SVC is running and will be stopped"
Stop-Service W3SVC
Write-Host "W3SVC is stopped." -BackgroundColor Red
}
else {
Write-Host "W3SVC is already stopped" -BackgroundColor DarkGray
@gillissm
gillissm / Add-SecureSiteBindings.ps1
Last active January 29, 2023 13:45
**Add-SecureSiteBinding** script has been created to provide the ability to add one or more domains to an IIS website each tied to a self-signed certificate providing SSL capabilities. The script contains three parts which I'll review, the full script can be found in the [Add-SecureSiteBindings Gist](GIST URL).
#Requires -RunAsAdministrator
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true,
Position=0,
HelpMessage = "Name of the IIS Site the new URLs should be associated to")]
[ValidateNotNullOrEmpty()]
[string]
@gillissm
gillissm / Push-DockerImages.ps1
Created January 28, 2022 19:21
Script to search for local docker images, retag them for a specific registry with a tag, then push these images to the registery.
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, HelpMessage="value used to filter to the specific images for pushing")]
[string]
$imageFilter,
[Parameter(Mandatory = $true, HelpMessage="full registry path the images will be pushed to")]
[string]
$targetRegistry,
[Parameter(Mandatory = $false, HelpMessage="image tag value if not 'latest'")]
[string]
@gillissm
gillissm / .env
Created February 15, 2021 06:00
Sitecore Containers - docker-compose for license file mount
COMPOSE_PROJECT_NAME=TestingLicenseFileMount
SITECORE_DOCKER_REGISTRY=scr.sitecore.com/sxp/
SITECORE_VERSION=10.0-20H2
SITECORE_ADMIN_PASSWORD=Password12345
SQL_SA_PASSWORD=Password12345
REPORTING_API_KEY=
TELERIK_ENCRYPTION_KEY=
SITECORE_IDSECRET=
SITECORE_ID_CERTIFICATE=
SITECORE_ID_CERTIFICATE_PASSWORD=QY4inXePJnde
@gillissm
gillissm / Configure-WindowsFeatures.ps1
Last active February 24, 2023 05:16
Enables the optional Windows Features of Containers and Hyper-V as required for Docker usage in Windows mode.
Write-Host "Runnng this script will install/enable the optional Windows features of Hyper-V and Containers."
Write-Host "After the Windows features are enabled this script will force a system reboot." -ForegroundColor Magenta
if($(Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V -Online).State -ieq 'disabled')
{
Write-Host "Installing Microsoft Hyper V feature." -ForegroundColor DarkCyan
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart
}
if($(Get-WindowsOptionalFeature -FeatureName Containers -Online).State -ieq 'disabled')
@gillissm
gillissm / SolrSuggestor-ApiSample.cs
Last active October 10, 2019 19:08
Files demonstrate the old verse the new way of implmenting Solr Suggesters with Sitecore.
/// <summary>
/// Solr Suggester Implementation via Sitecore API
/// </summary>
/// <param name="term"></param>
/// <returns></returns>
public IEnumerable<string> GetSuggestions(string term)
{
if (term.Length < 3)
return Enumerable.Empty<string>();
@gillissm
gillissm / RenderViewToString-Example.cs
Last active September 20, 2019 13:12
MVC Controller Extension Method that allos for rendering a view to a string for usage in AJAX scenarios.
[HttpPost]
public JsonResult PerformLocationSearch()
{
var searchParams = new LocationSearchParameters();
if (searchParams.SearchParamsExist)
{
int totalResult = 0;
var searchResults = _locationSearchHelper.PerformLocationSearch(searchParams, out totalResult).ToList();
if (searchResults != null && searchResults.Any())
@gillissm
gillissm / CreateRedirectRule.ps1
Created June 27, 2018 00:58
PowerShell script that automatically adds a HTTP to HTTPS redirect rule to a web site's web.config.
##############################
#.SYNOPSIS
# Creates a HTTP to HTTPS URL redirect rule in the given site's web.config
#
#.DESCRIPTION
# Creates a HTTP to HTTPS URL redirect rule in the given site's web.config
#
#.PARAMETER SiteBinding
# Value of the target sites IIS binding.
#
@gillissm
gillissm / SitecoreEasyInstall.ps1
Last active April 3, 2018 21:38
PowerShell Script for Simplifing Sitecore Experience Platform (XP) 9 Local Installs
#define parameters
##CUSTOM TO THE ENVIRONMENT - THE FOLLOWING ALL SHOULD BE UPDATED TO REFLECT YOUR LOCAL MACHINE
###Value that will be used as the prefix for Sitecore URL, db prefix and Solr core prefixes
$prefix = "easysitecore20"
###Path to the working directory, where this file has been saved to
$PSScriptRoot = "C:\\Sc9Install\\EasyInstall"
###Path to the Sitecore License File
$SitecoreLicense = "C:\\SitecoreVersions\\license.xml"
###Name that Solr will run as
@gillissm
gillissm / SolrInstall-SIF-Extensions.psm1
Last active February 2, 2018 18:23 — forked from jermdavis/SolrInstall-SIF-Extension.psm1
A Sitecore Install Framework extension to install a development instance of Solr - Further detail at: https://jermdavis.wordpress.com/2017/11/13/solr-installs-with-sif/ --- This fork includes an update for the NSSM version as well as updated JRE runtime values. There is a known issue with the stable NSSM on Windows 10 machines which cause the se…
##
## private functions
##
#
# If necessary, download a file and unzip it to the specified location
#
function downloadAndUnzipIfRequired
{
Param(