Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
How To Turn Off Discovery Schedules or Stop Active Discoveries - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • How To Turn Off Discovery Schedules or Stop Active Discoveries
KB0726258

How To Turn Off Discovery Schedules or Stop Active Discoveries


4701 Views Last updated : Jan 23, 2024 public Copy Permalink
KB Summary by Now Assist

Issue

In some cases, it may be necessary to stop discovery from running. This KB outlines some common scenarios and steps to stop discovery.

Note: Any sample script in this KB is given only as a starting point. Sample scripts should be tested first in a non production instance and modified to meet each instance's requirements if necessary.

Stop Active Discoveries

To stop active discoveries, you can use a list or a fix script. See below for steps to perform each method.

Using a list

  1. Navigate to Discovery > Status (discovery_status).
  2. Search for statuses where "stateINStarting,Active" (Encoded query for state is one of Starting, Active).
  3. Select all records.
  4. Select Cancel Discovery.

Using a fix script

  1. Navigate to System Definition > Fix Scripts.
  2. Click New.
  3. Define the fix script.
  4. Click the Run Fix Script related link. The following could be used as a sample script:
    var dac = new SncDiscoveryCancel();
    var status = new GlideRecord('discovery_status');
    status.addEncodedQuery('stateINStarting,Active');
    status.query();
    while(status.next()){
    gs.log("Fix Script: Canceling discovery_status " + status.sys_id);
    dac.cancelAll(status.sys_id);
    }

Stop Discoveries For Specific CI Types/Classes

Discovery can be stopped for certain classes after a CI is classified via the Discovery Configuration Console.

To stop a discovery after a CI has been classified:

  1. Navigate to Discovery Definition > Configuration Console.
  2. Find the device class under "Devices" and set to active = false.
  3. In the following example image, we turn off "Network Printers" discovery.

    In the Configuration Console, the Network Printers toggle is switched to inactive.

Note: Turning off all device types in the configuration console will not disable discovery. The Shazzam and Classification phases will still run. Discovery will stop once the devices are classified.

Stop Discoveries From Running on Cloned Instances

As part of the cloning process, Post-clone cleanup scripts are run on the target instance. A Post-clone cleanup script can be used to keep discovery from running on a target instance.

To create a Post-clone cleanup script:

  1. Navigate to System Clone > Clone Definition > Cleanup Scripts and click New.
  2. Populate the "Name" and "Script" fields. The following could be used as a sample script:
    var schedules = new GlideRecord('discovery_schedule')
    schedules.addQuery('active', true);
    schedules.query();
    schedules.setValue('active', false);
    schedules.updateMultiple(); 

Alternatively, use any of the previously mentioned methods to disable discovery once the cloning is complete.

Additional Information

Other relevant KB and documents:

  • Discovery Configuration Console
  • GlideRecord - Global
  • KB0680014: How to programatically stop Service Mapping discovery on a Business Service
  • Post-clone cleanup scripts
  • System Clone

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

Attachments

Attachments

  • configuration-console.png

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.