Skip to content

Instantly share code, notes, and snippets.

@naveed-ahmad-biz
naveed-ahmad-biz / HabitatSolutionScript.ps1
Created March 2, 2017 03:36 — forked from phaniav/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 = ""
$fileContentBytes = get-content 'C:\path\to\cert.pfx' -Encoding Byte
[System.Convert]::ToBase64String($fileContentBytes) | Out-File 'pfx-bytes.txt'
@naveed-ahmad-biz
naveed-ahmad-biz / parametersjson
Last active November 5, 2017 02:31
azuredeploy.parameters.json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentId": {
"value": "SitecoreXP1"
},
"location": {
"value": "East US"
},
$licenseFile = "C:\azure\sitecore-azure-2.0\license.xml"
$ArmTemplateUrl = "https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/Sitecore 9.0.0/XP/azuredeploy.json";
$ArmParametersPath = "C:\azure\sitecore-azure-2.0\xp\azuredeploy.parameters.json";
$RGName = "SitecoreXP1";
$DeploymentID = "SitecoreXP1"
$location = "East US";
Start-SitecoreAzureDeployment -location $location -Name $RGName -ArmTemplateUrl $ArmTemplateUrl -ArmParametersPath $ArmParametersPath -LicenseXmlPath $licenseFile
New-AzureRmResourceGroupDeployment : 6:18:47 PM - Resource Microsoft.Web/certificates 'sitecore-9cloud-auth' failed
with message '{
"Code": "NotFound",
"Message": "Cannot find Certificate with name sitecore-9cloud-auth.",
"Target": null,
"Details": [
{
"Message": "Cannot find Certificate with name sitecore-9cloud-auth."
},
{
New-AzureRmResourceGroupDeployment : 2:34:31 PM - Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The template resource 'templateLinkBase' at line '28' and column '30' is not valid: The language expression property 'templateLink' doesn't
exist, available properties are 'template, parameters, mode, provisioningState'.. Please see https://aka.ms/arm-template-expressions for usage details.'.
At C:\azure\sitecore-azure-2.0\tools\Sitecore.Cloud.Cmdlets.psm1:112 char:35
+ ... eployment = New-AzureRmResourceGroupDeployment -Name $Name -ResourceG ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
New-AzureRmResourceGroupDeployment : The deployment validation failed
At C:\azure\sitecore-azure-2.0\tools\Sitecore.Cloud.Cmdlets.psm1:112 ch
#generate certificate
$thumbprint = (New-SelfSignedCertificate `
-Subject "CN=$env:COMPUTERNAME @ Sitecore, Inc." `
-Type SSLServerAuthentication `
-FriendlyName "$env:USERNAME Certificate").Thumbprint
#export certificate with password
$certificateFilePath = "C:\Temp\$thumbprint.pfx"
Export-PfxCertificate `
-cert cert:\LocalMachine\MY\$thumbprint `
-FilePath "$certificateFilePath" `
@naveed-ahmad-biz
naveed-ahmad-biz / install.ps1
Created November 15, 2017 03:19
Sitecore 9 Install File
#define parameters
$prefix = "xp0"
$PSScriptRoot = "C:\Resources"
$XConnectCollectionService = "$prefix.xconnect"
$sitecoreSiteName = "$prefix.sc"
$SolrUrl = "https://localhost:8989/solr"
$SolrRoot = "C:\data\Solr-6.6.1"
$SolrService = "Solr-6.6.1"
$SqlServer = "MYCOMPUTERNAME\SQLEXPRESS2016"
$SqlAdminUser = "sitecoreUser"
@naveed-ahmad-biz
naveed-ahmad-biz / sitecore-9-error.ps1
Created November 15, 2017 03:27
ERROR_SCRIPTDOM_NEEDED_FOR_SQL_PROVIDER
[WebDeploy]:[Path] C:\Program Files\iis\Microsoft Web Deploy V3\msdeploy.exe
Error Code: ERROR_SCRIPTDOM_NEEDED_FOR_SQL_PROVIDER
More Information: The SQL provider cannot run because of a missing dependency. Please make sure that Microsoft SQL Server Transact-SQL ScriptDom is installed. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_SCRIPTDOM_NEEDED_FOR_SQL_PROVIDER.
**********************
Command start time: 20171023170201
**********************
PS>TerminatingError(Invoke-CommandTask): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Command C:\Program Files\iis\Microsoft Web Deploy V3\msdeploy.exe returned a non-zero exit code - (-1)"
>> TerminatingError(Invoke-CommandTask): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Command C:\Program Files\iis\Microsoft Web Deploy V3\msdeploy.exe returned a non-zero exit code - (-1)"
>> TerminatingError(I
@naveed-ahmad-biz
naveed-ahmad-biz / Sitecore.Ship.Update.UpdatePackageRunner.cs
Created November 19, 2017 05:18
Sitecore Ship failing silently fix
using (new SecurityDisabler())
{
bool flag;
DiffInstaller installer = new DiffInstaller(installationInfo.Action);
entries = installer.InstallPackage(installationInfo.Path, installationInfo.Mode, logger, new List<ContingencyEntry>(), "rollbackPackage.rlb", out flag, ref historyPath);
}