Search the Community
Showing results for tags 'programfilesdir'.
-
My exe should run in both 32 and 64 OS, so I am compiling it as 32 bit exe. But in 64 bit, it is picking C:\Program files (x86) for @ProgramFilesDir. Can anyone suggest how to use C:\Program files\ in both 32 and 64 bit OS.
- 1 reply
-
- program files
- @programfilesdir
-
(and 1 more)
Tagged with:
-
Hello Everyone! Been awhile since I've used AutoIt and been on the forums. Man has alot changed! Anyways...I've got a simple script to deploy LastPass via a startup script. Everything appears to be working fine so far except for the logging portion on a X64 system. The script will not generate a log file on a X64 system even when ran as an administrator. Anyone have any thoughts? Help? #requireadmin #Include <File.au3> #Region -- Variables -- Global $Domain = 'XXX' Global $UserName = 'XXX' Global $Password = 'XXX' Global $Options = '--userinstallie --userinstallff --userinstallchrome --installforallusers -j "C:\Program Files\LastPass"' Global $Path = '\\SBS01\Public\Downloads\LastPass' Global $LogFile = @ProgramFilesDir & '\LastPass\LastPass_Log.txt' Global $Version = '1.90.0' #Region -- OS Architecture Check -- Switch @OSArch Case 'X86' ; Check to see if the system is 32-bit based $Application = '\LastPassFull.exe' $Reg = 'HKLM' $LogMsg = 'INSTALLATION - 32-bit LastPass Enterprise installed' _Install () ; Move to Installation function Case 'X64' ; Check to see if the system is 64-bit based $Application = '\LastPass_X64Full.exe' $Reg = 'HKLM64' $LogMsg = 'INSTALLATION - 64-bit LastPass Enterprise installed' _Install () ; Move to Installation function Case Else MsgBox(0, "LastPass Error Message", "An error occurred during installation. Please contact your Administrator." EndSwitch #Region -- Installation Function -- Func _Install () $var = RegRead($Reg & '\SOFTWARE\LastPass', 'Enterprise') ; Check registry for Enterprise installation If $var >= $Version Then Exit ; If installed, exit script ElseIf $var < $Version Or @Error <> 0 Then ; If no, proceed MsgBox(4096, "LastPass Enterprise Installation", "LastPass Enterprise installation is about to begin", 10) RunAsWait($UserName, $Domain, $Password, 2, $Path & $Application & " " & $Options) ; Install application RegWrite($Reg & '\SOFTWARE\LastPass', 'Enterprise', 'REG_SZ', $Version) ; Write Enterprise version to registry _LogFile () FileClose($LogFile) MsgBox(0, "LastPass Enterprise Installation", "LastPass Enterprise installation is complete") EndIf EndFunc #Region -- Log File Function -- Func _LogFile () If FileExists($LogFile) Then ; Check to see if file exists FileOpen($LogFile, 1) ; If yes, open the log file Elseif _FileCreate($LogFile) Then ; If no, then create the log file FileOpen($LogFile, 1) ; Then open the new log file EndIf _FileWriteLog($LogFile, $LogMsg) ; Log function EndFunc Exit