def check_for_security_updates_using_scheduled_task(api, configuration, api_version, api_exception):
    """ Creates a scheduled task that checks for security updates.
        The scheduled task runs immediately after it is created, and is deleted thereafter.

    :param api: The Deep Security API modules.
    :param configuration: Configuration object to pass to the api client.
    :param api_version: The version of the API to use.
    :param api_exception: The Deep Security API exception module.
    :return: The ID of the scheduled task.
    """


    # Set the name and task type
    check_for_security_updates = api.ScheduledTask()
    check_for_security_updates.name = "Check For Security Updates"
    check_for_security_updates.type = "check-for-security-updates"

    # Run when the scheduled task is created
    check_for_security_updates.run_now = True

    # Use a once-only recurrence
    schedule_details = api.ScheduleDetails()
    schedule_details.recurrence_type = 'none'

    # Set the recurrence count to 1 so that the task is deleted after running
    schedule_details.recurrence_count = 1
    schedule_parameters = api.OnceOnlyScheduleParameters()

    # The start time is not important because it is deleted after running
    schedule_parameters.start_time = 0
    schedule_details.once_only_schedule_parameters = schedule_parameters
    check_for_security_updates.schedule_details = schedule_details

    # Scan all computers
    computer_filter = api.ComputerFilter()
    computer_filter.type = "all-computers"

    # Create the task parameters object and add the computer filter
    task_parameters = api.CheckForSecurityUpdatesTaskParameters()
    task_parameters.computer_filter = computer_filter

    check_for_security_updates.check_for_security_updates_task_parameters = task_parameters

    # Create the scheduled task on Deep Security Manager
    scheduled_tasks_api = api.ScheduledTasksApi(api.ApiClient(configuration))
    scheduled_task = scheduled_tasks_api.create_scheduled_task(check_for_security_updates, api_version)

    return scheduled_task.id