Jump to content

Line 3526 error in expression


 Share

Go to solution Solved by grimmlock,

Recommended Posts

Hi,

I've got an installer that is giving me the following error:

 

Line 3526 (File "RSA411.exe"):

Error:  Error in expression

The problem that I am running into is that this installer is working on a couple of PCs, but not the vast majority of them.  I know the scripting is not the best out there, but it has worked in the past - they don't pay me to code, but I can hack enough of it together to make the job easier usually.  I have stripped out the company info, IP addresses, etc, but otherwise it is intact.  The software installs a piece of software, then emails two different email addresses so a config file can be created by the pertinent teams.  Any help is appreciated.

Thanks,

DC

#include <INet.au3> 
#RequireAdmin

; SID get function
$Domain = EnvGet("USERDOMAIN")
Func _GetSID($Username, $UserDomain = '')
    Local $objWMIService, $objAccount
    If $UserDomain = '' Then $UserDomain = EnvGet("USERDOMAIN")
    $objWMIService = ObjGet("winmgmts:\\.\root\cimv2")
    $objAccount = $objWMIService.Get _
            ("Win32_UserAccount.Name='" & @Username & "',Domain='" & $UserDomain & "'")
    Return $objAccount.SID
EndFunc

WinMinimizeAll()
Local $var = Ping("XXX.XXX.XXX.XXX", 250)
If $var Then; also possible:  If @error = 0 Then ...
    ; Check to see if RSA client has already been installed, if so notify user

If FileExists (@MyDocumentsDir &"\rsainstalled.txt") Then
    MsgBox(1, "Company Name", "Your RSA SecurID software has already been installed." & @CRLF & "If you cannot locate it, please contact the Helpdesk at x6735." & @CRLF & "Please click OK to continue.", 20)
Exit
EndIf
MsgBox(0, "Step 1/3", "You are about to install RSA SecurID token software. This is a silent " & @CRLF & "installation that will take up to 3 minutes. Please do not use the PC until " & @CRLF & "the installation is complete." & @CRLF & @CRLF & "                                  Please click OK to continue", 20)
MsgBox(0, "Company Name", "Please note that your physical SecurID card is not used " & @CRLF & "at any point in this process.  Please click OK to continue.", 20)
; Install RSA SecurID client silently

ShellExecute("msiexec", "/i" & "RSA411.msi /quiet") 

; Wait for 120 seconds for RSA SecurID client to finish installing

Sleep(120000)

; Check to see if install is done

If FileExists (@ProgramFilesDir & "\RSA SecurID Software Token\SecurID.exe") Then

; Email network team with account SID, username and hostname

$s_SmtpServer = "x.x.x.x" 
$s_FromName = "RSA Installation Notifier" 
$s_FromAddress = "email address" 
$s_ToAddress = "email address"
$s_Subject = "RSA - Hostname: " & @ComputerName & " - Username: " & @USERNAME & " - SID: " & _GetSID(@UserName, $Domain)
Dim $as_Body[3] 

Local $aResult = _Date_Time_GetTimeZoneInformation() 
Local $bias = -$aResult[1] / 60 
Local $biasH = Int($bias) 
Local $biasM = 0 
If $biasH <> $bias Then $biasM = Abs($bias - $biasH) * 60 
$bias = StringFormat(" (%+.2d%.2d)", $biasH, $biasM) 

$as_Body[0] = "RSA Client installed by: " & @USERNAME
$as_Body[1] = "Installed on the following PC: " & @ComputerName

$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body,"","-1") 
$err = @error 

$s_SmtpServer2 = "x.x.x.x" 
$s_FromName2 = "RSA Installation Notifier" 
$s_FromAddress2 = "email address" 
$s_ToAddress2 = "email address"
$s_Subject2 = "RSA - Hostname: " & @ComputerName & " - Username: " & @USERNAME & " - SID: " & _GetSID(@UserName, $Domain)
Dim $as_Body[3] 

