No announcement yet.

A revised System.GetOSName()

  • Filter
  • Time
  • Show
Clear All
new posts

  • A revised System.GetOSName()

    As Setup Factory has not seen an update for some time, there are some situations where you can run into unexpected issues when working on operating platforms released after the version For example, when you use System.GetOSName() on Windows 11, the action will retrieve the name of the previous version.

    This is understandable, Microsoft also did not update the ProductName and CurrentVersion strings in the operating system - they still show "Windows 10" and "6.3" respectively. Microsoft also repeatedly mention in their developer documentation that one should not need to check the operating system name and version if the application is properly designed, but here we are - there were questions from customers how to know if the host is running Windows 10 or 11 to take action / make decisions in their installers.

    The Lua code attached in this post contains a backward compatible approach to retrieve the operating system name. If you call System.GetOSNameEx() for retrieving the operating system name to show in a dialog, you might get an output like shown in these samples:

    Click image for larger version  Name:	SCRN-2021-11-01-02.png Views:	0 Size:	31.5 KB ID:	307789

    A simple way to use this action would be adding the script to the project resources:

    Click image for larger version  Name:	SCRN-2021-11-01-01.png Views:	0 Size:	13.4 KB ID:	307790

    In this manner, you can update the external script if needed, like when a new build of Windows is released and further editions are published. In this case, just update the script, and rebuild the setup(s). You will not need to update each setup individually if you use shared code.

    It should work for Windows Server as well. This code is provided as-is, I believe it works fine but I do not guarantee that it is error free and will work in all situations. This code is also not endorsed by Indigo Rose, it is just an attempt to help.


  • #2
    Thank you, Ulrich!


    • #3
      Where do I find the attachment?


      • #4
        Originally posted by brian71us View Post
        Where do I find the attachment?
        It should appear in the original post. Please refresh the page and see if the attachment appears then. In any case, I have now placed a copy on my server.