Python Check Windows Server Version
Solution 1:
You could use the GetVersionEx Win32 API and check the value of wProductType
to differentiate.
Check out the Python for Windows extension package.
VER_NT_DOMAIN_CONTROLLER 0x0000002
The system is a domain controller and the operating system is Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
VER_NT_SERVER 0x0000003
The operating system is Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
Note that a server that is also a domain controller is reported as VER_NT_DOMAIN_CONTROLLER, not VER_NT_SERVER.
VER_NT_WORKSTATION 0x0000001
The operating system is Windows Vista, Windows XP Professional, Windows XP Home Edition, or Windows 2000 Professional.
Solution 2:
Try fetching it using WMI Win32_OperatingSystem
class (ProductType
is 3
on server systems). Scriptomatic can generate Python code for that.
Post a Comment for "Python Check Windows Server Version"