Local $aResult = _Date_Time_GetTimeZoneInformation() 
Local $bias = -$aResult[1] / 60 
Local $biasH = Int($bias) 
Local $biasM = 0 
If $biasH <> $bias Then $biasM = Abs($bias - $biasH) * 60 
$bias = StringFormat(" (%+.2d%.2d)", $biasH, $biasM) 

$as_Body[0] = "RSA Client installed by: " & @USERNAME
$as_Body[1] = "Installed on the following PC: " & @ComputerName

$Response = _INetSmtpMail ($s_SmtpServer2, $s_FromName2, $s_FromAddress2, $s_ToAddress2, $s_Subject2, $as_Body,"","-1") 
$err = @error 

If $Response = 1 Then 
Else 
   MsgBox(0, "Company name", "     There seems to be a problem with this installation." & @CRLF &  "Please contact Helpdesk at --------- for assistance.")
EndIf

; Notify user that installation is complete, and that action is required by network team
MsgBox(0, "Company name", "The RSA SecurID application has been successfully installed. You " & @CRLF & "will be contacted by Network Support within 48 hours" & @CRLF & "to complete the setup process.", 0)

;  file to Windows directory so installer knows that it has already been installed before
FileCopy("\\share\rsainstalled.txt", @MyDocumentsDir &"\rsainstalled.txt" ,9)
; Copy documentation

FileCopy("\\share\Instructions to download token.doc", @DesktopDir &"\Instructions to download token.doc" ,9)
FileCopy("\\share\Instructions to import token and setup Pin.doc", @DesktopDir &"\Instructions to import token and setup Pin.doc" ,9)

Exit
ElseIf
; Notify user that the installation appears to have issues and to call the Helpdesk
   MsgBox(0, "Company name", "     There seems to be a problem with this installation." & @CRLF &  "Please contact Helpdesk at ---------- for assistance.")
EndIf
Else
      MsgBox(1, "Company name", "You must be online to perform this installation.  Please ensure that " & @CRLF & "you are connected to the network, either in an office or via VPN.")    
      MsgBox(1, "Company name", "You must be online to perform this installation.  Please ensure that " & @CRLF & "you are connected to the network, either in an office or via VPN.")
 EndIf
Exit
Link to comment
Share on other sites

  • Solution

Try this....

(When I changed the Elseif to and Else and added an Endif to the end I was able to execute it)

#include <MsgBoxConstants.au3>
#include <INet.au3>
#RequireAdmin
 
; SID get function
$Domain = EnvGet("USERDOMAIN")
Func _GetSID($Username, $UserDomain = '')
    Local $objWMIService, $objAccount
    If $UserDomain = '' Then $UserDomain = EnvGet("USERDOMAIN")
    $objWMIService = ObjGet("winmgmts:\\.\root\cimv2")
    $objAccount = $objWMIService.Get _
            ("Win32_UserAccount.Name='" & @Username & "',Domain='" & $UserDomain & "'")
    Return $objAccount.SID
EndFunc
 
WinMinimizeAll()
Local $var = Ping("XXX.XXX.XXX.XXX", 250)
If $var Then; also possible:  If @error = 0 Then ...
    ; Check to see if RSA client has already been installed, if so notify user
 
If FileExists (@MyDocumentsDir &"\rsainstalled.txt") Then
    MsgBox(1, "Company Name", "Your RSA SecurID software has already been installed." & @CRLF & "If you cannot locate it, please contact the Helpdesk at x6735." & @CRLF & "Please click OK to continue.", 20)
Exit
 
 
MsgBox(0, "Step 1/3", "You are about to install RSA SecurID token software. This is a silent " & @CRLF & "installation that will take up to 3 minutes. Please do not use the PC until " & @CRLF & "the installation is complete." & @CRLF & @CRLF & "                                  Please click OK to continue", 20)
MsgBox(0, "Company Name", "Please note that your physical SecurID card is not used " & @CRLF & "at any point in this process.  Please click OK to continue.", 20)
; Install RSA SecurID client silently
 
