Announcement

Collapse
No announcement yet.

A revised System.GetOSName()

Collapse
X
 
  • 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 9.5.3.0. 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.

    Ulrich

  • #2
    Hi Ulrich! I would be interested but do not see the attachment.

    Comment


    • #3
      Strange, this looks like a forum engine issue or something with your bowser, as the attachment is definitely in the post, and a few members already downloaded the script.

      This is how I see the post:

      Click image for larger version

Name:	SCRN-2021-11-20-01.png
Views:	21
Size:	16.8 KB
ID:	307839

      Please try to log off and log into the forum again, who knows it might help.

      Ulrich

      Comment

      Working...
      X