Skip to content

Instantly share code, notes, and snippets.

<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8"
import="com.tridion.ambientdata.*,
com.tridion.ambientdata.claimstore.*,
java.net.*,
java.util.*,
java.util.Map.Entry,
net.minidev.json.JSONObject"%>
<%!
public String serializeClaimStore() {
ClaimStore store = AmbientDataContext.getCurrentClaimStore();
@jhorsman
jhorsman / SSL-Core-Service.ps1
Last active January 9, 2018 13:22
Connect to SDL Web 8 in the SDL Cloud
# December 2017: the switches "-ConnectionType Basic-SSL -CredentialType Basic" are new in the develop branch of the Tridion PowerShell modules
# install the develop version with iwr "https://raw.githubusercontent.com/pkjaer/tridion-powershell-modules/develop/CoreService/Installation/Install.ps1" | iex
$username = 'domain\user'
$password = 'password' | ConvertTo-SecureString -asPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($username, $password)
Set-TridionCoreServiceSettings -HostName cm-web-gocompare-test.tridion.sdlproducts.com -ConnectionType Basic-SSL -CredentialType Basic -Credential $credential
Get-TridionUser
@jhorsman
jhorsman / extend-windows-server-license.bat
Created November 21, 2017 15:10
Extend Windows Server evaluation licence by 180 days by rearming the machine
# check remaining rearm count
slmgr.vbs /dlv
# rearm the machine
slmgr.vbs /rearm
@jhorsman
jhorsman / application-ids.ps1
Created November 13, 2017 10:44
Get all applications ids from the Tridion Sites Core Service
Import-Module Tridion-CoreService
$client = Get-TridionCoreServiceClient
($client.GetApplicationIds()).count
$client.GetApplicationIds()
@jhorsman
jhorsman / credentials.ps1
Created November 13, 2017 09:46
User credentials object in PowerShell with the TridionModules and core service
$username = 'username'
$password = 'password' | ConvertTo-SecureString -asPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($username, $password)
Set-TridionCoreServiceSettings -Credential $credential -Hostname "localhost" -Version Web-8.5 -Persist
Get-TridionUser
@jhorsman
jhorsman / publish-and-check.ps1
Last active October 31, 2017 17:46
Publish an SDL Web 8.5 (Tridion) item and check result. This is an 8.5 version of this old script: https://gist.github.com/jhorsman/6b26396252119eb3a9d9
$ErrorActionPreference = "Stop"
$subject = "/webdav/400 Example Site/Home/000 Home.tpg"
#$subject = "/webdav/400 Example Site/Home/_Navigation.tpg"
#$subject = "/webdav/400 Example Site/Home"
# if you do not have the Tridion-CoreService module yet: get it from https://github.com/pkjaer/tridion-powershell-modules
Import-Module Tridion-CoreService -Verbose:$false
# Set up a Tridion Core Service client for the Content Manager server cms.server.com.
@jhorsman
jhorsman / map-network-drive.ps1
Created October 23, 2017 09:31
Map a drive with PowerShell
# Using Test-Path instead of Get-PSDrive and trying to map the drive without and then with credentials makes sure the script works in all circumstances:
# also when the drive was already mapped in Windows Explorer or in a PowerShell remoting session
# We map the drive with -Perist to make sure the drive is mapped in the Windows file explorer as well. Without -Persist the drive is only available in PowerShell.
# The -Scope Global parameter is used to make sure the drive is available outside of this script as well
$sharePath = "\\server\share\optional-path"
$mapDrive = "Z"
@jhorsman
jhorsman / set-env.ps1
Created October 18, 2017 07:50
Set a Windows environment variable with PowerShell. Scope: the whole machine, all users.
[Environment]::SetEnvironmentVariable("TRIDION_CM_ENVIRONMENT_ID", "Development", "Machine")
@jhorsman
jhorsman / remote-iisreset.ps1
Created October 12, 2017 19:49
Run iisreset over PowerShell remoting
Invoke-Command -ComputerName @("server1", "server2") -ScriptBlock {
Invoke-Expression "iisreset"
}
@jhorsman
jhorsman / install-java.bat
Created October 11, 2017 07:51
Perfect JAVA server install for Windows server. Without auto-update, task bar icon or browser toolbar.
jre-8u144-windows-x64.exe AUTO_UPDATE=Disable REBOOT=Disable INSTALL_SILENT=Enable