I have similar code for change IP info. That code works fine without running autorun.exe as admin. I just use the RunAs and it works fine. Same concept for mapping a drive! Below is the code I used for that.
Code:
RunUID = TextFile.ReadToString("AutoPlay\\Content\\Common\\CommonA.dat"); RunPWD = TextFile.ReadToString("AutoPlay\\Content\\Common\\CommonP.dat"); INT = Input.GetText("Interface1"); qut = Input.GetText("qut"); set = Input.SetText("ALL", "netsh interface ip show address " ..qut ..INT ..qut.. " >c:\\TSAT\\GetIP.txt"); get = Input.GetText("ALL"); TextFile.WriteFromString("AutoPlay\\Docs\\SystemLog.txt", System.GetDate(DATE_FMT_US).." | "..System.GetTime(TIME_FMT_AMPM).." | Get Other IP of Interfaces was selected\r\n", true); -- Check to see if a specific folder exists. does_exist = Input.GetText(INT); if INT == "" then Dialog.Message("Notice", "Local Area Connection cannot be blank! Choose a connection from the Available Interfaces.", MB_OK, MB_ICONINFORMATION); elseif does_exist then TextFile.WriteFromString("C:\\TSAT\\GetIP.bat", get.. "", false); File.RunAs("C:\\TSAT\\GetIP.bat", "", "", SW_HIDE, false, RunUID, RunPWD, "", LOGON_NO_OPTION, nil, nil); uSelectedText = TextFile.ReadToString("C:\\Windows\\TSAT\\GetIP.txt"); end if INT == "Interface" then Dialog.Message("Notice", "You cannot use Interface for Local Area Connection! Choose a connection from the Available Interfaces.", MB_OK, MB_ICONINFORMATION); elseif does_exist then TextFile.WriteFromString("C:\\TSAT\\GetIP.bat", get.. "", false); File.RunAs("C:\\TSAT\\GetIP.bat", "", "", SW_HIDE, false, RunUID, RunPWD, "", LOGON_NO_OPTION, nil, nil); uSelectedText = TextFile.ReadToString("C:\\Windows\\TSAT\\GetIP.txt"); end
Comment