Anyone know how to create (or modify) a shortcut to enable the run-as administrator in vista or xp? (Programmatically, of course).
Professional Software Development Tools
Anyone know how to create (or modify) a shortcut to enable the run-as administrator in vista or xp? (Programmatically, of course).
(Click here to contact me)
Providing Independent Professional Consulting Services for
IndigoRose products, World Wide.
Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)
My shortcuts in Vista won't work unless the user clicks "Run as administrator". Is there any way to create such a shortcut with SetupFactory 7 ?
Thanks,
Paul.
This is a vbs script that does the runas programically. I got it from the WSNAME instructions.
fill in the user, Password and command varibles execute it.
Code:Option Explicit Const USER = "" UserName Const PASS = "" Password Const WSNAME_COMMANDLINE = "" Command Line Dim fso : Set fso = CreateObject("Scripting.FileSystemObject") Dim WSHShell : Set WshShell = CreateObject("WScript.Shell") Dim WshNetwork : Set WshNetwork = CreateObject("WScript.Network") Dim oDic : Set oDic = CreateObject("Scripting.Dictionary") Dim objArgs : Set objArgs = WScript.Arguments Dim oProcessEnv : Set oProcessEnv = WshShell.Environment("PROCESS") Dim sPathToRunAs, iReturnCode sPathToRunAs = oProcessEnv("SystemRoot")&"\System32\runas.exe" if Not fso.FileExists(sPathToRunAs) Then : WScript.Quit(1) 'Can't find RunAs iReturnCode=WshShell.Run("runas /user:" & USER & " " & CHR(34) & WSNAME_COMMANDLINE & CHR(34), 2, FALSE) Wscript.Sleep 40 ' Time for window to open. WshShell.AppActivate(sPathToRunAs)' Activate the Window WSHShell.SendKeys PASS & "~" ' Send the password