-
Notifications
You must be signed in to change notification settings - Fork 2
/
qlikSenseUserdata.ps1
54 lines (42 loc) · 2.47 KB
/
qlikSenseUserdata.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<powershell>
# Log the bootstrapping process
Start-Transcript -Path c:\bootstrap.log -Append
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
# Add a new Windows user: ${user} to allow for log on without Administrator password
# PS 5.1
# $UserPassword = ConvertTo-SecureString -AsPlainText ${password} -Force
# New-LocalUser ${user} -Password $UserPassword -FullName ${user} -Description 'Qlik Admin'
# Add-LocalGroupMember -Group Administrators -Member ${user}
# wmic UserAccount Where "name='${user}'" Set PasswordExpires=FALSE
#PS 4.0
NET USER ${user} {$password} /ADD
NET LOCALGROUP "administrators" ${user} /ADD
# Open RDP port in Windows firewall
New-NetFirewallRule -DisplayName 'RDP Port 3389' -Direction Inbound -LocalPort 3389 -Protocol TCP -Action Allow
# Open HTTPS port in Windows firewall
New-NetFirewallRule -DisplayName 'Qlik Sense' -Direction Inbound -LocalPort 443 -Protocol TCP -Action Allow
# Start Qlik Sense Enterprise using the Qlik provided UserStartup.ps1 script
Unregister-ScheduledTask -TaskName 'UserLogonTask' -Confirm:$false
$SvcUser = 'qliksvc'
$SvcPassword = "${qse_svc_password}" | ConvertTo-SecureString -AsPlainText -Force # Set service user password
$DbSuPassword = "${qse_db_admin_password}" | ConvertTo-SecureString -AsPlainText -Force # Set DB superuser password
$DbRuPassword = "${qse_db_repository_password}" | ConvertTo-SecureString -AsPlainText -Force # Set DB repository password
C:\startup\UserStartup.ps1 -ManualSetup -Username $SvcUser -Password $SvcPassword -DbSuPassword $DbSuPassword -DbRuPassword $DbRuPassword
# Add the Qlik Service user to the Administrators group
# Add-LocalGroupMember -Group Administrators -Member $SvcUser
NET LOCALGROUP "administrators" $SvcUser /ADD
# Install Qlik-CLI
Get-PackageProvider -Name NuGet -ForceBootstrap | Out-Null
Install-Module -Name Qlik-CLI -Confirm:$false -Force | Out-Null
# Connect to the Qlik Sense Repository Service
Connect-Qlik $env:COMPUTERNAME -TrustAllCerts -UseDefaultCredentials
# License the Qlik Sense Server
Set-QlikLicense -serial ${qse_license} -control ${qse_control} -name "${qse_name}" -organization "${qse_org}"
# Add the ${user} to Qlik Sense as a Root Admin
$json = (@{userId = "${user}";
userDirectory = $env:COMPUTERNAME;
name = "${user}";
} | ConvertTo-Json -Compress -Depth 10 )
Invoke-QlikPost "/qrs/user" $json
Update-QlikUser -id $(Get-QlikUser -full -filter "name eq '${user}'").id -roles "RootAdmin" | Out-Null
</powershell>