Files
runner-images/images/windows/scripts/docs-gen/SoftwareReport.Databases.psm1
2025-10-02 12:35:19 +02:00

34 lines
1.4 KiB
PowerShell

function Get-PostgreSQLTable
{
$pgService = Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'"
$pgPath = $pgService.PathName
$pgRoot = $pgPath.split('"')[1].replace("\bin\pg_ctl.exe", "")
$env:Path += ";${env:PGBIN}"
$pgVersion = (postgres --version).split()[2].Trim()
return @(
[PSCustomObject]@{ Property = "ServiceName"; Value = $pgService.Name },
[PSCustomObject]@{ Property = "Version"; Value = $pgVersion },
[PSCustomObject]@{ Property = "ServiceStatus"; Value = $pgService.State },
[PSCustomObject]@{ Property = "ServiceStartType"; Value = $pgService.StartMode },
[PSCustomObject]@{ Property = "EnvironmentVariables"; Value = "`PGBIN=$env:PGBIN` <br> `PGDATA=$env:PGDATA` <br> `PGROOT=$env:PGROOT` " },
[PSCustomObject]@{ Property = "Path"; Value = $pgRoot },
[PSCustomObject]@{ Property = "UserName"; Value = $env:PGUSER },
[PSCustomObject]@{ Property = "Password"; Value = $env:PGPASSWORD }
)
}
function Get-MongoDBTable
{
$name = "MongoDB"
$command = "mongod"
$mongoService = Get-Service -Name $name
$mongoVersion = (Get-Command -Name $command).Version.ToString()
return [PSCustomObject]@{
Version = $mongoVersion
ServiceName = $name
ServiceStatus = $mongoService.Status
ServiceStartType = $mongoService.StartType
}
}