AasimPathan Posted March 13, 2019 Share Posted March 13, 2019 Hi, Our developers are constantly developing our application / add-in for Office programs for internal use. The way we currently do it is once the project is built we use Wix to build the msi package which is then deployed via Group Policy. The problem is this is slow, and it takes days for the Group Policy to apply (due to it requiring system to be restarted for the msi package to be installed) so not all users are using the same version at any give period. for e.g. we deployed v1.5 in our network 2 days ago. out of the 10 systems only 2 so far have the latest version and all others are on older versions. I would like to fix this problem by giving developers access / rights to install the program directly as soon as they deploy them by using AutoIT. So this is what I want my script to do. 1. Connect to Remote computer (command line, powershell etc.) 2. Close all running Office Applications 3. Uninstall installed Wix Application 4. Copy over the MSI file from the network. 5. Install new version of the application. The script I built is the following but I cant get it to work with multiple computers but this is as far as i got, any pointers to proceed further? expandcollapse popup#include <AutoItConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3>#include <AutoItConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> $user = "domainadmin" $pass = "Password!" $domain = "Domain" ConnectToRemoteComputer() Func ConnectToRemoteComputer() Run("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe") Sleep (500) Send ("$cred= Get-Credential") Send ("{Enter}") Sleep (5000) Send ("user") Send ("{TAB}") Send ("pass") Send ("{Enter}") Send ("Enter-PSSession -ComputerName Computername -Credential $cred") Send ("{Enter}") EndFunc Func CloseRunningOfficePrograms() If ProcessExists("WINWORD.EXE") Then ProcessClose ("WINWORD.EXE") EndIf If ProcessExists ("EXCEL.EXE") Then ProcessClose ("EXCEL.EXE") EndIf If ProcessExists ("OUTLOOK.EXE") Then ProcessClose ("OUTLOOK.EXE") EndIf If ProcessExists("VISIO.EXE") Then ProcessClose ("VISIO.EXE") EndIf If ProcessExists ("POWERPNT.EXE") Then ProcessClose ("POWERPNT.EXE") EndIf EndFunc UninstallMatrixCodeBase() Func UninstallMatrixCodeBase() RunAsWait($user, $domain, $pass, 0,"msiexec /x {4BE071E6-447E-4160-8768-B765885E73FE} /passive") EndFunc InstallMatrixCodeBase() Func() FileCopy("A:\xxxxxxx\xxxx\xxxxxxxx\xxzzzzz\xzzzzzzzzz\x\MatrixCodeBase.msi", "C:\Install") RunAsWait($user, $domain, $pass, 0,"msiexec /i C:\Install\MatrixCodeBase.msi /passive") EndFunc Link to comment Share on other sites More sharing options...
Earthshine Posted March 13, 2019 Share Posted March 13, 2019 (edited) It’s an MSI so install it silently using auto IT script Edited March 13, 2019 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
AasimPathan Posted March 13, 2019 Author Share Posted March 13, 2019 17 minutes ago, Earthshine said: It’s an MSI so install it silently using auto IT script remotely? on 10 computers? how? Link to comment Share on other sites More sharing options...
rm4453 Posted March 13, 2019 Share Posted March 13, 2019 32 minutes ago, AasimPathan said: Hi, Our developers are constantly developing our application / add-in for Office programs for internal use. The way we currently do it is once the project is built we use Wix to build the msi package which is then deployed via Group Policy. The problem is this is slow, and it takes days for the Group Policy to apply (due to it requiring system to be restarted for the msi package to be installed) so not all users are using the same version at any give period. for e.g. we deployed v1.5 in our network 2 days ago. out of the 10 systems only 2 so far have the latest version and all others are on older versions. I would like to fix this problem by giving developers access / rights to install the program directly as soon as they deploy them by using AutoIT. So this is what I want my script to do. 1. Connect to Remote computer (command line, powershell etc.) 2. Close all running Office Applications 3. Uninstall installed Wix Application 4. Copy over the MSI file from the network. 5. Install new version of the application. The script I built is the following but I cant get it to work with multiple computers but this is as far as i got, any pointers to proceed further? expandcollapse popup#include <AutoItConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3>#include <AutoItConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> $user = "domainadmin" $pass = "Password!" $domain = "Domain" ConnectToRemoteComputer() Func ConnectToRemoteComputer() Run("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe") Sleep (500) Send ("$cred= Get-Credential") Send ("{Enter}") Sleep (5000) Send ("user") Send ("{TAB}") Send ("pass") Send ("{Enter}") Send ("Enter-PSSession -ComputerName Computername -Credential $cred") Send ("{Enter}") EndFunc Func CloseRunningOfficePrograms() If ProcessExists("WINWORD.EXE") Then ProcessClose ("WINWORD.EXE") EndIf If ProcessExists ("EXCEL.EXE") Then ProcessClose ("EXCEL.EXE") EndIf If ProcessExists ("OUTLOOK.EXE") Then ProcessClose ("OUTLOOK.EXE") EndIf If ProcessExists("VISIO.EXE") Then ProcessClose ("VISIO.EXE") EndIf If ProcessExists ("POWERPNT.EXE") Then ProcessClose ("POWERPNT.EXE") EndIf EndFunc UninstallMatrixCodeBase() Func UninstallMatrixCodeBase() RunAsWait($user, $domain, $pass, 0,"msiexec /x {4BE071E6-447E-4160-8768-B765885E73FE} /passive") EndFunc InstallMatrixCodeBase() Func() ; <-----------> FUNC ISN'T NAMED! <-----------> FileCopy("A:\xxxxxxx\xxxx\xxxxxxxx\xxzzzzz\xzzzzzzzzz\x\MatrixCodeBase.msi", "C:\Install") RunAsWait($user, $domain, $pass, 0,"msiexec /i C:\Install\MatrixCodeBase.msi /passive") EndFunc 12 I commented on your code on a potential issue Link to comment Share on other sites More sharing options...
AasimPathan Posted March 13, 2019 Author Share Posted March 13, 2019 13 minutes ago, rm4453 said: I commented on your code on a potential issue Thanks, I saw that Link to comment Share on other sites More sharing options...
AasimPathan Posted March 13, 2019 Author Share Posted March 13, 2019 (edited) Currently the problem is 1. running the above script on multiple remote computers on the network from a single computer 2. Calling the following Func CloseRunningOfficePrograms() ,Func UninstallMatrixCodeBase() & Func InstallMatrixCodeBase() on the remote computer. Edited March 13, 2019 by AasimPathan Link to comment Share on other sites More sharing options...
rm4453 Posted March 13, 2019 Share Posted March 13, 2019 Just now, AasimPathan said: Currently the problem is 1. running the above script on multiple remote computers on the network from a single computer 2. Calling the following Func CloseRunningOfficePrograms() ,Func UninstallMatrixCodeBase() & Func InstallMatrixCodeBase() on the remote computer. Are you distributing the autoit script to all pc's you will be running it on? if so how? Link to comment Share on other sites More sharing options...
AasimPathan Posted March 13, 2019 Author Share Posted March 13, 2019 1 minute ago, rm4453 said: Are you distributing the autoit script to all pc's you will be running it on? if so how? Well that is not really a problem, i can distribute it easily using Group Policy > Computer Configuration > Preferences > Windows Settings > Files Here i usually place in the AutoIT compiled .exe's to copy over to each local computer. Link to comment Share on other sites More sharing options...
rm4453 Posted March 13, 2019 Share Posted March 13, 2019 2 minutes ago, AasimPathan said: Well that is not really a problem, i can distribute it easily using Group Policy > Computer Configuration > Preferences > Windows Settings > Files Here i usually place in the AutoIT compiled .exe's to copy over to each local computer. make the script run in the background, of every computer, and periodically check a text file on the network, for an encoded value that = true or false with a secondary line that is the file path encoded... if it equals true it downloads the new version then times out the file check for say a day or so you don't create an infinite download loop etc... if that makes sense? *i say encoded just for security no need to encode depending on network environment* Link to comment Share on other sites More sharing options...
rm4453 Posted March 13, 2019 Share Posted March 13, 2019 Actually if you keep update names unique you wouldn't need to time out the update you would just need to have it save whether it downloaded that file name before *save the last download to .ini file* and you would avoid the infinite loop like that. Link to comment Share on other sites More sharing options...
Subz Posted March 13, 2019 Share Posted March 13, 2019 Usually its better to use software deployment using SCCM although it maybe overkill for your organisation. In which case I would recommend PDQ Deploy - https://www.pdq.com/pdq-deploy/ we use both SCCM and PDQ Deploy for third-party patching and forcing installations like anti-virus etc... as the machines come online. Just my 2cents. AdamUL and Earthshine 1 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now