Have you looked at using WMI?Win32OperatingSystemThe Win32OperatingSystem class represents an operating system installed on a Win32 computer system. Any operating system that can be installed on a Win32 system is a descendent (or member) of this class.Example: Microsoft Windows 95.Win32OperatingSystem Properties:BuildNumber:The BuildNumber property indicates the build number of the operating system. It can be used for more precise versioning information than product release version numbersExample: 1381BuildType:The BuildType property indicates the type of build used for the operating system. Examples are retail build and checked build.Caption:The Caption property is a short textual description (one-line string) of the object.Description:The Description property provides a description of the Windows operating system. Some user interfaces (those that allow editing of this description) limit its length to 48 characters.ProductType:The ProductType property indicates additional information about the system. This member can be one of the following values:1 - Work Station2 - Domain Controller3 - ServerServicePackMajorVersion:The ServicePackMajorVersion property indicates the major version number of the service pack installed on the computer system. If no service pack has been installed, the value is zero.
![Osproductsuite Osproductsuite](/uploads/1/2/5/5/125558063/256253052.png)
ServicePackMajorVersion is valid for computers running Windows 2000 and later (NULL otherwise).ServicePackMinorVersion:The ServicePackMinorVersion property indicates the minor version number of the service pack installed on the computer system. If no service pack has been installed, the value is zero. ServicePackMinorVersion is valid for computers running Windows 2000 and later (NULL otherwise).Version:The Version property indicates the version number of the operating system.Example: 4.0.
![Wmi win32 operatingsystem Wmi win32 operatingsystem](https://s3.manualzz.com/store/data/028767662_1-9a5d74dab087c69764a56c25d7282529.png)
Return to Main Page. PowerShell 5 or higher; Return to Top. Coding notes. For clarity and documentation, make sure to have #comments for various segments.