functions/Get-JavaProperty.ps1
<#
.Synopsis Retrieves a Java configuration property from a Java Property File .Description Retrieves a Java configuration property from a Java Property File .Parameter PropertyFile The name of the property file to update .Parameter property The Name of the volume to mount .Example $value = Get-JavaProperty -PropertyFile "$PSScriptRoot\buildAgent.properties" -property "name" Write-Host $value #> function Get-JavaProperty { param ( [Parameter(Mandatory=$true)] [string] $PropertyFile, [Parameter(Mandatory=$true)] [string] $property ) $file_content = Get-Content $PropertyFile $pattern = "(?-s)(?<=$($property)=).+" $value = $file_content | sls $pattern | %{$_.Matches} | %{$_.Value} return $value } Export-ModuleMember -Function Get-JavaProperty |