DeepSeed
-
Total Posts
:
61
- Scores: 0
-
Reward points
:
0
- Joined: 1/15/2009
-
Status: offline
|
HTA and VbScript applications. Run as Administrator?
Wednesday, January 27, 2010 6:21 AM
( permalink)
My scripts many times do things that need administrator access but the pop up fails to come up so they just epic fail. They all used to work on XP. When I try to set them to run as Administrator the option is always greyed out, I have looked in all three places where you can set this and its never available for .hta, .vbs, .bat, .exe or anything. I tried running explorer.exe as administrator and it still epic fails. I have tried everything I found posted and nothing seems to work, anyone figured this out yet or does everyone just use XP still?
|
|
|
|
faulkkev
-
Total Posts
:
593
- Scores: 13
-
Reward points
:
0
- Joined: 11/1/2005
- Location: Kansas City, MO
-
Status: offline
|
Re:HTA and VbScript applications. Run as Administrator?
Wednesday, January 27, 2010 7:06 AM
( permalink)
go to cmd.exe and run as administrator. then drag and drop your script into the cmd window and it will run under those credentials. You can specify cscript in the run as cmd as well. This is how I run all of mine that need elevated privileges.
|
|
|
|
DeepSeed
-
Total Posts
:
61
- Scores: 0
-
Reward points
:
0
- Joined: 1/15/2009
-
Status: offline
|
Re:HTA and VbScript applications. Run as Administrator?
Wednesday, January 27, 2010 10:43 AM
( permalink)
Hey, cool. thats a decent work around. Unfortunately my non-tech users are gonna be somewhat confused of why they need to take their HTA shortcut and drop it in a cmd window each time they need to run it. Is there anyway to make it more user friendly. I can start programming a message that pops up saying you are not running in administrative mode in case they forget I guess. Still seems redundant. I mean if the OS lets them do it through a cmd prompt why can't they use a shortcut?
|
|
|
|
faulkkev
-
Total Posts
:
593
- Scores: 13
-
Reward points
:
0
- Joined: 11/1/2005
- Location: Kansas City, MO
-
Status: offline
|
Re:HTA and VbScript applications. Run as Administrator?
Wednesday, January 27, 2010 11:18 AM
( permalink)
DeepSeed Hey, cool. thats a decent work around. Unfortunately my non-tech users are gonna be somewhat confused of why they need to take their HTA shortcut and drop it in a cmd window each time they need to run it. Is there anyway to make it more user friendly. I can start programming a message that pops up saying you are not running in administrative mode in case they forget I guess. Still seems redundant. I mean if the OS lets them do it through a cmd prompt why can't they use a shortcut? I was thinking this was just for you? What are the users doing? Is this a domain thing or a local permission thing?
|
|
|
|
DeepSeed
-
Total Posts
:
61
- Scores: 0
-
Reward points
:
0
- Joined: 1/15/2009
-
Status: offline
|
Re:HTA and VbScript applications. Run as Administrator?
Wednesday, January 27, 2010 11:39 AM
( permalink)
I build HTA applications for in house use on our domain. These are applications that let non-tech users do common (normally technical) tasks like restoring SQL databases, creating new IIS applications, etc with a very simple interface. The vbscript in the HTA programs does many things like creating text files in odd places, executing programs like osql.exe that need administrative rights. They work great on Windows XP in the environment I developed them in. I need to make sure they will work as we migrate to Windows 7.
|
|
|
|
faulkkev
-
Total Posts
:
593
- Scores: 13
-
Reward points
:
0
- Joined: 11/1/2005
- Location: Kansas City, MO
-
Status: offline
|
Re:HTA and VbScript applications. Run as Administrator?
Thursday, January 28, 2010 12:30 AM
( permalink)
I can't think of a way around it unless you give the user id's access to the data bases and IIS. Also they may need local adming rights it just depends. Otherwise they have to elevate up to run them if the task is a privileged command. you could create global groups and give rights that way maybe so those needing sql or iis can do with with regular ids and on the server end give the global group rights to do so.
|
|
|
|
mbouchard
-
Total Posts
:
2110
- Scores: 29
-
Reward points
:
0
- Joined: 5/15/2003
- Location: USA
-
Status: offline
|
Re:HTA and VbScript applications. Run as Administrator?
Thursday, January 28, 2010 12:33 AM
( permalink)
I can think of 2 options 1) create a BAT/CMD file and have it call the script. While this will allow you to elevate the to admin rights, it doesn't have a native admin check 2) create an AutoIT script and compile it into an exe. With AutoIT you can check if you have admin rights and it will show properly with Vista/7's UAC.. Here is an example, taken from an old script I used as a POC.
;Hide the Tool Tray icon
#NoTrayIcon
$CreateLogFile = "\\SERVER\AutoItUtilities\CreateLogFile\CreateLogFile.exe"
$installScriptPath = "\\SERVER\Standard\Adobe\Install Acrobat Reader.vbs"
$installScriptTitle = "Install Adobe Reader 7.0.7"
If IsAdmin() = 0 Then
MsgBox(0, "Local Admin Rights not detected", "Local Admin rights are required for this installs/updates to occur." & @CRLF _
& "Please login with Admin rights and try again.")
Exit
EndIf
If FileExists ($installScriptPath) Then
;Comment out the Run and uncomment the msgbox to test FileExists = True
;Msgbox ( 0,"Title","File is present")
Run ($CreateLogFile & " """ & $installScriptTitle & """")
Run ("wscript.Exe """ & $installScriptPath & """")
Else
Msgbox (16,"Error with " & @ScriptName,"You are unable to access the file *" & $installScriptPath & "*" & @CRLF & @CRLF _
& "Please contact the Administrator or your IT Liasion.")
Exit
EndIf
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
|
|
DeepSeed
-
Total Posts
:
61
- Scores: 0
-
Reward points
:
0
- Joined: 1/15/2009
-
Status: offline
|
Re:HTA and VbScript applications. Run as Administrator?
Thursday, January 28, 2010 4:45 AM
( permalink)
"Please login with admin rights"? Only the Administrator account has admin rights in Windows 7. A Domain user, even domain administrator can't obtain admin rights anymore in the way a administrator was defined in Windows XP. It feels much more like using Linux now, with a Super User called root that has rights no user could possibly have. Which is a horrible idea for Windows in my opinion. Anyways I think the click and drag is the best solution. Strange that it is possible with a click and drag but Microsoft doesn't want people simply being able to click an icon anymore. They must be trying to recoup for all the money they spent on carpal tunnel research and get more sales in their natural mice.
|
|
|
|
DeepSeed
-
Total Posts
:
61
- Scores: 0
-
Reward points
:
0
- Joined: 1/15/2009
-
Status: offline
|
Re:HTA and VbScript applications. Run as Administrator?
Thursday, January 28, 2010 4:47 AM
( permalink)
On another note, batch files do not run as administrator by default. Right click, go to properties, select the compatibility tab. "Run this program as ad administrator" is greyed out.
|
|
|
|
mbouchard
-
Total Posts
:
2110
- Scores: 29
-
Reward points
:
0
- Joined: 5/15/2003
- Location: USA
-
Status: offline
|
Re:HTA and VbScript applications. Run as Administrator?
Thursday, January 28, 2010 5:21 AM
( permalink)
DeepSeed "Please login with admin rights"? Only the Administrator account has admin rights in Windows 7. A Domain user, even domain administrator can't obtain admin rights anymore in the way a administrator was defined in Windows XP. It feels much more like using Linux now, with a Super User called root that has rights no user could possibly have. Which is a horrible idea for Windows in my opinion. Anyways I think the click and drag is the best solution. Strange that it is possible with a click and drag but Microsoft doesn't want people simply being able to click an icon anymore. They must be trying to recoup for all the money they spent on carpal tunnel research and get more sales in their natural mice. Click/Drag is an option but not something as intuitive for the non-tech people and those, it appears, are who the OP is tying to find a solution for. The Administrator group is still present in Windows 7 and I have not seen anything different, besides the Run as Administrator, with how admin rights work in Windows 7\Vista compared to XP. The AutoIT script I posted was only an example, would hope that the OP, if they used it, would rewrite the msgbox to better fit their environment. Of the 3 options available to the OP from this post, the most simplistic, from a non-tech perspective, is running from a bat file, and yes you still need to right click and run as admin. AutoIT gives you an isAdmin check. While the open CMD prompt and drag and drop works with no behind the scenes work needed. The first two options require some work to setup, the last option doesn't but for non-tech people may be problematic. Edit: Meant to add, on my PC (and a freshly setup Win7 test system) Run As Admin is not grayed out.
<message edited by mbouchard on Thursday, January 28, 2010 5:24 AM>
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
|
|
DeepSeed
-
Total Posts
:
61
- Scores: 0
-
Reward points
:
0
- Joined: 1/15/2009
-
Status: offline
|
Re:HTA and VbScript applications. Run as Administrator?
Thursday, January 28, 2010 5:35 AM
( permalink)
Well I can put an IsAdmin check right into my HTA with a simple vb script. And I will do that. Isn't there some way instead of right clicking everything and saying run as admin, or click and drag in the case of .hta files, etc to just click that damn icon.
|
|
|
|
mbouchard
-
Total Posts
:
2110
- Scores: 29
-
Reward points
:
0
- Joined: 5/15/2003
- Location: USA
-
Status: offline
|
Re:HTA and VbScript applications. Run as Administrator?
Thursday, January 28, 2010 5:46 AM
( permalink)
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
|
|
DeepSeed
-
Total Posts
:
61
- Scores: 0
-
Reward points
:
0
- Joined: 1/15/2009
-
Status: offline
|
Re:HTA and VbScript applications. Run as Administrator?
Thursday, January 28, 2010 6:29 AM
( permalink)
Tried that, it does not make programs run as administrator. Can't even copy a text file to the c drive with UAC off.
|
|
|
|
everstrike
-
Total Posts
:
12
- Scores: 0
-
Reward points
:
0
- Joined: 4/12/2007
-
Status: offline
|
Re:HTA and VbScript applications. Run as Administrator?
Wednesday, November 30, 2011 8:29 PM
( permalink)
Another workaround for VBS and HTA scripts - to compile them to EXE using ExeScript and enable the following option: "Run as Administrator". Don't forget to add all additional files to resources for HTA script.
|
|
|
|