Evoke Vista/Win7 UAC

Author Message
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)
0
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. :)
 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9