Functions/Install-S1EPI.ps1


<#
.SYNOPSIS
    Installs the SentryOne Enhanced Platform Installer
.DESCRIPTION
    If not already installed it will downloads the current version of the S1 Platform installer and installs
.EXAMPLE
    Install-S1EPI
.INPUTS
    None
.OUTPUTS
    None
.NOTES
#>

function Install-S1EPI {
    [CmdletBinding()]
    param (
        
        [switch]$getLatest,
        [switch]$force,
        [switch]$silent
    )
    
    begin {
        
        $ErrorActionPreference = "Stop"

    }
    
    process {
        $url = "https://downloads.sentryone.com/downloads/epi/SentryOneSetup.exe"
        $OutFile = [IO.Path]::Combine((Get-S1ConfigureAppPath),"packages","SentryOneSetup.exe")
        $PackageName ="SentryOneSetup"
    
        $Header = "ETag"
        
        if ($GetLatest -or -not (Test-path $OutFile)) {
            Write-
            $output = Save-PackageFromUrl -Url $url -OutFile $outFile -packagename $PackageName -header $Header -Force:$Force
        }
        $processArgs = @("/passive")
        if ($silent) {$processArgs +="/quiet"}
        if ($force -or $output.newVersion) {
            start-process $OutFile $processArgs -Wait
        }
                
    }
    
    end {
        
    }
}



#&./s1.exe

#& 'C:\Program Files\SentryOne Framework\so' addreg -n rdtsqlmi --connectionServer sentryonemi.f7795d224c41.database.windows.net --connectionUsername SimonSabin --connectionPassword <bob> --connectionDatabase SentryOne

#& 'C:\Program Files\SentryOne Framework\SentryOne.App.ClientBootstrapper.exe'

#so upgradedb -n $connection

#THis upgrade will get queued
#How do you check on progress ? so listpackage will give current state
##so upgrade
#&./s1.exe