Skip to content

Instantly share code, notes, and snippets.

View SoulOfUniverse's full-sized avatar
🤖

Sergejs Kravcenko SoulOfUniverse

🤖
View GitHub Profile
@SoulOfUniverse
SoulOfUniverse / Github email change.ps
Created October 28, 2021 08:57
Github change email
git config user.email # will return your current user email
git config user.email youremail@gmail.com # will set your email
# this will resolve the issue why on commit changes in github it doesn't show the profile of your avatar
@SoulOfUniverse
SoulOfUniverse / StopIISService.ps1
Created August 25, 2021 12:47
Stop IIS Service
Write-Host "Stopping your iis service in order to run docker" -ForegroundColor Green
iisreset /stop
@SoulOfUniverse
SoulOfUniverse / StoppingSolrNssmServices.ps1
Created August 25, 2021 12:45
Sopping Solr/Nssm services Powershell prior starting up Docker
Write-Host "Scanning any solr or nssm services to stop them in order to run docker" -ForegroundColor Green
$services = get-wmiobject win32_service | Where-Object {$_.pathname -match 'nssm' -or $_.name -match 'solr' }
$services | Foreach-Object {
if ($_.State -eq "Running"){
$name = $_.Name
Write-Host "The solr service $name is running, we are stopping the service..." -ForegroundColor Yellow
Stop-Service -Name $_.Name
Write-Host "$name service is stopped" -ForegroundColor Green
@SoulOfUniverse
SoulOfUniverse / GetLogsTemotely.ps1
Created July 13, 2021 19:18
Sitecore Powershell Get Sitecore Logs Remotely
<#
Set-ExecutionPolicy RemoteSigned
#>
Import-Module -Name SPE
$session = New-ScriptSession -Username "Remoting" -Password "test" -ConnectionUri https://sitecore.instance.local
$jobId = Invoke-RemoteScript -ScriptBlock {
$filename = "log*"
Write-Verbose ("Started at " + [System.DateTime]::Now)
@SoulOfUniverse
SoulOfUniverse / StartIIS.ps1
Created July 13, 2021 19:15
Start IIS Application Pool using WebAdministration
# Load IIS module:
Import-Module WebAdministration
# Get AppPool Name
$appPoolName = $OctopusParameters['appPoolName']
Write-Output "Starting IIS app pool $appPoolName"
Start-WebAppPool $appPoolName
@SoulOfUniverse
SoulOfUniverse / StopIIS.ps1
Created July 13, 2021 19:15
Stop IIS Application Pool using WebAdministration
# Load IIS module:
Import-Module WebAdministration
# Get AppPool Name
$appPoolName = $OctopusParameters['appPoolName']
# Get the number of retries
$retries = $OctopusParameters['appPoolCheckRetries']
# Get the number of attempts
$delay = $OctopusParameters['appPoolCheckDelay']
@SoulOfUniverse
SoulOfUniverse / CleaningDirectory.ps1
Created July 13, 2021 19:12
Powershell Cleaning Directory
param
(
[ValidateScript( {Test-Path $_})]
[string]$path,
[switch] $force = $false
)
if (Test-Path $path) {
if ($path -like "*C:*" -and -not $force) {
Write-Error "$path is system path cannot be used"
}
@SoulOfUniverse
SoulOfUniverse / AddUserToCertificate.ps1
Created July 13, 2021 19:12
Sitecore Powershell Add User To A Certificate
param(
[string]$userName,
[string]$permission,
[string]$certStoreLocation,
[string]$certThumbprint
);
# check if certificate is already installed
$certificateInstalled = Get-ChildItem cert:$certStoreLocation | Where thumbprint -eq $certThumbprint
# download & install only if certificate is not already installed on machine
@SoulOfUniverse
SoulOfUniverse / SPE-GetItemUrlReferrer.ps1
Created July 13, 2021 19:08
Sitecore Powershell Get Item Url Referrer
$inputProps = @{
Prompt = "Enter the targeted item ID (Guid):"
Validation = [Sitecore.Configuration.Settings]::ItemNameValidation
ErrorMessage = "'`$Input' is not a valid item ID."
}
$itemId = Show-Input @inputProps
[Sitecore.Context]::SetActiveSite("website")
$urlop = [Sitecore.Links.LinkManager]::GetDefaultUrlOptions()
@SoulOfUniverse
SoulOfUniverse / ExtendSelfSignedCertificate.ps1
Created July 13, 2021 19:06
Sitecore Trusted Self Signed Certificated Extension
#Requires -RunAsAdministrator
#Author: Sergejs Kravcenko
#Date: 12/07/2018
#Description: RenewCertificate module, which allows to safely generate and issue new Sitecore Self-Signed certificates both Root and Personal in order to have Sitecore instance function correctly with its xConnect services
#Usage: Import-Module .\RenewCertificate.psm1
Write-Host "Importing RenewCertificateModule"
function New-RootCertificateFn{
param (