From 0faa62d1815ca8812558bf884b098a98467c0f7c Mon Sep 17 00:00:00 2001 From: Jeff Goldberg Date: Thu, 14 Jul 2016 08:36:04 -0400 Subject: [PATCH] Updates to ServicesConfBuilder --- utils/ServicesConfBuilder.ps1 | 45 +++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/utils/ServicesConfBuilder.ps1 b/utils/ServicesConfBuilder.ps1 index 97522a1..b69acff 100644 --- a/utils/ServicesConfBuilder.ps1 +++ b/utils/ServicesConfBuilder.ps1 @@ -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 | @@ -11,6 +27,8 @@ function getServiceDispatcherPath $serviceDispatcherPath = getServiceDispatcherPath +Write-Host "The services.conf file resides at path: "$serviceDispatcherPath +Write-Host function getConf { @@ -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." } \ No newline at end of file