#NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include <_RegEnumKeyEx.au3> #include #include <_Array1DTo2D.au3> #include <_IsUACAdmin.au3> ;**************************************** ;* * ;* Function List * ;* * ;**************************************** #cs ******* User functions _RefreshList - Opens SQL database. Reads the records and imports them into a database _DriverInfo - Scans Registry for drivers and imports the results into an Array _AppInfo - Extract registry sub keys to scan registry for installed software _Information - Initiates as an AddLib, so it runs every 400-500 milliseconds. Users reg keys obtained from AppInfo and DriverInfo to scan system software. Stores values obtained from the database and those installed on the system, and places them on the Gui in a label to present the information to the user. _CheckUpdates - Runs at the beginning of the script to inform user of updates required, and runs as part of and AdLib every 30 seconds. The system scans the registry and compares the versions in the database to those on the PC. The list of applications that need to be updated are added. _UpdateAll - Using list of Apps that need to be updated, all updates are applied one after the other. _Uninstall - Obtains the selected applications Registry path with the uninstall string, which was captured during the _Information function. Executes the uninstall string. _Install_Rollback - Installs the application in the Rollback directory _Install_Beta - Installs the application in the Beta directory _Install_Profile - Performs the standard install for applications in the Available/stable/root directory of the App Store. _Install_Limit_Update - Checks if the selected application has any installation limits. Applications can be set to only allow 1 installation. Once the installation is ran, the value of available installations is deducted from the database. _InstallApp - Determines if an installation is possible or allowed. If the installation is possible then the appropriate function to install the app is ran. _AddApp - Loads the Gui to add an application to the App Store Database _EditApp - Loads the Gui to edit an application that already exists in the App Store Database _RemoveApp - Removes the application from App Store Database. It will prompt for confirmation before deleting. _Admin - Will check to see if the user is a listed member of the admin config file, and will load the admin user gui if true.If the user isn't an admin, then they will get the user gui. _User - The user menu is loaded for all those that are not listed as admins in the config file _AppLog - After every installation a log is added to the Appstore logging database. This is separate from the Application database that presents the list of available applications. _AllowGroups - Loads the gui that obtains all the security groups in the domain. The ou that is searched for security groups is specified in the config. The gui is loaded if the user wants to restrict an application when they add it in the app store. Groups added here allow only its members to install the application. _DenyGroups - Loads the gui that obtains all the security groups in the domain. The ou that is searched for security groups is specified in the config. The gui is loaded if the user wants to restrict an application when they add it in the app store. Groups added here prevent its members from installing the application. _AllowGroupsEdit - Loads a Gui that mirrors the _AllowGroups function, but this obtains options that have already been set for the application and allows you to change them. _DenyGroupsEdit - Loads a Gui that mirrors the _DenyGroups function, but this obtains options that have already been set for the application and allows you to change them. ******* Application Functions _CheckBox_Active1 _Checkbox_Active2 _SetBut1 _SetBut2 _DecryptPW1 _DecryptPW2 _DecryptPW3 _Decrypt _GuiCtrlListView_GetChecked _ProgressMarquee_Start _ProgressMarquee_Stop WM_Size MyErrFunc #ce $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ;Global $rUser = $CMDLINE[1] $rUser = @UserName $scriptDir = @ScriptDir Local $iRows, $iColumns, $software ; For SQL Array Local $listApps, $btnShowUpdates, $labelInfoString1, $labelInfoString2, $check, $firstRun = True, $index = Null ; GUI Controls Local $key, $beta, $sBetaInstallDirx86, $sBetaInstallDirx64, $sVersionAA,$sVersionBA,$sVersionRA, $rollback, $sRollbackInstallDirx64, $sRollbackInstallDirx86, $installSel, $listAppsSort = False, $sPW, $sPW2, $sPW3, $sID, $IDlast, $selApp, $sSelAppReg, $sArchitecture, $restrictions, $driver, $bios, $param, $limit, $sProfile, $versionInst, $versionInstChk, $installDate, $publisher, $estimatedSize, $uninstall, $installDir, $sInstallDirx86, $sInstallDirx64, $hOpenFile, $sAllow, $sDeny, $sRunningApps ;Listview Local $inAppName,$sParamAA,$sPasswordAA, $sLimitAA, $sKeyAA, $rDownloadLimit, $aAppPara, $sParamRA,$sPasswordRA, $sLimitRA, $sKeyRA, $sParamBA,$sPasswordBA, $sLimitBA, $sKeyBA, $profile, $continue = False Local $arrayHKCU_UnInst, $arrayHKLM_Inst, $arrayHKLM_Inst64, $arrayHKLM_UnInst, $arrayHKLM_UnInst64, $arrayUpdates, $arrayUpdatesString, $arrayUpdatesLast, $arrayHKLM_Driver ;Application/registry Arrays Local $architecture, $chkDeny, $chkAllow, $selectedGroups1, $selectedGroups2, $listAllow, $listDeny, $btnOK, $rAllow1, $rDeny1, $btnSaveApp, $option = "Install" ; Variables for the Add or Edit Application GUI Local $sHKLM_Inst = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Userdata\S-1-5-18\Products" Local $sHKLM_Inst64 = "HKEY_LOCAL_MACHINE64\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Userdata\S-1-5-18\Products" Local $sHKLM_UnInst64 = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" Local $sHKLM_UnInst = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" Local $sHKCU_UnInst = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall" Local $sHKLM_Driver = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class" If Not FileExists(@ScriptDir & "\config.ini") Then MsgBox(0,"Error","A missing configuration is preventing this application from running." & @CRLF & @CRLF & "Please contact your Administrator.") Exit EndIf $configA = IniReadSection(@ScriptDir & "\config.ini","ADMINISTRATORS") $configS = IniReadSection(@ScriptDir & "\config.ini","SYSTEM") $configD = IniReadSection(@ScriptDir & "\config.ini","DATABASE") $configDL = IniReadSection(@ScriptDir & "\config.ini","DATABASELOGS") ;_ArrayDisplay($configA,"Administrators") $iniA_Users = $configA[1][1] $iniA_Groups = $configA[2][1] $iniA_InstallUser = $configA[3][1] $iniA_InstallPassword = $configA[4][1] $iniA_LocalInstallUser = $configA[5][1] $iniA_LocalInstallPassword = $configA[6][1] ;MsgBox(0,"Administrators","Users: " & $iniA_Users & @CR & "Groups: " & $iniA_Groups & @CR & "Install User: " & $iniA_InstallUser & @CR & "Install Password: " & $iniA_InstallPassword & @CR & "Local Install User: " & $iniA_LocalInstallUser & @CR & "Local Install Password: " & $iniA_LocalInstallPassword) ;_ArrayDisplay($configS,"System") $iniS_AppName = $configS[1][1] $iniS_Logo = $configS[2][1] $iniS_Company = $configS[3][1] $iniS_Domain = $configS[4][1] $iniS_ClientLog = $configS[5][1] $iniS_GroupsOU = $configS[6][1] $iniS_DomainFQDN = $configS[7][1] ;_ArrayDisplay($configD,"Database") $iniD_Provider = $configD[1][1] $iniD_Server = $configD[2][1] $iniD_Database = $configD[3][1] $iniD_User = $configD[4][1] $iniD_Password = $configD[5][1] $iniD_Table = $configD[6][1] ;_ArrayDisplay($configDL,"DatabaseLogs") $iniDL_Provider = $configDL[1][1] $iniDL_Server = $configDL[2][1] $iniDL_Database = $configDL[3][1] $iniDL_User = $configDL[4][1] $iniDL_Password = $configDL[5][1] $iniDL_Table = $configDL[6][1] #cs _DecryptPW1() MsgBox(0,"",$sPW) _DecryptPW2() MsgBox(0,"",$sPW2) _DecryptPW3() MsgBox(0,"",$sPW3) #ce #Region ### START Koda GUI section ### Form= SplashImageOn($iniS_AppName & " - Loading...", $iniS_Logo, 617, 290, -1, -1) $mainForm = GUICreate($iniS_AppName, 615, 482, -1, -1, BitOR($WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX)) $listApps = GUICtrlCreateListView(" ", 8, 8, 220, 444, BitOR($LVS_DEFAULT, $WS_BORDER)) ;$listApps = _GUICtrlListView_Create($mainForm, "Application", 8, 8, 220, 422, BitOR($LVS_DEFAULT, $WS_BORDER)) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) _GUICtrlListView_SetColumn($listApps, 0, "Application", 198) $listOptions = GUICtrlCreateList("", 232, 291, 121, 167) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $btnExecute = GUICtrlCreateButton("&Execute", 360, 292, 123, 81) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $btnRefresh = GUICtrlCreateButton("&Refresh", 488, 292, 123, 81) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $btnAdmin = GUICtrlCreateButton("&Admin Options", 360, 372, 123, 81) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $btnExit = GUICtrlCreateButton("E&xit", 488, 372, 123, 81) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $groupApp = GUICtrlCreateGroup("Application Information", 232, 8, 233, 180) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $labelInfo = GUICtrlCreateLabel("", 240, 26, 220, 128) ;$labelKey = GUICtrlCreateLabel("Key:", 240, 158, 220, 25) ;GUICtrlSetFont($labelKey,7) GUICtrlCreateGroup("", -99, -99, 1, 1) $groupSystem = GUICtrlCreateGroup("System Information", 232, 195, 233, 90) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $labelSystem = GUICtrlCreateLabel("Computer Name: " & @ComputerName & @CRLF & "Username: " & $rUser & @CRLF & "Architecture: " & @OSArch & @CRLF & "Operating System: " & @OSVersion, 240, 217, 210, 65) GUICtrlCreateGroup("", -99, -99, 1, 1) $groupStatus = GUICtrlCreateGroup("Update Status", 472, 8, 137, 277) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $labelStatus1 = GUICtrlCreateLabel("", 488, 32, 120, 90) $listUpdates = GUICtrlCreateList("", 488, 80, 110, 182,$LBS_NOSEL) $labelStatus2 = GUICtrlCreateLabel("", 488, 264, 120, 15) GUICtrlCreateGroup("", -99, -99, 1, 1) #EndRegion ### END Koda GUI section ### GUIRegisterMsg($WM_SIZE, "WM_SIZE") #cs _AD_Open($iniA_InstallUser,$iniA_InstallPassword,$iniS_DomainFQDN) $arrayGroups = _AD_RecursiveGetMemberOf($rUser) _AD_Close() $arrayGroups = _ArrayToString($arrayGroups, "|") $arrayGroups = StringSplit($arrayGroups, "|") $arrayGroups = _ArrayUnique($arrayGroups) _ArrayDelete($arrayGroups, 1) _ArrayDelete($arrayGroups, 0) _ArrayDelete($arrayGroups, 0) _ArrayInsert($arrayGroups, 0, UBound($arrayGroups)) For $i = 1 To $arrayGroups[0] If _StringBetween($arrayGroups[$i], "CN=", ",")[0] = "Domain Admins" Or _StringBetween($arrayGroups[$i], "CN=", ",")[0] = "Enterprise Admins" Or _StringBetween($arrayGroups[$i], "CN=", ",")[0] = "AdminGroup" Then GUICtrlSetState($btnAdmin, $GUI_ENABLE) ExitLoop Else GUICtrlSetState($btnAdmin, $GUI_DISABLE) EndIf Next #ce GUICtrlSetState($btnAdmin, $GUI_DISABLE) If $iniA_Users <> "" Then $usersAdmin = StringSplit($iniA_Users,",") ;_ArrayDisplay($usersAdmin,"Users") For $i = 1 To $usersAdmin[0] If @UserName = $usersAdmin[$i] Then GUICtrlSetState($btnAdmin, $GUI_ENABLE) EndIf Next EndIf If $iniA_Groups <> "" Then $groupsAdmin = StringSplit($iniA_Groups,",") ;_ArrayDisplay($groupsAdmin,"Groups") _AD_Open($iniA_InstallUser,$iniA_InstallPassword,$iniS_DomainFQDN) For $i = 1 To $groupsAdmin[0] If _AD_IsMemberOf($groupsAdmin[$i],@UserName) Then GUICtrlSetState($btnAdmin, $GUI_ENABLE) EndIf Next _AD_Close() EndIf _RefreshList() _User() GUISetState(@SW_SHOW) SplashOff() AdlibRegister("_Information", 400) Sleep(2000) _CheckUpdates() AdlibRegister("_CheckUpdates", 25000) GUISetState(@SW_SHOW) $admin = _IsUACAdmin() $canelevate = @extended If $canelevate = 1 Then $isAdmin = True Else $isAdmin = False EndIf SplashOff() While 1 Sleep(20) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE AdlibUnRegister("_Information") AdlibUnRegister("_CheckUpdates") Exit Case $btnExit AdlibUnRegister("_Information") AdlibUnRegister("_CheckUpdates") Exit Case $btnAdmin ; Calls Function _Admin to enable extra options in the $listOptions _Admin() Case $btnExecute GUICtrlSetState($btnExecute, $GUI_DISABLE) $option = GUICtrlRead($listOptions) If $option = "Install" Then $beta = "No" $rollback = "No" $installSel = True _Install_Password_AA() If $continue = True Then _InstallApp() _AppLog() EndIf AdlibUnRegister("_Information") AdlibUnRegister("_CheckUpdates") GUICtrlSetData($labelStatus2, "") AdlibRegister("_Information", 500) Sleep(2000) _CheckUpdates() AdlibRegister("_CheckUpdates", 30000) ElseIf $option = "Uninstall" Then $installSel = False _Uninstall() _AppLog() AdlibUnRegister("_Information") AdlibUnRegister("_CheckUpdates") GUICtrlSetData($labelStatus2, "") AdlibRegister("_Information", 500) Sleep(2000) _CheckUpdates() AdlibRegister("_CheckUpdates", 30000) ElseIf $option = "Update All" Then $beta = "No" $rollback = "No" $installSel = "Update" AdlibUnRegister("_CheckUpdates") ;AdlibRegister("_CheckUpdates", 800) _UpdateAll() AdlibUnRegister("_Information") ;AdlibUnRegister("_CheckUpdates") GUICtrlSetData($labelStatus2, "") AdlibRegister("_Information", 500) Sleep(2000) _CheckUpdates() AdlibRegister("_CheckUpdates", 30000) ElseIf $option = "Rollback" Then $beta = "No" $rollback = "Yes" $installSel = True _Install_Password_RA() If $continue = True Then _InstallApp() _AppLog() EndIf AdlibUnRegister("_Information") AdlibUnRegister("_CheckUpdates") GUICtrlSetData($labelStatus2, "") AdlibRegister("_Information", 500) Sleep(2000) _CheckUpdates() AdlibRegister("_CheckUpdates", 30000) ElseIf $option = "Beta" Then $beta = "Yes" $rollback = "No" $installSel = True _Install_Password_BA() If $continue = True Then _InstallApp() _AppLog() EndIf AdlibUnRegister("_Information") AdlibUnRegister("_CheckUpdates") GUICtrlSetData($labelStatus2, "") AdlibRegister("_Information", 500) Sleep(2000) _CheckUpdates() AdlibRegister("_CheckUpdates", 30000) ElseIf $option = "Add App" Then _AddAPP() ElseIf $option = "Edit App" Then _EditAPP() ElseIf $option = "Remove App" Then _RemoveApp() ElseIf $option = "Build EXE" Then Run($scriptDir & "\Tools\Build_Install_Files.exe") ElseIf $option = "Help" Then Local $oIE = _IECreate($scriptDir & "\Help\Application_Store.html") _IEPropertySet($oIE, "statusbar", 0) _IEPropertySet($oIE, "addressbar", 0) _IEPropertySet($oIE, "menubar", 0) _IEPropertySet($oIE, "toolbar", 0) _IEPropertySet($oIE, "silent", 1) _IEPropertySet($oIE, "contenteditable", 0) ElseIf $option = "Show Key" Then ;#cs - ****** Updated to display product key in a Popup Window ****** ; Check to see if Product key can be displayed If $sAllow = "" And $sDeny = "" Then ;No Deny or Allow Permissions set. MsgBox(0,"Key","Install Key: " & $sKeyAA & @CR & "Rollback Key: " & $sKeyRA & @CR & "Beta Key: " & $sKeyBA) Else ; Permissions set $arraySecAllow = StringSplit($sAllow, ";") $arraySecDeny = StringSplit($sDeny, ";") ;_ArrayDisplay($arraySecAllow,"Allow") ;_ArrayDisplay($arraySecDeny,"Deny") For $d = 1 To $arraySecDeny[0] _AD_Open($iniA_InstallUser,$iniA_InstallPassword,$iniS_DomainFQDN) If _AD_IsMemberOf($arraySecDeny[$d], $rUser) Then ; Deny rights are in place for user. Check user group membership. $denyChk = True MsgBox(0,"Key","You do not have rights to see the key.") ExitLoop Else $denyChk = False EndIf _AD_Close() Next If $denyChk <> True Then ; No Deny permissions have been set For $c = 1 To $arraySecAllow[0] _AD_Open($iniA_InstallUser,$iniA_InstallPassword,$iniS_DomainFQDN) If _AD_IsMemberOf($arraySecAllow[$c], $rUser, 1) Then ; Allow rights are in place for user. MsgBox(0,"Key","Install Key: " & $sKeyAA & @CR & "Rollback Key: " & $sKeyRA & @CR & "Beta Key: " & $sKeyBA) $recursive = False ExitLoop Else $recursive = True EndIf _AD_Close() Next ; Recursive security group check for permissions If $recursive = True Then _AD_Open($iniA_InstallUser,$iniA_InstallPassword,$iniS_DomainFQDN) For $c = 1 To $arraySecAllow[0] If _AD_IsMemberOf($arraySecAllow[$c], @UserName, True, True) Then $member = True ExitLoop ElseIf $c = $arraySecAllow[0] Then $member = False ExitLoop EndIf Next If $member = True Then ; User has allow rights to install application MsgBox(0,"Key","Install Key: " & $sKeyAA & @CR & "Rollback Key: " & $sKeyRA & @CR & "Beta Key: " & $sKeyBA) Else MsgBox(0,"Key","You do not have rights to see the key.") EndIf _AD_Close() EndIf EndIf EndIf EndIf GUICtrlSetState($btnExecute, $GUI_ENABLE) Case $btnRefresh _GUICtrlListView_DeleteAllItems($listApps) _RefreshList() EndSwitch WEnd Func _RefreshList() ;MsgBox(0,"",'Begin List refresh') ; Get connection to Master DB in MSSQL _DecryptPW2() $sqlCon = ObjCreate("ADODB.Connection") $sqlCon.Open("Provider=" & $iniD_Provider & "; Server=" & $iniD_Server & "; database=" & $iniD_Database & "; User ID=" & $iniD_User & "; Password=" & $sPW2 & ";") If @error Then MsgBox(0, "", "SQL Database error" & @CR & @CR & @error) ; Query for logins $oRS = ObjCreate("ADODB.RecordSet") $sQuery = "SELECT * FROM " & $iniD_Table $oRS.Open($sQuery, $sqlCon, 2); 2 = adOpenDynamic ;Requery and list all records again as a 2D array ;$oRS.ReQuery() If Not $oRS.EOF Then $software = $oRS.GetRows() ;_ArrayDisplay($software, "$avResults") Else MsgBox(0, "", "Error: No Results could be found.") EndIf ;_ArrayDisplay($software) ;Msgbox(0,"",$software[1][2]) For $i = 0 To UBound($software) - 1 $item = GUICtrlCreateListViewItem($software[$i][2], $listApps) GUICtrlSetData($item, $software[$i][2]) ;_GUICtrlListView_AddItem($listApps, $software[$i][2]) Next $sqlCon.Close $listAppsSort = False ; Sort the list ascending _GUICtrlListView_SimpleSort($listApps, $listAppsSort, 0) $IDlast = $software[UBound($software)-1][0] EndFunc ;==>_RefreshList Func _DriverInfo() $arrayHKLM_Driver = _RegEnumKeyEx($sHKLM_Driver) ;_ArrayDisplay($arrayHKLM_Driver) EndFunc ;==>_DriverInfo Func _AppInfo() ; Extract registry sub keys to scan registry for installed software. ;$time1 = TimerInit() $i = 1 $sSubKey = "" While 2 $sSubKey = $sSubKey & RegEnumKey($sHKLM_Inst, $i) & "|" If @error Then ExitLoop ;Msgbox(0,"HKLM_Inst","SubKey #" & $i & " under " & $sHKLM_Inst & "\" & $sSubKey & @CRLF) $i += 1 WEnd $arrayHKLM_Inst = $sSubKey Do If StringRight($arrayHKLM_Inst, 1) = "|" Then $arrayHKLM_Inst = StringTrimRight($arrayHKLM_Inst, 1) EndIf Until StringRight($arrayHKLM_Inst, 1) <> "|" $arrayHKLM_Inst = StringSplit($arrayHKLM_Inst, "|") ;_ArrayDisplay($arrayHKLM_Inst) $i = 1 $sSubKey = "" While 2 $sSubKey = $sSubKey & RegEnumKey($sHKLM_Inst64, $i) & "|" If @error Then ExitLoop ;Msgbox(0,"HKLM_Inst64","SubKey #" & $i & " under " & $sHKLM_Inst64 & "\" & $sSubKey & @CRLF) $i += 1 WEnd $arrayHKLM_Inst64 = $sSubKey Do If StringRight($arrayHKLM_Inst64, 1) = "|" Then $arrayHKLM_Inst64 = StringTrimRight($arrayHKLM_Inst64, 1) EndIf Until StringRight($arrayHKLM_Inst64, 1) <> "|" $arrayHKLM_Inst64 = StringSplit($arrayHKLM_Inst64, "|") ;_ArrayDisplay($arrayHKLM_Inst64) $i = 1 $sSubKey = "" While 2 $sSubKey = $sSubKey & RegEnumKey($sHKLM_UnInst, $i) & "|" If @error Then ExitLoop ;Msgbox(0,"HKLM_UnInst","SubKey #" & $i & " under " & $sHKLM_UnInst & "\" & $sSubKey & @CRLF) $i += 1 WEnd $arrayHKLM_UnInst = $sSubKey Do If StringRight($arrayHKLM_UnInst, 1) = "|" Then $arrayHKLM_UnInst = StringTrimRight($arrayHKLM_UnInst, 1) EndIf Until StringRight($arrayHKLM_UnInst, 1) <> "|" $arrayHKLM_UnInst = StringSplit($arrayHKLM_UnInst, "|") ;_ArrayDisplay($arrayHKLM_UnInst) $i = 1 $sSubKey = "" While 2 $sSubKey = $sSubKey & RegEnumKey($sHKLM_UnInst64, $i) & "|" If @error Then ExitLoop ;Msgbox(0,"HKLM_UnInst64","SubKey #" & $i & " under " & $sHKLM_UnInst64 & "\" & $sSubKey & @CRLF) $i += 1 WEnd $arrayHKLM_UnInst64 = $sSubKey Do If StringRight($arrayHKLM_UnInst64, 1) = "|" Then $arrayHKLM_UnInst64 = StringTrimRight($arrayHKLM_UnInst64, 1) EndIf Until StringRight($arrayHKLM_UnInst64, 1) <> "|" $arrayHKLM_UnInst64 = StringSplit($arrayHKLM_UnInst64, "|") ;_ArrayDisplay($arrayHKLM_UnInst64) $i = 1 $sSubKey = "" While 2 $sSubKey = $sSubKey & RegEnumKey($sHKCU_UnInst, $i) & "|" If @error Then ExitLoop ;Msgbox(0,"HKCU_Inst","SubKey #" & $i & " under " & $sHKCU_UnInst & "\" & $sSubKey & @CRLF) $i += 1 WEnd $arrayHKCU_UnInst = $sSubKey Do If StringRight($arrayHKCU_UnInst, 1) = "|" Then $arrayHKCU_UnInst = StringTrimRight($arrayHKCU_UnInst, 1) EndIf Until StringRight($arrayHKCU_UnInst, 1) <> "|" $arrayHKCU_UnInst = StringSplit($arrayHKCU_UnInst, "|") ;_ArrayDisplay($arrayHKCU_UnInst) ;MsgBox(0,"AppInfo function",TimerDiff($time1) / 1000 & " secs") EndFunc ;==>_AppInfo Func _Information() ;*********** Scan Registry for keys to check *********** _AppInfo() _DriverInfo() ;$time2 = TimerInit() ;*********** Check which application has been selected *********** $iData = _GUICtrlListView_GetItemCount($listApps) For $d = 0 To $iData If _GUICtrlListView_GetItemSelected($listApps, $d) And $index <> $d Or $firstRun = True Then $selApp = _GUICtrlListView_GetItemText($listApps, $d) $index = $d $check = True $firstRun = False ExitLoop Else If $d = $iData Then $check = False EndIf EndIf Next If $check = True Then ; Check to see if any changes were made ;*********** Read database array for selected application *********** For $i = 0 To UBound($software) - 1 If $software[$i][2] = $selApp Then $sID = $software[$i][0] $sSelAppReg = $software[$i][1] $sAllow = $software[$i][3] $sDeny = $software[$i][4] ;MsgBox(0,"","Allow: " & '"' & $sAllow & '"' & @CR & "Deny: " & '"' & $sDeny & '"') ;If $software[$i][3] = Null And $software[$i][4] = Null Or $software[$i][3] = "" And $software[$i][4] = "" Or $software[$i][3] = "" And $software[$i][4] = Null Or $software[$i][3] = Null And $software[$i][4] = "" Then If $software[$i][3] = "" And $software[$i][4] = "" Then $restrictions = "No" Else $restrictions = "Yes" EndIf $sProfile = $software[$i][5] $sRunningApps = $software[$i][6] $sDriver = $software[$i][7] $sBios = $software[$i][8] $sArchitecture = $software[$i][9] $sVersionAA = $software[$i][10] $sInstallDirx86 = $software[$i][11] $sInstallDirx64 = $software[$i][12] $sLimitAA= $software[$i][13] $sParamAA = $software[$i][14] $sPasswordAA = $software[$i][15] $sKeyAA = $software[$i][16] $sRollbackInstallDirx86 = $software[$i][17] $sRollbackInstallDirx64 = $software[$i][18] $sVersionRA = $software[$i][19] $sLimitRA= $software[$i][20] $sParamRA = $software[$i][21] $sPasswordRA = $software[$i][22] $sKeyRA = $software[$i][23] $sBetaInstallDirx86 = $software[$i][24] $sBetaInstallDirx64 = $software[$i][25] $sVersionBA = $software[$i][26] $sLimitBA= $software[$i][27] $sParamBA = $software[$i][28] $sPasswordBA = $software[$i][29] $sKeyBA = $software[$i][30] ExitLoop EndIf Next ;*********** Scan Registry for selected application information. Set variables accordingly. *********** If $sLimitAA > 1 Or $sLimitRA > 1 Or $sLimitBA > 1 Then $limit = "Yes" Else $limit = "No" EndIf $versionInst = 0 $installDate = "N/A" $publisher = "N/A" $estimatedSize = "N/A" If IsArray($arrayHKCU_UnInst) Then ;_ArrayDisplay($arrayHKCU_UnInst,"$arrayHKCU_UnInst") For $i = 1 To $arrayHKCU_UnInst[0] If StringInStr(RegRead($sHKCU_UnInst & "\" & $arrayHKCU_UnInst[$i], "DisplayName"), $sSelAppReg) Then $versionInst = RegRead($sHKCU_UnInst & "\" & $arrayHKCU_UnInst[$i], "DisplayVersion") $installDate = RegRead($sHKCU_UnInst & "\" & $arrayHKCU_UnInst[$i], "InstallDate") $uninstall = RegRead($sHKCU_UnInst & "\" & $arrayHKCU_UnInst[$i], "UninstallString") $publisher = RegRead($sHKCU_UnInst & "\" & $arrayHKCU_UnInst[$i], "Publisher") $estimatedSize = RegRead($sHKCU_UnInst & "\" & $arrayHKCU_UnInst[$i], "EstimatedSize"); Value is in KB EndIf Next EndIf If IsArray($arrayHKLM_Inst) Then ;_ArrayDisplay($arrayHKLM_Inst,"$arrayHKLM_Inst") For $i = 1 To $arrayHKLM_Inst[0] If StringInStr(RegRead($sHKLM_Inst & "\" & $arrayHKLM_Inst[$i], "DisplayName"), $sSelAppReg) Then If _VersionCompare(RegRead($sHKLM_Inst & "\" & $arrayHKLM_Inst[$i], "DisplayVersion"), $versionInst) = 1 Then $versionInst = RegRead($sHKLM_Inst & "\" & $arrayHKLM_Inst[$i], "DisplayVersion") $installDate = RegRead($sHKLM_Inst & "\" & $arrayHKLM_Inst[$i], "InstallDate") $uninstall = RegRead($sHKLM_Inst & "\" & $arrayHKLM_Inst[$i], "UninstallString") $publisher = RegRead($sHKLM_Inst & "\" & $arrayHKLM_Inst[$i], "Publisher") $estimatedSize = RegRead($sHKLM_Inst & "\" & $arrayHKLM_Inst[$i], "EstimatedSize"); Value is in KB EndIf EndIf Next EndIf If IsArray($arrayHKLM_Inst64) Then ;_ArrayDisplay($arrayHKLM_Inst64,"$arrayHKLM_Inst64") For $i = 1 To $arrayHKLM_Inst64[0] If StringInStr(RegRead($sHKLM_Inst64 & "\" & $arrayHKLM_Inst64[$i], "DisplayName"), $sSelAppReg) Then If _VersionCompare(RegRead($sHKLM_Inst64 & "\" & $arrayHKLM_Inst64[$i], "DisplayVersion"), $versionInst) = 1 Then $versionInst = RegRead($sHKLM_Inst64 & "\" & $arrayHKLM_Inst64[$i], "DisplayVersion") $installDate = RegRead($sHKLM_Inst64 & "\" & $arrayHKLM_Inst64[$i], "InstallDate") $uninstall = RegRead($sHKLM_Inst64 & "\" & $arrayHKLM_Inst64[$i], "UninstallString") $publisher = RegRead($sHKLM_Inst64 & "\" & $arrayHKLM_Inst64[$i], "Publisher") $estimatedSize = RegRead($sHKLM_Inst64 & "\" & $arrayHKLM_Inst64[$i], "EstimatedSize"); Value is in KB EndIf EndIf Next EndIf If IsArray($arrayHKLM_UnInst) Then ;_ArrayDisplay($arrayHKLM_UnInst,"$arrayHKLM_UnInst") For $i = 1 To $arrayHKLM_UnInst[0] If StringInStr(RegRead($sHKLM_UnInst & "\" & $arrayHKLM_UnInst[$i], "DisplayName"), $sSelAppReg) Then If _VersionCompare(RegRead($sHKLM_UnInst & "\" & $arrayHKLM_UnInst[$i], "DisplayVersion"), $versionInst) = 1 Then $versionInst = RegRead($sHKLM_UnInst & "\" & $arrayHKLM_UnInst[$i], "DisplayVersion") $installDate = RegRead($sHKLM_UnInst & "\" & $arrayHKLM_UnInst[$i], "InstallDate") $uninstall = RegRead($sHKLM_UnInst & "\" & $arrayHKLM_UnInst[$i], "UninstallString") $publisher = RegRead($sHKLM_UnInst & "\" & $arrayHKLM_UnInst[$i], "Publisher") $estimatedSize = RegRead($sHKLM_UnInst & "\" & $arrayHKLM_UnInst[$i], "EstimatedSize"); Value is in KB EndIf EndIf Next EndIf If IsArray($arrayHKLM_UnInst64) Then ;_ArrayDisplay($arrayHKLM_UnInst64,"$arrayHKLM_UnInst64") For $i = 1 To $arrayHKLM_UnInst64[0] If StringInStr(RegRead($sHKLM_UnInst64 & "\" & $arrayHKLM_UnInst64[$i], "DisplayName"), $sSelAppReg) Then If _VersionCompare(RegRead($sHKLM_UnInst64 & "\" & $arrayHKLM_UnInst64[$i], "DisplayVersion"), $versionInst) = 1 Then $versionInst = RegRead($sHKLM_UnInst64 & "\" & $arrayHKLM_UnInst64[$i], "DisplayVersion") $installDate = RegRead($sHKLM_UnInst64 & "\" & $arrayHKLM_UnInst64[$i], "InstallDate") $uninstall = RegRead($sHKLM_UnInst64 & "\" & $arrayHKLM_UnInst64[$i], "UninstallString") $publisher = RegRead($sHKLM_UnInst64 & "\" & $arrayHKLM_UnInst64[$i], "Publisher") $estimatedSize = RegRead($sHKLM_UnInst64 & "\" & $arrayHKLM_UnInst64[$i], "EstimatedSize"); Value is in KB EndIf EndIf Next EndIf If IsArray($arrayHKLM_Driver) Then ;_ArrayDisplay($arrayHKLM_Driver,"$arrayHKLM_Driver") For $i = 1 To $arrayHKLM_Driver[0] If StringInStr(RegRead($arrayHKLM_Driver[$i], "DriverDesc"), $sSelAppReg) Then If _VersionCompare(RegRead($arrayHKLM_Driver[$i], "DriverVersion"), $versionInst) = 1 Then $versionInst = RegRead($arrayHKLM_Driver[$i], "DriverVersion") $installDate = RegRead($arrayHKLM_Driver[$i], "DriverDate") $uninstall = "" $publisher = "" $estimatedSize = "" EndIf EndIf Next EndIf If $versionInst = 0 Then $versionInst = "Not installed" $installDate = "N/A" $publisher = "N/A" $estimatedSize = "N/A" EndIf ;*********** Check application update requirements *********** ;_CheckUpdates() ;*********** Set labels with system and application information *********** $labelInfoString1 = "Application Name: " & @CR & "Installed Version: " & @CR & "Available Version: " & @CR & "Rollback Version: " & @CR & "Beta Version: " & @CR & "Architecture: " & @CR & "Restrictions: " & @CR & "Install Limit: " & @CR & "Profile Application: " $labelInfoString2 = "Application Name: " & $selApp & @CR & "Installed Version: " & $versionInst & @CR & "Available Version: " & $sVersionAA & @CR & "Rollback Version: " & $sVersionRA & @CR & "Beta Version: " & $sVersionBA & @CR & "Architecture: " & $sArchitecture & @CR & "Restrictions: " & $restrictions & @CR & "Install Limit: " & $limit & @CR & "Profile Application: " & $sProfile GUICtrlSetData($labelInfo, $labelInfoString1) If _VersionCompare($versionInst, $sVersionAA) = -1 Then GUICtrlSetData($labelInfo, $labelInfoString2) GUICtrlSetColor($labelInfo, 0xff0000) ;Red Else GUICtrlSetData($labelInfo, $labelInfoString2) GUICtrlSetColor($labelInfo, 0x000000) ;Black EndIf Select Case IsArray($arrayUpdates); ;Sleep(250) GUICtrlSetState($btnShowUpdates, $GUI_ENABLE) GUICtrlSetData($labelStatus1, "Updates available: " & @CR & @CR & @CR & "List updates: " & @CR & @CR) GUICtrlSetData($labelStatus1, "Updates available: " & @CR & $arrayUpdates[0] & @CR & "List updates: " & @CR) Case Not IsArray($arrayUpdates); ;Sleep(250) GUICtrlSetState($btnShowUpdates, $GUI_DISABLE) GUICtrlSetData($labelStatus1, "Updates available: " & @CR & @CR & @CR & "List updates: " & @CR & @CR) GUICtrlSetData($labelStatus1, "Updates available: " & @CR & "No updates required" & @CR & "List updates: " & @CR) EndSelect EndIf ;MsgBox(0,"Information function",TimerDiff($time2) / 1000 & " secs") EndFunc ;==>_Information Func _CheckUpdates() ; Checks system to see what applications are out of date. #cs *************** For testing array ***************** If IsArray($software) Then MsgBox(0,"","Check updates initiated") _ArrayDisplay($software) Else MsgBox(0,"","Software not an array") EndIf #ce ;$time3 = TimerInit() $arrayUpdates = "" For $a = 1 To UBound($software) - 1 $versionInstChk = 0 If IsArray($arrayHKCU_UnInst) Then For $i = 1 To $arrayHKCU_UnInst[0] If StringInStr(RegRead($sHKCU_UnInst & "\" & $arrayHKCU_UnInst[$i], "DisplayName"), $software[$a][1]) Then $versionInstChk = RegRead($sHKCU_UnInst & "\" & $arrayHKCU_UnInst[$i], "DisplayVersion") EndIf Next EndIf If IsArray($arrayHKLM_Inst) Then For $i = 1 To $arrayHKLM_Inst[0] If StringInStr(RegRead($sHKLM_Inst & "\" & $arrayHKLM_Inst[$i], "DisplayName"), $software[$a][1]) Then If _VersionCompare(RegRead($sHKLM_Inst & "\" & $arrayHKLM_Inst[$i], "DisplayVersion"), $versionInstChk) = 1 Then $versionInstChk = RegRead($sHKLM_Inst & "\" & $arrayHKLM_Inst[$i], "DisplayVersion") EndIf EndIf Next EndIf If IsArray($arrayHKLM_Inst64) Then For $i = 1 To $arrayHKLM_Inst64[0] If StringInStr(RegRead($sHKLM_Inst64 & "\" & $arrayHKLM_Inst64[$i], "DisplayName"), $software[$a][1]) Then If _VersionCompare(RegRead($sHKLM_Inst64 & "\" & $arrayHKLM_Inst64[$i], "DisplayVersion"), $versionInstChk) = 1 Then $versionInstChk = RegRead($sHKLM_Inst64 & "\" & $arrayHKLM_Inst64[$i], "DisplayVersion") EndIf EndIf Next EndIf If IsArray($arrayHKLM_UnInst) Then For $i = 1 To $arrayHKLM_UnInst[0] If StringInStr(RegRead($sHKLM_UnInst & "\" & $arrayHKLM_UnInst[$i], "DisplayName"), $software[$a][1]) Then If _VersionCompare(RegRead($sHKLM_UnInst & "\" & $arrayHKLM_UnInst[$i], "DisplayVersion"), $versionInstChk) = 1 Then $versionInstChk = RegRead($sHKLM_UnInst & "\" & $arrayHKLM_UnInst[$i], "DisplayVersion") EndIf EndIf Next EndIf If IsArray($arrayHKLM_UnInst64) Then For $i = 1 To $arrayHKLM_UnInst64[0] If StringInStr(RegRead($sHKLM_UnInst64 & "\" & $arrayHKLM_UnInst64[$i], "DisplayName"), $software[$a][1]) Then If _VersionCompare(RegRead($sHKLM_UnInst64 & "\" & $arrayHKLM_UnInst64[$i], "DisplayVersion"), $versionInstChk) = 1 Then $versionInstChk = RegRead($sHKLM_UnInst64 & "\" & $arrayHKLM_UnInst64[$i], "DisplayVersion") EndIf EndIf Next EndIf If IsArray($arrayHKLM_Driver) Then For $i = 1 To $arrayHKLM_Driver[0] If StringInStr(RegRead($sHKLM_Driver & "\" & $arrayHKLM_Driver[$i], "DriverDesc"), $software[$a][1]) Then If _VersionCompare(RegRead($sHKLM_Driver & "\" & $arrayHKLM_Driver[$i], "DriverVersion"), $versionInstChk) = 1 Then $versionInstChk = RegRead($sHKLM_Driver & "\" & $arrayHKLM_Driver[$i], "DriverVersion") EndIf EndIf Next EndIf If _VersionCompare($versionInstChk, $software[$a][10]) = -1 And $versionInstChk <> 0 Then $arrayUpdates = $arrayUpdates & $software[$a][2] & "|" EndIf ;MsgBox(0,"","This version number: " & $versionInstChk & @CR & "Has to be less than: " & $software[$a][3] & @CR & "Result: " & _VersionCompare($versionInstChk,$software[$a][3]) & @CR & "String so far: " & $arrayUpdates) Next Do If StringRight($arrayUpdates, 1) = "|" Then $arrayUpdates = StringTrimRight($arrayUpdates, 1) EndIf Until StringRight($arrayUpdates, 1) <> "|" If $arrayUpdates <> "" Then $arrayUpdatesString = $arrayUpdates $arrayUpdates = StringSplit($arrayUpdates, "|") EndIf If $arrayUpdatesLast <> $arrayUpdatesString Then GUICtrlSetData($listUpdates, "") GUICtrlSetData($listUpdates, $arrayUpdatesString) GUICtrlSetData($labelStatus1, "Updates available: " & @CR & @CR & @CR & "List updates: " & @CR & @CR) If IsArray($arrayUpdates) Then GUICtrlSetData($labelStatus1, "Updates available: " & @CR & $arrayUpdates[0] & @CR & "List updates: " & @CR) Else GUICtrlSetData($labelStatus1, "Updates available: " & @CR & "No updates required" & @CR & "List updates: " & @CR) GUICtrlSetData($listUpdates, "") EndIf $arrayUpdatesLast = $arrayUpdatesString EndIf If StringInStr(GUICtrlRead($labelStatus1), "No updates required") Then GUICtrlSetData($listUpdates, "") EndIf ;_ArrayDisplay($arrayUpdates, "Updates available", "", 32) ;MsgBox(0,"Check Updates function",TimerDiff($time3) / 1000 & " secs") EndFunc ;==>_CheckUpdates Func _UpdateAll() $hOpenFile = FileOpen($iniS_ClientLog, 9) FileWriteLine($hOpenFile, @CRLF & "Date and Time: " & _Now() & @CR) FileWriteLine($hOpenFile, @CRLF & "OS Architecture: " & @OSArch & @CR) FileWriteLine($hOpenFile, @CRLF & "Selected Application: UPDATE ALL" & @CR) ;MsgBox(0,"","Updates: " & $arrayUpdates[0] & @CR & "Software: " & UBound($software) -1) ;_ArrayDisplay($arrayUpdates) ;_ArrayDisplay($software) $arrayUpdateAll = $arrayUpdates If IsArray($arrayUpdateAll) Then For $u = 1 To $arrayUpdateAll[0] For $i = 1 To UBound($software) - 1 If $software[$i][2] = $arrayUpdateAll[$u] Then $sSelAppReg = $software[$i][1] $sProfile = $software[$i][5] $sRunningApps = $software[$i][6] $sArchitecture = $software[$i][9] $sVersionAA = $software[$i][10] $sInstallDirx86 = $software[$i][11] $sInstallDirx64 = $software[$i][12] $sLimitAA = $software[$i][13] ExitLoop EndIf Next FileWriteLine($hOpenFile, @CRLF & "Application Name: " & $arrayUpdateAll[$u] & @CR) If $sRunningApps = "" Then GUICtrlSetData($labelStatus2, "Installing...") FileWriteLine($hOpenFile, @CRLF & "Code: U1001" & @CR) _Install_Profile() _CheckUpdates() Sleep(1500) _AppLog() Else $runningAppsSplit = StringSplit($sRunningApps, ";") If IsArray($runningAppsSplit) Then For $ra = 1 To $runningAppsSplit[0] If ProcessExists($runningAppsSplit[$ra]) <> 0 Then ; Running Application in memory FileWriteLine($hOpenFile, @CRLF & "Error: Installation aborted due to running application. " & $runningAppsSplit[$ra] & "." & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) MsgBox(16, "Process running", "The following process is running and needs to be closed for the installation to continue." & @CR & @CR & $runningAppsSplit[$ra] & @CR & @CR & "Please start the installation again.") ExitLoop Else GUICtrlSetData($labelStatus2, "Installing...") FileWriteLine($hOpenFile, @CRLF & "Code: U1002" & @CR) _Install_Profile() _CheckUpdates() Sleep(1500) _AppLog() ExitLoop EndIf Next Else GUICtrlSetData($labelStatus2, "Installing...") FileWriteLine($hOpenFile, @CRLF & "Code: U1003" & @CR) _Install_Profile() _CheckUpdates() Sleep(1500) _AppLog() EndIf EndIf If IsArray($arrayUpdateAll) Then If $u = $arrayUpdateAll[0] Then GUICtrlSetData($labelStatus1, "Updates available: " & @CR & "No updates required" & @CR & "List updates: " & @CR) GUICtrlSetData($listUpdates, "") ExitLoop EndIf EndIf Next EndIf EndFunc ;==>_UpdateAll Func _Uninstall() If StringInStr($uninstall, ".exe") Then ;Or StringInStr($uninstall, ".msi") Then $uninstall = '"' & $uninstall $uninstall = StringReplace($uninstall, ".exe", '.exe"', 1) EndIf If StringRight($uninstall, 2) = '""' Then $uninstall = StringTrimRight($uninstall, 1) EndIf If StringLeft($uninstall, 2) = '""' Then $uninstall = StringTrimLeft($uninstall, 1) EndIf If StringInStr($uninstall, '""') Then $uninstall = StringReplace($uninstall, '""','"') EndIf GUICtrlSetData($labelStatus2, "Uninstalling...") If $isAdmin = True Then RunWait(@ComSpec & " /c " & $uninstall, "", @SW_HIDE) ElseIf $isAdmin = False Then _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c " & $uninstall, "", @SW_HIDE) EndIf EndFunc ;==>_Uninstall Func _Install_Rollback() If @OSArch = "X86" Then $installDir = $sRollbackInstallDirx86 ElseIf @OSArch = "X64" And $sArchitecture = "X86" Then $installDir = $sRollbackInstallDirx86 Else $installDir = $sRollbackInstallDirx64 EndIf If $sParamRA = "" Then $profileApp = $installDir Else $profileApp = $installDir & " " & $sParamRA EndIf If $sProfile = "Yes" Then FileWriteLine($hOpenFile, @CRLF & "Profile Application: Yes" & @CR) ;$pw = InputBox("User password", "Please enter your network password.", "", "*") If @OSVersion = "WIN_XP" Then $randomPW = Random(100000, 999999, 1) $iProgress_1 = GUICtrlCreateProgress(200, 400, 445, 20, $PBS_MARQUEE) $Label1 = GUICtrlCreateLabel("Copy installation files...", 200, 420, 170, 15) _ProgressMarquee_Start($iProgress_1) FileCopy($profileApp, "C:\Temp\", 9) _ProgressMarquee_Stop($iProgress_1) GUICtrlDelete($iProgress_1) GUICtrlDelete($Label1) Local $string = _StringExplode($profileApp, "\") $arraySize = UBound($string) If IsAdmin() Then If FileExists('"C:\Temp\' & $string[$arraySize - 1] & '"') Then RunWait(@ComSpec & ' /c "C:\Temp\' & $string[$arraySize - 1] & '"', "", @SW_HIDE) Else RunWait(@ComSpec & ' /c "' & $profileApp & '"', "", @SW_HIDE) EndIf Else MsgBox(0, "Windows Security", "When prompted for a username and password, please enter the credentials below." & @CR & @CR & "Username: " & @ComputerName & "\" & $iniA_LocalInstallUser & @CR & "Password: " & $iniA_LocalInstallPassword & $randomPW) If $isAdmin = True Then RunWait(@ComSpec & " /c net user " & $iniA_LocalInstallUser & " " & $iniA_LocalInstallPassword & $randomPW & " /ADD", "", @SW_HIDE) RunWait(@ComSpec & " /c net localgroup Administrators " & $iniA_LocalInstallUser & " /ADD", "", @SW_HIDE) ElseIf $isAdmin = False Then _DecryptPW1() RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c net user " & $iniA_LocalInstallUser & " " & $iniA_LocalInstallPassword & $randomPW & " /ADD", "", @SW_HIDE) RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c net localgroup Administrators " & $iniA_LocalInstallUser & " /ADD", "", @SW_HIDE) EndIf If FileExists('"C:\Temp\' & $string[$arraySize - 1] & '"') Then RunWait(@ComSpec & ' /c "C:\Temp\' & $string[$arraySize - 1] & '"', "", @SW_HIDE) Else RunWait(@ComSpec & ' /c "' & $profileApp & '"', "", @SW_HIDE) EndIf If $isAdmin = True Then RunWait(@ComSpec & " /c net user " & $iniA_LocalInstallUser & " /Delete", "", @SW_HIDE) ElseIf $isAdmin = False Then _DecryptPW1() RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c net user " & $iniA_LocalInstallUser & " /Delete", "", @SW_HIDE) EndIf EndIf Else $randomPW = Random(100000, 999999, 1) $iProgress_1 = GUICtrlCreateProgress(200, 400, 445, 20, $PBS_MARQUEE) $Label1 = GUICtrlCreateLabel("Copy installation files...", 200, 420, 170, 15) _ProgressMarquee_Start($iProgress_1) EnvSet("__COMPAT_LAYER", "RunAsInvoker") FileCopy($profileApp, "C:\Temp\", 9) _ProgressMarquee_Stop($iProgress_1) GUICtrlDelete($iProgress_1) GUICtrlDelete($Label1) Local $string = _StringExplode($profileApp, "\") $arraySize = UBound($string) If IsAdmin() Then If FileExists('"C:\Temp\' & $string[$arraySize - 1] & '"') Then RunWait(@ComSpec & ' /c "C:\Temp\' & $string[$arraySize - 1] & '"', "", @SW_HIDE) Else RunWait(@ComSpec & ' /c "' & $profileApp & '"', "", @SW_HIDE) EndIf Else MsgBox(0, "Windows Security", "When prompted for a username and password, please enter the credentials below." & @CR & @CR & "Username: " & @ComputerName & "\" & $iniA_LocalInstallUser & @CR & "Password: " & $iniA_LocalInstallPassword & $randomPW) If $isAdmin = True Then EnvSet("__COMPAT_LAYER", "RunAsInvoker") RunWait(@ComSpec & " /c '" & $scriptDir & "\Apps\x86\microsoft\cmd\CreateUser.exe' " & $randomPW, "", @SW_HIDE) ElseIf $isAdmin = False Then _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c '" & $scriptDir & "\Apps\x86\microsoft\cmd\CreateUser.exe' " & $randomPW, "", @SW_HIDE) EndIf If FileExists('"C:\Temp\' & $string[$arraySize - 1] & '"') Then RunWait(@ComSpec & ' /c "C:\Temp\' & $string[$arraySize - 1] & '"', "", @SW_HIDE) Else RunWait(@ComSpec & ' /c "' & $profileApp & '"', "", @SW_HIDE) EndIf If $isAdmin = True Then EnvSet("__COMPAT_LAYER", "RunAsInvoker") RunWait(@ComSpec & " /c '" & $scriptDir & "\Apps\x86\microsoft\cmd\RemoveUser.exe'", "", @SW_HIDE) ElseIf $isAdmin = False Then _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c '" & $scriptDir & "\Apps\x86\microsoft\cmd\RemoveUser.exe'", "", @SW_HIDE) EndIf EndIf EndIf FileWriteLine($hOpenFile, @CRLF & "Install: Complete" & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) Else FileWriteLine($hOpenFile, @CRLF & "Profile Application: No" & @CR) If $isAdmin = True Then If $sParamRA = "" Then _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & ' /c "' & $installDir & '"', "", @SW_HIDE) Else _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & ' /c "' & $installDir & '"' & " " & $sParamRA, "", @SW_HIDE) EndIf ElseIf $isAdmin = False Then If $sParamRA = "" Then _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & ' /c "' & $installDir & '"', "", @SW_HIDE) Else _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & ' /c "' & $installDir & '"' & " " & $sParamRA, "", @SW_HIDE) EndIf EndIf FileWriteLine($hOpenFile, @CRLF & "Install: Complete" & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) EndIf EndFunc ;==>_Install_Rollback Func _Install_Beta() If @OSArch = "X86" Then $installDir = $sBetaInstallDirx86 ElseIf @OSArch = "X64" And $sArchitecture = "X86" Then $installDir = $sBetaInstallDirx86 Else $installDir = $sBetaInstallDirx64 EndIf If $sParamBA = "" Then $profileApp = $installDir Else $profileApp = $installDir & " " & $sParamBA EndIf If $profile = "Yes" Then FileWriteLine($hOpenFile, @CRLF & "Profile Application: Yes" & @CR) ;$pw = InputBox("User password", "Please enter your network password.", "", "*") If @OSVersion = "WIN_XP" Then $randomPW = Random(100000, 999999, 1) $iProgress_1 = GUICtrlCreateProgress(200, 400, 445, 20, $PBS_MARQUEE) $Label1 = GUICtrlCreateLabel("Copy installation files...", 200, 420, 170, 15) _ProgressMarquee_Start($iProgress_1) FileCopy($profileApp, "C:\Temp\", 9) _ProgressMarquee_Stop($iProgress_1) GUICtrlDelete($iProgress_1) GUICtrlDelete($Label1) Local $string = _StringExplode($profileApp, "\") $arraySize = UBound($string) If IsAdmin() Then If FileExists('"C:\Temp\' & $string[$arraySize - 1] & '"') Then RunWait(@ComSpec & ' /c "C:\Temp\' & $string[$arraySize - 1] & '"', "", @SW_HIDE) Else RunWait(@ComSpec & ' /c "' & $profileApp & '"', "", @SW_HIDE) EndIf Else MsgBox(0, "Windows Security", "When prompted for a username and password, please enter the credentials below." & @CR & @CR & "Username: " & @ComputerName & "\" & @CR & "Password: Tc" & $randomPW) If $isAdmin = True Then RunWait(@ComSpec & " /c net user " & $iniA_LocalInstallUser & " " & $iniA_LocalInstallPassword & $randomPW & " /ADD", "", @SW_HIDE) RunWait(@ComSpec & " /c net localgroup Administrators " & $iniA_LocalInstallUser & " /ADD", "", @SW_HIDE) ElseIf $isAdmin = False Then _DecryptPW1() RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c net user " & $iniA_LocalInstallUser & " " & $iniA_LocalInstallPassword & $randomPW & " /ADD", "", @SW_HIDE) RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c net localgroup Administrators " & $iniA_LocalInstallUser & " /ADD", "", @SW_HIDE) EndIf If FileExists('"C:\Temp\' & $string[$arraySize - 1] & '"') Then RunWait(@ComSpec & ' /c "C:\Temp\' & $string[$arraySize - 1] & '"', "", @SW_HIDE) Else RunWait(@ComSpec & ' /c "' & $profileApp & '"', "", @SW_HIDE) EndIf If $isAdmin = True Then RunWait(@ComSpec & " /c net user " & $iniA_LocalInstallUser & " /Delete", "", @SW_HIDE) ElseIf $isAdmin = False Then _DecryptPW1() RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c net user " & $iniA_LocalInstallUser & " /Delete", "", @SW_HIDE) EndIf EndIf Else $randomPW = Random(100000, 999999, 1) $iProgress_1 = GUICtrlCreateProgress(200, 400, 445, 20, $PBS_MARQUEE) $Label1 = GUICtrlCreateLabel("Copy installation files...", 200, 420, 170, 15) _ProgressMarquee_Start($iProgress_1) EnvSet("__COMPAT_LAYER", "RunAsInvoker") FileCopy($profileApp, "C:\Temp\", 9) _ProgressMarquee_Stop($iProgress_1) GUICtrlDelete($iProgress_1) GUICtrlDelete($Label1) Local $string = _StringExplode($profileApp, "\") $arraySize = UBound($string) If IsAdmin() Then If FileExists('"C:\Temp\' & $string[$arraySize - 1] & '"') Then RunWait(@ComSpec & ' /c "C:\Temp\' & $string[$arraySize - 1] & '"', "", @SW_HIDE) Else RunWait(@ComSpec & ' /c "' & $profileApp & '"', "", @SW_HIDE) EndIf Else MsgBox(0, "Windows Security", "When prompted for a username and password, please enter the credentials below." & @CR & @CR & "Username: " & @ComputerName & "\install" & @CR & "Password: Tc" & $randomPW) If $isAdmin = True Then EnvSet("__COMPAT_LAYER", "RunAsInvoker") RunWait(@ComSpec & " /c '" & $scriptDir & "\Apps\x86\microsoft\cmd\CreateUser.exe' " & $randomPW, "", @SW_HIDE) ElseIf $isAdmin = False Then _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c '" & $scriptDir & "\Apps\x86\microsoft\cmd\CreateUser.exe' " & $randomPW, "", @SW_HIDE) EndIf If FileExists('"C:\Temp\' & $string[$arraySize - 1] & '"') Then RunWait(@ComSpec & ' /c "C:\Temp\' & $string[$arraySize - 1] & '"', "", @SW_HIDE) Else RunWait(@ComSpec & ' /c "' & $profileApp & '"', "", @SW_HIDE) EndIf If $isAdmin = True Then EnvSet("__COMPAT_LAYER", "RunAsInvoker") RunWait(@ComSpec & " /c '" & $scriptDir & "\Apps\x86\microsoft\cmd\RemoveUser.exe'", "", @SW_HIDE) ElseIf $isAdmin = False Then _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c '" & $scriptDir & "\Apps\x86\microsoft\cmd\RemoveUser.exe'", "", @SW_HIDE) EndIf EndIf EndIf FileWriteLine($hOpenFile, @CRLF & "Install: Complete" & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) Else FileWriteLine($hOpenFile, @CRLF & "Profile Application: No" & @CR) If $isAdmin = True Then If $sParamBA = "" Then _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & ' /c "' & $installDir & '"', "", @SW_HIDE) Else _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & ' /c "' & $installDir & '"' & " " & $sParamBA, "", @SW_HIDE) EndIf ElseIf $isAdmin = False Then If $sParamBA = "" Then _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & ' /c "' & $installDir & '"', "", @SW_HIDE) Else _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & ' /c "' & $installDir & '"' & " " & $sParamBA, "", @SW_HIDE) EndIf EndIf FileWriteLine($hOpenFile, @CRLF & "Install: Complete" & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) EndIf EndFunc ;==>_Install_Beta Func _Install_Profile() If @OSArch = "X86" Then $installDir = $sInstallDirx86 ElseIf @OSArch = "X64" And $sArchitecture = "X86" Then $installDir = $sInstallDirx86 Else $installDir = $sInstallDirx64 EndIf If $sParamAA = "" Then $profileApp = $installDir Else $profileApp = $installDir & " " & $sParamAA EndIf If $profile = "Yes" Then FileWriteLine($hOpenFile, @CRLF & "Profile Application: Yes" & @CR) ;$pw = InputBox("User password", "Please enter your network password.", "", "*") If @OSVersion = "WIN_XP" Then $randomPW = Random(100000, 999999, 1) $iProgress_1 = GUICtrlCreateProgress(200, 400, 445, 20, $PBS_MARQUEE) $Label1 = GUICtrlCreateLabel("Copy installation files...", 200, 420, 170, 15) _ProgressMarquee_Start($iProgress_1) FileCopy($profileApp, "C:\Temp\", 9) _ProgressMarquee_Stop($iProgress_1) GUICtrlDelete($iProgress_1) GUICtrlDelete($Label1) Local $string = _StringExplode($profileApp, "\") $arraySize = UBound($string) If IsAdmin() Then If FileExists('"C:\Temp\' & $string[$arraySize - 1] & '"') Then RunWait(@ComSpec & ' /c "C:\Temp\' & $string[$arraySize - 1] & '"', "", @SW_HIDE) Else RunWait(@ComSpec & ' /c "' & $profileApp & '"', "", @SW_HIDE) EndIf Else MsgBox(0, "Windows Security", "When prompted for a username and password, please enter the credentials below." & @CR & @CR & "Username: " & @ComputerName & "\" & $iniA_LocalInstallUser & @CR & "Password: " & $iniA_LocalInstallPassword & $randomPW) If $isAdmin = True Then EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & " /c net user " & $iniA_LocalInstallUser & " " & $iniA_LocalInstallPassword & $randomPW & " /ADD", "", @SW_HIDE) EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & " /c net localgroup Administrators " & $iniA_LocalInstallUser & " /ADD", "", @SW_HIDE) ElseIf $isAdmin = False Then _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c net user " & $iniA_LocalInstallUser & " " & $iniA_LocalInstallPassword & $randomPW & " /ADD", "", @SW_HIDE) EndIf If FileExists('"C:\Temp\' & $string[$arraySize - 1] & '"') Then $pid = RunWait(@ComSpec & ' /c "C:\Temp\' & $string[$arraySize - 1] & '"', "", @SW_HIDE) Else $pid = RunWait(@ComSpec & ' /c "' & $profileApp & '"', "", @SW_HIDE) EndIf If $isAdmin = True Then EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & " /c net user " & $iniA_LocalInstallUser & " /Delete", "", @SW_HIDE) ElseIf $isAdmin = False Then _DecryptPW1() EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c net user " & $iniA_LocalInstallUser & " /Delete", "", @SW_HIDE) EndIf EndIf Else $randomPW = Random(100000, 999999, 1) $iProgress_1 = GUICtrlCreateProgress(200, 400, 445, 20, $PBS_MARQUEE) $Label1 = GUICtrlCreateLabel("Copy installation files...", 200, 420, 170, 15) _ProgressMarquee_Start($iProgress_1) EnvSet("__COMPAT_LAYER", "RunAsInvoker") FileCopy($profileApp, "C:\Temp\", 9) _ProgressMarquee_Stop($iProgress_1) GUICtrlDelete($iProgress_1) GUICtrlDelete($Label1) Local $string = _StringExplode($profileApp, "\") $arraySize = UBound($string) If IsAdmin() Then If FileExists('"C:\Temp\' & $string[$arraySize - 1] & '"') Then $pid = RunWait(@ComSpec & ' /c "C:\Temp\' & $string[$arraySize - 1] & '"', "", @SW_HIDE) Else $pid = RunWait(@ComSpec & ' /c "' & $profileApp & '"', "", @SW_HIDE) EndIf Else MsgBox(0, "Windows Security", "When prompted for a username and password, please enter the credentials below." & @CR & @CR & "Username: " & @ComputerName & "\" & $iniA_LocalInstallUser & @CR & "Password: " & $iniA_LocalInstallPassword & $randomPW) If $isAdmin = True Then ;EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & " /c \\apps\apps$\K-12\AppStore\Utilities\Create_Local_Admin.exe " & $randomPW, "", @SW_HIDE) ElseIf $isAdmin = False Then _DecryptPW1() ;EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c \\apps\apps$\K-12\AppStore\Utilities\Create_Local_Admin.exe " & $randomPW, "", @SW_HIDE) EndIf If FileExists('"C:\Temp\' & $string[$arraySize - 1] & '"') Then $pid = RunWait(@ComSpec & ' /c "C:\Temp\' & $string[$arraySize - 1] & '"', "", @SW_HIDE) Else $pid = RunWait(@ComSpec & ' /c "' & $profileApp & '"', "", @SW_HIDE) EndIf If $isAdmin = True Then ;EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & " /c \\apps\apps$\K-12\AppStore\Utilities\Delete_Local_Admin.exe", "", @SW_HIDE) ElseIf $isAdmin = False Then _DecryptPW1() ;EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & " /c \\apps\apps$\K-12\AppStore\Utilities\Delete_Local_Admin.exe", "", @SW_HIDE) EndIf EndIf EndIf FileWriteLine($hOpenFile, @CRLF & "Install: Complete" & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) Else FileWriteLine($hOpenFile, @CRLF & "Profile Application: No" & @CR) If $isAdmin = True Then If $sParamAA = "" Then EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & ' /c "' & $installDir & '"', "", @SW_HIDE) ;MsgBox(0,"",@ComSpec & ' /c "' & $installDir & '"') Else EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & ' /c "' & $installDir & '"' & " " & $sParamAA, "", @SW_HIDE) ;MsgBox(0,"",@ComSpec & ' /c "' & $installDir & '"' & " " & $sParamAA) EndIf #cs If StringRight($installDir,4) = ".msi" Then If $sParamAA = "" Then EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & ' /c "' & $installDir & '"', "", @SW_HIDE) ;MsgBox(0,"",@ComSpec & ' /c msiexec /i "' & $installDir & '"') Else EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & ' /c "' & $installDir & '"' & " " & $sParamAA, "", @SW_HIDE) ;MsgBox(0,"",@ComSpec & ' /c msiexec /i "' & $installDir & '"' & " " & $sParamAA) EndIf Else If $sParamAA = "" Then EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & ' /c "' & $installDir & '"', "", @SW_HIDE) ;MsgBox(0,"",@ComSpec & ' /c "' & $installDir & '"') Else EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunWait(@ComSpec & ' /c "' & $installDir & '"' & " " & $sParamAA, "", @SW_HIDE) ;MsgBox(0,"",@ComSpec & ' /c "' & $installDir & '"' & " " & $sParamAA) EndIf EndIf #ce ElseIf $isAdmin = False Then _DecryptPW1() If $sParamAA = "" Then EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & ' /c "' & $installDir & '"', "", @SW_HIDE) ;MsgBox(0,"",@ComSpec & ' /c "' & $installDir & '"' & @CRLF & @CRLF & "User: " & $iniA_InstallUser & @CRLF & "Domain: " & $iniS_Domain& @CRLF & "Password: " & $iniA_InstallPassword) Else EnvSet("__COMPAT_LAYER", "RunAsInvoker") $pid = RunAsWait($iniA_InstallUser, $iniS_Domain, $sPW, 0, @ComSpec & ' /c "' & $installDir & '"' & " " & $sParamAA, "", @SW_HIDE) ;MsgBox(0,"",@ComSpec & ' /c "' & $installDir & '"' & " " & $sParamAA & @CRLF & @CRLF & "User: " & $iniA_InstallUser & @CRLF & "Domain: " & $iniS_Domain& @CRLF & "Password: " & $iniA_InstallPassword) EndIf EndIf FileWriteLine($hOpenFile, @CRLF & "Install: Complete" & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) EndIf Sleep(4000) ;$fOpenP = FileOpen("C:\Temp\ProgressLog.txt", 10) Local $previous Local $loopP = 0 While 10 Sleep(50) $loopP = $loopP + 1 If $loopP >= 6 And $previous <> -1 Then ;FileClose($fOpenP) ExitLoop EndIf $msiProgress = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\InProgress", "") If @error Then If $previous = -1 And @error = 1 Then ;FileClose($fOpenP) ExitLoop EndIf $previous = @error ;FileWriteLine($fOpenP, "Error 1: " & @error) $msiProgress = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\InProgress", "") If @error Then ;FileWriteLine($fOpenP, "Error 2: " & @error) Sleep(4000) Else ;FileClose($fOpenP) ExitLoop EndIf Else Sleep(900) EndIf WEnd EndFunc ;==>_Install_Profile Func _Install_Limit_Update() ;MsgBox(0,"Limit",$limit) If $beta = "Yes" Then If StringIsDigit($sLimitBA) And $sLimitBA > 0 Then ;MsgBox(0,"Limit Set",$limit -1) _DecryptPW2() $sqlCon = ObjCreate("ADODB.Connection") $sqlCon.Open("Provider=" & $iniD_Provider & "; Server=" & $iniD_Server & "; database=" & $iniD_Database & "; User ID=" & $iniD_User & "; Password=" & $sPW2 & ";") $sqlEXE = $sqlCon.execute('UPDATE [' & $iniD_Database & '].[dbo].[' & $iniD_Table & '] SET "Limit Installations BA"=' & "'" & $sLimitBA - 1 & "'" & ' WHERE "Friendly Name"=' & "'" & $selApp & "';") $sqlCon.Close EndIf ElseIf $rollback = "Yes" Then If StringIsDigit($sLimitRA) And $sLimitRA > 0 Then ;MsgBox(0,"Limit Set",$limit -1) _DecryptPW2() $sqlCon = ObjCreate("ADODB.Connection") $sqlCon.Open("Provider=" & $iniD_Provider & "; Server=" & $iniD_Server & "; database=" & $iniD_Database & "; User ID=" & $iniD_User & "; Password=" & $sPW2 & ";") $sqlEXE = $sqlCon.execute('UPDATE [' & $iniD_Database & '].[dbo].[' & $iniD_Table & '] SET "Limit Installations RA"=' & "'" & $sLimitRA - 1 & "'" & ' WHERE "Friendly Name"=' & "'" & $selApp & "';") $sqlCon.Close EndIf Else If StringIsDigit($sLimitAA) And $sLimitAA > 0 Then ;MsgBox(0,"Limit Set",$sLimitAA -1) _DecryptPW2() $sqlCon = ObjCreate("ADODB.Connection") $sqlCon.Open("Provider=" & $iniD_Provider & "; Server=" & $iniD_Server & "; database=" & $iniD_Database & "; User ID=" & $iniD_User & "; Password=" & $sPW2 & ";") $sqlEXE = $sqlCon.execute('UPDATE [' & $iniD_Database & '].[dbo].[' & $iniD_Table & '] SET "Limit Installations AA"=' & "'" & $sLimitAA - 1 & "'" & ' WHERE "Friendly Name"=' & "'" & $selApp & "';") $sqlCon.Close EndIf EndIf EndFunc ;==>_Install_Limit_Update Func _Install_Limit_AA() If $sLimitAA = "0" Then ; No more licenses available for the application FileWriteLine($hOpenFile, @CRLF & "Code: 1002" & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) MsgBox(0, "Software license", "There are no more licenses available for download.") ElseIf $sLimitAA = "" Then ;No Licenses set FileWriteLine($hOpenFile, @CRLF & "Running Applications: " & $sRunningApps & @CR) $runningAppsSplit = StringSplit($sRunningApps, ";") If $sRunningApps = "" Then ; No Running applications set to restrict installation FileWriteLine($hOpenFile, @CRLF & "Code: 1003" & @CR) GUICtrlSetData($labelStatus2, "Installing...") _Install_Profile() Else ; Running application restrictions in place FileWriteLine($hOpenFile, @CRLF & "Code: 1004" & @CR) For $ra = 1 To $runningAppsSplit[0] If ProcessExists($runningAppsSplit[$ra]) <> 0 Then ; Running application in memory FileWriteLine($hOpenFile, @CRLF & "Error: Installation aborted due to running application. " & $runningAppsSplit[$ra] & "." & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) MsgBox(16, "Process running", "The following process is running and needs to be closed for the installation to continue." & @CR & @CR & $runningAppsSplit[$ra] & @CR & @CR & "Please start the installation again.") Else ; No Running applications in memory FileWriteLine($hOpenFile, @CRLF & "Code: 1005" & @CR) GUICtrlSetData($labelStatus2, "Installing...") _Install_Profile() ExitLoop EndIf Next EndIf Else ; No licenses specified, or license not exceeded FileWriteLine($hOpenFile, @CRLF & "Running Applications: " & $sRunningApps & @CR) $runningAppsSplit = StringSplit($sRunningApps, ";") If $sRunningApps = "" Then ; No running applications set to restrict installation FileWriteLine($hOpenFile, @CRLF & "Code: 1006" & @CR) GUICtrlSetData($labelStatus2, "Installing...") _Install_Profile() _Install_Limit_Update() Else ; Running application restrictions in place FileWriteLine($hOpenFile, @CRLF & "Code: 1007" & @CR) For $ra = 1 To $runningAppsSplit[0] If ProcessExists($runningAppsSplit[$ra]) <> 0 Then ; Running application in memory FileWriteLine($hOpenFile, @CRLF & "Error: Installation aborted due to running application. " & $runningAppsSplit[$ra] & "." & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) MsgBox(16, "Process running", "The following process is running and needs to be closed for the installation to continue." & @CR & @CR & $runningAppsSplit[$ra] & @CR & @CR & "Please start the installation again.") Else ; No running applications in memory FileWriteLine($hOpenFile, @CRLF & "Code: 1008" & @CR) GUICtrlSetData($labelStatus2, "Installing...") _Install_Profile() _Install_Limit_Update() ExitLoop EndIf Next EndIf EndIf EndFunc Func _Install_Limit_RA() If $sLimitRA = "0" Then ; No more licenses available for the application FileWriteLine($hOpenFile, @CRLF & "Code: 1002" & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) MsgBox(0, "Software license", "There are no more licenses available for download.") ElseIf $sLimitRA = "" Then ;No Licenses set FileWriteLine($hOpenFile, @CRLF & "Running Applications: " & $sRunningApps & @CR) $runningAppsSplit = StringSplit($sRunningApps, ";") If $sRunningApps = "" Then ; No Running applications set to restrict installation FileWriteLine($hOpenFile, @CRLF & "Code: 1003" & @CR) GUICtrlSetData($labelStatus2, "Installing...") _Install_Rollback() Else ; Running application restrictions in place FileWriteLine($hOpenFile, @CRLF & "Code: 1004" & @CR) For $ra = 1 To $runningAppsSplit[0] If ProcessExists($runningAppsSplit[$ra]) <> 0 Then ; Running application in memory FileWriteLine($hOpenFile, @CRLF & "Error: Installation aborted due to running application. " & $runningAppsSplit[$ra] & "." & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) MsgBox(16, "Process running", "The following process is running and needs to be closed for the installation to continue." & @CR & @CR & $runningAppsSplit[$ra] & @CR & @CR & "Please start the installation again.") Else ; No Running applications in memory FileWriteLine($hOpenFile, @CRLF & "Code: 1005" & @CR) GUICtrlSetData($labelStatus2, "Installing...") _Install_Rollback() ExitLoop EndIf Next EndIf Else ; No licenses specified, or license not exceeded FileWriteLine($hOpenFile, @CRLF & "Running Applications: " & $sRunningApps & @CR) $runningAppsSplit = StringSplit($sRunningApps, ";") If $sRunningApps = "" Then ; No running applications set to restrict installation FileWriteLine($hOpenFile, @CRLF & "Code: 1006" & @CR) GUICtrlSetData($labelStatus2, "Installing...") _Install_Rollback() _Install_Limit_Update() Else ; Running application restrictions in place FileWriteLine($hOpenFile, @CRLF & "Code: 1007" & @CR) For $ra = 1 To $runningAppsSplit[0] If ProcessExists($runningAppsSplit[$ra]) <> 0 Then ; Running application in memory FileWriteLine($hOpenFile, @CRLF & "Error: Installation aborted due to running application. " & $runningAppsSplit[$ra] & "." & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) MsgBox(16, "Process running", "The following process is running and needs to be closed for the installation to continue." & @CR & @CR & $runningAppsSplit[$ra] & @CR & @CR & "Please start the installation again.") Else ; No running applications in memory FileWriteLine($hOpenFile, @CRLF & "Code: 1008" & @CR) GUICtrlSetData($labelStatus2, "Installing...") _Install_Rollback() _Install_Limit_Update() ExitLoop EndIf Next EndIf EndIf EndFunc Func _Install_Limit_BA() If $sLimitBA = "0" Then ; No more licenses available for the application FileWriteLine($hOpenFile, @CRLF & "Code: 1002" & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) MsgBox(0, "Software license", "There are no more licenses available for download.") ElseIf $sLimitBA = "" Then ;No Licenses set FileWriteLine($hOpenFile, @CRLF & "Running Applications: " & $sRunningApps & @CR) $runningAppsSplit = StringSplit($sRunningApps, ";") If $sRunningApps = "" Then ; No Running applications set to restrict installation FileWriteLine($hOpenFile, @CRLF & "Code: 1003" & @CR) GUICtrlSetData($labelStatus2, "Installing...") _Install_Beta() Else ; Running application restrictions in place FileWriteLine($hOpenFile, @CRLF & "Code: 1004" & @CR) For $ra = 1 To $runningAppsSplit[0] If ProcessExists($runningAppsSplit[$ra]) <> 0 Then ; Running application in memory FileWriteLine($hOpenFile, @CRLF & "Error: Installation aborted due to running application. " & $runningAppsSplit[$ra] & "." & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) MsgBox(16, "Process running", "The following process is running and needs to be closed for the installation to continue." & @CR & @CR & $runningAppsSplit[$ra] & @CR & @CR & "Please start the installation again.") Else ; No Running applications in memory FileWriteLine($hOpenFile, @CRLF & "Code: 1005" & @CR) GUICtrlSetData($labelStatus2, "Installing...") _Install_Beta() ExitLoop EndIf Next EndIf Else ; No licenses specified, or license not exceeded FileWriteLine($hOpenFile, @CRLF & "Running Applications: " & $sRunningApps & @CR) $runningAppsSplit = StringSplit($sRunningApps, ";") If $sRunningApps = "" Then ; No running applications set to restrict installation FileWriteLine($hOpenFile, @CRLF & "Code: 1006" & @CR) GUICtrlSetData($labelStatus2, "Installing...") _Install_Beta() _Install_Limit_Update() Else ; Running application restrictions in place FileWriteLine($hOpenFile, @CRLF & "Code: 1007" & @CR) For $ra = 1 To $runningAppsSplit[0] If ProcessExists($runningAppsSplit[$ra]) <> 0 Then ; Running application in memory FileWriteLine($hOpenFile, @CRLF & "Error: Installation aborted due to running application. " & $runningAppsSplit[$ra] & "." & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) MsgBox(16, "Process running", "The following process is running and needs to be closed for the installation to continue." & @CR & @CR & $runningAppsSplit[$ra] & @CR & @CR & "Please start the installation again.") Else ; No running applications in memory FileWriteLine($hOpenFile, @CRLF & "Code: 1008" & @CR) GUICtrlSetData($labelStatus2, "Installing...") _Install_Beta() _Install_Limit_Update() ExitLoop EndIf Next EndIf EndIf EndFunc Func _Install_Password_AA() ;MsgBox(0,"AA",'"' & $sPasswordAA & '"') $continue = False $password = "" If $sPasswordAA = "" Or $sPasswordAA = Null Then ;MsgBox(0,"AA",'No password') $continue = True Else ;MsgBox(0,"AA",'password') $password = InputBox("Password","Please enter the password to install this application.","","*") If $sPasswordAA = $password Then ;MsgBox(0,"AA",'Continue') $continue = True Else $continue = False MsgBox(0,"Error","The password entered is incorrect. Please try again.") EndIf EndIf EndFunc Func _Install_Password_RA() $continue = False $password = "" If $sPasswordRA = "" Or $sPasswordRA = Null Then $continue = True Else $password = InputBox("Password","Please enter the password to install this application.","","*") If $sPasswordRA = $password Then $continue = True Else $continue = False MsgBox(0,"Error","The password entered is incorrect. Please try again.") EndIf EndIf EndFunc Func _Install_Password_BA() $continue = False $password = "" If $sPasswordBA = "" Or $sPasswordBA = Null Then $continue = True Else $password = InputBox("Password","Please enter the password to install this application.","","*") If $sPasswordBA = $password Then $continue = True Else $continue = False MsgBox(0,"Error","The password entered is incorrect. Please try again.") EndIf EndIf EndFunc Func _InstallApp() $hOpenFile = FileOpen($iniS_ClientLog, 9) FileWriteLine($hOpenFile, @CRLF & "Date and Time: " & _Now() & @CR) FileWriteLine($hOpenFile, @CRLF & "OS Architecture: " & @OSArch & @CR) FileWriteLine($hOpenFile, @CRLF & "Selected Application: " & $selApp & @CR) If $restrictions = "No" Then ;No Deny or Allow Permissions set. If $beta = "No" And $rollback = "No" Then _Install_Limit_AA() ElseIf $rollback = "Yes" Then _Install_Limit_RA() ElseIf $beta = "Yes" Then _Install_Limit_BA() EndIf Else ; Permissions set FileWriteLine($hOpenFile, @CRLF & "Code: 1009" & @CR) FileWriteLine($hOpenFile, @CRLF & "Allow Permissions: " & $sAllow & @CR) FileWriteLine($hOpenFile, @CRLF & "Deny Permissions: " & $sDeny & @CR) $arraySecAllow = StringSplit($sAllow, ";") $arraySecDeny = StringSplit($sDeny, ";") ;_ArrayDisplay($arraySecAllow,"Allow") ;_ArrayDisplay($arraySecDeny,"Deny") _AD_Open() ; $iniA_InstallUser,$iniA_InstallPassword,$iniS_DomainFQDN For $d = 1 To $arraySecDeny[0] ;MsgBox(0,"Loop: " & $d,"Group: " & $arraySecDeny[$d] & @CRLF & "User: " & $rUser) If _AD_IsMemberOf($arraySecDeny[$d], $rUser) Then ; Deny rights are in place for user. Check user group membership. FileWriteLine($hOpenFile, @CRLF & "Error: User has been denied installation rights. " & $arraySecDeny[$d] & "." & @CR) FileWriteLine($hOpenFile, @CRLF & "**************************************************************************************" & @CR) MsgBox(48, "Error", "Your user account has not been granted rights to install this application.") $denyChk = True ExitLoop Else $denyChk = False EndIf Next _AD_Close() If $denyChk <> True Then ; No Deny permissions have been set FileWriteLine($hOpenFile, @CRLF & "Code: 1010" & @CR) If $arraySecAllow[1] = "" Then ; No Allow permissions have been set If $beta = "No" And $rollback = "No" Then _Install_Limit_AA() ElseIf $rollback = "Yes" Then _Install_Limit_RA() ElseIf $beta = "Yes" Then _Install_Limit_BA() EndIf Else ; Checking installation permissions - Some have been set FileWriteLine($hOpenFile, @CRLF & "Code: 1019" & @CR) For $c = 1 To $arraySecAllow[0] _AD_Open() ; $iniA_InstallUser,$iniA_InstallPassword,$iniS_DomainFQDN If _AD_IsMemberOf($arraySecAllow[$c], $rUser, 1) Then ; Allow rights are in place for user. If $beta = "No" And $rollback = "No" Then _Install_Limit_AA() ElseIf $rollback = "Yes" Then _Install_Limit_RA() ElseIf $beta = "Yes" Then _Install_Limit_BA() EndIf $recursive = False ExitLoop Else $recursive = True EndIf _AD_Close() Next ; Recursive security group check for permissions If $recursive = True Then FileWriteLine($hOpenFile, @CRLF & "Code: 1026" & @CR) _AD_Open($iniA_InstallUser,$iniA_InstallPassword,$iniS_DomainFQDN) For $c = 1 To $arraySecAllow[0] If _AD_IsMemberOf($arraySecAllow[$c], @UserName, True, True) Then $member = True ExitLoop ElseIf $c = $arraySecAllow[0] Then $member = False FileWriteLine($hOpenFile, @CRLF & "Error: Rights to install the application have been denied." & @CR) FileWriteLine($hOpenFile, @CRLF & "Code: 1035" & @CR) MsgBox(0, "Access Denied", "You do not have rights to install this application.") ExitLoop EndIf Next If $member = True Then ; User has allow rights to install application If $beta = "No" And $rollback = "No" Then _Install_Limit_AA() ElseIf $rollback = "Yes" Then _Install_Limit_RA() ElseIf $beta = "Yes" Then _Install_Limit_BA() EndIf EndIf _AD_Close() EndIf EndIf EndIf EndIf EndFunc ;==>_InstallApp ;#cs Func _AddAPP() _AD_Open() Local $adGroups = _AD_GetObjectsInOU($iniS_GroupsOU, "(objectclass=group)") _AD_Close() #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Add Application", 687, 578, 296, 189) $btnAddApp = GUICtrlCreateButton("Add", 600, 543, 75, 25) $btnExitAdd = GUICtrlCreateButton("Exit", 512, 543, 75, 25) $tab1 = GUICtrlCreateTab(16, 16, 657, 521) ;***** Settings Tab ***** $TabSheet1 = GUICtrlCreateTabItem("Settings") $grpAllowed = GUICtrlCreateGroup("Allowed Groups", 32, 136, 297, 257) GUICtrlSetBkColor(-1, 0xFFFFFF) $listAllow = GUICtrlCreateListView(" ", 48, 160, 265, 214, -1, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_SetColumnWidth($listAllow, 0, 232) For $a = 1 To $adGroups[0] _GUICtrlListView_AddItem($listAllow, $adGroups[$a]) Next GUICtrlCreateGroup("", -99, -99, 1, 1) $grpDenied = GUICtrlCreateGroup("Denied Groups", 352, 136, 305, 257) GUICtrlSetBkColor(-1, 0xFFFFFF) $listDeny = GUICtrlCreateListView(" ", 368, 160, 273, 214, -1, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_SetColumnWidth($listDeny, 0, 232) $btnOK = GUICtrlCreateButton("OK", 115, 280, 70, 25) $btnCancel = GUICtrlCreateButton("Cancel", 195, 280, 70, 25) For $a = 1 To $adGroups[0] _GUICtrlListView_AddItem($listDeny, $adGroups[$a]) Next GUICtrlCreateGroup("", -99, -99, 1, 1) $cbBIOS = GUICtrlCreateCheckbox("BIOS", 28, 405, 105, 20) $cbDriver = GUICtrlCreateCheckbox("Driver", 28, 430, 105, 20) $cbProfile = GUICtrlCreateCheckbox("Profile Application", 28, 455, 105, 20) GUICtrlSetTip(-1, 'Check this box if the application that is being installed, installs to the users profile and not the "Program Files" folder.') $lblProcesses = GUICtrlCreateLabel("Processes", 28, 488, 53, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $inProcesses = GUICtrlCreateInput("", 96, 486, 561, 21) $lblProcessesExp = GUICtrlCreateLabel("Separate processes with a semi-colon (;). If a listed process exists, the script won't run.", 96, 512, 296, 15) GUICtrlSetFont(-1, 6, 400, 2, "Arial") GUICtrlSetBkColor(-1, 0xFFFFFF) $inFriendly = GUICtrlCreateInput("", 124, 58, 536, 21) GUICtrlSetTip(-1, "This is how the application name will be listed in the Application Store.") $inAppName = GUICtrlCreateInput("", 124, 100, 536, 21) GUICtrlSetTip(-1, "This is how the application is named on the system. The registry will be checked for this name.") $lblAppName = GUICtrlCreateLabel("Application Name", 28, 101, 87, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $lblFriendly = GUICtrlCreateLabel("Friendly Name", 28, 59, 87, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) ;***** Available Application Tab ***** $TabSheet2 = GUICtrlCreateTabItem("Available Application") $inAppVer = GUICtrlCreateInput("", 156, 59, 504, 21) $btnBrowse86 = GUICtrlCreateButton("Application Path x86", 28, 100, 110, 25, $BS_FLAT) $btnBrowse64 = GUICtrlCreateButton("Application Path x64", 28, 144, 110, 25, $BS_FLAT) $inPath86 = GUICtrlCreateInput("", 156, 102, 504, 21) $inPath64 = GUICtrlCreateInput("", 156, 145, 504, 21) $lblAppVer = GUICtrlCreateLabel("Application Version", 28, 63, 99, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $lblParamAA = GUICtrlCreateLabel("Parameters", 28, 232, 57, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $inParamAA = GUICtrlCreateInput("", 156, 229, 504, 21) $inLimitAA = GUICtrlCreateInput("", 156, 188, 40, 21) $lblLimitAA = GUICtrlCreateLabel("Limit Downloads", 28, 191, 81, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $lblPasswordAA = GUICtrlCreateLabel("Password", 28, 272, 50, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $inPasswordAA = GUICtrlCreateInput("", 156, 269, 504, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD)) GUICtrlSetTip(-1, "Enter a password to protect the application from installation") $lblKeyAA = GUICtrlCreateLabel("Key", 28, 312, 22, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $inKeyAA = GUICtrlCreateInput("", 156, 309, 504, 21) GUICtrlSetTip(-1, "A product or serial key can be entered to present itself to the user.") ;***** Rollback Application Tab ***** $TabSheet3 = GUICtrlCreateTabItem("Rollback Application") $inRollbackVer = GUICtrlCreateInput("", 156, 59, 504, 21) $btnRollback86 = GUICtrlCreateButton("Rollback Path x86", 28, 100, 110, 25, $BS_FLAT) $inRollback86 = GUICtrlCreateInput("", 156, 102, 504, 21) $btnRollback64 = GUICtrlCreateButton("Rollback Path x64", 28, 144, 110, 25, $BS_FLAT) $inRollback64 = GUICtrlCreateInput("", 156, 145, 504, 21) $lblRollbackVer = GUICtrlCreateLabel("Rollback Version", 28, 63, 99, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $inKeyRA = GUICtrlCreateInput("", 156, 309, 504, 21) GUICtrlSetTip(-1, "A product or serial key can be entered to present itself to the user.") $lblKeyRA = GUICtrlCreateLabel("Key", 28, 312, 22, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $inPasswordRA = GUICtrlCreateInput("", 156, 269, 504, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD)) GUICtrlSetTip(-1, "Enter a password to protect the application from installation") $lblPasswordRA = GUICtrlCreateLabel("Password", 28, 272, 50, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $lblLimitRA = GUICtrlCreateLabel("Limit Downloads", 28, 191, 81, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $inLimitRA = GUICtrlCreateInput("", 156, 188, 40, 21) $inParamRA = GUICtrlCreateInput("", 156, 229, 504, 21) $lblParamRA = GUICtrlCreateLabel("Parameters", 28, 232, 57, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) ;***** Beta Application Tab ***** $TabSheet4 = GUICtrlCreateTabItem("Beta Application") $inBetaVer = GUICtrlCreateInput("", 156, 59, 504, 21) $btnBeta86 = GUICtrlCreateButton("Beta Path x86", 28, 100, 110, 25, $BS_FLAT) $inBeta86 = GUICtrlCreateInput("", 156, 102, 504, 21) $btnBeta64 = GUICtrlCreateButton("Beta Path x64", 28, 144, 110, 25, $BS_FLAT) $inBeta64 = GUICtrlCreateInput("", 156, 145, 504, 21) $lblBetaVer = GUICtrlCreateLabel("Beta Version", 28, 63, 99, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $lblParamBA = GUICtrlCreateLabel("Parameters", 28, 232, 57, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $inParamBA = GUICtrlCreateInput("", 156, 229, 504, 21) $inLimitBA = GUICtrlCreateInput("", 156, 188, 40, 21) $lblLimitBA = GUICtrlCreateLabel("Limit Downloads", 28, 191, 81, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $lblPasswordBA = GUICtrlCreateLabel("Password", 28, 272, 50, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $inPasswordBA = GUICtrlCreateInput("", 156, 269, 504, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD)) GUICtrlSetTip(-1, "Enter a password to protect the application from installation") $lblKeyBA = GUICtrlCreateLabel("Key", 28, 312, 22, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $inKeyBA = GUICtrlCreateInput("", 156, 309, 504, 21) GUICtrlSetTip(-1, "A product or serial key can be entered to present itself to the user.") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 3 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE WinActivate($iniS_AppName, "") GUIDelete($Form3) ExitLoop Case $btnExitAdd WinActivate($iniS_AppName, "") GUIDelete($Form3) ExitLoop Case $btnBrowse86 $var = FileOpenDialog("Select a file", @WindowsDir & "", "Installers (*.exe;*.msi)|Scripts (*.vbs;*.bat)", 1) GUICtrlSetData($inPath86, '"' & $var & '"') Case $btnBrowse64 $var = FileOpenDialog("Select a file", @WindowsDir & "", "Installers (*.exe;*.msi)|Scripts (*.vbs;*.bat)", 1) GUICtrlSetData($inPath64, '"' & $var & '"') Case $btnRollback64 $var = FileOpenDialog("Select a file", @WindowsDir & "", "Installers (*.exe;*.msi)|Scripts (*.vbs;*.bat)", 1) GUICtrlSetData($inRollback64, '"' & $var & '"') Case $btnRollback86 $var = FileOpenDialog("Select a file", @WindowsDir & "", "Installers (*.exe;*.msi)|Scripts (*.vbs;*.bat)", 1) GUICtrlSetData($inRollback86, '"' & $var & '"') Case $btnBeta64 $var = FileOpenDialog("Select a file", @WindowsDir & "", "Installers (*.exe;*.msi)|Scripts (*.vbs;*.bat)", 1) GUICtrlSetData($inBeta64, '"' & $var & '"') Case $btnBeta86 $var = FileOpenDialog("Select a file", @WindowsDir & "", "Installers (*.exe;*.msi)|Scripts (*.vbs;*.bat)", 1) GUICtrlSetData($inBeta86, '"' & $var & '"') #cs Case $btnAllow _AllowGroups() Case $btnDeny _DenyGroups() #ce Case $btnAddApp GUICtrlSetData($labelStatus2, "Saving...") ;Save Settings tab $aFriendlyName = GUICtrlRead($inFriendly) $aAppName = GUICtrlRead($inAppName) $aProcesses = GUICtrlRead($inProcesses) If _checkbox_active1($listAllow) = 1 Then $sAllow = _GuiCtrlListView_GetChecked($listAllow) EndIf If _checkbox_active2($listDeny) = 1 Then $sDeny = _GuiCtrlListView_GetChecked($listDeny) EndIf If BitAND(GUICtrlRead($cbBIOS), $GUI_CHECKED) = $GUI_CHECKED Then $aBIOS = "Yes" Else $aBIOS = "No" EndIf If BitAND(GUICtrlRead($cbDriver), $GUI_CHECKED) = $GUI_CHECKED Then $aDriver = "Yes" Else $aDriver = "No" EndIf If BitAND(GUICtrlRead($cbProfile), $GUI_CHECKED) = $GUI_CHECKED Then $aProfile = "Yes" Else $aProfile = "No" EndIf ;Save Available Application tab $aAppVer = GUICtrlRead($inAppVer) $aAppPath86 = GUICtrlRead($inPath86) $aAppPath64 = GUICtrlRead($inPath64) $aAppParaAA = GUICtrlRead($inParamAA) $rDownloadLimitAA = GUICtrlRead($inLimitAA) $rKeyAA = GUICtrlRead($inKeyAA) $rPasswordAA = GUICtrlRead($inPasswordAA) ;Save Rollback Application tab $aRollbackVer = GUICtrlRead($inRollbackVer) $aRollbackPath86 = GUICtrlRead($inRollback86) $aRollbackPath64 = GUICtrlRead($inRollback64) $aAppParaRA = GUICtrlRead($inParamRA) $rDownloadLimitRA = GUICtrlRead($inLimitRA) $rKeyRA = GUICtrlRead($inKeyRA) $rPasswordRA = GUICtrlRead($inPasswordRA) ;Save Beta Application tab $aBetaVer = GUICtrlRead($inBetaVer) $aBetaPath86 = GUICtrlRead($inBeta86) $aBetaPath64 = GUICtrlRead($inBeta64) $aAppParaBA = GUICtrlRead($inParamBA) $rDownloadLimitBA = GUICtrlRead($inLimitBA) $rKeyBA = GUICtrlRead($inKeyBA) $rPasswordBA = GUICtrlRead($inPasswordBA) If $aFriendlyName = "" Or $aAppName = "" Or $aAppVer = "" Or $aAppPath86 = "" And $aAppPath64 = "" Then MsgBox(0, "Error", "Please make sure you have a Friendly Name, App Name, App Version and either a 32bit and/or 64bit Application path entered in the form.") Else If $aAppPath86 <> "" Then $aAppPath = "X86" ElseIf $aAppPath64 <> "" Then $aAppPath = "X64" ElseIf $aAppPath64 And $aAppPath86 <> "" Then $aAppPath = "X86/X64" EndIf If IsArray($sAllow) Then ;_ArrayDisplay($chkAllow) For $i = 1 To $sAllow[0][0] $selectedGroups1 = $selectedGroups1 & $sAllow[$i][1] & ";" Next ;MsgBox(0,"Allowed Groups",$selectedGroups1) Else $selectedGroups1 = "" EndIf If IsArray($sDeny) Then ;_ArrayDisplay($chkDeny) For $i = 1 To $sDeny[0][0] $selectedGroups2 = $selectedGroups2 & $sDeny[$i][1] & ";" Next ;MsgBox(0,"Denied Groups",$selectedGroups2) Else $selectedGroups2 = "" EndIf If StringRight($aAppPath64, 1) = '"' Then $aAppPath64 = StringTrimRight($aAppPath64, 1) EndIf If StringLeft($aAppPath64, 1) = '"' Then $aAppPath64 = StringTrimLeft($aAppPath64, 1) EndIf If StringRight($aAppPath86, 1) = '"' Then $aAppPath86 = StringTrimRight($aAppPath86, 1) EndIf If StringLeft($aAppPath86, 1) = '"' Then $aAppPath86 = StringTrimLeft($aAppPath86, 1) EndIf If StringRight($aRollbackPath64, 1) = '"' Then $aRollbackPath64 = StringTrimRight($aRollbackPath64, 1) EndIf If StringLeft($aRollbackPath64, 1) = '"' Then $aRollbackPath64 = StringTrimLeft($aRollbackPath64, 1) EndIf If StringRight($aRollbackPath86, 1) = '"' Then $aRollbackPath86 = StringTrimRight($aRollbackPath86, 1) EndIf If StringLeft($aRollbackPath86, 1) = '"' Then $aRollbackPath86 = StringTrimLeft($aRollbackPath86, 1) EndIf If StringRight($aBetaPath64, 1) = '"' Then $aBetaPath64 = StringTrimRight($aBetaPath64, 1) EndIf If StringLeft($aBetaPath64, 1) = '"' Then $aBetaPath64 = StringTrimLeft($aBetaPath64, 1) EndIf If StringRight($aBetaPath86, 1) = '"' Then $aBetaPath86 = StringTrimRight($aBetaPath86, 1) EndIf If StringLeft($aBetaPath86, 1) = '"' Then $aBetaPath86 = StringTrimLeft($aBetaPath86, 1) EndIf $sql1 = "" $sql2 = "" ;#cs If $IDlast <> "" Then $sql1 = $sql1 & ",[ID]" $sql2 = $sql2 & ",'" & $IDlast + 1 & "'" EndIf If $aAppName <> "" Then $sql1 = $sql1 & ",[Application Name]" $sql2 = $sql2 & ",'" & $aAppName & "'" Else $sql1 = $sql1 & ",[Application Name]" $sql2 = $sql2 & ",''" EndIf If $aFriendlyName <> "" Then $sql1 = $sql1 & ",[Friendly Name]" $sql2 = $sql2 & ",'" & $aFriendlyName & "'" Else $sql1 = $sql1 & ",[Friendly Name]" $sql2 = $sql2 & ",''" EndIf If $selectedGroups1 <> "" Then $sql1 = $sql1 & ",[Permissions Allow]" $sql2 = $sql2 & ",'" & $selectedGroups1 & "'" Else $sql1 = $sql1 & ",[Permissions Allow]" $sql2 = $sql2 & ",''" EndIf If $selectedGroups2 <> "" Then $sql1 = $sql1 & ",[Permissions Deny]" $sql2 = $sql2 & ",'" & $selectedGroups2 & "'" Else $sql1 = $sql1 & ",[Permissions Deny]" $sql2 = $sql2 & ",''" EndIf If $aProfile <> "" Then $sql1 = $sql1 & ",[Profile Application]" $sql2 = $sql2 & ",'" & $aProfile & "'" Else $sql1 = $sql1 & ",[Profile Application]" $sql2 = $sql2 & ",''" EndIf If $sRunningApps <> "" Then $sql1 = $sql1 & ",[Running Application Check]" $sql2 = $sql2 & ",'" & $sRunningApps & "'" Else $sql1 = $sql1 & ",[Running Application Check]" $sql2 = $sql2 & ",''" EndIf If $aDriver <> "" Then $sql1 = $sql1 & ",[Driver]" $sql2 = $sql2 & ",'" & $aDriver & "'" Else $sql1 = $sql1 & ",[Driver]" $sql2 = $sql2 & ",''" EndIf If $aBIOS <> "" Then $sql1 = $sql1 & ",[BIOS]" $sql2 = $sql2 & ",'" & $aBIOS & "'" Else $sql1 = $sql1 & ",[BIOS]" $sql2 = $sql2 & ",''" EndIf If $aAppPath64 = "" Then $architecture = "X86" Else $architecture = "X86/X64" EndIf If $architecture <> "" Then $sql1 = $sql1 & ",[Architecture]" $sql2 = $sql2 & ",'" & $architecture & "'" EndIf If $aAppVer <> "" Then $sql1 = $sql1 & ",[Version]" $sql2 = $sql2 & ",'" & $aAppVer & "'" Else $sql1 = $sql1 & ",[Version]" $sql2 = $sql2 & ",''" EndIf If $aAppPath86 <> "" Then $sql1 = $sql1 & ",[Installer Directory x86]" $sql2 = $sql2 & ",'" & $aAppPath86 & "'" Else $sql1 = $sql1 & ",[Installer Directory x86]" $sql2 = $sql2 & ",''" EndIf If $aAppPath64 <> "" Then $sql1 = $sql1 & ",[Installer Directory x64]" $sql2 = $sql2 & ",'" & $aAppPath64 & "'" Else $sql1 = $sql1 & ",[Installer Directory x64]" $sql2 = $sql2 & ",''" EndIf If $rDownloadLimitAA <> "" Then $sql1 = $sql1 & ",[Limit Installations AA]" $sql2 = $sql2 & ",'" & $rDownloadLimitAA & "'" Else $sql1 = $sql1 & ",[Limit Installations AA]" $sql2 = $sql2 & ",''" EndIf If $aAppParaAA <> "" Then $sql1 = $sql1 & ",[Install Parameters AA]" $sql2 = $sql2 & ",'" & $aAppParaAA & "'" Else $sql1 = $sql1 & ",[Install Parameters AA]" $sql2 = $sql2 & ",''" EndIf If $rPasswordAA <> "" Then $sql1 = $sql1 & ",[Install Password AA]" $sql2 = $sql2 & ",'" & $rPasswordAA & "'" Else $sql1 = $sql1 & ",[Install Password AA]" $sql2 = $sql2 & ",''" EndIf If $rKeyAA <> "" Then $sql1 = $sql1 & ",[Install Key AA]" $sql2 = $sql2 & ",'" & $rKeyAA & "'" Else $sql1 = $sql1 & ",[Install Key AA]" $sql2 = $sql2 & ",''" EndIf If $aRollbackPath86 <> "" Then $sql1 = $sql1 & ",[Rollback Directory x86]" $sql2 = $sql2 & ",'" & $aRollbackPath86 & "'" Else $sql1 = $sql1 & ",[Rollback Directory x86]" $sql2 = $sql2 & ",''" EndIf If $aRollbackPath64 <> "" Then $sql1 = $sql1 & ",[Rollback Directory x64]" $sql2 = $sql2 & ",'" & $aRollbackPath64 & "'" Else $sql1 = $sql1 & ",[Rollback Directory x64]" $sql2 = $sql2 & ",''" EndIf If $aRollbackVer <> "" Then $sql1 = $sql1 & ",[Rollback version]" $sql2 = $sql2 & ",'" & $aRollbackVer & "'" Else $sql1 = $sql1 & ",[Rollback version]" $sql2 = $sql2 & ",''" EndIf If $rDownloadLimitRA <> "" Then $sql1 = $sql1 & ",[Limit Installations RA]" $sql2 = $sql2 & ",'" & $rDownloadLimitRA & "'" Else $sql1 = $sql1 & ",[Limit Installations RA]" $sql2 = $sql2 & ",''" EndIf If $aAppParaRA <> "" Then $sql1 = $sql1 & ",[Install Parameters RA]" $sql2 = $sql2 & ",'" & $aAppParaRA & "'" Else $sql1 = $sql1 & ",[Install Parameters RA]" $sql2 = $sql2 & ",''" EndIf If $rPasswordRA <> "" Then $sql1 = $sql1 & ",[Install Password RA]" $sql2 = $sql2 & ",'" & $rPasswordRA & "'" Else $sql1 = $sql1 & ",[Install Password RA]" $sql2 = $sql2 & ",''" EndIf If $rKeyRA <> "" Then $sql1 = $sql1 & ",[Install Key RA]" $sql2 = $sql2 & ",'" & $rKeyRA & "'" Else $sql1 = $sql1 & ",[Install Key RA]" $sql2 = $sql2 & ",''" EndIf If $aBetaPath86 <> "" Then $sql1 = $sql1 & ",[Beta Directory x86]" $sql2 = $sql2 & ",'" & $aBetaPath86 & "'" Else $sql1 = $sql1 & ",[Beta Directory x86]" $sql2 = $sql2 & ",''" EndIf If $aBetaPath64 <> "" Then $sql1 = $sql1 & ",[Beta Directory x64]" $sql2 = $sql2 & ",'" & $aBetaPath64 & "'" Else $sql1 = $sql1 & ",[Beta Directory x64]" $sql2 = $sql2 & ",''" EndIf If $aBetaVer <> "" Then $sql1 = $sql1 & ",[Beta version]" $sql2 = $sql2 & ",'" & $aBetaVer & "'" Else $sql1 = $sql1 & ",[Beta version]" $sql2 = $sql2 & ",''" EndIf If $rDownloadLimitBA <> "" Then $sql1 = $sql1 & ",[Limit Installations BA]" $sql2 = $sql2 & ",'" & $rDownloadLimitBA & "'" Else $sql1 = $sql1 & ",[Limit Installations BA]" $sql2 = $sql2 & ",''" EndIf If $aAppParaBA <> "" Then $sql1 = $sql1 & ",[Install Parameters BA]" $sql2 = $sql2 & ",'" & $aAppParaBA & "'" Else $sql1 = $sql1 & ",[Install Parameters BA]" $sql2 = $sql2 & ",''" EndIf If $rPasswordBA <> "" Then $sql1 = $sql1 & ",[Install Password BA]" $sql2 = $sql2 & ",'" & $rPasswordBA & "'" Else $sql1 = $sql1 & ",[Install Password BA]" $sql2 = $sql2 & ",''" EndIf If $rKeyBA <> "" Then $sql1 = $sql1 & ",[Install Key BA]" $sql2 = $sql2 & ",'" & $rKeyBA & "'" Else $sql1 = $sql1 & ",[Install Key BA]" $sql2 = $sql2 & ",''" EndIf ;#ce If StringLeft($sql1, 1) = "," Then $sql1 = StringTrimLeft($sql1, 1) EndIf If StringLeft($sql2, 1) = "," Then $sql2 = StringTrimLeft($sql2, 1) EndIf ;ConsoleWrite("INSERT INTO " & $iniD_Table & " (" & $sql1 & ") VALUES (" & $sql2 & ");") $sqlCon = ObjCreate("ADODB.Connection") _DecryptPW2() $sqlCon.Open("Provider=" & $iniD_Provider & "; Server=" & $iniD_Server & "; database=" & $iniD_Database & "; User ID=" & $iniD_User & "; Password=" & $sPW2 & ";") $sqlEXE = $sqlCon.execute("INSERT INTO [" & $iniD_Database & "].[dbo].[" & $iniD_Table & "] (" & $sql1 & ") VALUES (" & $sql2 & ")") $sqlCon.Close _GUICtrlListView_DeleteAllItems($listApps) _RefreshList() ;ConsoleWrite(@CRLF & @CRLF & "*************" & @CRLF & "INSERT INTO [" & $iniD_Database & "].[dbo].[" & $iniD_Table & "] (" & $sql1 & ") VALUES (" & $sql2 & ");" & @CRLF & "*************" & @CRLF & @CRLF) EndIf GUICtrlSetData($labelStatus2, "") WinActivate($iniS_AppName, "") GUIDelete($Form3) ExitLoop EndSwitch WEnd EndFunc ;==>_AddAPP Func _EditAPP() _Information() _AD_Open() Local $adGroups = _AD_GetObjectsInOU($iniS_GroupsOU, "(objectclass=group)") _AD_Close() ;MsgBox(0,"Allow",$sAllow) ;MsgBox(0,"Deny",$sDeny) ;_ArrayDisplay($sAllow,"Allow Groups") ;_ArrayDisplay($sDeny,"Deny Groups") #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Edit Application", 687, 578, 296, 189) $btnSaveApp = GUICtrlCreateButton("Save", 600, 543, 75, 25) $btnExitAdd = GUICtrlCreateButton("Exit", 512, 543, 75, 25) $tab1 = GUICtrlCreateTab(16, 16, 657, 521) ;***** Settings Tab ***** $TabSheet1 = GUICtrlCreateTabItem("Settings") $grpAllowed = GUICtrlCreateGroup("Allowed Groups", 32, 136, 297, 257) GUICtrlSetBkColor(-1, 0xFFFFFF) $listAllow = GUICtrlCreateListView(" ", 48, 160, 265, 214, -1, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_SetColumnWidth($listAllow, 0, 232) If StringRight($sAllow,1) = ";" Then $sAllow = StringTrimRight($sAllow,1) EndIf $sAllowArray = StringSplit($sAllow,";") For $a = 1 To $adGroups[0] _GUICtrlListView_AddItem($listAllow, $adGroups[$a]) If IsArray($sAllowArray) Then For $i = 1 To $sAllowArray[0] If $adGroups[$a] = $sAllowArray[$i] Then _GUICtrlListView_SetItemChecked($listAllow,$a-1, True) EndIf Next EndIf Next _setbut1() GUICtrlCreateGroup("", -99, -99, 1, 1) $grpDenied = GUICtrlCreateGroup("Denied Groups", 352, 136, 305, 257) GUICtrlSetBkColor(-1, 0xFFFFFF) $listDeny = GUICtrlCreateListView(" ", 368, 160, 273, 214, -1, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_SetColumnWidth($listDeny, 0, 232) $btnOK = GUICtrlCreateButton("OK", 115, 280, 70, 25) $btnCancel = GUICtrlCreateButton("Cancel", 195, 280, 70, 25) If StringRight($sDeny,1) = ";" Then $sDeny = StringTrimRight($sDeny,1) EndIf $sDenyArray = StringSplit($sDeny,";") For $a = 1 To $adGroups[0] _GUICtrlListView_AddItem($listDeny, $adGroups[$a]) If IsArray($sDenyArray) Then For $i = 1 To $sDenyArray[0] If $adGroups[$a] = $sDenyArray[$i] Then _GUICtrlListView_SetItemChecked($listDeny, $a-1, True) EndIf Next EndIf Next _setbut2() GUICtrlCreateGroup("", -99, -99, 1, 1) $cbBIOS = GUICtrlCreateCheckbox("BIOS", 28, 405, 105, 20) $cbDriver = GUICtrlCreateCheckbox("Driver", 28, 430, 105, 20) $cbProfile = GUICtrlCreateCheckbox("Profile Application", 28, 455, 105, 20) GUICtrlSetTip(-1, 'Check this box if the application that is being installed, installs to the users profile and not the "Program Files" folder.') $lblProcesses = GUICtrlCreateLabel("Processes", 28, 488, 53, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $inProcesses = GUICtrlCreateInput("", 96, 486, 561, 21) $lblProcessesExp = GUICtrlCreateLabel("Separate processes with a semi-colon (;). If a listed process exists, the script won't run.", 96, 512, 296, 15) GUICtrlSetFont(-1, 6, 400, 2, "Arial") GUICtrlSetBkColor(-1, 0xFFFFFF) $inFriendly = GUICtrlCreateInput("", 124, 58, 536, 21) GUICtrlSetTip(-1, "This is how the application name will be listed in the Application Store.") $inAppName = GUICtrlCreateInput("", 124, 100, 536, 21) GUICtrlSetTip(-1, "This is how the application is named on the system. The registry will be checked for this name.") $lblAppName = GUICtrlCreateLabel("Application Name", 28, 101, 87, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $lblFriendly = GUICtrlCreateLabel("Friendly Name", 28, 59, 87, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) ;***** Available Application Tab ***** $TabSheet2 = GUICtrlCreateTabItem("Available Application") $inAppVer = GUICtrlCreateInput("", 156, 59, 504, 21) $btnBrowse86 = GUICtrlCreateButton("Application Path x86", 28, 100, 110, 25, $BS_FLAT) $btnBrowse64 = GUICtrlCreateButton("Application Path x64", 28, 144, 110, 25, $BS_FLAT) $inPath86 = GUICtrlCreateInput("", 156, 102, 504, 21) $inPath64 = GUICtrlCreateInput("", 156, 145, 504, 21) $lblAppVer = GUICtrlCreateLabel("Application Version", 28, 63, 99, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $lblParamAA = GUICtrlCreateLabel("Parameters", 28, 232, 57, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $inParamAA = GUICtrlCreateInput("", 156, 229, 504, 21) $inLimitAA = GUICtrlCreateInput("", 156, 188, 40, 21) $lblLimitAA = GUICtrlCreateLabel("Limit Downloads", 28, 191, 81, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $lblPasswordAA = GUICtrlCreateLabel("Password", 28, 272, 50, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $inPasswordAA = GUICtrlCreateInput("", 156, 269, 504, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD)) GUICtrlSetTip(-1, "Enter a password to protect the application from installation") $lblKeyAA = GUICtrlCreateLabel("Key", 28, 312, 22, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $inKeyAA = GUICtrlCreateInput("", 156, 309, 504, 21) GUICtrlSetTip(-1, "A product or serial key can be entered to present itself to the user.") ;***** Rollback Application Tab ***** $TabSheet3 = GUICtrlCreateTabItem("Rollback Application") $inRollbackVer = GUICtrlCreateInput("", 156, 59, 504, 21) $btnRollback86 = GUICtrlCreateButton("Rollback Path x86", 28, 100, 110, 25, $BS_FLAT) $inRollback86 = GUICtrlCreateInput("", 156, 102, 504, 21) $btnRollback64 = GUICtrlCreateButton("Rollback Path x64", 28, 144, 110, 25, $BS_FLAT) $inRollback64 = GUICtrlCreateInput("", 156, 145, 504, 21) $lblRollbackVer = GUICtrlCreateLabel("Rollback Version", 28, 63, 99, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $inKeyRA = GUICtrlCreateInput("", 156, 309, 504, 21) GUICtrlSetTip(-1, "A product or serial key can be entered to present itself to the user.") $lblKeyRA = GUICtrlCreateLabel("Key", 28, 312, 22, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $inPasswordRA = GUICtrlCreateInput("", 156, 269, 504, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD)) GUICtrlSetTip(-1, "Enter a password to protect the application from installation") $lblPasswordRA = GUICtrlCreateLabel("Password", 28, 272, 50, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $lblLimitRA = GUICtrlCreateLabel("Limit Downloads", 28, 191, 81, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $inLimitRA = GUICtrlCreateInput("", 156, 188, 40, 21) $inParamRA = GUICtrlCreateInput("", 156, 229, 504, 21) $lblParamRA = GUICtrlCreateLabel("Parameters", 28, 232, 57, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) ;***** Beta Application Tab ***** $TabSheet4 = GUICtrlCreateTabItem("Beta Application") $inBetaVer = GUICtrlCreateInput("", 156, 59, 504, 21) $btnBeta86 = GUICtrlCreateButton("Beta Path x86", 28, 100, 110, 25, $BS_FLAT) $inBeta86 = GUICtrlCreateInput("", 156, 102, 504, 21) $btnBeta64 = GUICtrlCreateButton("Beta Path x64", 28, 144, 110, 25, $BS_FLAT) $inBeta64 = GUICtrlCreateInput("", 156, 145, 504, 21) $lblBetaVer = GUICtrlCreateLabel("Beta Version", 28, 63, 99, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $lblParamBA = GUICtrlCreateLabel("Parameters", 28, 232, 57, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $inParamBA = GUICtrlCreateInput("", 156, 229, 504, 21) $inLimitBA = GUICtrlCreateInput("", 156, 188, 40, 21) $lblLimitBA = GUICtrlCreateLabel("Limit Downloads", 28, 191, 81, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) $lblPasswordBA = GUICtrlCreateLabel("Password", 28, 272, 50, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $inPasswordBA = GUICtrlCreateInput("", 156, 269, 504, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD)) GUICtrlSetTip(-1, "Enter a password to protect the application from installation") $lblKeyBA = GUICtrlCreateLabel("Key", 28, 312, 22, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $inKeyBA = GUICtrlCreateInput("", 156, 309, 504, 21) GUICtrlSetTip(-1, "A product or serial key can be entered to present itself to the user.") GUICtrlCreateTabItem("") ;Set Application settings GUICtrlSetData($inFriendly, $selApp) GUICtrlSetData($inAppName, $sSelAppReg) GUICtrlSetData($inProcesses, $sRunningApps) ;Available Application GUICtrlSetData($inAppVer, $sVersionAA) GUICtrlSetData($inPath86, $sInstallDirx86) GUICtrlSetData($inPath64, $sInstallDirx64) GUICtrlSetData($inParamAA, $sParamAA) GUICtrlSetData($inLimitAA, $sLimitAA) GUICtrlSetData($inPasswordAA, $sPasswordAA) GUICtrlSetData($inKeyAA, $sKeyAA) ;Rollback Application GUICtrlSetData($inRollbackVer, $sVersionRA) GUICtrlSetData($inRollback86, $sRollbackInstallDirx86) GUICtrlSetData($inRollback64, $sRollbackInstallDirx64) GUICtrlSetData($inParamRA, $sParamRA) GUICtrlSetData($inLimitRA, $sLimitRA) GUICtrlSetData($inPasswordRA, $sPasswordRA) GUICtrlSetData($inKeyRA, $sKeyRA) ;Beta Application GUICtrlSetData($inBetaVer, $sVersionBA) GUICtrlSetData($inBeta86, $sBetaInstallDirx86) GUICtrlSetData($inBeta64, $sBetaInstallDirx64) GUICtrlSetData($inParamBA, $sParamBA) GUICtrlSetData($inLimitBA, $sLimitBA) GUICtrlSetData($inPasswordBA, $sPasswordBA) GUICtrlSetData($inKeyBA, $sKeyBA) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 3 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE WinActivate($iniS_AppName, "") GUIDelete($Form3) ExitLoop Case $btnExitAdd WinActivate($iniS_AppName, "") GUIDelete($Form3) ExitLoop Case $btnBrowse86 $var = FileOpenDialog("Select a file", @WindowsDir & "", "Installers (*.exe;*.msi)|Scripts (*.vbs;*.bat)", 1) GUICtrlSetData($inPath86, '"' & $var & '"') Case $btnBrowse64 $var = FileOpenDialog("Select a file", @WindowsDir & "", "Installers (*.exe;*.msi)|Scripts (*.vbs;*.bat)", 1) GUICtrlSetData($inPath64, '"' & $var & '"') Case $btnRollback86 $var = FileOpenDialog("Select a file", @WindowsDir & "", "Installers (*.exe;*.msi)|Scripts (*.vbs;*.bat)", 1) GUICtrlSetData($inRollback86, '"' & $var & '"') Case $btnRollback64 $var = FileOpenDialog("Select a file", @WindowsDir & "", "Installers (*.exe;*.msi)|Scripts (*.vbs;*.bat)", 1) GUICtrlSetData($inRollback64, '"' & $var & '"') Case $btnBeta86 $var = FileOpenDialog("Select a file", @WindowsDir & "", "Installers (*.exe;*.msi)|Scripts (*.vbs;*.bat)", 1) GUICtrlSetData($inBeta86, '"' & $var & '"') Case $btnBeta64 $var = FileOpenDialog("Select a file", @WindowsDir & "", "Installers (*.exe;*.msi)|Scripts (*.vbs;*.bat)", 1) GUICtrlSetData($inBeta64, '"' & $var & '"') #cs - Legacy Case $btnAllow $rAllow1 = StringSplit($allow, ";") _AllowGroupsEdit() Case $btnDeny $rDeny1 = StringSplit($deny, ";") _DenyGroupsEdit() Case $btnRunningApps $runningApps = InputBox("Process name", "Please enter the running process/processes name(s)to check, before starting installation." & @CR & @CR & "e.g. iexplore.exe;outlook.exe", $runningApps) #ce Case $btnSaveApp GUICtrlSetData($labelStatus2, "Saving...") ;Save Settings tab $aFriendlyName = GUICtrlRead($inFriendly) $aAppName = GUICtrlRead($inAppName) $aProcesses = GUICtrlRead($inProcesses) If _checkbox_active1($listAllow) = 1 Then $sAllow = _GuiCtrlListView_GetChecked($listAllow) EndIf If _checkbox_active2($listDeny) = 1 Then $sDeny = _GuiCtrlListView_GetChecked($listDeny) EndIf If BitAND(GUICtrlRead($cbBIOS), $GUI_CHECKED) = $GUI_CHECKED Then $aBIOS = "Yes" Else $aBIOS = "No" EndIf If BitAND(GUICtrlRead($cbDriver), $GUI_CHECKED) = $GUI_CHECKED Then $aDriver = "Yes" Else $aDriver = "No" EndIf If BitAND(GUICtrlRead($cbProfile), $GUI_CHECKED) = $GUI_CHECKED Then $aProfile = "Yes" Else $aProfile = "No" EndIf ;Save Available Application tab $aAppVer = GUICtrlRead($inAppVer) $aAppPath86 = GUICtrlRead($inPath86) $aAppPath64 = GUICtrlRead($inPath64) $aAppParaAA = GUICtrlRead($inParamAA) $rDownloadLimitAA = GUICtrlRead($inLimitAA) $rKeyAA = GUICtrlRead($inKeyAA) $rPasswordAA = GUICtrlRead($inPasswordAA) ;Save Rollback Application tab $aRollbackVer = GUICtrlRead($inRollbackVer) $aRollbackPath86 = GUICtrlRead($inRollback86) $aRollbackPath64 = GUICtrlRead($inRollback64) $aAppParaRA = GUICtrlRead($inParamRA) $rDownloadLimitRA = GUICtrlRead($inLimitRA) $rKeyRA = GUICtrlRead($inKeyRA) $rPasswordRA = GUICtrlRead($inPasswordRA) ;Save Beta Application tab $aBetaVer = GUICtrlRead($inBetaVer) $aBetaPath86 = GUICtrlRead($inBeta86) $aBetaPath64 = GUICtrlRead($inBeta64) $aAppParaBA = GUICtrlRead($inParamBA) $rDownloadLimitBA = GUICtrlRead($inLimitBA) $rKeyBA = GUICtrlRead($inKeyBA) $rPasswordBA = GUICtrlRead($inPasswordBA) If $aFriendlyName = "" Or $aAppName = "" Or $aAppVer = "" Or $aAppPath86 = "" And $aAppPath64 = "" Then MsgBox(0, "Error", "Please make sure you have a Friendly Name, App Name, App Version and either a 32bit and/or 64bit Application path entered in the form.") Else If $aAppPath86 <> "" Then $aAppPath = "X86" ElseIf $aAppPath64 <> "" Then $aAppPath = "X64" ElseIf $aAppPath64 And $aAppPath86 <> "" Then $aAppPath = "X86/X64" EndIf If IsArray($sAllow) Then ;_ArrayDisplay($chkAllow) For $i = 1 To $sAllow[0][0] $selectedGroups1 = $selectedGroups1 & $sAllow[$i][1] & ";" Next ;MsgBox(0,"Allowed Groups",$selectedGroups1) Else $selectedGroups1 = "" EndIf If IsArray($sDeny) Then ;_ArrayDisplay($chkDeny) For $i = 1 To $sDeny[0][0] $selectedGroups2 = $selectedGroups2 & $sDeny[$i][1] & ";" Next ;MsgBox(0,"Denied Groups",$selectedGroups2) Else $selectedGroups2 = "" EndIf If StringRight($aAppPath64, 1) = '"' Then $aAppPath64 = StringTrimRight($aAppPath64, 1) EndIf If StringLeft($aAppPath64, 1) = '"' Then $aAppPath64 = StringTrimLeft($aAppPath64, 1) EndIf If StringRight($aAppPath86, 1) = '"' Then $aAppPath86 = StringTrimRight($aAppPath86, 1) EndIf If StringLeft($aAppPath86, 1) = '"' Then $aAppPath86 = StringTrimLeft($aAppPath86, 1) EndIf If StringRight($aRollbackPath64, 1) = '"' Then $aRollbackPath64 = StringTrimRight($aRollbackPath64, 1) EndIf If StringLeft($aRollbackPath64, 1) = '"' Then $aRollbackPath64 = StringTrimLeft($aRollbackPath64, 1) EndIf If StringRight($aRollbackPath86, 1) = '"' Then $aRollbackPath86 = StringTrimRight($aRollbackPath86, 1) EndIf If StringLeft($aRollbackPath86, 1) = '"' Then $aRollbackPath86 = StringTrimLeft($aRollbackPath86, 1) EndIf If StringRight($aBetaPath64, 1) = '"' Then $aBetaPath64 = StringTrimRight($aBetaPath64, 1) EndIf If StringLeft($aBetaPath64, 1) = '"' Then $aBetaPath64 = StringTrimLeft($aBetaPath64, 1) EndIf If StringRight($aBetaPath86, 1) = '"' Then $aBetaPath86 = StringTrimRight($aBetaPath86, 1) EndIf If StringLeft($aBetaPath86, 1) = '"' Then $aBetaPath86 = StringTrimLeft($aBetaPath86, 1) EndIf $sql1 = "" ;#cs If $aAppName <> "" Then $sql1 = $sql1 & ',"Application Name"=' & "'" & $aAppName & "'" Else $sql1 = $sql1 & ',"Application Name"=' & "''" EndIf If $aFriendlyName <> "" Then $sql1 = $sql1 & ',"Friendly Name"=' & "'" & $aFriendlyName & "'" Else $sql1 = $sql1 & ',"Friendly Name"=' & "''" EndIf If $selectedGroups1 = "" Then $sql1 = $sql1 & ',"Permissions Allow"=' & "''" Else $sql1 = $sql1 & ',"Permissions Allow"=' & "'" & $selectedGroups1 & "'" EndIf If $selectedGroups2 = "" Then $sql1 = $sql1 & ',"Permissions Deny"=' & "''" Else $sql1 = $sql1 & ',"Permissions Deny"=' & "'" & $selectedGroups2 & "'" EndIf If $aProfile <> "" Then $sql1 = $sql1 & ',"Profile Application"=' & "'" & $aProfile & "'" Else $sql1 = $sql1 & ',"Profile Application"=' & "''" EndIf If $sRunningApps <> "" Then $sql1 = $sql1 & ',"Running Application Check"=' & "'" & $sRunningApps & "'" Else $sql1 = $sql1 & ',"Running Application Check"=' & "''" EndIf If $aDriver <> "" Then $sql1 = $sql1 & ",Driver='" & $driver & "'" Else $sql1 = $sql1 & ",Driver=''" EndIf If $aBIOS <> "" Then $sql1 = $sql1 & ",BIOS='" & $bios & "'" Else $sql1 = $sql1 & ",BIOS=''" EndIf If $aAppPath64 = "" Then $architecture = "X86" Else $architecture = "X86/X64" EndIf If $architecture <> "" Then $sql1 = $sql1 & ",Architecture='" & $architecture & "'" EndIf If $aAppVer <> "" Then $sql1 = $sql1 & ",Version='" & $aAppVer & "'" Else $sql1 = $sql1 & ",Version=''" EndIf If $aAppPath86 <> "" Then $sql1 = $sql1 & ',"Installer Directory x86"=' & "'" & $aAppPath86 & "'" Else $sql1 = $sql1 & ',"Installer Directory x86"=' & "''" EndIf If $aAppPath64 <> "" Then $sql1 = $sql1 & ',"Installer Directory x64"=' & "'" & $aAppPath64 & "'" Else $sql1 = $sql1 & ',"Installer Directory x64"=' & "''" EndIf If $rDownloadLimitAA <> "" Then $sql1 = $sql1 & ',"Limit Installations AA"=' & "'" & $rDownloadLimitAA & "'" Else $sql1 = $sql1 & ',"Limit Installations AA"=' & "''" EndIf If $aAppParaAA <> "" Then $sql1 = $sql1 & ',"Install Parameters AA"=' & "'" & $aAppParaAA & "'" Else $sql1 = $sql1 & ',"Install Parameters AA"=' & "''" EndIf If $rPasswordAA <> "" Then $sql1 = $sql1 & ',"Install Password AA"=' & "'" & $rPasswordAA & "'" Else $sql1 = $sql1 & ',"Install Password AA"=' & "''" EndIf If $rKeyAA <> "" Then $sql1 = $sql1 & ',"Install Key AA"=' & "'" & $rKeyAA & "'" Else $sql1 = $sql1 & ',"Install Key AA"=' & "''" EndIf If $aRollbackPath86 <> "" Then $sql1 = $sql1 & ',"Rollback Directory x86"=' & "'" & $aRollbackPath86 & "'" Else $sql1 = $sql1 & ',"Rollback Directory x86"=' & "''" EndIf If $aRollbackPath64 <> "" Then $sql1 = $sql1 & ',"Rollback Directory x64"=' & "'" & $aRollbackPath64 & "'" Else $sql1 = $sql1 & ',"Rollback Directory x64"=' & "''" EndIf If $aRollbackVer <> "" Then $sql1 = $sql1 & ',"Rollback Version"=' & "'" & $aRollbackVer & "'" Else $sql1 = $sql1 & ',"Rollback Version"=' & "''" EndIf If $rDownloadLimitRA <> "" Then $sql1 = $sql1 & ',"Limit Installations RA"=' & "'" & $rDownloadLimitRA & "'" Else $sql1 = $sql1 & ',"Limit Installations RA"=' & "''" EndIf If $aAppParaRA <> "" Then $sql1 = $sql1 & ',"Install Parameters RA"=' & "'" & $aAppParaRA & "'" Else $sql1 = $sql1 & ',"Install Parameters RA"=' & "''" EndIf If $rPasswordRA <> "" Then $sql1 = $sql1 & ',"Install Password RA"=' & "'" & $rPasswordRA & "'" Else $sql1 = $sql1 & ',"Install Password RA"=' & "''" EndIf If $rKeyRA <> "" Then $sql1 = $sql1 & ',"Install Key RA"=' & "'" & $rKeyRA & "'" Else $sql1 = $sql1 & ',"Install Key RA"=' & "''" EndIf ;$sql1 = $sql1 & ",Key= " If $aBetaPath86 <> "" Then $sql1 = $sql1 & ',"Beta Directory x86"=' & "'" & $aBetaPath86 & "'" Else $sql1 = $sql1 & ',"Beta Directory x86"=' & "''" EndIf If $aBetaPath64 <> "" Then $sql1 = $sql1 & ',"Beta Directory x64"=' & "'" & $aBetaPath64 & "'" Else $sql1 = $sql1 & ',"Beta Directory x64"=' & "''" EndIf If $aBetaVer <> "" Then $sql1 = $sql1 & ',"Beta Version"=' & "'" & $aBetaVer & "'" Else $sql1 = $sql1 & ',"Beta Version"=' & "''" EndIf If $rDownloadLimitBA <> "" Then $sql1 = $sql1 & ',"Limit Installations BA"=' & "'" & $rDownloadLimitBA & "'" Else $sql1 = $sql1 & ',"Limit Installations BA"=' & "''" EndIf If $aAppParaBA <> "" Then $sql1 = $sql1 & ',"Install Parameters BA"=' & "'" & $aAppParaBA & "'" Else $sql1 = $sql1 & ',"Install Parameters BA"=' & "''" EndIf If $rPasswordBA <> "" Then $sql1 = $sql1 & ',"Install Password BA"=' & "'" & $rPasswordBA & "'" Else $sql1 = $sql1 & ',"Install Password BA"=' & "''" EndIf If $rKeyBA <> "" Then $sql1 = $sql1 & ',"Install Key BA"=' & "'" & $rKeyBA & "'" Else $sql1 = $sql1 & ',"Install Key BA"=' & "''" EndIf ;#ce If StringLeft($sql1,1) = "," Then $sql1 = StringTrimLeft($sql1, 1) EndIf $sqlCon = ObjCreate("ADODB.Connection") _DecryptPW2() $sqlCon.Open("Provider=" & $iniD_Provider & "; Server=" & $iniD_Server & "; database=" & $iniD_Database & "; User ID=" & $iniD_User & "; Password=" & $sPW2 & ";") ;MsgBox(0,"SQL","UPDATE [" & $iniD_Database & "].[dbo].[" & $iniD_Table & "] SET " & $sql1 & " WHERE ID=" & $sID & ";") $sqlEXE = $sqlCon.execute("UPDATE [" & $iniD_Database & "].[dbo].[" & $iniD_Table & "] SET " & $sql1 & " WHERE ID=" & $sID & ";") $sqlCon.Close _GUICtrlListView_DeleteAllItems($listApps) _RefreshList() EndIf GUICtrlSetData($labelStatus2, "") WinActivate($iniS_AppName, "") GUIDelete($Form3) ExitLoop EndSwitch WEnd EndFunc ;==>_EditAPP Func _RemoveApp() #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Default Button=Second, Icon=None If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(260, "Remove Application", "Are you sure you want to remove this Application?" & @CR & @CR & $selApp) Select Case $iMsgBoxAnswer = 6 ;Yes GUICtrlSetData($labelStatus2, "Removing...") $sqlCon = ObjCreate("ADODB.Connection") _DecryptPW2() $sqlCon.Open("Provider=" & $iniD_Provider & "; Server=" & $iniD_Server & "; database=" & $iniD_Database & "; User ID=" & $iniD_User & "; Password=" & $sPW2 & ";") $sqlEXE = $sqlCon.execute("DELETE From [" & $iniD_Database & "].[dbo].[" & $iniD_Table & "] WHERE ID='" & $sID & "';") $sqlCon.Close _GUICtrlListView_DeleteAllItems($listApps) GUICtrlSetData($labelStatus2, "") _RefreshList() Case $iMsgBoxAnswer = 7 ;No EndSelect #EndRegion --- CodeWizard generated code Start --- EndFunc ;==>_RemoveApp ;#ce Func _Admin() GUICtrlSetData($listOptions, "") GUICtrlSetData($listOptions, "Add App|Edit App|Remove App|Install|Uninstall|Update All|Build EXE|Help|Rollback|Beta|Show Key") EndFunc ;==>_Admin Func _User() GUICtrlSetData($listOptions, "Install|Beta|Rollback|Uninstall|Update All|Show Key|Help") EndFunc ;==>_User Func _AppLog() $todayDate = @MON & "/" & @MDAY & "/" & @YEAR $todayTime = @HOUR & ":" & @MIN & ":" & @SEC If $installSel = True Then _DecryptPW3() $installSel = "Install" $sqlCon = ObjCreate("ADODB.Connection") $sqlCon.Open("Provider=" & $iniDL_Provider & "; Server=" & $iniDL_Server & "; database=" & $iniDL_Database & "; User ID=" & $iniDL_User & "; Password=" & $sPW3 & ";"); TRUSTED_CONNECTION = YES") If $beta = "no" And $rollback = "no" Then $sqlEXE = $sqlCon.execute("INSERT INTO [" & $iniDL_Database & "].[dbo].[" & $iniDL_Database & "] ([Application Name],[Version],[Install or Uninstall],[Date],[Time],[Username],[Computer Name],[IP Address],[Operating System]) VALUES ('" & $sSelAppReg & "','" & $sVersionAA & "','" & $installSel & "','" & $todayDate & "','" & $todayTime & "','" & @UserName & "','" & @ComputerName & "','" & @IPAddress1 & "','" & @OSVersion & "')") ElseIf $beta = "no" And $rollback = "yes" Then $sqlEXE = $sqlCon.execute("INSERT INTO [" & $iniDL_Database & "].[dbo].[" & $iniDL_Database & "] ([Application Name],[Version],[Install or Uninstall],[Date],[Time],[Username],[Computer Name],[IP Address],[Operating System]) VALUES ('" & $sSelAppReg & "','" & $sVersionRA & "','" & $installSel & "','" & $todayDate & "','" & $todayTime & "','" & @UserName & "','" & @ComputerName & "','" & @IPAddress1 & "','" & @OSVersion & "')") ElseIf $beta = "yes" And $rollback = "no" Then $sqlEXE = $sqlCon.execute("INSERT INTO [" & $iniDL_Database & "].[dbo].[" & $iniDL_Database & "] ([Application Name],[Version],[Install or Uninstall],[Date],[Time],[Username],[Computer Name],[IP Address],[Operating System]) VALUES ('" & $sSelAppReg & "','" & $sVersionBA & "','" & $installSel & "','" & $todayDate & "','" & $todayTime & "','" & @UserName & "','" & @ComputerName & "','" & @IPAddress1 & "','" & @OSVersion & "')") EndIf $sqlCon.close ElseIf $installSel = False Then _DecryptPW3() $installSel = "Uninstall" $sqlCon = ObjCreate("ADODB.Connection") $sqlCon.Open("Provider=" & $iniDL_Provider & "; Server=" & $iniDL_Server & "; database=" & $iniDL_Database & "; User ID=" & $iniDL_User & "; Password=" & $sPW3 & ";"); TRUSTED_CONNECTION = YES") $sqlEXE = $sqlCon.execute("INSERT INTO [" & $iniDL_Database & "].[dbo].[" & $iniDL_Database & "] ([Application Name],[Version],[Install or Uninstall],[Date],[Time],[Username],[Computer Name],[IP Address],[Operating System]) VALUES ('" & $sSelAppReg & "','" & $versionInst & "','" & $installSel & "','" & $todayDate & "','" & $todayTime & "','" & @UserName & "','" & @ComputerName & "','" & @IPAddress1 & "','" & @OSVersion & "')") $sqlCon.close ElseIf $installSel = "Update" Then _DecryptPW3() $installSel = "Update" $sqlCon = ObjCreate("ADODB.Connection") $sqlCon.Open("Provider=" & $iniDL_Provider & "; Server=" & $iniDL_Server & "; database=" & $iniDL_Database & "; User ID=" & $iniDL_User & "; Password=" & $sPW3 & ";"); TRUSTED_CONNECTION = YES") If $beta = "no" And $rollback = "no" Then $sqlEXE = $sqlCon.execute("INSERT INTO [" & $iniDL_Database & "].[dbo].[" & $iniDL_Database & "] ([Application Name],[Version],[Install or Uninstall],[Date],[Time],[Username],[Computer Name],[IP Address],[Operating System]) VALUES ('" & $sSelAppReg & "','" & $sVersionAA & "','" & $installSel & "','" & $todayDate & "','" & $todayTime & "','" & @UserName & "','" & @ComputerName & "','" & @IPAddress1 & "','" & @OSVersion & "')") ElseIf $beta = "no" And $rollback = "yes" Then $sqlEXE = $sqlCon.execute("INSERT INTO [" & $iniDL_Database & "].[dbo].[" & $iniDL_Database & "] ([Application Name],[Version],[Install or Uninstall],[Date],[Time],[Username],[Computer Name],[IP Address],[Operating System]) VALUES ('" & $sSelAppReg & "','" & $sVersionRA & "','" & $installSel & "','" & $todayDate & "','" & $todayTime & "','" & @UserName & "','" & @ComputerName & "','" & @IPAddress1 & "','" & @OSVersion & "')") ElseIf $beta = "yes" And $rollback = "no" Then $sqlEXE = $sqlCon.execute("INSERT INTO [" & $iniDL_Database & "].[dbo].[" & $iniDL_Database & "] ([Application Name],[Version],[Install or Uninstall],[Date],[Time],[Username],[Computer Name],[IP Address],[Operating System]) VALUES ('" & $sSelAppReg & "','" & $sVersionBA & "','" & $installSel & "','" & $todayDate & "','" & $todayTime & "','" & @UserName & "','" & @ComputerName & "','" & @IPAddress1 & "','" & @OSVersion & "')") EndIf $sqlCon.close EndIf EndFunc ;==>_AppLog Func _checkbox_active1($listAllow) For $i = 0 To _GUICtrlListView_GetItemCount($listAllow) - 1 Step 1 If _GUICtrlListView_GetItemChecked($listAllow, $i) = 1 Then Return 1 EndIf Next Return 0 EndFunc ;==>_checkbox_active1 Func _checkbox_active2($listDeny) For $i = 0 To _GUICtrlListView_GetItemCount($listDeny) - 1 Step 1 If _GUICtrlListView_GetItemChecked($listDeny, $i) = 1 Then Return 1 EndIf Next Return 0 EndFunc ;==>_checkbox_active2 Func _setbut1() If _checkbox_active1($listAllow) Then If BitAND(GUICtrlGetState($btnOK), $GUI_DISABLE) Then GUICtrlSetState($btnOK, $GUI_ENABLE) EndIf ElseIf BitAND(GUICtrlGetState($btnOK), $GUI_ENABLE) Then GUICtrlSetState($btnOK, $GUI_DISABLE) EndIf EndFunc ;==>_setbut1 Func _setbut2() If _checkbox_active2($listDeny) Then If BitAND(GUICtrlGetState($btnOK), $GUI_DISABLE) Then GUICtrlSetState($btnOK, $GUI_ENABLE) EndIf ElseIf BitAND(GUICtrlGetState($btnOK), $GUI_ENABLE) Then GUICtrlSetState($btnOK, $GUI_DISABLE) EndIf EndFunc ;==>_setbut2 #cs Func _AllowGroups() _AD_Open() Local $adGroups = _AD_GetObjectsInOU($iniS_GroupsOU, "(objectclass=group)") _AD_Close() $formAllow = GUICreate("Allowed Security Groups", 280, 320) $listAllow = GUICtrlCreateListView(" ", 15, 15, 250, 250, -1, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_SetColumnWidth($listAllow, 0, 232) $btnOK = GUICtrlCreateButton("OK", 115, 280, 70, 25) $btnCancel = GUICtrlCreateButton("Cancel", 195, 280, 70, 25) For $a = 1 To $adGroups[0] _GUICtrlListView_AddItem($listAllow, $adGroups[$a]) Next If IsArray($chkAllow) Then For $i = 1 To $chkAllow[0][0] _GUICtrlListView_SetItemChecked($listAllow, $chkAllow[$i][0], True) Next EndIf _setbut1() GUISetState(@SW_SHOW, $formAllow) ;GUISwitch($formAllow) While 6 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE WinActivate("Add Application", "") GUIDelete($formAllow) ExitLoop Case $btnCancel WinActivate("Add Application", "") GUIDelete($formAllow) ExitLoop Case $btnOK If _checkbox_active1($listAllow) = 1 Then $chkAllow = _GuiCtrlListView_GetChecked($listAllow) EndIf WinActivate("Add Application", "") GUIDelete($formAllow) ExitLoop Case Else _setbut1() EndSwitch WEnd EndFunc ;==>_AllowGroups Func _DenyGroups() _AD_Open() Local $adGroups = _AD_GetObjectsInOU($iniS_GroupsOU, "(objectclass=group)") _AD_Close() $formDeny = GUICreate("Denied Security Groups", 280, 320) $listDeny = GUICtrlCreateListView(" ", 15, 15, 250, 250, -1, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_SetColumnWidth($listDeny, 0, 232) $btnOK = GUICtrlCreateButton("OK", 115, 280, 70, 25) $btnCancel = GUICtrlCreateButton("Cancel", 195, 280, 70, 25) For $a = 1 To $adGroups[0] _GUICtrlListView_AddItem($listAllow, $adGroups[$a]) Next If IsArray($chkDeny) Then For $i = 1 To $chkAllow[0][0] _GUICtrlListView_SetItemChecked($listAllow, $chkDeny[$i][0], True) Next EndIf _setbut2() GUISetState(@SW_SHOW) GUISwitch($formDeny) While 6 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE WinActivate("Add Application", "") GUIDelete($formDeny) ExitLoop Case $btnCancel WinActivate("Add Application", "") GUIDelete($formDeny) ExitLoop Case $btnOK If _checkbox_active2($listDeny) = 1 Then $chkDeny = _GuiCtrlListView_GetChecked($listDeny) EndIf WinActivate("Add Application", "") GUIDelete($formDeny) ExitLoop Case Else _setbut2() EndSwitch WEnd EndFunc ;==>_DenyGroups Func _AllowGroupsEdit() _AD_Open() Local $adGroups = _AD_GetObjectsInOU($iniS_GroupsOU, "(objectclass=group)") _AD_Close() $formAllow = GUICreate("Allowed Security Groups", 280, 320) $listAllow = GUICtrlCreateListView(" ", 15, 15, 250, 250, -1, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_SetColumnWidth($listAllow, 0, 232) $btnClear = GUICtrlCreateButton("Clear", 35, 280, 70, 25) $btnOK = GUICtrlCreateButton("OK", 115, 280, 70, 25) $btnCancel = GUICtrlCreateButton("Cancel", 195, 280, 70, 25) For $a = 1 To $adGroups[0] _GUICtrlListView_AddItem($listAllow, $adGroups[$a]) For $b = 1 To $rAllow1[0] If $adGroups[$a] = $rAllow1[$b] Then _GUICtrlListView_SetItemChecked($listAllow, $a - 1, True) ExitLoop EndIf Next Next _setbut1() GUISetState(@SW_SHOW, $formAllow) ;GUISwitch($formAllow) While 6 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE WinActivate("Edit Application", "") GUIDelete($formAllow) ExitLoop Case $btnCancel WinActivate("Edit Application", "") GUIDelete($formAllow) ExitLoop Case $btnOK If _checkbox_active1($listAllow) = 1 Then $chkAllow = _GuiCtrlListView_GetChecked($listAllow) EndIf WinActivate("Edit Application", "") GUIDelete($formAllow) ExitLoop Case $btnClear $chkAllow = Null WinActivate("Edit Application", "") GUIDelete($formAllow) ExitLoop Case Else _setbut1() EndSwitch WEnd EndFunc ;==>_AllowGroupsEdit Func _DenyGroupsEdit() _AD_Open() Local $adGroups = _AD_GetObjectsInOU($iniS_GroupsOU, "(objectclass=group)") _AD_Close() $formDeny = GUICreate("Denied Security Groups", 280, 320) $listDeny = GUICtrlCreateListView(" ", 15, 15, 250, 250, -1, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT)) _GUICtrlListView_SetColumnWidth($listDeny, 0, 232) $btnClear = GUICtrlCreateButton("Clear", 35, 280, 70, 25) $btnOK = GUICtrlCreateButton("OK", 115, 280, 70, 25) $btnCancel = GUICtrlCreateButton("Cancel", 195, 280, 70, 25) For $a = 1 To $adGroups[0] _GUICtrlListView_AddItem($listDeny, $adGroups[$a]) For $b = 1 To $rDeny1[0] If $adGroups[$a] = $rDeny1[$b] Then _GUICtrlListView_SetItemChecked($listDeny, $a - 1, True) ExitLoop EndIf Next Next _setbut2() GUISetState(@SW_SHOW) GUISwitch($formDeny) While 6 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE WinActivate("Edit Application", "") GUIDelete($formDeny) ExitLoop Case $btnCancel WinActivate("Edit Application", "") GUIDelete($formDeny) ExitLoop Case $btnOK If _checkbox_active2($listDeny) = 1 Then $chkDeny = _GuiCtrlListView_GetChecked($listDeny) EndIf WinActivate("Edit Application", "") GUIDelete($formDeny) ExitLoop Case $btnClear $chkDeny = Null WinActivate("Edit Application", "") GUIDelete($formDeny) ExitLoop Case Else _setbut2() EndSwitch WEnd EndFunc ;==>_DenyGroupsEdit #ce Func _DecryptPW1() ; Config file - Administrators section - InstallPassword _Crypt_Startup() Global $sPasswordCT = $iniA_InstallPassword Global $sPW = '' $sPW = _Decrypt("password", $sPasswordCT) _Crypt_Shutdown() EndFunc ;==>_DecryptPW1 Func _DecryptPW2() ; Config file - Database section - Password _Crypt_Startup() Global $sPasswordCT = $iniD_Password Global $sPW2 = '' $sPW2 = _Decrypt("password", $sPasswordCT) _Crypt_Shutdown() EndFunc ;==>_DecryptPW1 Func _DecryptPW3() ; Config file - DatabaseLogs section - Password _Crypt_Startup() Global $sPasswordCT = $iniDL_Password Global $sPW3 = '' $sPW3 = _Decrypt("password", $sPasswordCT) _Crypt_Shutdown() EndFunc ;==>_DecryptPW1 Func _Decrypt($sKey, $sData) Local $hKey = _Crypt_DeriveKey($sKey, $CALG_AES_256) Local $sDecrypted = BinaryToString(_Crypt_DecryptData(Binary($sData), $hKey, $CALG_USERKEY)) _Crypt_DestroyKey($hKey) Return $sDecrypted EndFunc ;==>_Decrypt Func _GuiCtrlListView_GetChecked($hWnd, $text = True, $Column = 0) Local $rows = _GUICtrlListView_GetItemCount($hWnd) - 1, $n = 1, $SeparatorChar = Opt('GUIDataSeparatorChar'), $Columns If $rows = 0 Then Return SetError(1) If $text And (Not StringRegExp($Column, "\d+") Or $Column < 0 Or $Column > _GUICtrlListView_GetColumnCount($hWnd)) Then $Column = 0 Local $sArray[$n][2] For $i = 0 To $rows If _GUICtrlListView_GetItemChecked($hWnd, $i) Then ReDim $sArray[$n + 1][2] $sArray[$n][0] = $i If $text Then $Columns = StringSplit(_GUICtrlListView_GetItemTextString($hWnd, $i), $SeparatorChar, 1) $sArray[$n][1] = $Columns[$Column + 1] $n += 1 EndIf EndIf Next $sArray[0][0] = UBound($sArray) - 1 If Not $text Then ReDim $sArray[$n][1] Return $sArray EndIf Return $sArray EndFunc ;==>_GuiCtrlListView_GetChecked Func _ProgressMarquee_Start($iControlID = -1) Local Const $PBM_SETMARQUEE = 1034 Return GUICtrlSendMsg($iControlID, $PBM_SETMARQUEE, 1, 50) EndFunc ;==>_ProgressMarquee_Start Func _ProgressMarquee_Stop($iControlID = -1, $iReset = 0) Local Const $PBS_MARQUEE = 0x0008, $PBM_SETMARQUEE = 1034 GUICtrlSendMsg($iControlID, $PBM_SETMARQUEE, 0, 50) If $iReset = 1 Then Return GUICtrlSetStyle($iControlID, $PBS_MARQUEE) EndIf Return 1 EndFunc ;==>_ProgressMarquee_Stop Func WM_SIZE($hWnd, $msg, $wParam, $lParam) Local $iWidth = BitAND($lParam, 0xFFFF) Local $iHeight = BitShift($lParam, 16) _WinAPI_MoveWindow($listApps, 8, 8, $iWidth - 392, $iHeight - 15, True) Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE Func MyErrFunc() ConsoleWrite("AutoItCOM Test" & @CRLF & "We intercepted a COM Error !" & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & Hex($oMyError.number, 8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext & @CRLF ) ;"err $sqlString is:" & @TAB &$sqlString& @CRLF ) SetError(1) EndFunc ;==>MyErrFunc