Skip to content

Instantly share code, notes, and snippets.

@mountaindude
Forked from levi-turner/RegisterNode.ps1
Created August 27, 2019 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mountaindude/8fd9b08ac6d1caddc034a93522fc511c to your computer and use it in GitHub Desktop.
Save mountaindude/8fd9b08ac6d1caddc034a93522fc511c 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