def set_hostname(hostname):
    '''
    .. versionadded:: 2016.3.0

    Set the hostname of the windows minion, requires a restart before this
    will be updated.

    :param str hostname:
        The hostname to set

    CLI Example:

    .. code-block:: bash

        salt 'minion-id' system.set_hostname newhostname
    '''
    curr_hostname = get_hostname()
    cmd = "wmic computersystem where name='{0}' call rename name='{1}'".format(curr_hostname, hostname)
    ret = __salt__['cmd.run'](cmd=cmd)

    return "successful" in ret
dataset/ETHPy150Open saltstack/salt/salt/modules/win_system.py/set_hostname/original