Last active
October 12, 2022 04:20
-
-
Save Nillth/102dedb8f01c03373d367f305df12d02 to your computer and use it in GitHub Desktop.
Scripted Implementation: https://community.qlik.com/t5/Knowledge/Stream-are-not-visible-or-available-on-the-hub-in-Qlik-Sense-May/ta-p/1943938
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.NOTES | |
=========================================================================== | |
Created by: Marc Collins | |
Organization: Qlik CSE | |
Filename: QlikSense-Capabilities-HUB_HIDE_EMPTY_STREAMS.ps1 | |
=========================================================================== | |
.DESCRIPTION | |
Scripted Implementation: https://community.qlik.com/t5/Knowledge/Stream-are-not-visible-or-available-on-the-hub-in-Qlik-Sense-May/ta-p/1943938 | |
#> | |
#Requires -RunAsAdministrator | |
function Get-ServicePath | |
{ | |
param | |
( | |
[Parameter(Mandatory = $true)] | |
$Name | |
) | |
#Find the repository service | |
$WinService = Get-WmiObject win32_service | Where-Object{ | |
$_.Name -eq $Name | |
} | Select-Object 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 | |
} | |
#Get location of the Repository Service | |
$RepositoryService = Get-ServicePath -Name QlikSenseRepositoryService | |
#Find the Install Directory | |
$InstallFolder = $RepositoryService.Path.Directory.Parent | |
#Get the version information | |
$Composition = Get-content "$($InstallFolder.FullName)\AboutService\technical-composition-info.json" | ConvertFrom-Json | |
#Get the Capabilities File | |
$CapabilitiesFile = "$($InstallFolder.FullName)\CapabilityService\capabilities.json" | |
$Capabilities = Get-content $CapabilitiesFile | ConvertFrom-Json | |
#Check the version | |
if ($([version]$Composition.composition.version) -ge [version]::new("14.67.13")) | |
{ | |
#Newer or Equal to May 2022 Patch 4 | |
$Capabilities | Where-Object{ | |
$_.flag -eq "HUB_OPTIMIZED_SEARCH" | |
} | ForEach-Object{ | |
$_.enabled = $true | |
} | |
} | |
else | |
{ | |
$Capabilities | Where-Object{ | |
$_.flag -eq "HUB_HIDE_EMPTY_STREAMS" | |
} | ForEach-Object{ | |
$_.enabled = $false | |
} | |
} | |
#Save the Changes | |
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False | |
$OutString = $Capabilities | ConvertTo-Json | |
[System.IO.File]::WriteAllLines($CapabilitiesFile, $OutString, $Utf8NoBomEncoding) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment