Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Issues when launching a vbscript file from hta interface file

Reply
Thread Tools Display Modes

Issues when launching a vbscript file from hta interface file

 
 
Hari
Guest
Posts: n/a

 
      04-14-2009
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!!
 
Reply With Quote
 
 
 
 
Hari
Guest
Posts: n/a

 
      04-14-2009


"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\Micros oft\Windows
NT\CurrentVersion\Winlogon\AllocateDASD") 'Reading registry value

msgbox regvalue

 
Reply With Quote
 
Alex K. Angelopoulos
Guest
Posts: n/a

 
      04-14-2009
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" <> wrote in message
news:5cb3dc33-d867-4a10-b91a-...
> 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\Micros oft\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/


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Please Help !! VBscript convert my image/music file into VBscript file Dave Patrick Scripting 0 12-10-2006 01:37 PM
null document.location.search in ie7 when launching local file howard_goldstein Internet Explorer 1 10-06-2006 04:37 PM
Pre-rc1 launching iso file dr_oracles Windows Vista General Discussion 5 08-31-2006 12:56 AM
Pre-rc1 launching iso file dr_oracles Windows Vista General Discussion 0 08-31-2006 12:18 AM
launching file sharing DCH Windows MSN Messenger 1 10-31-2003 07:11 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59