How To Turn Off Discovery Schedules or Stop Active DiscoveriesDescription<!-- div.margin{ padding: 10px 40px 40px 30px; } table.tocTable{ border: 1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); padding-top: .6em; padding-bottom: .6em; padding-left: .9em; padding-right: .6em; } table.noteTable{ border:1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); width: 100%; border-spacing:2; } table.internaltable { white-space:nowrap; text-align:left; border-width: 1px; border-collapse: collapse; font-size:14px; width: 85%; } table.internaltable th { border-width: 1px; padding: 5px; border-style: solid; border-color: rgb(245, 245, 245); background-color: rgb(245, 245, 245); } table.internaltable td { border-width: 1px; padding: 5px; border-style: solid; border-color: #E0E0E0; color: #000000; } table tr td { padding: 15px; } .title { color: #D1232B; font-weight:normal; font-size:28px; } h1{ color: #D1232B; font-weight:normal; font-size:21px; margin-bottom:-5px } h2{ color: #646464; font-weight:bold; font-size:18px; } h3{ color: #000000; font-weight:BOLD; font-size:16px; text-decoration:underline; } h4{ color: #646464; font-weight:BOLD; font-size:15px; text-decoration:; } h5{ color: #000000; font-weight:BOLD; font-size:13px; text-decoration:; } h6{ color: #000000; font-weight:BOLD; font-size:14px; text-decoration:; } hr{ border-top-width: 1px; border-top-style: solid; border-top-color: #cccccc; } ul { list-style: disc outside none; margin-left: 0; } li { padding-left: 1em; } --> Overview In some cases, it may be necessary to stop discovery from running. This KB goes over a few case scenarios and how 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 Using a list: Navigate to "Discovery > Status" (discovery_status).Search for statuses where "stateINStarting,Active" (Encoded query for state is one of Starting, Active).Select all records.Select "Cancel Discovery". Using a fix script: Navigate to "System Definition > Fix Scripts".Click New.Define the fix script.Click "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: Go to "Discovery Definition > Configuration Console".Find the device class under "Devices" and set to active = false.In the following example we turn off "Network Printer" discovery. 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: Navigate to System Clone > Clone Definition > Cleanup Scripts and click New.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 ConsoleGlideRecord - GlobalHow to programatically stop Service Mapping discovery on a Business ServicePost-clone cleanup scriptsSystem Clon