Category : AutoIt

SCCM Toad 12 Upgrade Package with AutoIt Script

Here is an old script I wrote last year to upgrade our Toad for oracle from 11 to 12. It is certainly one of the most complex package I pushed.

When you download the original Toad for oracle package, it has several small msi packages, if you use the official batch file to install, actually it won’t work well with SCCM. most of the time SCCM only execute 3 msi files under batch script. So I have to use AuotIt to script it. Plus, for the license issue, you have to copy license.xml file to  AppData folder, and import the registry settings.

Here comes the issue, as the registry settings needs to run as local user, if you use SCCM to run as SYSTEM, the license registration won’t work. Luckily that we give every user local admin rights, so I just use the script to run as current user.

As it is an upgrade package, so I first move the Toad user data in the “11.5_uninstalled” folder, so when the Toad 12 runs for the first time, it will pick up the user settings. and this step has to finish before uninstall Toad 11, otherwise the uninstallation will delete the user setting files.

After copy user data, I use this simple “SilentUnisntall” program to uninstall any Toad in the system.

Then create the license folder to copy license file.

Run msi installers.

and the last step is to import registry settings.

; ————————————
; Toad Upgrade Package
; Rui Qiu
; 09/30/2014
; ————————————
DirMove(‘@AppDataDir&”\Quest Software\Toad for Oracle\11.5\’,’@AppDataDir&”\Quest Softwaree\Toad for Oracle\11.5_uninstalled\’)
RunWait(‘SilentUninstall.exe “Toad”‘,””,@SW_HIDE)
RunWait(‘SilentUninstall.exe “Toad for Oracle”‘,””,@SW_HIDE)
RunWait(‘SilentUninstall.exe “Quest SQL Optimizer”‘,””,@SW_HIDE)
FileCopy(“Dell SQL Optimizer 8.9.0 for Oracle.lnk”,@DesktopDir)
DirCreate(@AppDataDir&”\Quest Software”)
FileCopy(“ProductLicenses.xml”,@AppDataDir&”\Quest Software”)
DirRemove(“C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Quest Software\Toad Data Modeler”,1)
FileDelete(“C:\Users\Public\Desktop\Toad Data Modeler*.lnk”)
RunWait(‘msiexec.exe /i “Dell Toad for Oracle 12.5.msi” /q INSTALLDIR=”C:\Quest Software\Toad for Oracle 12.5\”‘,””,@SW_HIDE)
RunWait(‘msiexec.exe /i “ToadDataModeler_5.2.4.25.msi” /q’,””,@SW_HIDE)
RunWait(‘msiexec.exe /i “QuestSQLOptimizerForOracle_8_9_0_3012_32bit.msi” /q’,””,@SW_HIDE)
Run(“regedit.exe /s QuestKey.reg”)


Force Reboot AutoIt Script

Sometimes in our environment we need to force reboot some machines, here is the AutoIt script to do the job for us.

The reboot command will be first to run before user gets the notification about the reboot. So even if a user close the pop up window, the reboot still goes. and the user has two times notification. First is 30min before reboot, and second is 10min before the reboot.

 

#include <MsgBoxConstants.au3>
Run(“c:\windows\system32\Shutdown.exe -r -t 1800”)
sleep(3000)
MsgBox(262144, “System Maintenance Alert!”, “You have less than 30 minutes before the force reboot..Please save your work!!! Thank you and we appreciate your cooperation.”,1200)
Sleep(1200000)
MsgBox(262144, “System Maintenance Alert!”, “You have less than 10 minutes before the force reboot..Please save your work!!! Thank you and we appreciate your cooperation.a


Deploy Apttus in SCCM with Autoit

Autoit is a great tool in terms of sccm deployment. We can use the quiet switch “/s /v/qn” for installation, so it’s relatively simple.

But as this is a Word plugin, we want to make it effective right away, so we’d better close the Word before installation.  Before we do that, it’s a good practice to give user notification first.

 

Here is my autoit code of push Apttus to our environment:

 

#include <MsgBoxConstants.au3>

; ———————————–
; Developed by Rui Qiu
; ———————————–

; Open a message box to remind user Word will be closed
MsgBox(262144, “System Alert”, “Apttus will be installed on your system in 10min. Please save all your documents from Word and click ‘OK’ . Or we will close your Word in 10min.”)

; Give user 10 min to save documents
Sleep(600000)

; Close Word process
If ProcessExists(“WINWORD.exe”) Then
ProcessClose(“WINWORD.exe”)
EndIf

;Install Apttus
Run(“Apttus7_1.exe /s /v/qn”)