def set_computer_name(name):
    '''
    Set the Windows computer name

    :param str name:
        The new name to give the computer. Requires a reboot to take effect.

    :return:
        Returns a dictionary containing the old and new names if successful.
        False if not.

    CLI Example:

    .. code-block:: bash

        salt 'minion-id' system.set_computer_name 'DavesComputer'
    '''
    if name:
        name = name.decode('utf-8')

    if windll.kernel32.SetComputerNameExW(win32con.ComputerNamePhysicalDnsHostname,
                                          name):
        ret = {'Computer Name': {'Current': get_computer_name()}}
        pending = get_pending_computer_name()
        if pending not in (None, False):
            if pending == name.upper():
                ret['Computer Name']['Pending'] = name
            else:
                ret['Computer Name']['Pending'] = pending
        return ret
    return False
dataset/ETHPy150Open saltstack/salt/salt/modules/win_system.py/set_computer_name/original