Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
Updates to ServicesConfBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
goldbergjeffrey committed Jul 14, 2016
1 parent 483951e commit 0faa62d
Showing 1 changed file with 43 additions and 2 deletions.
45 changes: 43 additions & 2 deletions utils/ServicesConfBuilder.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
$installParent = Get-Location
$installedProjects = Get-ChildItem -path $installParent | Where-Object{($_.PSIsContainer)} | foreach-object{$_.Name}
$count = 0

$intro = "This is the EAPowerTools services.conf update script.`n"
$intro += "This script will review installed PowerTools and add entries to the`n"
$intro += "services.conf file if applicable and if missing due to an upgrade of`n"
$intro += "Qlik Sense.`n`n"
$intro += "Press any key to begin the update."

Write-Host $intro
Write-Host "========================================================================"

$x = $Host.ui.RawUI.ReadKey("NoEcho,IncludeKeyDown")

Write-Host "========================================================================"
Write-Host


function getServiceDispatcherPath
{
$Entry = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall" -Recurse |
Expand All @@ -11,6 +27,8 @@ function getServiceDispatcherPath

$serviceDispatcherPath = getServiceDispatcherPath

Write-Host "The services.conf file resides at path: "$serviceDispatcherPath
Write-Host

function getConf
{
Expand All @@ -25,28 +43,51 @@ function getConf
}
}

Write-Host "Reviewing list of installed EAPowerTools"
Write-Host
Write-Host "========================================================================"


forEach($appName in $installedProjects)
{
#Write-Host 'this app is called' $appName
Write-Host
Write-Host $appName" is installed on this system."
$appWithBracks = "\[$appName\]"
#Write-Host $appWithBracks
$configuredApps = Select-String -Path $serviceDispatcherPath -pattern $appWithBracks

if(!$configuredApps)
{
Write-Host "Adding "$appName" configuration to services.conf."
$conf = getConf $installParent $appName
Add-Content $serviceDispatcherPath "`n$conf"
$count++
}
else
{
Write-Host $appName" configuration already exists"
Write-Host $appName" configuration exists in services.conf"
}

Write-Host
Write-Host "========================================================================"

}

if($count -gt 0)
{

Write-Host "Made $count updates to the services.conf."
Write-Host "Stopping the Qlik Sense Service Dispatcher Service."
Stop-Service -DisplayName "Qlik Sense Service Dispatcher"
Write-Host
Write-Host "========================================================================"

Write-Host
Write-Host "Starting the Qlik Sense Service Dispatcher Service."
Start-Service -DisplayName "Qlik Sense Service Dispatcher"
}
else
{
Write-Host
Write-Host "No updates need to be made to the services.conf."
}

0 comments on commit 0faa62d

Please sign in to comment.