Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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