Jump to content

Alexandre

Active Members
  • Posts

    51
  • Joined

  • Last visited

Everything posted by Alexandre

  1. Hi everyone Can any one get some idea how can i run powershell and elevate with anhoter user like this Runas("user","domain","password",0,'PowerShell.exe') -File c:\temp\myscript-ps1 -ExecutionPolicy bypass Tank you
  2. Run("psexec.exe" & \\ $CmdLine[0] & ' -f -u "europe\sup-analmeida" cmd.exe') When i compile i have this error
  3. Hi Any ideias how i can call external program like psexec tools to ask the computername that i wont to connect like this run("psexec.exe2" & \\computername -u myuser cmd.exe this sould be called my myapp.exe computer1
  4. Hello Franceco, Tank you for your reply, i'm new to Koda can you give any help or templado of koda for what i need to do?
  5. I need to create another button to search fsetup files nad run it
  6. This is the code mabe by now #include <GUIConstantsEx.au3> AltranAdmin() Func AltranAdmin() ;Change UAC Settings RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA","REG_SZ", "0") ; Create a GUI with various controls. ; Local $hGUI = GUICreate("AltranAdmin", 1920, 100, @DesktopWidth - 300, @DesktopHeight - 300) Local $hGUI = GUICreate("Altran Admin Tool", 300, 300, @DesktopWidth - 400, @DesktopHeight - 400, "$WS_EX_TOPMOST") ; Create a button control. Local $sUserName = "sup-analmeida" Local $sPassword = "Alex01dc01" Local $idButton_Services = GUICtrlCreateButton("Services", 10, 10, 85, 25) Local $idButton_cmd = GUICtrlCreateButton("Cmd", 10, 40, 85, 25) Local $idButton_Close = GUICtrlCreateButton("Close", 10, 70, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $iPID = 0 ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idButton_Services ; Run SERVICES. Run('mmc "services.msc"') Case $idButton_cmd ;Run CMD. ;Run("C:\WINDOWS\system32\cmd.exe") ;Run(@ComSpec & " /c " & 'C:\windows\system32\sysdm.cpl', "", @SW_HIDE) Run("rundll32 sysdm.cpl,EditEnvironmentVariables") EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) ; Close the Notepad process using the PID returned by Run. If $iPID Then ProcessClose($iPID) EndFunc ;==>Example
  7. Hello I under if any one can gvie any ideias how to create a form to search one setup file to run in adicional windown I'm creating a program to user to run several apps in admin mode without admin privelegies and need to browser on setup file to install it.
  8. I has trying to help user with one script that can do what he wont's connecting directly to smtp server.
  9. You need to use SendMailFileConstants.au3 SendMailFileInclude.au3
  10. smtp.gmail.com %usrname% someone@someone.com someone2@someone2.com Line 1 smtp hosntame Line 2 %username% who send the mail Line 3 email adress of the sender Line 4 mailto: ex someone@someone.com You can download this api from microsoft web site SendMailExchangeCdo.exe SendMailExchangeMapiCdo.EXE
  11. %username% is the system envoirent for the corrent user logon.
  12. Config. ini smtp.gmail.com %username%
  13. Full code ;################################## ; Include ;################################## #Include<SendMailFileInclude.au3> ;################################## ; Variables ;################################## $FileAttach = FileOpen("FileAttach.lst") ;File location path for list of file to attach - REQUIRED $Fileconfig = FileOpen("config.ini") ;File location path for list of file to attach - REQUIRED $Filebody = FileOpen("body.txt") $SmtpServer = FileReadLine($Fileconfig) ; address for the smtp-server to use - REQUIRED $FromName = FileReadLine($Fileconfig) ; name from who the email was sent $FromAddress = FileReadLine($Fileconfig) ; address from where the mail should come $Replyaddress ="" $ToAddress = FileReadLine($Fileconfig) ; destination address of the email - REQUIRED $Subject = "" ; subject from the email - can be anything you want it to be $Body = FileRead($Filebody) $AttachFiles = FileReadLine($FileAttach) ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress ="" ; address for cc - leave blank if not needed $BccAddress ="" ; address for bcc - leave blank if not needed $Importance ="Normal" ; Send message priority: "High", "Normal", "Low" $Username ="" ; username for the account used from where the mail gets sent - REQUIRED $Password ="" ; password for the account used from where the mail gets sent - REQUIRED $IPPort =465 ; port used for sending the mail $ssl =1 ; enables/disables secure socket layer sending - put to 1 if using httpS ;~ $IPPort=465 ; GMAIL port used for sending the mail ;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS ;################################## ;################################## ; Script ;################################## While 1 $AttachFiles = FileReadLine($FileAttach) If @error = -1 Then ExitLoop Sleep(2000) ;Wait 2 seconds Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $Replyaddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) If @error Then MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc) EndIf WEnd ; ; The UDF Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_Replyaddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.replyto = '"' & $s_Replyaddress & '" <' & $s_Replyaddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_AttachFiles If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf If $s_AttachFiles <> "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) ;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF) $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) SetError(1) Return 0 EndIf Next EndIf $objEmail.Configuration.Fields.Item ("[url="http://schemas.microsoft.com/cdo/configuration/sendusing"]http://schemas.microsoft.com/cdo/configuration/sendusing"[/url]) = 2 $objEmail.Configuration.Fields.Item ("[url="http://schemas.microsoft.com/cdo/configuration/smtpserver"]http://schemas.microsoft.com/cdo/configuration/smtpserver"[/url]) = $s_SmtpServer If Number($IPPort) = 0 then $IPPort = 25 $objEmail.Configuration.Fields.Item ("[url="http://schemas.microsoft.com/cdo/configuration/smtpserverport"]http://schemas.microsoft.com/cdo/configuration/smtpserverport"[/url]) = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item ("[url="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"[/url]) = 1 $objEmail.Configuration.Fields.Item ("[url="http://schemas.microsoft.com/cdo/configuration/sendusername"]http://schemas.microsoft.com/cdo/configuration/sendusername"[/url]) = $s_Username $objEmail.Configuration.Fields.Item ("[url="http://schemas.microsoft.com/cdo/configuration/sendpassword"]http://schemas.microsoft.com/cdo/configuration/sendpassword"[/url]) = $s_Password $objEmail.Configuration.Fields.Item ("[url="http://schemas.microsoft.com/cdo/configuration/postuserreplyemailaddress"]http://schemas.microsoft.com/cdo/configuration/postuserreplyemailaddress[/url] ") = $s_Replyaddress EndIf If $ssl Then $objEmail.Configuration.Fields.Item ("[url="http://schemas.microsoft.com/cdo/configuration/smtpusessl"]http://schemas.microsoft.com/cdo/configuration/smtpusessl"[/url]) = True EndIf ;Update settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf $objEmail="" EndFunc ;==>_INetSmtpMailCom ; ; ; Com Error Handler Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description, 3) ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) SetError(1); something to check for when this function returns Return MsgBox(0,"SendMail Completed","Mails enviados com sucesso") Exit EndFunc ;==>MyErrFunc Exit ;End funcion to create and send mail with attach. Exit
  14. with the program that i made you use the variable %username%
  15. Are you trying to get this? $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 then $IPPort = 25 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/postuserreplyemailaddress ") = $s_Replyaddress You need i allready write a script that pick file from directori and attach to mail and send it
  16. Are you trying to look for this $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 then $IPPort = 25 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/postuserreplyemailaddress ") = $s_Replyaddress
  17. Hello Can any one tell me what is worng on this script If $CmdLine[0]=1 Then RunWait("psexec.exe -s \\ ' & $CmdLine[1] &' & cmd") ; Do what you specified , e.g. sleep 99 sec Else MsgBox (0, 'Test', 'Cmdline was not used.') ; Do your default stuff, e.g. sleep 1 sec EndIf
  18. Hello all Does any one knows hot to insert windows instalation serial number after windows setp with autoit?
  19. No jchd i'm only new on autoit Tank you for your help
  20. Hy firefox I need to read Character form the registri to declar one var i have the key sourcepah on registry with the text sb1cd1test, an i need to read from the 3 Character until the 8 Character in this case the var should be sb1cd1. ok for you like this?
  21. But the stingmid does not allow to read from registry.
  22. Hello How can i read something like this How can i read x numer of caracter i have this code $var = regread("hkey_local_machine\software\microsoft\windows\currentversion", "sourcepath") in the key i have \\sb1cd1\teste and i0d like to read somethin like $var = regread("hkey_local_machine\software\microsoft\windows\currentversion", "sourcepath;2,6") in this case e gate only the test "SB1CD1" Any ideas?
  23. tank you AutoIt MVPs (MVP)
×
×
  • Create New...