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? Link to comment Share on other sites More sharing options...
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}') Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now