configuration - How to programmatically determine supportedRuntime in Powershell? -


i've looked through posted questions, , while see related issues, don't see answer specific question i'm pose.

what programmatically determine in powershell script supported runtimes (especially defined in configuration file). example, if content of powershell.exe.config file this:

<?xml version="1.0"?> <configuration>     <startup uselegacyv2runtimeactivationpolicy="true">          <supportedruntime version="v4.0.30319"/>                  <supportedruntime version="v2.0.50727"/>             </startup> </configuration> 

...can programmatically info within powershell script (i.e. versions 'v4.0.30319' , 'v2.0.50727' supported)?

thanks in advance , apologies if has been answered elsewhere.

edit: clear, looking way did not depend on reading config file itself...just in case values set (or defaulted) means other config file. there object can query contains info on supported runtimes, regardless of how specified (config file or otherwise)?

the straightforward way:

[xml](gc $pshome\powershell.exe.config) |      %{ $_.configuration.startup.supportedruntime} |           select -expand version 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -