Just a thought... is this a 64bit OS?

At the top of the script, try...
 Code:
$RC=setoption("WOW64AlternateRegView","On")