Skip to main content

August 24, 2026

Command Line Operations

You can use the command line to run the Windows OS Optimization Tool for Omnissa Horizon.

You specify parameters to control the behavior. Run a CMD prompt as an Administrator.

The main options available through the command line are given below. Each main task has additional command line options and detail described in the sections below.

To run the command, you use the Windows OS Optimization Tool's EXE file, the one you downloaded as described in Obtaining the Omnissa Windows OS Optimization Tool for Horizon.

Run the command prompt as administrator and use the appropriate options.

Main options

Here, we use the string optimization-tool.exe to represent that downloaded EXE file. When you run the commands on your system, replace that string with the actual name that you have for that EXE.

Important: For readibility, the options here have been listed on separate lines. However, when you run the command, the command line should not contain line breaks and should be entered as a single command.

optimization-tool.exe [-h]

optimization-tool.exe [-v]

optimization-tool.exe [-optimize|-o]

optimization-tool.exe [-generalize|-g]

optimization-tool.exe [-finalize|-f]

optimization-tool.exe [-reboot|-shutdown]

where

ParameterDescription
-hDisplays command line help.
-vEnables verbose mode and displays detailed messages.
-optimize|-oOptimizes the image. For information on optimization parameters to use with the -optimize option, see this page's Optimize command-line parameters section.
-generalize|-gGeneralizes Windows by running sysprep.
-finalize|-fPerforms cleanup tasks and clears up the specified information.
-rebootRestarts the computer after all operations have completed.
-shutdownShuts down the computer after all operations have completed.

Optimize command-line operation

You can use the command line parameters in the following table when optimizing an image using the command line.

Important: Before running the command, ensure that you are running on one of the supported Windows operating system versions and not trying to run on an incompatible Windows version.

[-r report_file_path_name]

[-o [no-item | all-item]]

[-applyoptimization settings_file.json]

[-t template]

[-reboot | -shutdown]

where

ParameterDescription
[-r report_file_path_name]Saves the analysis report as a file with the specified name.
[-o [no-item | all-item]]Optimizes items with the specified level and above. If the -o parameter is not specified, there is no optimization performed. -o all-item runs all items in the default or chosen template. -o no-item clears all template item selections. If no value is provided after -o, the tool uses the default template selections.
[-applyoptimization settings_file.json]Applies optimization based on the specified JSON file. The JSON file is created using the tool's Optimize tab's Export Selections button. Follow the steps in Optimize Image.
[-t template]Specifies the template to be used for optimization. The template can be the name of a template in the default template repository or the absolute path of a template file. For example, -t "Omnissa Templates\Windows 10, 11 and Server 2019, 2022"
If this -t parameter is not specified, the default template is used.
[-reboot | -shutdown]Reboots or shuts down the computer after all operations have completed.

Optimize Examples

  • Generate an analysis report without performing any optimization

    optimization-tool.exe -r c:\reports\

  • Optimize image using the default template and default selected items to optimize

    optimization-tool.exe -o

  • Optimize using the default template for only recommended and mandatory items. Show verbose messages.

    optimization-tool.exe -o recommended -v

  • Optimize by importing the optimization selections from a JSON file containing previously selected items

    optimization-tool.exe -o -v -applyoptimization my-settings.json

  • Optimize all default selected items, using a specified Omnissa template.

    optimization-tool.exe -o -t "Omnissa Templates\Windows 10, 11 and Server 2022, 2025"

  • Optimize all default selected items, using a specified custom template.

    optimization-tool.exe -o -t "My Templates\My Windows Server 2022"

  • Optimize all default selected items using the specified template, where the template is located in folder templates

    optimization-tool.exe -o -t templates

  • Optimize all default selected items using the specified template file

    optimization-tool.exe -o -t c:\temp\myTmpl.xml

  • Optimize using the default template and items selected by default. Write output to a file

    optimization-tool.exe o -v > c:\temp\mylog.txt 2>&1

Controlling Optimization Common Options

