.: Windows Application Deployment - Outlook Setup File
|
|
| |
Create Outlook Setup File
The Outlook Setup File is an executable file that holds the username and passwords of user accounts that have local admin rights on the client PC. A normal batch file can be used but this leaves the local admin credentials open to anyone that knows how to edit the batch file. DO NOT name the file "Setup.exe" or "Install.exe" as this causes the "RunAs" window to open when the program is run under a non-admin user account.
If you want to use a batch file then you should use the following script: |
|
@ECHO off
If EXIST "C:\Program Files\Microsoft Office\Office11\Outlook.exe" Goto ApplyPRF
REM First Username Password Combination --------------------------------------------------------------------------
"%Temp%\Outlook\CPAU.exe -u UserName -p Password -ex "%Temp%\Outlook\SetupOLK.exe /qb+ TRANSFORMS=%Temp%\Outlook\OutlookMSTDesktop.MST" -profile -wait -hide -cwd C:"
If EXIST "C:\Program Files\Microsoft Office\Office11\Outlook.exe" Goto ApplyPRF
REM Second Username Password Combination --------------------------------------------------------------------------
"%Temp%\Outlook\CPAU.exe -u UserName1 -p Password1 -ex "%Temp%\Outlook\SetupOLK.exe /qb+ TRANSFORMS=%Temp%\Outlook\OutlookMSTDesktop.MST" -profile -wait -hide -cwd C:"
If EXIST "C:\Program Files\Microsoft Office\Office11\Outlook.exe" Goto ApplyPRF
REM Third Username Password Combination --------------------------------------------------------------------------
"%Temp%\Outlook\CPAU.exe -u UserName2 -p Password2 -ex "%Temp%\Outlook\SetupOLK.exe /qb+ TRANSFORMS=%Temp%\Outlook\OutlookMSTDesktop.MST" -profile -wait -hide -cwd C:"
:ApplyPRF
"%temp%\ApplyPRF.bat"
"%temp%\Cleanup.bat"
Exit
The above code first checks for the existence of the Outlook exe and if found apply's the configured PRF file using ApplyPRF.bat and then performs the cleanup operation with CleanUp.bat. Outlook starts and is configured and the install exits. If the Outlook exe is not found then it attempts to run the installation. Each combination of username and password must have its own code-block as below:
If EXIST "C:\Program Files\Microsoft Office\Office11\Outlook.exe" Goto ApplyPRF
REM Second Username Password Combination --------------------------------------------------------------------------
"%Temp%\Outlook\CPAU.exe -u UserName1 -p Password1 -ex "%Temp%\Outlook\SetupOLK.exe /qb+ TRANSFORMS=%Temp%\Outlook\OutlookMSTDesktop.MST" -profile -wait -hide -cwd C:"
This uses CPAU to launch the Outlook MSI under the given credentials, configure with the MST file and wait until the process completes. If the username and password combination does not match a known user account then an error is returned and the process moves on to the next code block. Remember to change the MST file name to match the one used, either OutlookMSTDesktop.MST or OutlookMSTlaptop.MST, also remember to enter the correct username and password.
If you do not want to use a batch file to launch the installation but wish to hide the user credentials in an exe file then there is a number of ways to do this:
You can buy one of the many bach file compilers that are available on the net or you can use the CPAU encrypt job file function to encrypt the credentials, i never used this so i dont know how to do it or if it is any good, but feel free to give it a shot. If you want to do it the way i did then you can use Microsoft Visual C++ to build the exe. Microsoft offers a free version of Visual C++ Express Edition which you can use to create the executable. Once downloaded start a new project and use the following code:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <fstream.h>
#include <cstdlib>
int main(void)
{
ifstream X;
X.open ("C:\\Program Files\\Microsoft Office\\Office11\\Outlook.exe");
if (X)
{
system("\"%temp%\\ApplyPRF.bat\"");
system("\"%temp%\\Cleanup.bat\"");
exit(0);
}
system("@ECHO off");
system("%Temp%\\Outlook\\CPAU.exe -u username -p password -ex \"%Temp%\\Outlook\\SetupOLK.exe /qb+ TRANSFORMS=%Temp%\\Outlook\\OutlookMSTDesktop.MST\" -profile -wait -hide -cwd C:\\");
system("Exit");
ifstream X1;
X1.open ("C:\\Program Files\\Microsoft Office\\Office11\\Outlook.exe");
if (X1)
{
system("\"%temp%\\ApplyPRF.bat\"");
system("\"%temp%\\Cleanup.bat\"");
exit(0);
}
system("@ECHO off");
system("%Temp%\\Outlook\\CPAU.exe -u username1 -p password1 -ex \"%Temp%\\Outlook\\SetupOLK.exe /qb+ TRANSFORMS=%Temp%\\Outlook\\OutlookMSTDesktop.MST\" -profile -wait -hide -cwd C:\\");
system("Exit");
ifstream X8;
X8.open ("C:\\Program Files\\Microsoft Office\\Office11\\Outlook.exe");
if (X8)
{
system("\"%temp%\\Cleanup.bat\"");
exit(0);
}
return 0;
}
Here as in the batch file a check is made for the outlook exe and if found the PRF file is applied. If the file is not found then the installation is initiated. Again, remember to change the name of the MST file for either a desktop or laptop and enter the correct credentials, each username/password combination will need another code-block as shown below:
ifstream X1;
X1.open ("C:\\Program Files\\Microsoft Office\\Office11\\Outlook.exe");
if (X1)
{
system("\"%temp%\\ApplyPRF.bat\"");
system("\"%temp%\\Cleanup.bat\"");
exit(0);
}
system("@ECHO off");
system("%Temp%\\Outlook\\CPAU.exe -u username1 -p password1 -ex \"%Temp%\\Outlook\\SetupOLK.exe /qb+ TRANSFORMS=%Temp%\\Outlook\\OutlookMSTDesktop.MST\" -profile -wait -hide -cwd C:\\");
system("Exit");
Once complete build the exe and add it to the folder with the other outlook installation files. Name the folder Outlook and return to either the Outlook CD page, or the Outlook Server Deployment page.
Web site contents © Copyright Alan Phipps 2006, All rights reserved.
Website templates
|