I'm trying to get into understanding scripting and I have a book
"Microsoft Windows Scripting self-paced Learning Guide" by Ed Wilson.
The second example in the book is the following:
Option Explicit
'On Error Resume Next
Dim objShell
Dim regActiveComputerName, regComputerName, regHostName
Dim ActiveComputerName, ComputerName, HostName
regActiveComputerName = "HKLM\SYSTEM\CurrentControlSet\Control
\ComputerName\ActiveComputerName"
'Wscript.Echo regActiveComputerName
regComputerName = "HKLM\System\CurrentControlSet\" & _
"ComputerName\ActiveComutername\Computername\"
regHostName = "HKLM\System\CurrentControlSet\Control\" & _
"Services\Tcpip\Parameters\Hostname"
Set objShell = CreateObject("Wscript.Shell")
ActiveComputername = objShell.RegRead(regActiveComputerName)
Computername = objShell.RegRead(regComputerName)
HostName = objShell.RegRead(regHostName)
Wscript.Echo activeComputername & " is ActiveComputerName."
Wscript.Echo ComputerName & " is ComputerName."
Wscript.Echo HostName & " is host name."
If I try and run this on my Vista Ultimate system, I get a pop-up
error messsage saying:
"Error unable to open registry key"
The error code is 80070002 and the source is WshShell.RegRead.
I've verified that the key exists in my registry and have copied it
from the registry. Still same error. No hits on Google.
Any help?
Thanks a lot.



