Jump to content

juanpis013

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by juanpis013

  1. Hi, I found a way to do that from network locations: You have to make two (2) different scripts with AutoIT: 1.- The first file must have the mapping to the network drive and the other actions like this: #region ; Checking the drive Available Local $i Local $DriveLst = DriveGetDrive("ALL") Local $DriveLetter Local $AscDrive For $i = 1 to $DriveLst[0] $AscDrive = Asc($DriveLst[$i]) If ($i < $DriveLst[0]) Then If (($AscDrive + 1) <> (Asc($DriveLst[$i + 1]))) Then $DriveLetter = StringUpper(Chr($AscDrive + 1)) ExitLoop EndIf Else If (($AscDrive + 1) = (Asc($DriveLst[$i]) + 1)) Then $DriveLetter = Chr($AscDrive + 1) ExitLoop EndIf EndIf Next #endregion ; End Checking the Drive Available #region ; Mapping Network Drive $result = DriveMapAdd($DriveLetter & ":", StringMid($installation_path, 1, StringLen($installation_path) - 1), 1) Local $errormsg = "" If (@extended > 0) Then $errormsg = _WinAPI_GetLastErrorMessage() EndIf Run($LogPath & ' "' & $Software_Name & '" "i" "Mapping Network Drive in ' & $DriveLetter & ':" "' & $result & ' - ERROR:' & @error & "-" & @extended & ' - ' & $errormsg & '"') If $result = 0 Then Exit EndIf #endregion ; End Mapping Network Drive #region ; Open the Program setup $result = Run('"' & $DriveLetter & ':\ProgramFolder\Setup.exe"', $DriveLetter & ":\ProgramFolder") $errormsg = _WinAPI_GetLastErrorMessage() Run($LogPath & ' "' & $Software_Name & '" "i" "Installing Sofware" "' & $result & ' - ERROR:' & @error & "-" & @extended & ' - ' & $errormsg & '"') #endregion ; End Open the Program setup --NOTE: Is very important to add the working dir in the run option: $result = Run('"' & $DriveLetter & ':\ProgramFolder\Setup.exe"', $DriveLetter & ":\ProgramFolder") --Because is working with the network drive mapped. 2.- The other script, have the Administrative Credentials and run the other script, like this #region ; Installing PDS $result = RunAsWait($UserName, $Domain, $PassWord, 1, '"' & $Server_Path & 'Network location\where the script\is located\script_1.exe"') Run($LogPath & ' "' & $Software_Name & '" "i" "Installing Script_1" "' & $result & '"') #endregion ; End Installing PDS And is working right now with my scripts. I know this post is very old, but I figured out by myself and I hope it work for you guys.
×
×
  • Create New...