JoelK Posted January 18, 2019 Report Share Posted January 18, 2019 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? Quote Link to post Share on other sites
JoelK Posted January 19, 2019 Author Report Share Posted January 19, 2019 Ugh! Figured it out after reading through the forum some more. $app.Variables.ReplaceAllInString('{version}') Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.