Skip to content

Instantly share code, notes, and snippets.

@levi-turner
Last active December 9, 2021 11:54
Show Gist options
  • Save levi-turner/6edf4860d9c7b1c8729fbaeae295a0db to your computer and use it in GitHub Desktop.
Save levi-turner/6edf4860d9c7b1c8729fbaeae295a0db to your computer and use it in GitHub Desktop.
Register a Qlik Node using Qlik CLI
<#
Run on the Central
#>
# Connect to Qlik Sense
# See https://github.com/ahaydon/Qlik-Cli/wiki/Establishing-a-connection for more connection options
Connect-Qlik
# Add the Node to the Cluster; store the password element of the response for the ZIP as $password
# nodePurpose: 0 (Production) / 1 (Development) / 2 (Both)
# engineEnabled, proxyEnabled, schedulerEnabled, $printingEnabled, $failoverCandidate as options
$password = New-QlikNode -hostname qlikserver2.domain.local -name qlikserver2 -nodePurpose 0 -engineEnabled -proxyEnabled
# Build an array for the password; used later for a POST to the unlocking page
$foo = @{__pwd="$password"}
<#
Using this will allow a silent execution without password prompt
$Username = 'DOMAIN\Administrator'
$Password = 'Password123!'
$pass = ConvertTo-SecureString -AsPlainText $Password -Force
$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$pass
Invoke-Command -ComputerName qlikserver2.domain.local -ScriptBlock { Invoke-WebRequest -Uri "http://localhost:4570/certificateSetup" -Method Post -Body $Using:foo } -credential $Cred
#>
Invoke-Command -ComputerName qlikserver2.domain.local -ScriptBlock { Invoke-WebRequest -Uri "http://localhost:4570/certificateSetup" -Method Post -Body $Using:foo } -credential DOMAIN\Administrator
# Filter by the name param from line 7
$nodeid = Get-QlikNode -filter "(name eq 'qlikserver2')"
Invoke-QlikGet -path /qrs/servernoderegistration/start/$($nodeid.id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment