Microsoft Windows Vista Community Forums - Vistaheads
Recommended Download



Welcome to the Microsoft Windows Vista Community Forums - Vistaheads, YOUR Largest Resource for Windows Vista related information.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so , join our community today!

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

Driver Scanner

Running an HTA or WSH script as administrator

microsoft.public.windows.vista.security






Speedup My PC
Reply
  #1 (permalink)  
Old 01-05-2007
 

Posts: n/a
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.


Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-05-2007
=?Utf-8?B?SmVzcGVy?=
 

Posts: n/a
RE: 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?

"m.piceni@newsgroup.nospam" 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.
>
>
>

Reply With Quote
  #3 (permalink)  
Old 01-05-2007
=?Utf-8?B?SmVzcGVy?=
 

Posts: n/a
RE: 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?
>
> "m.piceni@newsgroup.nospam" 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.
> >
> >
> >

Reply With Quote
  #4 (permalink)  
Old 01-10-2007
 

Posts: n/a
Re: 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" <Jesper@discussions.microsoft.com> ha scritto nel messaggio
news:488DBE68-8D45-4197-BD80-620010925102@microsoft.com...
> 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?
>>
>> "m.piceni@newsgroup.nospam" 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.
>> >
>> >
>> >



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

vB 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
Delete Administrator Account? =?Utf-8?B?TWNHdXl3ZXI=?= microsoft.public.windows.vista.administration accounts passwords 7 03-11-2007 15:10
Re: Login Script Problems =?Utf-8?B?U2hhbmU=?= microsoft.public.windows.vista.networking sharing 1 01-18-2007 15:38
Question on running priviledge? Polaris microsoft.public.windows.vista.security 4 12-20-2006 10:23
ADSI Schema Cache Download at login script =?Utf-8?B?UmljYXJkIFBpw7FvbA==?= microsoft.public.windows.vista.networking sharing 0 12-19-2006 13:38
Administrator account with *full* rights? Bill Hobson microsoft.public.windows.vista.security 8 12-15-2006 16:02




All times are GMT +1. The time now is 04:01.




Driver Scanner - Free Scan Now

Vistaheads.com is part of the Heads Network. See also XPHeads.com , Win7Heads.com and Win8Heads.com.


Design by Vjacheslav Trushkin for phpBBStyles.com.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.0 RC 2

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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120