Removing Applications or Features After Installation
Removing Microsoft Office XP applications, features, files, or registry settings after they are installed requires special tools provided as part of the Office XP Resource Kit. You can complete the task of removing an Office application or related files by using any of the following tools:
- Profile Wizard
While it is not advised to use the Office Profile Wizard to remove an application, it can be used to remove files, folders, and registry settings. It works well removing small support files like templates, ActiveX® controls, batch files, utilities, and registry settings by placing instructions in the …ResetToDefaults sections of the INI file used to capture settings.
Using the Custom Maintenance Wizard to remove applications or features
The Custom Maintenance Wizard allows you to remove an Office application or feature by setting its installation state to Not Available or Not Available, Hidden, Locked. Using Not Available, Hidden, Locked provides an advantage over simply removing an application with the Removal Wizard: it ensures that a user cannot install the application at a later date.
For directions on how to set and change installation states for Office applications and features, see the Help for the Set Feature Installation States page of the Custom Maintenance Wizard.
Setting applications or features to Not Available
Setting an application or feature to Not Available with the Custom Maintenance Wizard removes the application from the user's computer. When Not Available is used, a user can still install the feature by starting the Add/Remove Programs utility from Control Panel and selecting Add/Remove… to add the application. Windows Installer then installs the application from the administrative installation point. The user has the option of changing the installation state of the application to Run from My Computer.
Setting applications or features to Not Available, Hidden, Locked
Setting an application or feature to Not Available, Hidden, Locked with the Custom Maintenance Wizard removes the application from the user's computer. The user cannot defeat this installation state by running Add/Remove Program in Control Panel. The only way to change this installation state is by using the Custom Maintenance Wizard.
Using the Removal Wizard to remove applications
The Removal Wizard is one of the easiest wizards to use in the Office Resource Kit. It allows you to select different modes of removal and how aggressively it will perform a removal of older versions of Office applications. The following subjects are included in this section:
- Overview of the Removal Wizard
- Removal Wizard command-line options
- Components of the Removal Wizard
- Customizing the Oclncust.opc and
Oclncore.opc files
- Running the Removal Wizard from a user's computer
Overview of the Removal Wizard
If you use the Removal Wizard without supplying any command-line options, the Removal Options page of the wizard presents three options:
- Let me decide which Microsoft Office applications will be removed.
This option allows you to choose which applications to remove by displaying the Applications You Can Remove page. This page has two list boxes. The Applications to Keep list box on the right displays the applications you can delete. By moving them to the Applications to Remove list box, you instruct the Removal Wizard to remove them from your computer.
Administrators have the extra options of using the Removal Wizard to:
Note The Removal Wizard needs administrator permissions to run under Microsoft Windows NT 4.0 or Microsoft Windows 2000.
You can run the Removal Wizard in one of three modes, depending on the degree to which you want to clean up a user's hard disk:
- Aggressive
If selected, the Removal Wizard removes all instances of existing Office applications from the computer, plus common and shared files and applications. From the command line, use the /a option, or select the Completely remove all my previous versions of Microsoft Office applications option from the Removal Options page of the wizard.
- Safe
If selected, the Removal Wizard only removes the necessary Office applications and files necessary to provide a clean install environment for Office XP. From the command line, use the /s option, or select the Remove only the files that I absolutely do not need option from the Removal Options page of the wizard.
Caution Running the Removal Wizard using the /a (aggressive mode) command-line option removes all instances of Office applications. If you plan on deploying Office in stages, you should modify the OPC files accordingly.
Removal Wizard command-line options
By using command-line options, you can set:
- The mode in which the Removal Wizard runs
- The OPC file it uses
- The log file it creates
- Whether to display the user interface
To run the Removal Wizard with command-line options, click Run on the Start menu, and then type Offcln.exe followed by the command-line options you want to use.
The Removal Wizard uses the following command-line options syntax:
Offcln.exe [/a | /s [/q [/r]] [/l[!][logfile]]] [directory]
/a Aggressive mode; the Removal Wizard removes files associated with all previously installed versions of Office and Office-related applications. This option does not allow you to select which files to keep. You must use a customized OPC file if you want the wizard to remove only selected files.
/s Safe mode; the Removal Wizard removes only those files marked as SAFE in the command section of the OPC file. This option does not allow you to select which files to keep. You must use a customized OPC file if you want the wizard to only remove specific files.
/q Quiet mode; the Removal Wizard runs without prompting the user for information or displaying progress indicators. The wizard does not reboot the user's computer automatically; therefore, changes might not be completed until the user reboots the computer.
/r Used together with the /q option, reboots the computer automatically if necessary. The user has no opportunity to save files before the computer reboots.
/llogfile Creates a log with the file name logfile. If no log file name is specified, the Removal Wizard creates a default log file, Offcln.log, in the current folder of the wizard.
/l!logfile Creates a log file in the same manner as /l, but the Removal Wizard does not perform the removal process. This option is useful for testing the Removal Wizard before running.
For example, the following command-line string runs the Removal Wizard in aggressive mode without user intervention, restarts the system automatically if needed, and creates a default log file:
Offcln.exe /a /q /r /l
directory Instructs the Removal Wizard where to look for the Oclncore.opc. The requirement is for Oclncore.opc and Oclncust.opc to be in the same directory. Any LCID subdirectories (for example 1033 for English) found below the directory where these two files are found and the current language of the user interface with that LCID language is also found on the computer, the Removal Wizard will run the Oclnintl.opc found in the folder with the same LCID number.
The Removal Wizard uses a new method for loading and evaluating OPC files. In prior releases it would only open one OPC file. Now, it automatically opens three different OPC files. It loads the following OPC files in the following order:
- Oclncore.opc
- Oclncust.opc
- Oclnintl.opc
The Removal Wizard looks for the first two files in the same directory from which the Offcln.exe is run. It then looks for any LCID subdirectories for instances of an Oclnintl.opc for the language in which the Office Resource Kit was provided.
Note The Removal Wizard provides a return code to indicate whether the wizard encountered any errors. If you use the Removal Wizard in a batch file, you can use this with conditional statements to provide branching to alternate actions in case you want a specific activity to occur if an error is encountered. The wizard returns 0 to indicate an error occurred or 1 to indicate no errors were encountered (success).
Components of the Removal Wizard
The Removal Wizard consists of several files, including templates and executable files.
OPC templates
The Removal Wizard includes the following template files:
- Oclncore.opc
This template file is used by the Offcln.exe (Removal Wizard). It identifies files, registry settings, and shortcuts to remove from a target computer. This OPC file specifies the core resources of Office for removal. The Removal Wizard searches for this file first.
You can customize this OPC file so only the files or registry settings you specify are removed. However, it is recommended that additions to an OPC file should be made in the Oclncust.opc. You should only comment out entries in the Oclncore.opc file by adding a semicolon to a line to ignore entries in the file, removing a semicolon to activate an instruction, or change the setting of the dependency variable to either KEEP, DETECT, or REMOVE.
- Oclncust.opc
This template file contains removal information for non-typical installations. It is provided for administrators who need to customize their removal processes. Any customizations an administrator may need to make to a removal process should be made in this file. Almost all the necessary files an administrator may optionally remove are provided in this OPC file. An administrator only needs to uncomment them to force the removal of the file or registry entry. Optionally, you can add sections to this file, comment instructions, or add instructions as needed.
- Oclnintl.opc
This template file is stored in the LCID subfolder of the Office Resource Kit install folder (for English, look in the 1033 folder). This special file contains a listing of those files and registry settings unique to a localized language. It is not advised to make any changes to this file. The English version of this file has no sections or instructions.
Executables
The Removal Wizard includes the following executable files:
- Oclean.dll — Dynamic Link Library file
containing the core code for the Office Removal Wizard.
- Offcln.exe — Provides the user interface for running the wizard as a stand-alone utility.
Customizing the Oclncore.opc and Oclncust.opc files
The Oclncore.opc and Oclncust.opc files can be edited to specify which components the Removal Wizard will remove from a user's computer, including non-Office applications. Before editing these files, it is beneficial to understand the contents and structure of OPC files.
An OPC file is divided into two unmarked sections, definitions and commands. The definitions section is for dependency variables (defining variables also known as application tokens), which are used to point to groupings of files, registry settings, and INI file entries defined in the commands section. The commands section contains a reference to the dependency variable that instructs how those groupings are removed.
When the Removal Wizard runs, it reads the OPC file and, depending on the mode it runs in, performs the instructions it finds within the file.
The dependency variables are set only in the definitions section of the Oclncore.opc file. The Oclncust.opc has optional customization commands you can activate by removing comments.
Unlike the Office 2000 release of the Removal Wizard, the Office XP release uses three OPC files instead of one. These three files are read in the following order: Oclncore.opc, Oclncust.opc, and Oclnintl.opc. The files are cumulative. As each file is read, the dependency variables defined in the Oclncore.opc apply to all the subsequent OPC files read by the Removal Wizard.
Definitions section
The definitions section contains a declaration of a token known as a dependency variable (appears in capital letters) with a specific action it can have: KEEP, DETECT, or REMOVE.
Note Do not attempt to add new dependency variables; they will not be recognized or used. Only the existing dependency variables listed in the Oclncore.opc are recognized by the Removal Wizard.
Example: WORD94=DETECT
Syntax: Dependency variable=action
Where action can be:
- KEEP — Synonyms are FALSE and EXIST.
- DETECT — Changes to KEEP or REMOVE,
depending on whether the Removal Wizard is in aggressive or safe
mode.
- REMOVE — Synonyms are TRUE and NOTEXIST
Commands section
The commands section contains a reference to the dependency variable that instructs how files, registry entries, shortcuts, menu items, shared dynamic-link library files (DLLs), and INI file entries are removed. The syntax of this section consists of SAFE or RISKY, followed by listed dependency variables listed in the definitions section.
An optional string can be added to the right of the [ ] block to define what the section is associated with. In the case of a custom application, no dependency variable exists in the definitions section and therefore is not required.
SAFE instructs the Removal Wizard to remove the listed contents whenever the Removal Wizard is run, and the dependency variable in the definitions section is set to either DETECT or REMOVE.
RISKY instructs the Removal Wizard to only remove the listed contents when the wizard is set to use aggressive mode and the dependency variable is set to either DETECT or REMOVE. When not run in aggressive mode and the dependency variable is set to DETECT, the contents of the section are not removed.
If a dependency variable is used in a command grouping and is set to KEEP, any instance within the commands section where the token is found is not executed, thereby KEEPing the application, feature, or utility associated with this token, regardless of whether the SAFE or RISKY instruction is found at the beginning of the section.
If the token is set to DETECT, the mode in which the Removal Wizard is running determines whether or not the commands found later in the OPC are executed. Modes are:
- Aggressive mode, where all applications
(whether marked as RISKY or SAFE on their command section) are
removed.
- Safe mode, where only command sections marked as SAFE are removed.
Customizing this file consists of any of the following actions:
- Setting a dependency variable to KEEP,
DETECT, or REMOVE.
- Adding a comment instruction to a line
using a semicolon at the beginning of the line.
- Removing a comment instruction from a line
to activate it.
- Adding an instruction to a section to
remove a file, registry entry, or INI file entry.
- Creating a new command section.
Creating a new command section takes the form of the following example:
[SAFE]
<registry entries to remove>
<files to remove>
<INI file entries to remove>
<shortcuts to remove>
<special actions>
<shared dll files to remove>
<menu items to remove>
For further information regarding the syntax and how to use or change an OPC file, see the OPC.doc Microsoft Word document supplied with the Office Resource Kit.
Though it is not recommended, there are instances where an administrator may need to make changes to the Oclncore.opc — specifically to the definitions section of the file where application tokens are set to either KEEP, REMOVE, or DETECT.
To modify the Oclncore.opc file
- Create a copy of Oclncore.opc, and name it
SafeCore.opc.
- Open Oclncore.opc in a text editor.
- Change any of the KEEP, REMOVE, or DETECT
settings associated with dependency variables to the configuration
you need for that application.
- Uncomment any needed dependency variables listed in the SPECIAL CLEANUP OPERATIONS area within the definitions section and set them to either KEEP, REMOVE, or DETECT as appropriate for your configuration needs.
This step may require adding a section to remove the files associated with the application if no section exists in either the Oclncore.opc or Oclncust.opc.
- Comment any instructions you do not want
to occur by adding a semicolon to the beginning of the line.
- Save and close the Oclncore.opc.
The following procedure shows how to modify the Oclncust.opc file to create a custom OPC file.
To modify the Oclncust.opc file
- Create a copy of Oclncust.opc, and name it
SafeCust.opc.
- Open Oclncust.opc in a text editor.
- Remove any leading semicolon from a line
that you want activated.
- Add any required entry to a line where a
file, registry entry, or INI file entry should be removed for that
application.
- To delete any registry, file, or INI file entry for a custom application, add lines similar to other entries.
For example:
[SAFE] "Internal charting tool"
C:\program files\internal\chart\chart.exe
C:\program files\internal\chart\chartsub.dll
C:\program files\internal\chart\chartprt.dat
C:\program files\internal\chart\readme.txt
Adding a new entry with [SAFE] instructs the wizard to remove the registry entries, files, and INI file entries listed below this section whenever the wizard is run.
Creating an entry with [RISKY] assures the registry entries, files, and INI file entries are removed only when the wizard is set to run in aggressive mode:
[RISKY] "Stuff to remove only when we're being aggressive"
HKLM\Software\Inhouse\accounting\specialaccounting\startup
HKLM\Software\Inhouse\accounting\specialaccounting\MRU1
HKLM\Software\Inhouse\accounting\specialaccounting\MRU2
HKLM\Software\Inhouse\accounting\specialaccounting\MRU3
HKLM\Software\Inhouse\accounting\specialaccounting\MRU4
C:\program files\internal\accounting\SpecialAccounting.exe
C:\program files\internal\accounting\SpecialAccounting.dll
- Save and close Oclncust.opc.
Test your customized OPC file on a computer by using the /l!logfile command-line option. This step creates a log of the files and registry entries it will delete when using your customized OPC file.
Running the Removal Wizard from a user's computer
To run your custom OPC file on a user's computer, copy Offcln.exe, Oclean.dll, Oclncust.opc, and Oclncore.opc to the administrative installation point. If you are running a localized version, copy the Oclnintl.opc to the appropriate subdirectory. The Removal Wizard evaluates the language the operating system is set to and uses the subdirectory (LCID number) of the LCID for that language posted on the administrative installation point.
To run the Removal Wizard provide a batch file or shortcut with the following command line and post to the administrative installation point, e-mail it to users, or use Systems Management Server (SMS) to enact your changes:
<path>\Offcln.exe /a /q /r
Using maintenance mode to repair features or applications
Access to maintenance mode is through the Add/Remove Programs utility of Control Panel. The Add/Remove Programs utility starts Windows Installer and, if necessary, changes the install configuration of the operating system to allow changes to registry branches and restricted folders.
When Windows Installer is in maintenance mode, and when it is set to use elevated privileges, users can make changes to their installation of Office. They have the option of opening the feature tree in Setup and changing the state of an application or feature to Installed on First Use or Not Available. Setting an application or feature to either of these two installation states removes all the files and registry settings associated with the feature or application (excluding user settings) from the computer.
Users can be restricted from running in maintenance mode by using system policy settings.
Using the Office Profile Wizard to remove files
It is possible to use the Office Profile Wizard to remove files and registry settings for a small application or utility on a user's computer, but the wizard should not be used to remove large applications. For more information on how to customize an INI file for the Profile Wizard, see Using the Office Profile Wizard. For further information about the Profile Wizard, see the Help in the Profile Wizard.
By modifying the Reset to default sections of the OPW10adm.ini file, you can remove files and registry settings. Add the path and file name plus any registry entries to remove to the appropriate sections of the file.
This is advantageous when you want to apply a user-setting customization and need to remove a small set of files or registry settings at the same time.
|