What it does
The package in the enclosed example workspace queries the operating system and tries to retrieve a number of properties about this.
This package is based on the regcheck package from http://www.vdf-guidance.com
The OS detection logic has been extracted from there and put in here. It has been completely rewritten in a way that makes it more versatile and easier to use.
The property peOSVersion should be used if you want to run code that depends on a specific OS version.
Current Limitations, the code does not check for Hyper-V roles or if windows is licensed, or if the Vista Version used is Ultimate or Professional. For that we will need to use the GetProductInfo WinAPI
call. (Vista and up) Knowing the OS version is Vista is OK for now.
The code has been tested to work on VDF15+
Special thanks to Mertech Data
for allowing me to share this code with the community.
Supported Operating Systems
The following operating systems can be detected using this code:
- Windows 95
- Windows 98
- Windows ME
- Windows NT 3.51
- Windows NT40 Professional
- Windows NT40 Server
- Windows 2000 Professional
- Windows 2000 Server
- Windows XP Professional
- Windows XP
- Windows XP Professional x64 Edition
- Windows Server 2003
- Windows Server 2003 R2
- Windows Vista
- Windows Home Server
- Windows Server 2008
- Windows Server 2008 R2
- Windows 7
You can also get edition info such as, Home, Tablet, Starter, Multimedia Center, Embedded, Datacenter, enterprise, web edition... etcetera..
Property String psCSDVersion ''
Windows NT and up: Contains a string, such as "Service Pack 3", that indicates the latest Service Pack installed on the system. If no Service Pack has been installed, the string is empty.
Windows 95: Contains a null-terminated string that provides arbitrary additional information about the operating system.
Property Integer piServicePackMajor 0
Identifies the major version number of the latest Service Pack installed on the system. For example, for Service Pack 3, the major version number is 3. If no Service Pack has been installed, the value is zero.
Property String psSuite ""
The psSuite string only contains features which can be enabled or not, so it is NOT a direct mapping to piSuiteMask. An example of this is if you are in a remote desktop session or not, or if you have administrative privileges.
Property String psEdition ""
The Edition string contains specific details about the platform that cannot be enabled as a role. So "Home" Edition or "Datacenter" edition are good examples. R2 is a peOSVersion
Property String psOSVersion CS_OSVERSION_UNKNOWN
Contains which version of windows is running as a text. If it can not sort it out it will be CS_OSVERSION_UNKNOWN (="Windows Version UNKNOWN")
Property Integer peOSVersion CE_OSVERSION_UNKNOWN
peOSVersion must be one of the following values:
Property Boolean pbNTServer False
Running windows version is a server version
Property Boolean pbWindowsHome False
Running on a Windows HOME version. That is Windows ME and Windows XP Home
Both are not recommended platforms for business (networking is limited).
So not for vdf.
Property Boolean pbX64 False
pbX64 is set to true if your host OS is x64
Property Boolean pbRemoteDesktop False
pbRemoteDesktop is set to true if your application currently runs under a remote desktop session
Property Boolean pbAdminRights False
Does your user run with administrator rights or not (Windows 2000 or higher) When running under an older OS, it will always returns false.
In its most bare form you would call it to retrieve the string that
sums up all of the OS capabilities for your host like this:
Function HostOS Returns String
Move "" To sOSVersion
Get Create U_cOSVersionInfo To hoVersionInfo
If (hoVersionInfo) Begin
Get OSVersion Of hoVersionInfo To sOSVersion
End_Function // HostOS
This then returns a string as in the "Complete" form at the bottom of the screenshot here.