lansti Posted December 18, 2011 Share Posted December 18, 2011 Hi. I have this program that has to be run as an administrator. For this i have created a new shortcut that runs this commando line: Local $sUserName = "administrator" Local $sPassword = "password" $programPath = @ProgramFilesDir & "\folder\program.exe" if FileExists($programPath) Then runas($sUserName, @LogonDomain, $sPassword, 0, $programPath, @SystemDir) Else MsgBox(48,$MsgTitle,"Program not installed.",3) EndIf Exit But i need to map a drive as this administrator user as well, and not as the logged on user. I hoped that this would help, in the IF sentence right above runas program as administrato: runas($sUserName, @LogonDomain, $sPassword, 0, DriveMapAdd("i:", "\\server\share", 0, "username to share", "password to share")) But it seems that it map this drive as the logged on user... I can verify that by opening CMD with the administrator user and "net use". no mapped drive will appear. if i manually map the drive in this CMD, the program works, and i can verfy the mapping in the same CMD Any suggestions? Link to comment Share on other sites More sharing options...
willichan Posted December 19, 2011 Share Posted December 19, 2011 Do you already have a connection to that same server as the logged on user? You can't make concurrent connections to the same server with different credentials. My UDFs: Barcode Libraries, Automate creation of any type of project folder, File Locking with Cooperative Semaphores, Inline binary files, Continue script after reboot, WinWaitMulti, Name Aggregator, Enigma, CornedBeef Hash Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now