Try using this:
 Code:
$osversion = ReadValue("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentVersion")