[PS] Convert string to version

How to convert a string to version (Major, Minor, Build, Revision) in PS

Sometimes you struggle in getting the version of a piece of software or file that is installed on my windows boxes in the right format.

Well I struggled with comparing installed versions of my installed SQL instances.
.Net and PowerShell helped me resolve this issues.

Use the following .net command

For my SQLinstances I used the following

This resulted in

When you select only the patchlevel in resulted in

And the Version resulted in

Now I have data in a table where I can compare versions.

Hope this was informative for you.




I am a Technical Specialist - Cloud Infrastructures from the Netherlands.
My Skills are mainly PowerShell, VMWare, Hyper-V, Microsoft System Center products and Windows Azure Pack.

I work for a company in Utrecht The Netherlands.