Skip to content

Instantly share code, notes, and snippets.

View RobsonAutomator's full-sized avatar

Ro Se RobsonAutomator

View GitHub Profile
@RobsonAutomator
RobsonAutomator / get-rolememberof.ps1
Last active July 31, 2017 07:30
List the roles that this role is member of
function Get-RoleMemberOf{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, Position=0)]
[string]$Identity
)
$role = Get-Role $Identity
return Get-Role -Filter * | Where-Object { $_.IsMember($role,$true,$true) -and $_ -ne $role }
}
@RobsonAutomator
RobsonAutomator / Clear-CopyLocal
Created April 4, 2017 08:15
Set copy local parameter for Sitecore*.dll
#https://www.powershellgallery.com/packages/sitecore-automation/1.2.0.0
import-module sitecore-automation
$csproj = 'c:\users\documents\visual studio 2017\Projects\My.Sitecore.Solution\My.Web\My.Web.csproj'
Clear-CopyLocal -Path $csproj -verbose
@RobsonAutomator
RobsonAutomator / Set-Files-Readonly
Created April 4, 2017 08:28
Set read only attributes on files
$source="C:\inetpub\wwwroot\Sitecore82\Website\bin\*" #path to files
Set-ItemProperty -Path $source -Name IsReadOnly -Value $true -Verbose
@RobsonAutomator
RobsonAutomator / export-dictionary
Created April 4, 2017 14:28
Export Sitecore dictionary items for selected language.
# Author: Robert Senktas
# Description: Export Sitecore dictionary items for selected language.
$parentItem = {DC0FC646-AAB3-4D7A-B265-7AC5CDC73905}
$dialog = Read-Variable -Parameters `
@{ Name = "language"; Title = "Language"; Source="DataSource=/sitecore/system/Languages" ; Editor="droplist"} `
-Description "This script will export Dictionary data into file." `
-Width 800 -Height 600 `
-Title "Simple Dictionary Export Utility" `
// 1. Use this code only once to store variables
Environment.SetEnvironmentVariable("CognitoPoolId", "<tutaj podaj dane>", EnvironmentVariableTarget.User);
Environment.SetEnvironmentVariable("CognitoClientId", "<tutaj podaj dane>", EnvironmentVariableTarget.User);
// 2. Next we can read back our settings from environement variables:
var poolId = Environment.GetEnvironmentVariable("CognitoPoolId",EnvironmentVariableTarget.User);
var clientId = Environment.GetEnvironmentVariable("CognitoClientId", EnvironmentVariableTarget.User);
// 3. The final check - HttpStatusCode == "OK" means success :)
using (var client = new AmazonCognitoIdentityProviderClient())
@RobsonAutomator
RobsonAutomator / dictionary-toolbox-export
Created April 12, 2017 15:25
Simple script to export dictionary domain items
$dialog = Read-Variable -Parameters `
@{ Name = "dictionaryDomain"; Title = "dictionary"; Source="DataSource=/sitecore/content&DatabaseName=master&IncludeTemplatesForDisplay=Dictionary domain" ; Editor="treelist"}, `
@{ Name = "language"; Title = "Language"; Source="DataSource=/sitecore/system/languages" ; Editor="droplist"}, `
@{ Name = "emptyOption"; Value=$true; Title = "Export empty items" ; Editor="bool"} `
-Description "This script will export Dictionary data into file." `
-Width 400 -Height 200 `
-Title "Dictionary Toolbox" `
-OkButtonName "Export" `
-CancelButtonName "Cancel"
@RobsonAutomator
RobsonAutomator / Install Solr.ps1
Created April 14, 2017 15:16 — forked from kamsar/Install Solr.ps1
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)
@RobsonAutomator
RobsonAutomator / credential-store-examples.ps1
Last active June 6, 2017 21:56
A simple Powershell credentials store
# See also: http://lets-share.senktas.net/2017/06/powershell-simple-credentials-store.html
# See also: https://www.powershellgallery.com/packages/sitecore-automation/1.3.0.0
# Uncomment two below lines for a first use
#Install-Module Sitecore-Automation -Force -Verbose
#Import-Module Sitecore-Automation -Force -Verbose
# Create a new credentials
New-StoredCredential -Key "SMTP-Server" -Username "SMTP-User" -Password ( "password" | ConvertTo-SecureString -AsPlainText -Force)
New-StoredCredential -Key "SQL-Server" -Username "SQL-User" -Password ( "password" | ConvertTo-SecureString -AsPlainText -Force)
@RobsonAutomator
RobsonAutomator / azure-login.ps1
Created June 28, 2017 09:33
Login to Azure in automated way
# #############################################################################
# Login to Azure
#
# AUTHOR: Robert Senktas
# BLOG: http://lets-share.senktas.net/2017/06/sitecore-on-azure-login.html
#
# COMMENT:
# #############################################################################
#Requires –Modules sitecore-automation
@RobsonAutomator
RobsonAutomator / sitecore-on-azure-sas-token.ps1
Created July 2, 2017 16:24
How to use shared access signatures (SAS) in an automated way during Sitecore deployment with Azure Toolkit.
#Requires -Modules Azure
# #############################################################################
# Get SAS tokents
#
# AUTHOR: Robert Senktas
# BLOG: http://lets-share.senktas.net/2017/07/sitecore-on-azure-sas-token.html
#
# COMMENT:
# #############################################################################