Solved

Need users to run HTA as admin

Posted on 2011-03-04
6
1,611 Views
Last Modified: 2012-05-11
Hi again!

I need to run HTA vbscripts as an domain administrator, so i can give tools to my coworkers and let them reset passwords etc. by the HTA. Need it plain and simple, best would be in the HTA.  
0
Comment
Question by:RowaldLaterveer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 11

Expert Comment

by:Tasmant
ID: 35037271
The simplest way should to delegate them the right to reset passwords (and other stuff you want they do) with their user account instead to write the domain administrator within the hta.
And as soon as they have the delegation, they could run the hta with their account to do the stuff, that will work.
0
 

Author Comment

by:RowaldLaterveer
ID: 35037441
Tasmant, i have created another user who has ad rights, i want to run the HTA with priviliges within the HTA (don't know how to encode... so yes, plain text, or create an exe). I know there is a "impersonate" function but that's it..
0
 

Author Comment

by:RowaldLaterveer
ID: 35057656
Ok, the price just went up..
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 65

Expert Comment

by:RobSampson
ID: 35062046
Hi, you can encode the VBScript portion of HTA files, but that may still not function the way you need it to:
http://blogs.technet.com/b/heyscriptingguy/archive/2006/03/09/how-can-i-encode-scripts-within-an-hta.aspx

For AD operations, you can use the OpenDSObject method to provide alternate credentials during LDAP binds.

Some way or another though, you're wanting to provide your domain admin rights to someone else....it sound like a very secure idea.

Maybe what you could do is create a VBS that uses PSExec to run the HTA, and runs:

Set objShell = CreateObject("WScript.Shell")
objShell.Run "\\server\share\psexec.exe -accepteula -i -u domain\admin -p password mshta.exe \\server\share\myhta.hta", 1, False

And then, convert that VBS to an EXE with VBS2EXE:
www.f2ko.de

Regards,

Rob.
0
 

Author Comment

by:RowaldLaterveer
ID: 35067892
Rob, i have tied the above, only the exe can't run an HTA, just the vbscript part. The code i am using is the code you helpded compiling to change passwords (HTA). PSEXEC maybe is an option, but i like to code it into the script.

The encode option won't work;
C:\script\encode>screnc /f /e htm wachtwoord.hta

Scripting encoder object ("Scripting.Encoder") failed on C:\script\encode\wachtwoord.hta

Is there no impersonation script? Or maybe a bat file to create with admin rights, wich can start the HTA?
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 35073344
If the VBScript didn't work, then this command in a batch file:
\\server\share\psexec.exe -accepteula -i -u domain\admin -p password mshta.exe \\server\share\myhta.hta

as long as the batch is run as admin, should work too.

Regards,

Rob.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question