Skip to content

Commit

Permalink
Install method updated
Browse files Browse the repository at this point in the history
  • Loading branch information
gardart committed Jan 23, 2019
1 parent 6a235e7 commit 174df48
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions Deploy-Application.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ Try {
[string]$appArch = ''
[string]$appLang = 'EN'
[string]$appRevision = '01'
[string]$appScriptVersion = '1.0.2'
[string]$appScriptVersion = '1.0.3'
[string]$appScriptDate = '23/01/2019'
[string]$appScriptAuthor = 'Gardar Thorsteinsson<gardart@gmail.com>'
##*===============================================
## Variables: Install Titles (Only set here to override defaults set by the toolkit)
[string]$installName = 'NSClient++ Deployment'
[string]$installTitle = ''
[version]$AdagiosRelease = [version]'1.0.3'
## Variables: System architecture detection
#If([IntPtr]::Size -eq 8)
#{
Expand Down Expand Up @@ -173,14 +174,18 @@ Try {
[string]$installPhase = 'Post-Installation'

## <Perform Post-Installation tasks here>
Stop-ServiceAndDependencies -Name 'nscp'
Copy-File -Path "$dirSupportFiles\*.*" -Destination "$envProgramFiles\NSClient++\"
Copy-File -Path "$dirSupportFiles\Scripts" -Destination "$envProgramFiles\NSClient++" -Recurse

# Update registry key for Adagios agent version (OKconfig version)
Set-RegistryKey -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\OpinKerfi\Adagios' -Name 'CurrentVersion' -Value $appScriptVersion -Type String -ContinueOnError:$True
Start-ServiceAndDependencies -Name 'nscp'

if((Get-RegistryKey "HKLM:\SOFTWARE\OpinKerfi\Adagios" -Value CurrentVersion) -lt $AdagiosRelease) {
Write-Log -Source $deployAppScriptFriendlyName -Message "Adagios OKconfig templates are < [string]$AdagiosRelease, installing"
Stop-ServiceAndDependencies -Name 'nscp'
Copy-File -Path "$dirSupportFiles\*.*" -Destination "$envProgramFiles\NSClient++\"
Copy-File -Path "$dirSupportFiles\Scripts" -Destination "$envProgramFiles\NSClient++" -Recurse

# Update registry key for Adagios agent version (OKconfig version)
Set-RegistryKey -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\OpinKerfi\Adagios' -Name 'CurrentVersion' -Value $AdagiosRelease -Type String -ContinueOnError:$True
Start-ServiceAndDependencies -Name 'nscp'

}

## Display a message at the end of the install
If (-not $useDefaultMsi) { Show-InstallationPrompt -Message 'Installation completed successfully. Remember to add the ip address of your Nagios server to the "allowed hosts" variable located in the file $envProgramFiles\NSClient++\allowed_hosts.ini. At last, restart the NSClient++ service.' -ButtonRightText 'OK' -Icon Information -NoWait }
}
Expand Down

0 comments on commit 174df48

Please sign in to comment.