Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Administration > HTA's in Vista

Reply
Thread Tools Display Modes

HTA's in Vista

 
 
Pete Gomersall
Guest
Posts: n/a

 
      11-17-2006
Hi,
Does anyone know why HTA code that previously worked in XP doesn't in Vista?
For example this code taken from the HTA Developers Center on Script Center
works fine in XP and also on Vista if called within a .vbs file however it
doesn't work in Vista when used in a HTA:
Sub GetOSVersion
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
Msgbox objOperatingSystem.Caption & " " & _
objOperatingSystem.Version
Next
End Sub

I suspect a change in the security model for the interaction of mshta and IE
7 (protected mode etc) but I am guessing here.
It would be great if someone from MSFTcould provide a link to documentation
on HTA's and Vista.

 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a

 
      11-17-2006
Pete Gomersall wrote:
> Hi,
> Does anyone know why HTA code that previously worked in XP doesn't in
> Vista? For example this code taken from the HTA Developers Center on
> Script Center works fine in XP and also on Vista if called within a
> .vbs file however it doesn't work in Vista when used in a HTA:


I have not even installed Vista so I cannot answer your question.

However, I can say that the likelihood of anyone being able to help will
be limited by your failure to define "doesn't work". What is the failure
mode? Machine crash? Error message? Incorrect results? Acts as if it
does something but nothing happens?
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
Pete Gomersall
Guest
Posts: n/a

 
      11-17-2006
All,
For those of you that cannot see the point of the question:
What are the security differences between running HTA's on XP and Vista (as
I suspect that the inherent difference is because of changes in Vista's
security model - particularly IE 7's protected mode)?
Code that works fine in XP doesn't work (as far as I can determine it is
"just ignored" and fails silently without error, preventing any subsequent
lines to run).
For example this code in any HTA on Vista fails silently at the 3rd line,
the second msgBox never executes and no errors are returned.
msgBox "Blah, Blah!"
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
msgBox "Blah, Blah!"
The same code in a standard .vbs works fine.
Pete
"Bob Barrows [MVP]" <> wrote in message
news:...
> Pete Gomersall wrote:
>> Hi,
>> Does anyone know why HTA code that previously worked in XP doesn't in
>> Vista? For example this code taken from the HTA Developers Center on
>> Script Center works fine in XP and also on Vista if called within a
>> .vbs file however it doesn't work in Vista when used in a HTA:

>
> I have not even installed Vista so I cannot answer your question.
>
> However, I can say that the likelihood of anyone being able to help will
> be limited by your failure to define "doesn't work". What is the failure
> mode? Machine crash? Error message? Incorrect results? Acts as if it
> does something but nothing happens?
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>


 
Reply With Quote
 
Slim
Guest
Posts: n/a

 
      11-18-2006

"Pete Gomersall" <> wrote in message
news:784F69FB-166E-4CB6-9B72-...
> All,
> For those of you that cannot see the point of the question:
> What are the security differences between running HTA's on XP and Vista
> (as I suspect that the inherent difference is because of changes in
> Vista's security model - particularly IE 7's protected mode)?
> Code that works fine in XP doesn't work (as far as I can determine it is
> "just ignored" and fails silently without error, preventing any subsequent
> lines to run).
> For example this code in any HTA on Vista fails silently at the 3rd line,
> the second msgBox never executes and no errors are returned.
> msgBox "Blah, Blah!"
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
> "\root\cimv2")
> msgBox "Blah, Blah!"
> The same code in a standard .vbs works fine.
> Pete
> "Bob Barrows [MVP]" <> wrote in message
> news:...
>> Pete Gomersall wrote:
>>> Hi,
>>> Does anyone know why HTA code that previously worked in XP doesn't in
>>> Vista? For example this code taken from the HTA Developers Center on
>>> Script Center works fine in XP and also on Vista if called within a
>>> .vbs file however it doesn't work in Vista when used in a HTA:

>>
>> I have not even installed Vista so I cannot answer your question.
>>
>> However, I can say that the likelihood of anyone being able to help will
>> be limited by your failure to define "doesn't work". What is the failure
>> mode? Machine crash? Error message? Incorrect results? Acts as if it
>> does something but nothing happens?
>> --
>> Microsoft MVP -- ASP/ASP.NET
>> Please reply to the newsgroup. The email account listed in my From
>> header is my spam trap, so I don't check it very often. You will get a
>> quicker response by posting to the newsgroup.
>>
>>

>


I have never used Vista either
But I would suggest that HTA scrips are not enabled by default


 
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




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