core.ebusiness
-
Total Posts
:
17
- Scores: 0
-
Reward points
:
0
- Joined: 9/20/2010
- Location: North Jersey
-
Status: offline
|
Evoke Vista/Win7 UAC
Friday, October 29, 2010 7:14 AM
( permalink)
here is a vbscript i use in some of my apps to evoke the necessary UAC privileges to perform "heavy tasks" such as clearing the event log(s) or defragging without having to do the "Net user administrator /active:[yes|no]" hassle just to run a few simple commands: If WScript.Arguments.length =0 Then
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "wscript.exe", Chr(34) & _
WScript.ScriptFullName & Chr(34) & " Skiye", "", "runas", 1
Else
Set objShell = CreateObject("Shell.Application")
Set FSO = CreateObject("Scripting.FileSystemObject")
strPath = FSO.GetParentFolderName (WScript.ScriptFullName)
objShell.ShellExecute(strPath + "\Defrag.exe")
End If this particular example calls my defrag executable (in the same folder as this script) after making the UAC pop-up appear for the required permissions. the small string " Skiye" can be changed to pretty much anything you wish. i like to put my name in some things for fun. :)
|
|
|
|