def set_state(profile, state, store='local'):
    '''
    Configure the firewall state.

    Args:

        profile (str):
            The firewall profile to configure. Valid options are:

            - domain
            - public
            - private

        state (str):
            The firewall state. Valid options are:

            - on
            - off
            - notconfigured

        store (str):
            The store to use. This is either the local firewall policy or the
            policy defined by local group policy. Valid options are:

            - lgpo
            - local

            Default is ``local``

    Returns:
        bool: ``True`` if successful

    Raises:
        CommandExecutionError: If an error occurs
        ValueError: If the parameters are incorrect
    '''
    # Input validation
    if profile.lower() not in ('domain', 'public', 'private'):
        raise ValueError('Incorrect profile: {0}'.format(profile))
    if state.lower() not in ('on', 'off', 'notconfigured'):
        raise ValueError('Incorrect state: {0}'.format(state))

    # Run the command
    command = 'set {0}profile state {1}'.format(profile, state)
    results = _netsh_command(command=command, store=store)

    # A successful run should return an empty list
    if results:
        raise CommandExecutionError('An error occurred: {0}'.format(results))

    return True
def set_state ( profile , state , store = 'local' ) : if profile . lower ( ) not in ( 'domain' , 'public' , 'private' ) : raise ValueError ( 'Incorrect profile: {0}' . format ( profile ) ) if state . lower ( ) not in ( 'on' , 'off' , 'notconfigured' ) : raise ValueError ( 'Incorrect state: {0}' . format ( state ) ) command = 'set {0}profile state {1}' . format ( profile , state ) results = _netsh_command ( command = command , store = store ) if results : raise CommandExecutionError ( 'An error occurred: {0}' . format ( results ) ) return True
Configure the firewall state.

    Args:

        profile (str):
            The firewall profile to configure. Valid options are:

            - domain
            - public
            - private

        state (str):
            The firewall state. Valid options are:

            - on
            - off
            - notconfigured

        store (str):
            The store to use. This is either the local firewall policy or the
            policy defined by local group policy. Valid options are:

            - lgpo
            - local

            Default is ``local``

    Returns:
        bool: ``True`` if successful

    Raises:
        CommandExecutionError: If an error occurs
        ValueError: If the parameters are incorrect