|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Issues when launching a vbscript file from hta interface fileHave 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!!
Show quote
Hide quote
"Hari" wrote: Please find below the code for the hta and vbs file ..please let me know is > 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!! 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 On Apr 14, 11:21 am, Hari <H***@discussions.microsoft.com> wrote:
Show quoteHide quote > "Hari" wrote: I believe the 64 bit compliant wscript.exe host is in a different> > 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 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/ 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. Show quoteHide quote "T Lavedas" <tglba***@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/
Batch Script Text file parse
Drive Mapping in Server 2008 Schedule Defrag through GPO (non admin) Access protected folders using system account help with logon vbs script Query OU for disabled computers Script AD remove all members groups OU Re: Updating AD with a script Command to add registry entry !Around Variable Name! |
|||||||||||||||||||||||