salt.states.win_license#

Install and manage software licenses using Windows Software Licensing Service#

Manage product licenses (Windows OS, Office, etc.) using the Software Licensing Service.

activate_windows:
  license.activate:
    - product_key: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

ensure_office_licensed:
  license.present:
    - product_key: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    - activate_key: True

remove_office_key:
  license.absent:
    - product_key: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
salt.states.win_license.absent(name, product_key='', all_keys=False)#

Ensure that a product key is uninstalled.

Parameters:
  • name (str) -- Descriptive state ID.

  • product_key (str) -- The product key to remove. If not specified, defaults to name for backwards compatibility. Ignored if all_keys=True.

  • all_keys (bool) -- If True, remove all product keys (default: False).

Returns:

A standard Salt state return dict with name, result,

changes, and comment keys.

Return type:

dict

CLI Example:

remove_office_key:
  license.absent:
    - product_key: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

remove_all_licenses:
  license.absent:
    - all_keys: True
salt.states.win_license.absent_kms(name, host=False, port=False, product_key='')#

Ensure KMS host and/or port are removed.

Parameters:
  • name (str) -- Descriptive state ID.

  • host (bool) -- Remove KMS host (default: False).

  • port (bool) -- Remove KMS port (default: False).

  • product_key (str) -- Optional product key to scope operations to. If not specified, modifies global KMS settings.

Returns:

A standard Salt state return dict with name, result,

changes, and comment keys.

Return type:

dict

CLI Example:

clear_global_kms_host:
  license.absent_kms:
    - host: True

clear_kms_port_for_office:
  license.absent_kms:
    - product_key: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    - port: True
salt.states.win_license.activate(name, product_key='')#

Install and activate a product key.

Parameters:
  • name (str) -- Descriptive state ID.

  • product_key (str) -- The product key to install and activate. If not specified, defaults to name for backwards compatibility.

Returns:

A standard Salt state return dict with name, result,

changes, and comment keys.

Return type:

dict

CLI Example:

activate_windows:
  license.activate:
    - product_key: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

XXXXX-XXXXX-XXXXX-XXXXX-XXXXX:
  license.activate
salt.states.win_license.present(name, product_key='', kms_host='', kms_port=0, activate_key=False)#

Ensure that a product key is installed with optional KMS and activation.

Parameters:
  • name (str) -- Descriptive state ID.

  • product_key (str) -- The product key to install. If not specified, defaults to name for backwards compatibility.

  • kms_host (str) -- Optional KMS host name or IP address.

  • kms_port (int) -- Optional KMS port number.

  • activate_key (bool) -- Whether to activate the product key (default: False).

Returns:

A standard Salt state return dict with name, result,

changes, and comment keys.

Return type:

dict

CLI Example:

install_office_key:
  license.present:
    - product_key: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    - kms_host: kms.example.com
    - kms_port: 1688
    - activate_key: True
salt.states.win_license.present_kms(name, kms_host, kms_port=0, product_key='')#

Ensure KMS host and port are configured.

Parameters:
  • name (str) -- Descriptive state ID.

  • kms_host (str) -- The KMS host name or IP address.

  • kms_port (int) -- Optional KMS port number. If not specified, leaves the port unchanged.

  • product_key (str) -- Optional product key to configure KMS for. If not specified, configures global KMS settings.

Returns:

A standard Salt state return dict with name, result,

changes, and comment keys.

Return type:

dict

CLI Example:

configure_kms_globally:
  license.present_kms:
    - kms_host: kms.example.com
    - kms_port: 1688

configure_kms_for_office:
  license.present_kms:
    - kms_host: kms.example.com
    - kms_port: 1688
    - product_key: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX