I am trying to write a PowerShell script that runs after any application is updated that will among other things record the version number of the newly updated application to a file. If I have an application where {version} is defined as a regex match of URL contents and I do something like this:
$app.Variables.version.CachedContent | Out-File -FilePath "E:\test\$($app.Name).txt"
I will get the version number written to a text file named after the application as expected. However, if I have an application where {version} is defined as the following textual content (where {versionraw} is already defined as a regex match of URL contents and the below does some formatting of that value):
{versionraw:replace:_:.}
and then I do something like this:
$app.Variables.version.TextualContent | Out-File -FilePath "E:\test\$($app.Name).txt"
the text file will not contain the version number (e.g. 9.1.5) but rather what I actual function from the textual content field ({versionraw:replace:_:.}). I know {version} contains the value I expect because if for example I set the download location to "E:\test\{version}.msi" the file will be saved as "9.1.5.msi". So, how can I get the value of {version} in PowerShell when {version} is textual?