You can specify common options while running the optimize command. (For the UI comparables, refer to the Optimize Image page's Configure the Common Options settings.)

optimization-tool.exe -o

[-SyncHkcuToHku [enable | disable]]

[-visualeffect [performance | balanced | quality | enablehardwareacceleration]]

[-notification [enable | disable]]

[-windowsupdate [enable | disable]]

[-officeupdate [enable | disable]]

[-windowsSearch [enablecortana | searchboxasicon | searchboxasinputbox]]

[-storeapp [keep-all | remove-all [--exclude [Alarms | ScreenSketch | Camera | SoundRecorder | Calculator | StickyNotes | Paint3D | Photos | WebExtension | MSTeams]]]

[-background [#000000 | enablecustomization | disablecustomization]]

[-firewall [enable | disable]]

[-antivirus [enable | disable]]

[-securitycenter [enable | disable]]

[-Smartscreen [enable | disable]]

[-HVCI [enable | disable]

[-OneDrive [enable | disable]]

where

AreaParameterDescription
SyncHkcuToHku[-SyncHkcuToHku [enable | disable]]Specifies whether to enable or disable synchronizing the HKU (Current User) registry keys to the default user registry hive. The default user registry is used to create new user profiles. This parameter is enabled by default.
Visual effect[-visualeffect [performance | balanced | quality | enablehardwareacceleration | disablehardwareacceleration]]Specifies the visual effects level.
  • performance turns off all visual effects settings to prioritize performance.
  • balanced turns off all visual effects settings apart from the Windows settings Smooth edges of font screens and Use drop shadows for icon labels on the desktop.
  • quality leaves all visual effects settings turned on. This prioritizes the user experience but consumes more resources.
  • enablehardwareacceleration enables hardware acceleration for applications. This setting is recommended when using GPU cards in host server VMs.
  • disablehardwareacceleration disables hardware acceleration for applications. Use this when GPU acceleration is not available, not required, or causing compatibility or display issues.

Example: Optimize using the default template with the default selected items and setting the common options of visual effect to performance.
OmnissaHorizonOSOptimizationTool.exe -o -visualeffect performance
Notification[-notification [enable | disable]]Specifies whether system notifications are enabled or disabled. These include balloon tips, lock screen notification, and security and maintenance notifications.
Example: Optimize using the default template with the default selected items and disabling system notifications.
OmnissaHorizonOSOptimizationTool.exe -o -notification disable
Windows Update[-windowsupdate [enable | disable]]Specifies whether Windows Update is enabled or disabled. When enabled, Windows updates will be downloaded and installed.
With non-persistent desktops, it is highly recommended to disable Windows updates and handle updates through the golden image and updating the pool in Horizon.
Example: Optimize using the default template with the default selected items but leaving Windows Updates enabled.
OmnissaHorizonOSOptimizationTool.exe -o -windowsupdate enable
Office Update[-officeupdate [enable | disable]]Specifies whether to activate update service for Office 365, 2016 and 2019 (Click-to-Run).
Windows search[-windowsSearch [enablecortana | searchboxasicon]]Specifies whether to enable Cortana and change the taskbar entry for Cortana to a magnifying glass.
  • enablecortana keeps Cortana and its search function available.
  • Searchboxasicon shows the search box as a magnifying glass icon on the taskbar and not an input field.

Example: Optimize using the default template with the default selected items but leaving Cortana enabled and show the search box as a magnifying glass icon on the Windows task bar.
OmnissaHorizonOSOptimizationTool.exe -o -windowssearch enablecortana searchboxasicon
Store Apps[-storeapp [keep-all | remove-all [--exclude [Alarms | ScreenSketch | Camera | SoundRecorder | Calculator | StickyNotes | Paint3D | Photos | WebExtension | MSTeams]]]Specifies the Windows store applications to be removed.
  • keep-all retains all Windows store applications.
  • remove-all removes all Windows store applications.
  • --exclude is used in conjunction with the remove-all parameter to retain certain applications.

Example: Optimize using the default template with the default selected items and removing all of the Windows Store Apps except for the alarms and calculator apps.
OmnissaHorizonOSOptimizationTool.exe -o -storeapp remove-all --exclude alarms calculator
Background[-background [#000000 | enablecustomization | disablecustomization]]Sets the background (wallpaper) to a solid color where #000000 is the hex value of the color. See https://htmlcolorcodes.com/color-names/ for a list of possible colors and corresponding hex values.
enablecustomization allows background customization.
disablecustomization prevents background customization.
Example: Optimize using the default template with the default selected items and set the background to sky blue. OmnissaHorizonOSOptimizationTool.exe -o -background #87CEEB
Example: Optimize using the default template with the default selected items and set the background to sky blue.
OmnissaHorizonOSOptimizationTool.exe -o -background #87CEEB
Firewall[-firewall [enable | disable]]Specifies whether to enable the Windows firewall. This setting is enabled by default.
Antivirus [-antivirus [enable | disable]]Specifies whether to enable the OS built-in antivirus. This setting is enabled by default.
Security center[-securitycenter [enable | disable]]Specifies whether to enable the Security Center. This setting is enabled by default.
SmartScreen[-smartscreen [enable | disable]]Specifies whether to enable Windows SmartScreen. This setting is disabled by default.
HVCI[-hvci [enable | disable]]Specifies whether to enable Hypervisor-Protected Code Integrity (HVCI). This setting is disabled by default.
OneDrive[-onedrive [enable | disable]]Specifies whether to enable OneDrive. This setting is enabled by default.

Generalize command-line operation

Generalizing the Windows image removes computer-specific information so that the image can be safely cloned and deployed throughout the enterprise. This performs a Sysprep using the provided unattend answer file.

OmnissaHorizonOSOptimizationTool.exe -g \[answerfile\] \[-reboot | -shutdown\]

Where:

  • answerfile- The Sysprep answer file. If none is provided, the built-in sysprep answer file is used.

Notes:

  • The generalize operation requires Windows in audit mode.
  • Windows will need to reboot after finishing the generalize operation.
  • A generalize operation can be carried out at the same time as an optimize operation.
  • A generalize operation cannot be carried out at the same time as a finalize operation.

Examples

Generalize using a supplied Sysprep unattend answer file: OmnissaHorizonOSOptimizationTool.exe -g "C:\\unattend.xml"

Generalize using the built-in Sysprep unattend answer file: OmnissaHorizonOSOptimizationTool.exe -generalize

Generalize using the built-in Sysprep unattend answer file and reboot when complete: OmnissaHorizonOSOptimizationTool.exe -generalize -reboot

Finalize command-line operation

Finalizing the VM performs tasks to clean up the system and clear information. These tasks are generally recommended to be run as the last step before shutting down to use the prepared golden image in Horizon. These should also be used after a revision to the Windows image with application installations or updates, or after a Windows update process.

OmnissaHorizonOSOptimizationTool.exe -f \[all |0 |1 |2 |3 |4 |5 |6 |7 |8 |9 |10 |11\] \[-reboot | -shutdown\]

Where:

  • all - Runs all of the tasks below.
  • 0 - Native Image Generator (NGEN). Optimizes the .NET Framework. Should be run after an update of .NET Framework.
  • 1 - Side-by-Side Component Cleanup (DISM). Reduces the size of the WinSxS folder by uninstalling and deleting packages with components that have been replaced by other components with newer versions. Should be run after a Windows update.
  • 2 - Compact. Enables CompactOS to compress specific Windows system files to free up space. Can take several minutes to execute.
  • 3 - Disk Cleanup. Deletes temporary and unnecessary files.
  • 4 - Clears system event logs.
  • 5 - Disables Superfetch service.
  • 6 - Clears default user profile.
  • 7 - Zero empty disk space (to enable this option, copy SDelete64.exe into the Windows\System32 or the current user directory).
  • 8 - Creates local group policies (to enable this option, copy LGPO.exe into the Windows\System32 or the current user directory).
  • 9 - Clears KMS Settings.
  • 10 - Flushes DNS cache.
  • 11 - Releases IP Address.

Examples

Finalize, running all the tasks: OmnissaHorizonOSOptimizationTool.exe -f all

Finalize, running NGEN to optimize .NET Framework and DISM to do a side-by-side component cleanup: OmnissaHorizonOSOptimizationTool.exe -f 0 1

Combining command-line parameters

You can combine the various optimize, common options, and either the generalize or finalize parameters together into a single command.

Please note: You cannot combine a generalize operation and a finalize operation into a single command, because a reboot is required after a generalize operation.

The following example optimizes (applying the default selected items) and:

  • Disables system notifications.
  • Removes all the Windows Store Apps apart from the Photos application.
  • Runs the generalize operation using a provided Sysprep answer file.

OmnissaHorizonOSOptimizationTool.exe -o -v -notification disable -windowsupdate enable -storeapp remove-all --exclude photos -g c:\\unattend.xml

The following example optimizes (applying the recommended items) and:

  • Disables system notifications.
  • Sets Visual Effects to performance.
  • Leaves Windows Update enabled.
  • Removes all of the Windows Store Apps apart from the Paint3D and calculator applications.
  • Sets the background to light sea green.
  • Runs all the finalize tasks.

OmnissaHorizonOSOptimizationTool.exe -o recommended -v -notification disable -visualeffect performance -windowsupdate enable -storeapp remove-all --exclude paint3d calculator -background #20B2AA -f all

Was this page helpful?

Provide feedback for this topic

Was this topic helpful?

Please do not include any personal or confidential information.

Generating link…