Skip to content

Instantly share code, notes, and snippets.

@Nillth
Nillth / profile.ps1
Created October 18, 2021 01:14
Record PowerShell History.
#Add the following to your PowerShell Profile to record history on exit.
#Windows PowerShell
#<userdirectory>\Documents\WindowsPowerShell\profile.ps1
#PowerShell Core.
#<userdirectory>\Documents\PowerShell\profile.ps1
$PWSHHistory = [System.IO.DirectoryInfo]"$Home\PWSHHistory"
$PWSHHistory.Create() | Out-Null
<#
.NOTES
===========================================================================
Created by: Marc Collins
Organization: Qlik
Filename: Set-GeneratePublisherEvidence.ps1
===========================================================================
.DESCRIPTION
Configure GeneratePublisherEvidence
https://community.qlik.com/t5/Knowledge/An-error-occurred-Failed-to-load-connection-error-message-in/ta-p/1714051
@Nillth
Nillth / NPrinting-CLI-Demo.ps1
Created October 26, 2021 23:22
Some Demo calls using the QlikNPrinting-CLI to collect various bits of data from the APIs
<#
.NOTES
===========================================================================
Created on: 2021-10-27 10:09 AM
Created by: Marc Collins
Organization: Qlik
Title: Senior Principal Technical Architect
Email: [email protected]
Filename: NPrinting-CLI-Demo.ps1
===========================================================================
@Nillth
Nillth / Example-Qlik-CLI-Windows-CustomPropertyExtraction.ps1
Created October 27, 2021 00:06
Demo for extracting Name=Value pairs for Custom Properties with explanation
<#
.NOTES
===========================================================================
Created on: 2021-10-27 10:09 AM
Created by: Marc Collins
Organization: Qlik
Title: Senior Principal Technical Architect
Email: [email protected]
Filename: Qlik-CLI-Windows-CustomPropertyExtraction.ps1
===========================================================================
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
CREATE OR REPLACE FUNCTION public.validate_payload(IN payload JSON) RETURNS TEXT AS $$
BEGIN
RETURN payload->>'XXXXX';
@Nillth
Nillth / Export_QV_LoadScript.ps1
Created November 22, 2021 22:57
Export QlikView Load Scripts
<#
.NOTES
===========================================================================
Created on: 2021-11-23 9:36 AM
Created by: Marc Collins
Email: [email protected]
Organization: Qlik
Filename: Export_QV_LoadScript.ps1
===========================================================================
#>
@Nillth
Nillth / Get-ServicePath.ps1
Created November 23, 2021 05:52
Get Service Path
Function Get-ServicePath($Name)
{
#Find the repository service
$WinService = Get-WmiObject win32_service | ?{ $_.Name -eq $Name } | select Name, DisplayName, State, PathName
[regex]$EXEPath = '(\\\\|\w:)(.+)(\..{3})'
if ($WinService.PathName -match $EXEPath) { [System.IO.FileInfo]$WinServicePath = $Matches[0] }
$WinService | Add-Member -MemberType NoteProperty -Name Path -Value $WinServicePath
$WinService
}
<#
.NOTES
===========================================================================
Created on: 2021-11-24 6:00 PM
Created by: Marc Collins
Title: Senior Principal Technical Architect
Organization: Qlik
Filename: QlikView-ADSync_Assign_Named_CALs.ps1
===========================================================================
#>
@Nillth
Nillth / New-Credential.ps1
Created December 6, 2021 22:39 — forked from evetsleep/New-Credential.ps1
New-Credential
function New-Credential{
$counter = 0
$more = $true
while($more){
if($counter -ge 3){
Write-Warning -Message ('Take a deep breath and perhaps a break. You have entered your password {0} times incorrectly' -f $counter)
Write-Warning -Message ('Please wait until {0} to try again to avoid risking locking yourself out.' -f $((Get-Date).AddMinutes(+15).ToShortTimeString()))
Start-Sleep -Seconds 30
}
#Set the regex patterns to look for
$http = [regex]::new("^.*?http.ssl=.*$")
$sslcert = [regex]::new("^.*?http.sslcert=.*$")
$sslkey = [regex]::new("^.*?http.sslkey=.*$")
#define the new values to put in the file
$newhttpline = "http.ssl=true"
$newsslcertLine = "http.sslcert=`${ProgramData}\NPrinting\certificates\qlik.pem"
$newsslkeyLine = "http.sslkey=`${ProgramData}\NPrinting\certificates\qlik.key"