Windows Vista Forums

Beginning scripting and have a problem
  1. #1


    MikeB Guest

    Beginning scripting and have a problem

    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.

      My System SpecsSystem Spec

  2. #2


    MikeB Guest

    Re: Beginning scripting and have a problem

    On Apr 16, 11:40*pm, MikeB <mpbr...@newsgroup> wrote:

    > 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:
    >
    Doh. Sorry, posting here must have been the equivalent of asking for
    help v from a colleague. I found multiple errors and fixed them, now
    it's working hunky-dory. Will teach me to try and learn stuff sitting
    in the doctor's waiting room.


      My System SpecsSystem Spec

  3. #3


    LikeToCode Guest

    Re: Beginning scripting and have a problem

    Glad you figured it out! Download the script56.chm help file it is a great
    resource and come back if you get stuck.
    http://www.microsoft.com/downloads/d...displaylang=en


      My System SpecsSystem Spec

  4. #4


    MikeB Guest

    Re: Beginning scripting and have a problem

    On Apr 17, 10:48*am, LikeToCode <LikeToC...@newsgroup>
    wrote:

    > Glad you figured it out! Download the script56.chm help file it is a great
    > resource and come back if you get stuck.http://www.microsoft.com/downloads/d...d=01592C48-207...
    Thank you - that was useful And will be useful in the future as well.


      My System SpecsSystem Spec

Beginning scripting and have a problem problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scheduled DOS scripting problem between servers Bob Server General 2 06 Nov 2009
Scripting network printer changes - problem Mark Clark VB Script 0 17 Aug 2009
Client - Server Scripting Problem Len VB Script 1 11 Jun 2008
The Beginning and the End (the process to) Brandon Shell PowerShell 0 04 Jan 2007