this is what I use - kudos to Bryce...It gives the OSversion, subversion (a,b, etc) and Service Pack version
sdetect
$pp = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductType")
$SubVer = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","SubVersionNumber")
$SPNbr = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion")
select
Case @inwin=1 and $pp<>"WinNT" and @dos=5.0
$os="Windows 2000 Server"
Case @inwin=1 and $pp="WinNT" and @dos=5.0
$os="Windows 2000 Professional Workstation"
Case @inwin=1 and $pp="LANMANNT"
$os="Windows NT 4.0 $SPNbr Domain Controller"
Case @inwin=1 and $pp="ServerNT"
$os="Windows NT 4.0 $SPNbr Member Server"
Case @inwin=1 and $pp="WinNT"
$os="Windows NT 4.0 $SPNbr Workstation"
Case @inwin=2 and @dos="4.10"
$os="Windows 98 $Subver"
Case @inwin=2 and @dos="4.0"
$os="Windows 95 $Subver"
Case 1
$os="undetermined" ; This value will be set if no other EXACT match is made
endselect