Files
runner-images/images/win/scripts/Installers/Validate-PostgreSQL.ps1
Darii Nurgaleev 32bea7d8d3 PostgreSQL: Remove from PATH/Add environment variables. (#1099)
* Removed PostgreSQL server from path.

* Added new Paths

* added another solution for documentation

* Fixed path in generator.
2020-06-25 12:20:48 +03:00

19 lines
512 B
PowerShell

$pgReadyPath = Join-Path $PGBIN "pg_isready.exe"
$pgReady = Start-Process -FilePath $pgReadyPath -Wait -PassThru
$exitCode = $pgReady.ExitCode
if ($exitCode -eq 0)
{
Write-Host -Object "PostgreSQL has been successfully installed."
}
else
{
Write-Host -Object "PostgreSQL is not ready. Exitcode: $exitCode"
exit $exitCode
}
#Stop and disable PostgreSQL service
$pgService = Get-Service -Name postgresql*
Stop-Service -InputObject $pgService
Set-Service -InputObject $pgService -StartupType Disabled