ShellExecute("msiexec", "/i" & "RSA411.msi /quiet")
 
; Wait for 120 seconds for RSA SecurID client to finish installing
 
Sleep(120000)
 
; Check to see if install is done
 
If FileExists (@ProgramFilesDir & "\RSA SecurID Software Token\SecurID.exe") Then
 
; Email network team with account SID, username and hostname
 
$s_SmtpServer = "x.x.x.x"
$s_FromName = "RSA Installation Notifier"
$s_FromAddress = "email address"
$s_ToAddress = "email address"
$s_Subject = "RSA - Hostname: " & @ComputerName & " - Username: " & @USERNAME & " - SID: " & _GetSID(@UserName, $Domain)
Dim $as_Body[3]
 
Local $aResult = _Date_Time_GetTimeZoneInformation()
Local $bias = -$aResult[1] / 60
Local $biasH = Int($bias)
Local $biasM = 0
If $biasH <> $bias Then $biasM = Abs($bias - $biasH) * 60
$bias = StringFormat(" (%+.2d%.2d)", $biasH, $biasM)
 
$as_Body[0] = "RSA Client installed by: " & @USERNAME
$as_Body[1] = "Installed on the following PC: " & @ComputerName
 
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body,"","-1")
$err = @error
 
$s_SmtpServer2 = "x.x.x.x"
$s_FromName2 = "RSA Installation Notifier"
$s_FromAddress2 = "email address"
$s_ToAddress2 = "email address"
$s_Subject2 = "RSA - Hostname: " & @ComputerName & " - Username: " & @USERNAME & " - SID: " & _GetSID(@UserName, $Domain)
Dim $as_Body[3]
 
Local $aResult = _Date_Time_GetTimeZoneInformation()
Local $bias = -$aResult[1] / 60
Local $biasH = Int($bias)
Local $biasM = 0
 
 
 
If $biasH <> $bias Then $biasM = Abs($bias - $biasH) * 60
$bias = StringFormat(" (%+.2d%.2d)", $biasH, $biasM)
$as_Body[0] = "RSA Client installed by: " & @USERNAME
$as_Body[1] = "Installed on the following PC: " & @ComputerName
 
$Response = _INetSmtpMail ($s_SmtpServer2, $s_FromName2, $s_FromAddress2, $s_ToAddress2, $s_Subject2, $as_Body,"","-1")
$err = @error
 
If $Response = 1 Then
Else
MsgBox(0, "Company name", "     There seems to be a problem with this installation." & @CRLF &  "Please contact Helpdesk at --------- for assistance.")
EndIf
 
; Notify user that installation is complete, and that action is required by network team
MsgBox(0, "Company name", "The RSA SecurID application has been successfully installed. You " & @CRLF & "will be contacted by Network Support within 48 hours" & @CRLF & "to complete the setup process.", 0)
 
;  file to Windows directory so installer knows that it has already been installed before
FileCopy("\\share\rsainstalled.txt", @MyDocumentsDir &"\rsainstalled.txt" ,9)
; Copy documentation
 
FileCopy("\\share\Instructions to download token.doc", @DesktopDir &"\Instructions to download token.doc" ,9)
FileCopy("\\share\Instructions to import token and setup Pin.doc", @DesktopDir &"\Instructions to import token and setup Pin.doc" ,9)
 
Exit
 
 
Else ; changed from elseif
; Notify user that the installation appears to have issues and to call the Helpdesk
   MsgBox(0, "Company name", "     There seems to be a problem with this installation." & @CRLF &  "Please contact Helpdesk at ---------- for assistance.")
EndIf
Else
      MsgBox(1, "Company name", "You must be online to perform this installation.  Please ensure that " & @CRLF & "you are connected to the network, either in an office or via VPN.")
      MsgBox(1, "Company name", "You must be online to perform this installation.  Please ensure that " & @CRLF & "you are connected to the network, either in an office or via VPN.")
 
EndIf
EndIf ; added another endif
Exit

 

Thanks,

Grimm

Thanks

Grimm

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...