>>> import sys
>>> sys.getwindowsversion()
(5, 1, 2600, 2, 'Service Pack 2')
>>> import platform as pl
>>> pl.platform()
'Windows-XP-5.1.2600-SP2'
>>> pl.system()
'Windows'
>>> pl.release()
'XP'
>>> pl.version()
'5.1.2600'
You got the concept, now convert it into script.