A Windows Vista forum. Vista Banter

Welcome to Vista Banter.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to ask questions and reply to others posts, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

Go Back   Home » Vista Banter forum » Microsoft Windows Vista » Security and Windows Vista
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Security and Windows Vista A forum for discussion on security issues with Windows Vista. (microsoft.public.windows.vista.security)

Running an HTA or WSH script as administrator



 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old January 5th 07, 08:58 AM posted to microsoft.public.windows.vista.security
Guest
 
Posts: n/a
Default Running an HTA or WSH script as administrator

Hi,

does anyone knows how to run an HTA file as administrator with UAC enabled ?
HTA doensn't have the "Run as administrator" in the context menu, doesn't
have the compatibility tab in the properties and seems to completely ignore
a myapp.hta.manifest file. The runas command with /trustlevel:unrestricted
doesn't work. I cannot runas built-in administrator because this is disabled
by default (and it's better to leave disabled)
I even tryed to run cmd as administrator and run the HTA from there, but it
still don't have administrative rights (I think it creates a new context
with lower trustlevel).
I've the same problem with WSH scripts (i.e. VBS).
I'm not in a domain, so I cannot use group policy.

Thanks for any help.

Massimo.


  #2 (permalink)  
Old January 5th 07, 05:36 PM posted to microsoft.public.windows.vista.security
Jesper
external usenet poster
 
Posts: 839
Default Running an HTA or WSH script as administrator

HTAs, and also scripts, are not applications per se. Therefore, they do not
have the "Run as administrator" in the context menu. They are simply scripts,
interpreted by mshta.exe and cscript.exe.

When I run an HTA from an elevated command prompt, however, mshta.exe is a
full admin. How are you determining that it is not in your case?

" wrote:

Hi,

does anyone knows how to run an HTA file as administrator with UAC enabled ?
HTA doensn't have the "Run as administrator" in the context menu, doesn't
have the compatibility tab in the properties and seems to completely ignore
a myapp.hta.manifest file. The runas command with /trustlevel:unrestricted
doesn't work. I cannot runas built-in administrator because this is disabled
by default (and it's better to leave disabled)
I even tryed to run cmd as administrator and run the HTA from there, but it
still don't have administrative rights (I think it creates a new context
with lower trustlevel).
I've the same problem with WSH scripts (i.e. VBS).
I'm not in a domain, so I cannot use group policy.

Thanks for any help.

Massimo.



  #3 (permalink)  
Old January 5th 07, 05:41 PM posted to microsoft.public.windows.vista.security
Jesper
external usenet poster
 
Posts: 839
Default Running an HTA or WSH script as administrator

Forgot to mention, if you want to add the "Run as administrator" item to the
context menu for HTA files or scripts you can do that by hacking the
registry. Here is a reg script that does it for HTA files:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\htafile\shell\runas]

[HKEY_CLASSES_ROOT\htafile\shell\runas\command]
@="C:\\Windows\\system32\\mshta.exe \"%1\" %*"
"IsolatedCommand"="C:\\Windows\\system32\\mshta.ex e \"%1\" %*"



"Jesper" wrote:

HTAs, and also scripts, are not applications per se. Therefore, they do not
have the "Run as administrator" in the context menu. They are simply scripts,
interpreted by mshta.exe and cscript.exe.

When I run an HTA from an elevated command prompt, however, mshta.exe is a
full admin. How are you determining that it is not in your case?

" wrote:

Hi,

does anyone knows how to run an HTA file as administrator with UAC enabled ?
HTA doensn't have the "Run as administrator" in the context menu, doesn't
have the compatibility tab in the properties and seems to completely ignore
a myapp.hta.manifest file. The runas command with /trustlevel:unrestricted
doesn't work. I cannot runas built-in administrator because this is disabled
by default (and it's better to leave disabled)
I even tryed to run cmd as administrator and run the HTA from there, but it
still don't have administrative rights (I think it creates a new context
with lower trustlevel).
I've the same problem with WSH scripts (i.e. VBS).
I'm not in a domain, so I cannot use group policy.

Thanks for any help.

Massimo.



  #4 (permalink)  
Old January 10th 07, 03:49 PM posted to microsoft.public.windows.vista.security
Guest
 
Posts: n/a
Default Running an HTA or WSH script as administrator

Hi Jesper,

the REG script works fine. Using it you can run an HTA in elevated mode from
a script, in this simple way:

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\")
Set objFolderItem = objFolder.ParseName("myhta.hta")
objFolderItem.InvokeVerb "runas"

This will bring up the Vista confirmation box and then run c:\myhta.hta in
elevated mode.
This will run on any executable that has the "Run as Administrator" in the
context menu (BAT, COM, EXE, etc.)

Thanks.

Massimo.

"Jesper" ha scritto nel messaggio
...
Forgot to mention, if you want to add the "Run as administrator" item to
the
context menu for HTA files or scripts you can do that by hacking the
registry. Here is a reg script that does it for HTA files:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\htafile\shell\runas]

[HKEY_CLASSES_ROOT\htafile\shell\runas\command]
@="C:\\Windows\\system32\\mshta.exe \"%1\" %*"
"IsolatedCommand"="C:\\Windows\\system32\\mshta.ex e \"%1\" %*"



"Jesper" wrote:

HTAs, and also scripts, are not applications per se. Therefore, they do
not
have the "Run as administrator" in the context menu. They are simply
scripts,
interpreted by mshta.exe and cscript.exe.

When I run an HTA from an elevated command prompt, however, mshta.exe is
a
full admin. How are you determining that it is not in your case?

" wrote:

Hi,

does anyone knows how to run an HTA file as administrator with UAC
enabled ?
HTA doensn't have the "Run as administrator" in the context menu,
doesn't
have the compatibility tab in the properties and seems to completely
ignore
a myapp.hta.manifest file. The runas command with
/trustlevel:unrestricted
doesn't work. I cannot runas built-in administrator because this is
disabled
by default (and it's better to leave disabled)
I even tryed to run cmd as administrator and run the HTA from there,
but it
still don't have administrative rights (I think it creates a new
context
with lower trustlevel).
I've the same problem with WSH scripts (i.e. VBS).
I'm not in a domain, so I cannot use group policy.

Thanks for any help.

Massimo.





 




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

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



All times are GMT. The time now is 06:09 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Optimization by vBSEO 3.0.0 RC6
Copyright ©2004-2024 Vista Banter.
The comments are property of their posters.