Skip to content

Instantly share code, notes, and snippets.

View create file with leading space.ps1
Write-Output "test" > " another test in space.txt"
Get-Item "*.txt"
View logback.xml
<appender name="rollingSI4TExtensionsLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.folder}/si4t-extentions.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>${log.history}</maxHistory>
</rollingPolicy>
<encoder>
<charset>${log.encoding}</charset>
<pattern>${log.pattern}</pattern>
</encoder>
<prudent>true</prudent>
View tls.ps1
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
View disable TLS 1.0 and TLS 1.1 in JAVA
From https://stackoverflow.com/a/32510141/1678525
jdk.tls.disabledAlgorithms= SSLv2Hello, SSLv3, TLSv1, TLSv1.1
In the file jre/lib/security/java.security on the server
Mind that the jdk.tls.disabledAlgorithms might already have many more protocols, add the protocols above to that list.
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
View Test-ServerSSLSupport.ps1
function Test-ServerSSLSupport {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[ValidateNotNullOrEmpty()]
[string]$HostName,
[UInt16]$Port = 443
)
process {
$RetValue = New-Object psobject -Property @{
View list-system-users.ps1
# see https://github.com/pkjaer/tridion-powershell-modules
# see https://gist.github.com/jhorsman/b218ba7e2e5587d21c395d5968583b61 to learn more about configuring the Tridion-CoreService module
# Install the Tridion-CoreService module from the Tridion-Powershell-Modules project
Install-Module -Name Tridion-CoreService
Import-Module -Name Tridion-CoreService
# Set the server configuration
Set-TridionCoreServiceSettings -Credential (Get-Credential) -CredentialType Windows
Set-TridionCoreServiceSettings -HostName my-cms-server -Version Web-8.5 -ConnectionType Basic-SSL
View Install Tridion-CoreService module.ps1
# Install the Tridion-CoreService module from the Tridion-Powershell-Modules project. See https://github.com/pkjaer/tridion-powershell-modules
Install-Module -Name Tridion-CoreService
Import-Module -Name Tridion-CoreService
# Set the server configuration
Set-TridionCoreServiceSettings -HostName my-cms-server -Version Web-8.5 -ConnectionType Basic
Set-TridionCoreServiceSettings -Credential (Get-Credential) -CredentialType Windows
# Alternatively use SSL (https)
#Set-TridionCoreServiceSettings -HostName my-cms-server -Version Web-8.5 -ConnectionType Basic-SSL
View Windows Desktop and Explorer settings.ps1
# from https://superuser.com/a/1479800/477803
function Test-DesktopIconHidden {
[CmdletBinding(SupportsShouldProcess=$false)]
Param()
Process {
$Shell = New-Object -ComObject "Shell.Application"
$Shell.GetSetting(0x4000)
}
View Set-DxAddon.ps1
# Usage examples
# .\Set-DxAddon.ps1 -Url "http://server:83" -Path addon.zip
# .\Set-DxAddon.ps1 -Path addon.zip
param (
[parameter(Mandatory=$false, HelpMessage="Tridion DX Add-on service URL. Defaults to 'http://localhost:83'")]
[string] $Url = "http://localhost:83",
[parameter(Mandatory=$true, HelpMessage="Path to to the add-on.")]
[string] $Path
You can’t perform that action at this time.