2

I want to make a script in python which can differentiate between windows server and windows desktop. OS and platform are giving same result for both, is there any way to differ them on the basis of python script? The main problem I'm facing is script is giving same output for server and desktop no difference it's showing.

mad-eye
  • 19
  • 4
  • Possible duplicate of [Python: What OS am I running on?](https://stackoverflow.com/questions/1854/python-what-os-am-i-running-on) – Erik Šťastný Jan 18 '19 at 07:28
  • Possible duplicate of [How can I find the current OS in Python?](https://stackoverflow.com/questions/110362/how-can-i-find-the-current-os-in-python) – Bira Jan 18 '19 at 07:28

1 Answers1

0

Use platform.release()

Ex:

import platform
print(platform.release())

if OS is Desktop:

7

If OS is Server:

2008ServerR2
Rakesh
  • 81,458
  • 17
  • 76
  • 113
  • I already tried this in windows server and it's giving output only "10" in windows server 2016. The main problem I'm facing is script is giving same output for server and desktop no difference it's showing. – mad-eye Jan 18 '19 at 10:08