Docfxit Posted December 3, 2014 Share Posted December 3, 2014 I know the python script is running. Is there a way to test the userdomain and userpassword to make sure there isn't a permissions issue in the python script. My AutoIt script is: #RequireAdmin ;_ShellExecuteWaitAsAdmin("userlogin","userdomain", "userpassword", 0, "\\server\path_to_batch\batch.bat") _ShellExecuteWaitAsAdmin("Administrator", "workgroup", "MyPassword", 0, "C:\Batch\CGPLog.bat") Func _ShellExecuteWaitAsAdmin($sUserName, $sDomain, $sPassword, $iLogonFlag, $sFile, $sParamters = "") Local $sCmd = ' /AutoIt3ExecuteLine "ShellExecuteWait(''' & $sFile & ''', ''' & $sParamters & ''', '''', ''runas'')"' Return RunAsWait($sUserName, $sDomain, $sPassword, $iLogonFlag, @AutoItExe & $sCmd) EndFunc ;==>_ShellExecuteWaitAsAdmin The bat file I'm trying to run: cd "C:\Programs\CommuniGate Files\SystemLogs" Call "C:\Batch\CGPLogSummary.py" cmd The python script isn't reading/writing the files it should. I'm not getting any errors. Thanks, Docfxit Link to comment Share on other sites More sharing options...
computergroove Posted December 3, 2014 Share Posted December 3, 2014 What happens when you try to run the commands manually without autoit? Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
Docfxit Posted December 3, 2014 Author Share Posted December 3, 2014 I right click on the bat file and select run as administrator. I get Access is denied. Thanks, Docfxit Link to comment Share on other sites More sharing options...
MikahS Posted December 3, 2014 Share Posted December 3, 2014 Are you using an administrator account? Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Docfxit Posted December 3, 2014 Author Share Posted December 3, 2014 Yes. The user I am signed on with does have administrator rights. Thanks, Docfxit Link to comment Share on other sites More sharing options...
MikahS Posted December 3, 2014 Share Posted December 3, 2014 Hmph. So even on your admin account you cannot access it manually or with AutoIt? Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 3, 2014 Moderators Share Posted December 3, 2014 (edited) Your alignment looks a bit off, may not be, but looks it to me. Try replacing your $sCmd and RunWait with this: Local $sCmd = '"' & @AutoItExe & '" /AutoIt3ExecuteLine "ShellExecuteWait("""' & $sFile & '""", """' & $sParamters & '""", "", "runas")"' Return RunAsWait($sUserName, $sDomain, $sPassword, $iLogonFlag, $sCmd) Edit: BTW, you do have an app on the machine you're trying to run this on by the same name right? If you're sending this via F5 it uses the AutoIt exe in the AutoIt directory, if you're compiling and sending it, it's using the name and location of the exe you're compiling. Edited December 3, 2014 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Docfxit Posted December 3, 2014 Author Share Posted December 3, 2014 Thank you for the suggestion. I'm getting an error saying: Docfxit Link to comment Share on other sites More sharing options...
Docfxit Posted December 3, 2014 Author Share Posted December 3, 2014 Although the new AutoIt code is causing a problem. I tried running the bat file while logged in as Administrator. So I think it's a problem with the python script and maybe not the authorization it's running under. I would like to correct the AutoIt code so that when I get the python script running correctly I will be able to run this under the correct user. Thanks, Docfxit PS: Does anyone know where I can get help with the python script? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 4, 2014 Moderators Share Posted December 4, 2014 Starting to confuse myself with this. I don't use this function, but I know you need to concatenate the quotes in case of spaces. Also the fourth parameter is a verb, I don't see "runas" as an acceptable verb. http://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx Try this I guess: Local $sCmd = '"' & @AutoItExe & '" /AutoIt3ExecuteLine ' & '"ShellExecuteWait(""' & $sFile & '"", ""' & $sParamters & '"", "", Null)"' Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Docfxit Posted December 5, 2014 Author Share Posted December 5, 2014 That does run without giving me errors. I will know more when I get the Python script executing correctly. Thank you very much, Docfxit 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