
I could have them RunAs and give them an admin password, but that would sorta defeat the entire purpose (they'd use the password for other stuff I don't want them fidding with).
Anyway, anyone deal with issues like this? Have any suggestions?
i have a little "yts_runas.exe" that i created for a similar purpose to this ... it is still in testing and development, and you may need to be a bit creative to use it in your own environment, but it should at least help you out.cgallery wrote:I could have them RunAs and give them an admin password
Might as well just post the core of the code here ... not much to it really ...JDaus wrote:cgallery wrote:i will PM you the autoit code that i have, so that you can have a play around
Code: Select all
$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc"); Install a custom error handler
; Init objects
Const $ADS_UF_DONT_EXPIRE_PASSWD = 0X10000
Const $ADS_UF_PASSWD_CANT_CHANGE = 0X40
Global $V2M_EventDisplay, $DebugLevel = 10
$AppIni = @ScriptDir & "\yts_runas.ini" ;can be a network drive if you want ... needs to be readable by user ...
$UserName = "YTS_RunAs" ;change to your admin username
$Password = "YTS_RunAsPassword" ;change to your admin password
If IniRead($AppIni, "Common", "INIVersion", "") = "" Then
MsgBox(0, "New Setup", "Please edit the INI (" & $AppIni & ") to setup the app you wish to launch", 10)
IniWrite($AppIni, "Common", "INIVersion", "1")
IniWrite($AppIni, "App", "Name_1", "")
IniWrite($AppIni, "App", "Dir_1", "")
IniWrite($AppIni, "App", "EXE_1", "")
RunWait(@ComSpec & " /C notepad.exe " & $AppIni, @ScriptDir)
Else
RunAs($UserName, "", $Password, 4, IniRead($AppIni, "App", "Dir_1", "") & "" & IniRead($AppIni, "App", "EXE_1", ""), IniRead($AppIni, "App", "Dir_1", ""))
Sleep(5000)
EndIf