Skip to content

Instantly share code, notes, and snippets.

@jhorsman
jhorsman / semver-regex.md
Last active Aug 9, 2022
Semantic versioning regex
View semver-regex.md
@jhorsman
jhorsman / Cisco_Anyconnect.ps1
Created Jan 6, 2015
PowerShell to automate VPN connection with Cisco AnyConnect Secure Mobility Client
View Cisco_Anyconnect.ps1
#Source www.cze.cz
#This script is tested with "Cisco AnyConnect Secure Mobility Client version 3.1.00495"
# Usage: & '.\Cisco_Anyconnect.ps1' [-Server <server name or ip>] [-Group <group>] [-User <user>] [-Password <password>]
#Please change following variables
#IP address or host name of cisco vpn, Username, Group and Password as parameters
param (
[string]$Server = $( Read-Host "Input server, please" ),
View PinnedApplications.psm1
###########################################################################"
#
#
# NAME: PinnedApplications.psm1
#
# AUTHOR: Jan Egil Ring, Crayon
#
# DATE : 06.08.2010
#
# COMMENT: Module with the ability to pin and unpin programs from the taskbar and the Start-menu in Windows 7 and Windows Server 2008 R2.
View enable-TLS.ps1
# Inspired by https://gist.github.com/jbratu/6262684939e15e638892973f5f8eed78 and https://stackoverflow.com/questions/55914397/enable-tls-and-disable-ssl-via-powershell-script
function Disable-SSL-2.0 {
New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server' -Force | Out-Null
New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server' -name Enabled -value 0 -PropertyType 'DWord' -Force | Out-Null
New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server' -name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null
New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client' -Force | Out-Null
New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client' -name Enabled -value 0 -PropertyType 'DWord' -Force | Out-Null
New-Ite
@jhorsman
jhorsman / main.cpp
Created Jan 26, 2018
Blink for Node MCU; Blinking the builtin led on GPIO pin 2.
View main.cpp
/**
* Blink for Node MCU
* also see https://arduino.stackexchange.com/questions/38477/does-the-node-mcu-v3-lolin-not-have-a-builtin-led
*
* Turns on an LED on for one second,
* then off for one second, repeatedly.
*/
#include "Arduino.h"
// On a NodeMCU board the built-in led is on GPIO pin 2
@jhorsman
jhorsman / item-sync-publications.ps1
Last active Jan 6, 2022
Synchronize SDL Web components (by publication) with schemas using PowerShell
View item-sync-publications.ps1
#WARNING this script is set to run component-sync with the -Update flag, meaning it will commit and save the changed components
#Usage examples
# .\item-sync-publications.ps1
# .\item-sync-publications.ps1 | Tee-Object sync.log
# Prerequisite: Install the tridion-powershell-modules https://github.com/pkjaer/tridion-powershell-modules
Import-Module Tridion-CoreService -Verbose:$false
Set-TridionCoreServiceSettings -Version "2013-SP1"
@jhorsman
jhorsman / create-admin-user.ps1
Last active Jan 6, 2022
Make an administrator user in SDL Web with PowerShell. Using the Tridion CoreService module (https://github.com/pkjaer/tridion-powershell-modules).
View create-admin-user.ps1
Import-Module Tridion-CoreService
Set-TridionCoreServiceSettings -HostName "my-cm-server" -Version Web-8.5 -ConnectionType Basic-SSL -Persist
New-TridionUser -UserName "domain\username" -Description "Person Name" -MakeAdministrator
# For Web 8.5 the -MakeAdministrator option does not work, you have to add the user to the System Administrator group instead
# New-TridionUser -UserName "domain\username" -Description "Person Name" -MemberOf "System Administrator"
View add-user-to-group.ps1
$Computer = $env:COMPUTERNAME
$GroupName = 'Topology Manager Administrators'
$ADSI = [ADSI]("WinNT://$Computer")
$Group = $ADSI.Children.Find($GroupName, 'group')
Write-Host ("Found group '{0}'" -f $Group.Name.Value)
#$User = $env:USERNAME
#$Group.Add(("WinNT://$Computer/$User"))
$User = "domain\username"
@jhorsman
jhorsman / test-cd-microservices.ps1
Last active Jan 6, 2022
Test SDL Web 8.5 micro services with PowerShell
View test-cd-microservices.ps1
<#
https://gist.github.com/jhorsman/6f253941cdd0caec6bbba26a2cb26345
.SYNOPSIS
Verifies the SDL Web Content Delivery micro services which are listed in the discovery service
.PARAMETER DiscoveryEndpointUrl
Endpoint to the discovery service. By default it is on port 8082 and it always ends with /discovery.svc
.PARAMETER Local
@jhorsman
jhorsman / installService.ps1
Created Mar 1, 2018
Install SDL Web Content Delivery mico service with Windows service dependency
View installService.ps1
....
# $dependsOn should not just contain the name of the service, but the full command line parameter like so:
$dependsOn='--DependsOn="SDLWebDiscoveryService"'
...