Sign in to follow this  
Followers 0
GeekOrGuru

@ProgramFilesDir on X64 system

3 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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?

Check if you have write privileges to the target directory, if you don't, which is probably the case (but I'm not too familiar with the 64 bit pool and NT 5+) then you may need to alter the directories access control list, acls to get writing privileges, also try removing read only attributes from t he directory and post results and error code you get when opening a file for writing.

Edited by ApudAngelorum

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

Check if you have write privileges to the target directory, if you don't, which is probably the case (but I'm not too familiar with the 64 bit pool and NT 5+) then you may need to alter the directories access control list, acls to get writing privileges, also try removing read only attributes from t he directory and post results and error code you get when opening a file for writing.

I think you hit the nail on the head!

Thanks...I'm looking into it.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • ur
      By ur
      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.