Skip to content

Instantly share code, notes, and snippets.

View levi-turner's full-sized avatar

Levi Turner levi-turner

  • Qlik
  • Boston, MA
View GitHub Profile
# Creates a valid certificate for data encryption which expires 1 day from current time
New-SelfSignedCertificate -Subject "QlikSenseDataEncrytion" `
-KeyAlgorithm RSA `
-KeyLength 4096 `
-Provider "Microsoft Software Key Storage Provider" `
-KeyExportPolicy ExportableEncrypted `
-CertStoreLocation "cert:\CurrentUser\My" `
-NotAfter (Get-Date).AddDays(1)
# Change the location to the VirtualBox installdir; default is used here
Set-Location "C:\Program Files\Oracle\VirtualBox"
# Get a list of VMs
.\VBoxManage.exe list vms
# Determine the off-set required; modify date as needed
([datetime]"07/01/2019" - [datetime]::Now)
cd /d D:\dbgen\dbgen\Debug
dbgen -vf -s 1
@levi-turner
levi-turner / openSSLGoodies.bat
Last active June 26, 2020 16:33
Using OpenSSL to strip passwords, add proper CSPs for SHA256, and create pems
# Adjust CSP
openssl pkcs12 -in cert.pfx -out cert.pem -password pass:<password> -passin pass:<password>
openssl pkcs12 -export -in cert.pem -out cert-new.pfx -CSP "Microsoft Enhanced RSA and AES Cryptographic Provider"
certutil -dump cert-new.pfx
# Rename file
rename cert.pfx cert-original.pfx
rename cert-new.pfx cert.pfx
# Strip Password
@levi-turner
levi-turner / qs-qrs-migrate_all_apps.ps1
Created April 1, 2019 14:24
Manually migrate all apps
#--------------------------------------------------------------------------------------------------------------------------------
#
# Script Name: qs-qrs-migrate_all_apps.ps1
# Description: Manually migrate all apps (useful post upgrade if the automatic upgrade isn't done
# Dependency: Run as service account (or other account authorized to make QRS API calls)
#
# Version Date Author Change Notes
# 0.1 2019-04-01 Levi Turner Initial Version
#
#--------------------------------------------------------------------------------------------------------------------------------
Get-ChildItem -Recurse -Filter *.json |
ForEach-Object {
Write-Host $_.Name
Write-Host $_.FullName
$jsondata = Get-Content -Raw -Path $_.FullName | ConvertFrom-Json
$jsondata.scenario | Where{$_.Label -eq 'SELECT in Benchmark'} | ForEach{$_.Type = 'SelectString'}
$jsondata.scenario | Where{$_.Label -eq 'SELECT in Benchmark'} | ForEach{$_.StringSelection = 'Under 65 Population'}
$jsondata | ConvertTo-Json -depth 100 | Out-File -LiteralPath $_.FullName
}
# List all QVConnect processes
# Select the subset which have been were spawned 3 hours prior
# Stop that subset
Get-Process QvConnect64 | Where StartTime -lt (Get-Date).AddMinutes(-180) | Stop-Process -Force
$hdrs = @{}
$hdrs.Add("X-Qlik-Xrfkey","examplexrfkey123")
$hdrs.Add("X-Qlik-User", "UserDirectory=INTERNAL; UserId=sa_api")
$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}
$Data = Get-Content C:\ProgramData\Qlik\Sense\Host.cfg
$FQDN = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($($Data)))
$qpsalive = 0
Do {
@levi-turner
levi-turner / ChromeExtensionInstall.ps1
Created June 28, 2018 19:37
Installs a Chrome extension
<#
From: https://www.reddit.com/r/PowerShell/comments/8u0xl6/install_chrome_firefox_plugins_without_user/e1cli8p/
#>
$regLocation = 'Software\Policies\Google\Chrome\ExtensionInstallForcelist'
# Each extension if you want to force install more than 1 extension needs its own key #
$regKey = '1'
# 'mpabchoaimgbdbbjjieoaeiibojelbhm' is the Extension ID, easiest way to get this is from the URL of the extension
$regData = 'mpabchoaimgbdbbjjieoaeiibojelbhm;https://clients2.google.com/service/update2/crx'
New-Item -Path "HKLM:\$regLocation" -Force
@levi-turner
levi-turner / dummyfile.ps1
Created June 28, 2018 18:48
create dummy file
'd60df0b7-7dd1-4e80-8555-fd1d5af2bf9b' | % { New-Item -Path c:\temp -Name "$_" -Value (Get-Date).toString()-ItemType file}