Results 1 to 5 of 5

Thread: Issues when launching a vbscript file from hta interface file

  1. #1
    Hari Guest

    Issues when launching a vbscript file from hta interface file

    Hi,

    Have you ever came across issues when u launch a vbscript file from hta
    interface file on x64 OS
    My script involves some registry key reads and when I double click the vbs
    file or lauch it from cmd it works fine , but when I lauch it from an hta
    interface, the registry reads incorrectly and the output of registry keys
    says nill or gives me an incorrect value.
    command I used to launch vbs file from hta interface file is
    "c:\windows\system32\wscript.exe path\file.vbs"

    Same script and same interface file is working fine on a 32 bit OS.
    not for all registry keys but for some particular registry keys
    Eg:
    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    NT\CurrentVersion\Winlogon\AllocateDASD

    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    NT\CurrentVersion\Winlogon\AllocateCDRoms

    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    NT\CurrentVersion\Winlogon\AllocateFloppies

    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    NT\CurrentVersion\Winlogon\CachedLogonsCount

    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    NT\CurrentVersion\Winlogon\PasswordExpiryWarning

    Please let me know if we have any solution for this.
    Thanks in advance!!

  2. #2
    Hari Guest

    RE: Issues when launching a vbscript file from hta interface file



    "Hari" wrote:

    > Hi,
    >
    > Have you ever came across issues when u launch a vbscript file from hta
    > interface file on x64 OS
    > My script involves some registry key reads and when I double click the vbs
    > file or lauch it from cmd it works fine , but when I lauch it from an hta
    > interface, the registry reads incorrectly and the output of registry keys
    > says nill or gives me an incorrect value.
    > command I used to launch vbs file from hta interface file is
    > "c:\windows\system32\wscript.exe path\file.vbs"
    >
    > Same script and same interface file is working fine on a 32 bit OS.
    > not for all registry keys but for some particular registry keys
    > Eg:
    > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    > NT\CurrentVersion\Winlogon\AllocateDASD
    >
    > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    > NT\CurrentVersion\Winlogon\AllocateCDRoms
    >
    > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    > NT\CurrentVersion\Winlogon\AllocateFloppies
    >
    > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    > NT\CurrentVersion\Winlogon\CachedLogonsCount
    >
    > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    > NT\CurrentVersion\Winlogon\PasswordExpiryWarning
    >
    > Please let me know if we have any solution for this.
    > Thanks in advance!!


    Please find below the code for the hta and vbs file ..please let me know is
    we have a any solution for this..This code works fine with 32 bit OS and
    gives me a reg read error when I run in it x64 bit OS..Thanks in advance!!!

    code for hta

    <HTML>
    <HEAD>
    <TITLE>regread</TITLE>
    <script language="vbscript">

    sub window_onload()

    set wshell = createobject("wscript.shell")
    wshell.run "C:\windows\system32\wscript.exe C:\regread.vbs"

    end sub

    </script>
    </head>
    <body>
    </body>
    </html>

    code for regread.vbs file

    Set Objreg = Createobject("Wscript.shell")
    regvalue = objreg.regread("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    NT\CurrentVersion\Winlogon\AllocateDASD") 'Reading registry value

    msgbox regvalue


  3. #3
    T Lavedas Guest

    Re: Issues when launching a vbscript file from hta interface file

    On Apr 14, 11:21 am, Hari <H...@discussions.microsoft.com> wrote:
    > "Hari" wrote:
    > > Hi,

    >
    > > Have you ever came across issues when u launch a vbscript file from hta
    > > interface file on x64 OS
    > > My script involves some registry key reads and when I double click the vbs
    > > file or lauch it from cmd it works fine , but when I lauch it from an hta
    > > interface, the registry reads incorrectly and the output of registry keys
    > > says nill or gives me an incorrect value.
    > > command I used to launch vbs file from hta interface file is
    > > "c:\windows\system32\wscript.exe path\file.vbs"

    >
    > > Same script and same interface file is working fine on a 32 bit OS.
    > > not for all registry keys but for some particular registry keys
    > > Eg:
    > > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    > > NT\CurrentVersion\Winlogon\AllocateDASD

    >
    > > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    > > NT\CurrentVersion\Winlogon\AllocateCDRoms

    >
    > > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    > > NT\CurrentVersion\Winlogon\AllocateFloppies

    >
    > > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    > > NT\CurrentVersion\Winlogon\CachedLogonsCount

    >
    > > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    > > NT\CurrentVersion\Winlogon\PasswordExpiryWarning

    >
    > > Please let me know if we have any solution for this.
    > > Thanks in advance!!

    >
    > Please find below the code for the hta and vbs file ..please let me know is
    > we have a any solution for this..This code works fine with 32 bit OS and
    > gives me a reg read error when I run in it x64 bit OS..Thanks in advance!!!
    >
    > code for hta
    >
    > <HTML>
    > <HEAD>
    > <TITLE>regread</TITLE>
    > <script language="vbscript">
    >
    > sub window_onload()
    >
    > set wshell = createobject("wscript.shell")
    > wshell.run "C:\windows\system32\wscript.exe C:\regread.vbs"
    >
    > end sub
    >
    > </script>
    > </head>
    > <body>
    > </body>
    > </html>
    >
    > code for regread.vbs file
    >
    > Set Objreg = Createobject("Wscript.shell")
    > regvalue = objreg.regread("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    > NT\CurrentVersion\Winlogon\AllocateDASD") 'Reading registry value
    >
    > msgbox regvalue


    I believe the 64 bit compliant wscript.exe host is in a different
    place on 64 bit OSs. At least, that's what I've read, not having
    encounterd a 64 bit OS yet. That is, the host for 32 bit and 64 bit
    are different programs. So, to make your solution work, you'll need
    to determing which host is appropriate and alter the path to the host
    appropriately. Or possibly rely on the system setup to associate the
    script properly, thus ...

    createobject("wscript.shell").run "C:\regread.vbs"

    However, my question is why are you using an external script - and
    it's attendant problems? Why not execute the RegRead directly in the
    HTA?

    Tom Lavedas
    ***********
    http://there.is.no.more/tglbatch/

  4. #4
    Alex K. Angelopoulos Guest

    Re: Issues when launching a vbscript file from hta interface file

    Tom outlined the correct issue here, especially with the use of an HTA and
    then a script launched separately. On a 64-bit OS, there is registry data
    stored in different locations and read differently by software depending on
    whether it is a 32-bit or 64-bit app checking for it and whether the data
    was written by 32 or 64-bit apps.

    Comments on how this works below, but first: on the 64-bit system, can you
    confirm via Regedit that the data exists in the registry in the expected
    location? First try the expected location, under

    HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon

    Then check the 32-bit node, under

    HKLM\Software\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Winlogon

    File locations: the System32 folder is "the" System folder for any OS
    bitness, for longstanding reasons having to do with the adoption of that
    folder when 16-bit Windows was going away. So on a 64-bit OS, that's "the"
    system folder. The 32-bit versions of system files are kept in SysWOW64.
    This isn't a guarantee, though, depending on what you're using and how.
    Since many ActiveX controls were never made available in 64-bit versions,
    HTAs are launched in the 32-bit MSHTA by default (the same applies to 32-bit
    IE, which is the default host for Internet URLs on x64 Windows). The
    operating system _may_ be redirecting the path for launch automatically to
    the 32-bit WSH host in SysWOW64 - I can't be sure, since I don't have an HTA
    wrapper set up for easy testing right at this moment. In this particular
    case, I expect that this isn't happening; I believe what may be occurring is
    that you _are_ launching the 64-bit WSH, but the registry data is present
    under the Wow6432Node path instead of where you expect it to be.

    "T Lavedas" <tglbatch@cox.net> wrote in message
    news:5cb3dc33-d867-4a10-b91a-96908f2eb915@n11g2000vba.googlegroups.com...
    > On Apr 14, 11:21 am, Hari <H...@discussions.microsoft.com> wrote:
    >> "Hari" wrote:
    >> > Hi,

    >>
    >> > Have you ever came across issues when u launch a vbscript file from hta
    >> > interface file on x64 OS
    >> > My script involves some registry key reads and when I double click the
    >> > vbs
    >> > file or lauch it from cmd it works fine , but when I lauch it from an
    >> > hta
    >> > interface, the registry reads incorrectly and the output of registry
    >> > keys
    >> > says nill or gives me an incorrect value.
    >> > command I used to launch vbs file from hta interface file is
    >> > "c:\windows\system32\wscript.exe path\file.vbs"

    >>
    >> > Same script and same interface file is working fine on a 32 bit OS.
    >> > not for all registry keys but for some particular registry keys
    >> > Eg:
    >> > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    >> > NT\CurrentVersion\Winlogon\AllocateDASD

    >>
    >> > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    >> > NT\CurrentVersion\Winlogon\AllocateCDRoms

    >>
    >> > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    >> > NT\CurrentVersion\Winlogon\AllocateFloppies

    >>
    >> > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    >> > NT\CurrentVersion\Winlogon\CachedLogonsCount

    >>
    >> > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    >> > NT\CurrentVersion\Winlogon\PasswordExpiryWarning

    >>
    >> > Please let me know if we have any solution for this.
    >> > Thanks in advance!!

    >>
    >> Please find below the code for the hta and vbs file ..please let me know
    >> is
    >> we have a any solution for this..This code works fine with 32 bit OS and
    >> gives me a reg read error when I run in it x64 bit OS..Thanks in
    >> advance!!!
    >>
    >> code for hta
    >>
    >> <HTML>
    >> <HEAD>
    >> <TITLE>regread</TITLE>
    >> <script language="vbscript">
    >>
    >> sub window_onload()
    >>
    >> set wshell = createobject("wscript.shell")
    >> wshell.run "C:\windows\system32\wscript.exe C:\regread.vbs"
    >>
    >> end sub
    >>
    >> </script>
    >> </head>
    >> <body>
    >> </body>
    >> </html>
    >>
    >> code for regread.vbs file
    >>
    >> Set Objreg = Createobject("Wscript.shell")
    >> regvalue = objreg.regread("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
    >> NT\CurrentVersion\Winlogon\AllocateDASD") 'Reading registry value
    >>
    >> msgbox regvalue

    >
    > I believe the 64 bit compliant wscript.exe host is in a different
    > place on 64 bit OSs. At least, that's what I've read, not having
    > encounterd a 64 bit OS yet. That is, the host for 32 bit and 64 bit
    > are different programs. So, to make your solution work, you'll need
    > to determing which host is appropriate and alter the path to the host
    > appropriately. Or possibly rely on the system setup to associate the
    > script properly, thus ...
    >
    > createobject("wscript.shell").run "C:\regread.vbs"
    >
    > However, my question is why are you using an external script - and
    > it's attendant problems? Why not execute the RegRead directly in the
    > HTA?
    >
    > Tom Lavedas
    > ***********
    > http://there.is.no.more/tglbatch/



  5. #5
    Join Date
    Mar 2012
    Posts
    1

    Re: Issues when launching a vbscript file from hta interface file

    I had the exact same issue... Resolution for running 32 bit apps to edit 64 bit OS reg settings from VBS or other 32 bit app is SysNative!

    When you launch the VBS from HTA, Call the WSCRIPT.exe like this

    Shell.Run "%systemroot%\sysnative\Wscript.exe"
    This should allow you to edit 64 bit native reg keys from an app launched from a 32 bit shell.

    Hope this helps...

Similar Threads

  1. How to run a .bat file with VBScript ?
    By troy in forum Software Development
    Replies: 8
    Last Post: 29-06-2012, 10:55 AM
  2. VBScript to split a text file evenly in three
    By Kazz013 in forum Software Development
    Replies: 3
    Last Post: 16-12-2010, 06:35 PM
  3. Vbscript to find latest file
    By BoanHed in forum Software Development
    Replies: 3
    Last Post: 23-11-2009, 08:38 AM
  4. What happens when you drag and drop a file on top of a vbscript
    By Dharmavira in forum Software Development
    Replies: 2
    Last Post: 01-06-2009, 10:00 PM
  5. How can i drag and drop another file on top of the VBScript file
    By Dharmesh Arora in forum Software Development
    Replies: 2
    Last Post: 01-06-2009, 09:53 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,429,511.09155 seconds with 17 queries