Skip to content

Instantly share code, notes, and snippets.

ECHO MongoDB Installation
@ECHO OFF
set mongoVersion=3.2
set mongoServiceName="MongoDB-%mongoVersion%"
set mongoDBFolder=C:\Data\MongoDB\%mongoVersion%
set mongoDBDataFolder=%mongoDBFolder%\Data
set mongoDBLogsFolder=%mongoDBFolder%\Logs
set mongoDBMongoD="C:\Program Files\MongoDB\Server\%mongoVersion%\bin\mongod.exe"
using System.Collections.Specialized;
using System.Linq;
using System.Web;
public static class NameValueCollectionExtensions
{
public static string ToQueryString(this NameValueCollection nvc)
{
return string.Join("&",
nvc.AllKeys.Where(key => !string.IsNullOrWhiteSpace(nvc[key]))
@mawiseman
mawiseman / RestSitecoreAdmin.sql
Created November 23, 2017 03:31
Reset Sitecore admin account
UPDATE
[aspnet_Membership]
SET
[Password]='qOvF8m8F2IcWMvfOBjJYHmfLABc=',
[PasswordSalt]='OM5gu45RQuJ76itRvkSPFw==',
[IsApproved] = '1',
[IsLockedOut] = '0'
WHERE
UserId IN (
SELECT UserId FROM dbo.aspnet_Users WHERE UserName = 'sitecore\Admin'
using Sitecore.Data;
using Sitecore.Data.Items;
public static class ItemExtensions
{
public static T GetValueAs<T>(this Item contextItem, ID settingFieldID)
{
return (T)System.Convert.ChangeType(contextItem.Fields[settingFieldID].Value, typeof(T));
}
}
@mawiseman
mawiseman / SitecoreViewGetRelatedItemsPipeline
Last active December 5, 2018 04:52
Sitecore admin page to display a list of related items during publish. Just place a copy this to your websites \sitecore\admin\ViewRelatedItems.aspx and run via the browser
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="Sitecore.Data" %>
<%@ Import Namespace="Sitecore.Globalization" %>
@mawiseman
mawiseman / delete-azure-deployments.ps1
Last active May 2, 2019 07:13
Delete Azure Deployments
# README
# This script will delete all deployments in an Azure resource group older than X Days
# You can use this script to count hom many deployments exist: Get-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroup | measure
# Variables
$subscriptionName = '{{azure subscription name}}'
$resourceGroupName = '{{azure resource group name}}'
$daysOldToDelete = -150
@mawiseman
mawiseman / powershell-iis-and-default-modules.ps1
Created November 18, 2019 00:26
Installs the required modules to run IIS (and some other i use for development)
# Allow remote scripts
Set-ExecutionPolicy AllSigned
# Install SqlServer powershell modules
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module -Name SqlServer
# Misc
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All -All
@mawiseman
mawiseman / SQLServer2016ConfigurationFile.ini
Last active January 12, 2021 03:14
Automate SQL Server 2016 install with Management Studio
;SQL Server 2016 Configuration File
[OPTIONS]
; Specifies a Setup work flow, like INSTALL, UNINSTALL, or UPGRADE. This is a required parameter.
ACTION="Install"
; Specifies that SQL Server Setup should not display the privacy statement when ran from the command line.
SUPPRESSPRIVACYSTATEMENTNOTICE="False"
@mawiseman
mawiseman / powershell-generate-gallery.ps1
Created May 17, 2021 06:23
Create a quick html page displaying all images under the target irectory
@mawiseman
mawiseman / chocolatey-packages.config
Last active October 15, 2021 03:23
Chocolatey package file to install default applications
<?xml version="1.0" encoding="utf-8"?>
<!-- choco install chocolatey-packages.config -y -->
<packages>
<!-- Windows Features -->
<package id="webdeploy" />
<package id="urlrewrite" />
<!-- Default Apps -->
<package id="googlechrome" />
<package id="firefox" />