
'Bismillahir Rahmanir Rahim
'This is a SCRIPT for limited user to run a PROGRAM which required ADMIN right. In other word this 'script let users run a application on be half of another user.
'Code for Computing Relative Path.
Dim RPATH
Dim aRPATH
Set fso = CreateObject("Scripting.FileSystemObject")
RPATH = fso.GetParentFolderName(wscript.ScriptFullName)
'Setup Files required in the followng line.
aRPATH = RPATH & "\some-setup-files-here"
'Code for requesting a program to run as ADMIN
Dim oShell
set oShell= Wscript.CreateObject("WScript.Shell")
'Put desire user name in the following line
oShell.Run "runas /noprofile /user:administrator "& Chr(34) _
& aRPATH & Chr(34)
WScript.Sleep 100
'ADMIN PASSWORD/user password required in the following line.
oShell.Sendkeys "admin-password-here~"
Wscript.Quit
'Note that the execiutable file & this VB Script need to remain in same directory.
------------------------Script End----------------------------
Now next part would be to encode the VBS code to VBE to secure the from viewing. For this MS Script Encoder might help & this script encoder only works up to Windows XP. I think the following link might be helpful to go ahead if someone fell interest on it...
http://xinn.org/RunasVBS.html
No comments:
Post a Comment