Files
runner-images/images/win/scripts/SoftwareReport/SoftwareReport.Databases.psm1
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

42 lines
1.3 KiB
PowerShell

function Get-PostgreSQLMarkdown
{
$name = "PostgreSQL"
$pgService = Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'"
$pgPath = $pgService.PathName
$pgRoot = $pgPath.split('"')[1].replace("\bin\pg_ctl.exe", "")
$pgVersion = (pg_config --version).split()[1].Trim()
$content = [PSCustomObject]@{
Version = $pgVersion
UserName = $env:PGUSER
Password = $env:PGPASSWORD
EnvironmentVariables = "PGBIN=$env:PGBIN; <br> PGDATA=$env:PGDATA; <br> PGROOT=$env:PGROOT"
Path = $pgRoot
ServiceName = $pgService.Name
ServiceStatus = $pgService.State
ServiceStartType = $pgService.StartMode
} | New-MDTable
Build-MarkdownElement -Head $name -Content $content
}
function Get-MongoDBMarkdown
{
$name = "MongoDB"
$mongoService = Get-Service -Name $name
$mongoVersion = (Get-Command -Name 'mongo').Version.ToString()
$content = [PSCustomObject]@{
Version = $mongoVersion
ServiceName = $name
ServiceStatus = $mongoService.Status
ServiceStartType = $mongoService.StartType
} | New-MDTable
Build-MarkdownElement -Head $name -Content $content
}
function Build-DatabasesMarkdown
{
$markdown = ""
$markdown += Get-PostgreSQLMarkdown
$markdown += Get-MongoDBMarkdown
$markdown
}