Skip to content

Instantly share code, notes, and snippets.

@phaniav
phaniav / HabitatSolutionScript.ps1
Last active March 2, 2017 03:36 — forked from akshaysura/HabitatSolutionScript.ps1
Updated the Visual Studio installation location using powershell environment variable
#paths to the project templates on your system
$global:classTemplate = "$env:VS140COMNTOOLS..\IDE\ProjectTemplatesCache\CSharp\Windows Root\Windows\1033\ClassLibrary\csClassLibrary.vstemplate"
$global:webTemplate = "$env:VS140COMNTOOLS..\IDE\ProjectTemplatesCache\CSharp\Web\1033\WebApplicationProject40\EmptyWebApplicationProject40.vstemplate"
#variable used to store the path for the empty Habitat folder
$global:helixPath =""
#empty variable used to store the solution name
$global:solutionName = ""
@phaniav
phaniav / LuisHelpIntent.cs
Created August 28, 2017 09:54
Sample LuisIntent["Help"] for slack with channel data hydration
[LuisIntent("Help")]
public async Task Help(IDialogContext context, IAwaitable<IMessageActivity> activity, LuisResult result)
{
var message = await activity;
var reply = context.MakeMessage();
reply.TextFormat = "markdown";
reply.Text = @"You can try some of the below options
* find me sweaters
* do you have wallets
* show me yellow v - neck sweaters";
@phaniav
phaniav / Dictionary2QueryStringExtension.cs
Created September 12, 2017 22:24
Dictionary to Querystring convertor
using System.Collections.Generic;
using System.Linq;
using System.Text;
public static class CollectionExtensions
{
public static string ToQueryString(this IDictionary<string, string> dict)
{
if (dict.Count == 0) return string.Empty;
@phaniav
phaniav / MasterVariablesReplacer.config
Created September 17, 2017 18:46
Custom Sitecore Tokens and replacement
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<setting name="MasterVariablesReplacer">
<patch:attribute name="value">Sitecore.Sharedsource.Data.MasterVariablesReplacer,Sitecore.Sharedsource</patch:attribute>
</setting>
</settings>
</sitecore>
</configuration>
@phaniav
phaniav / Sitecore Database Backup script.sql
Created November 21, 2017 11:13
Script to take Sitecore database backups
BACKUP DATABASE [sc821Sitecore_core]
TO DISK = N'E:\SitecoreInstances\sc821\821db\sc821Sitecore_core'
WITH NOFORMAT, NOINIT,
NAME = N'sc821Sitecore_core-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
BACKUP DATABASE [sc821Sitecore_master]
TO DISK = N'E:\SitecoreInstances\sc821\821db\sc821Sitecore_master'
WITH NOFORMAT, NOINIT,
NAME = N'sc821Sitecore_master-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
@phaniav
phaniav / Powershell-DB-Backup.ps1
Created November 21, 2017 11:52
sample script to take a sql server database backup using powershell
Set-Location "SQLSERVER:\SQL\Computer\Instance\Databases"
SQLSERVER:\SQL\Computer\Instance\Databases> ForEach($database in (Get-ChildItem)) {
$dbName = $database.Name
Backup-SqlDatabase -Database $dbName -BackupFile "\\mainserver\databasebackup\$dbName.bak"
}
@phaniav
phaniav / SelfSignedCertificate_Powershell.ps1
Created November 27, 2017 19:03
Creating the Selfsigned certificate using powershell commands
# https://stackoverflow.com/a/2292546/5532726 - Learn about .cer, .pvk and .pfx
$thumbprint = (New-SelfSignedCertificate `
-Subject "CN=$env:COMPUTERNAME @ Sitecore, Inc." `
-Type SSLServerAuthentication `
-FriendlyName "$env:USERNAME Certificate").Thumbprint
#you can select the path for your pfx export as per your requirements
$certificateFilePath = "C:\Sitecore9\install\$thumbprint.pfx"
Export-PfxCertificate `
-cert cert:\LocalMachine\MY\$thumbprint `
-FilePath "$certificateFilePath" `
@phaniav
phaniav / SitecoreXP1AzureDeployParams.json
Last active November 28, 2017 08:21
Sample deploy parameters for Sitecore Azure XP1 topology
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentId": {
"value": ""
},
"location": {
"value": "eastus"
},
@phaniav
phaniav / SitecoreXP1AzureInstallScript.ps1
Created November 28, 2017 08:30
Installation Script for Sitecore 9 XP1 (XP Scaled) on Azure
#Parameters
$SCARMTemplate = 'https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/Sitecore%209.0.0/XP/azuredeploy.json'
$Deploymentid = "scninecloud" #this will be the name of resoure group
$LicenseFile = "D:\projects\sitecore\license.xml"
$CertificateFile = 'D:\projects\sitecore\1A5A5EEF9F9237471DAF3A464457BC9A18D5EAC3.pfx'
$SubscriptionId = "cf764d1e-ba89-405d-9712-4b69a34bb353"
$Location = "eastus"
$ParamFile = "D:\Projects\Sitecore\sc9Cloud\Sitecore-Azure-Quickstart-Templates-2.0\Sitecore 9.0.0\XP\azuredeploy.parameters.json"
$Parameters = @{
"authCertificateBlob" = [system.convert]:: ToBase64String([system.IO.File]::ReadAllBytes($certificatefile));
<#
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: