Set the domain or workgroup the computer belongs to.

    .. versionadded:: 2019.2.0

    Returns:
        bool: ``True`` if successful, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        salt 'minion-id' system.set_domain_workgroup LOCAL

def set_domain_workgroup(workgroup):
    '''
    Set the domain or workgroup the computer belongs to.

    .. versionadded:: 2019.2.0

    Returns:
        bool: ``True`` if successful, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        salt 'minion-id' system.set_domain_workgroup LOCAL
    '''
    if six.PY2:
        workgroup = _to_unicode(workgroup)

    # Initialize COM
    with salt.utils.winapi.Com():
        # Grab the first Win32_ComputerSystem object from wmi
        conn = wmi.WMI()
        comp = conn.Win32_ComputerSystem()[0]

        # Now we can join the new workgroup
        res = comp.JoinDomainOrWorkgroup(Name=workgroup.upper())

    return True if not res[0] else False