HTA - Mutliple questions about using WScript.Shell's Run Method and control.exe
- From: internetsavant@xxxxxxxxx
- Date: 1 Mar 2007 21:16:33 -0800
I wrote an HTA to simplify the lives of administrators who work in a
LUA environment (one normal account, one admin account used for admin
tasks). Basically, you execute a "web page" that you authenticate
your "admin" account with and as long as that web page remains open,
you can click links, configure links, or just run arbitrary files from
the interface and they will execute with admin rights because the HTA
is running under your admin account's security context. To make
things even more simpler, I created a tab that has common
administrative tools that, I personally use but assume that others use
as well. Regardless, most of those custom administrative tasks I've
tried to link use an argument and control.exe to bring up a different
Control Panel Applet (eg Add/Remove Progs, Add Hardware Wiz, etc), my
problem is that most work, some don't, and some bring up something
totally and completely different. Here is the specific section of
code in the HTA that actually runs the specified program:
[code]
' Above this code, the executable control.exe is held in tempArr(0)
and it's argument is in tempArr(1)
sCmdLine = Trim(tempArr(0)) & " " & Trim(tempArr(1))
'sCmdLine = "control.exe ncpa.cpl"
'MsgBox sCmdLine
oShell.Run sCmdLine, 9, False
[/code]
As you can see, I'm trimming array elements to rid myself of empty
space, I've even tried opening a Command Prompt Window running a
command from there, having it work, then copy and pasting the command
string into sCmdLine and it still doesn't work.
I must be misunderstanding some part of how control.exe or the Run
method works. So I guess my questions are:
1) Am I missing something simple or does someone know what I'm doing
wrong?
2) Is there a command line to kick off the entire Control Panel window
and not just the individual applets? ..I've tried "RunDll32.exe
shell32.dll,Control_RunDLL" but when my HTA executes that statement,
it brings up a Windows Explorer window starting at my root of C:
3) Is there a way to kick off explorer.exe using the Run method?
Right now, people who use my program just open up the Internet
Explorer link and then type in C: which takes them to a Windows
Explorer window but I heard that this is no longer supported in IE7 or
Vista so I need to find a work around for that hack.
Thank you for taking the time to read this long thread. I appreciate
any and all feedback possible. By the way, you can download and use
or view the source to this program at my site, here:
http://www.thepip3r.com/index.php?m=projects;hta;&p=runas_admin
.
- Follow-Ups:
- Re: HTA - Mutliple questions about using WScript.Shell's Run Method and control.exe
- From: E C H (He of too much code)
- Re: HTA - Mutliple questions about using WScript.Shell's Run Method and control.exe
- From: Ayush
- Re: HTA - Mutliple questions about using WScript.Shell's Run Method and control.exe
- Prev by Date: Re: vbscript msgbox 1023 character limit
- Next by Date: Re: HTA - Mutliple questions about using WScript.Shell's Run Method and control.exe
- Previous by thread: Re: VBScript runtime error '800a0006'
- Next by thread: Re: HTA - Mutliple questions about using WScript.Shell's Run Method and control.exe
- Index(es):
Relevant Pages
|