How to automate Engine's Orphaned File Check task using API calls
This article outlines a method to automate the Orphaned File Check task using a PowerShell script in combination with the CURL command.
Command formatting guidelines:
-
Each command includes a payload section, which can be customized depending on the POST command being used.
-
Replace the UserName:AccountPassword
placeholder with the actual account name and password.
-
Substitute EMS_IP
with the IP address of the EMS server.
-
Replace Cluster_FQDN
with the fully qualified domain name of the server, as shown in the EMS server list.
A. To enable ophaned file detection and set the action to "delete":
- $payload = '
- {
- "autoDeletes":{"PRIMARY":true,"SECONDARY":true,"TERTIARY":true},
- "autoDeleteAction":1,
- "doFastCheck":true,
- "fastCheckTimeout":60000
- }'
- $url = "https://EMS_IP:9727/hbws/v4/server/Cluster_FQDN/data/FileStateMgr"
- curl.exe -k -u "UserName:AccountPassword" `
- -H "Content-Type: application/json" `
- -d $payload `
- -X POST $url
B: To run the Orphaned File task on the first Passive:
- $payload = '{
- "server":"PRIMARY"
- }'
- $url = "https://EMS_IP:9727/hbws/v4/server/Cluster_FQDN/data/orphanedfilescheck"
- curl.exe -k -u "UserName:AccountPassword" `
- -H "Content-Type: application/json" `
- -d $payload `
- -X POST $url
For example, to run an OrphanedFileCheck on the first Passive server using the NeverfailTest user account with the password Neverf@il, targeting the EMS server at 192.168.1.1 and the cluster named SqlServer.engine.lab, the code would be as follows:
- $payload = '{
- "server":"PRIMARY"
- }'
- $url = "https://192.168.1.1:9727/hbws/v4/server/SQLServer.engine.lab/data/orphanedfilescheck"
- curl.exe -k -u "NeverfailTest:Neverf@il" `
- -H "Content-Type: application/json" `
- -d $payload `
- -X POST $url
Related Articles
Engine Management Service API
Summary This knowledgebase article provides information about Engine Management Service (EMS) API: frequently used API endpoints (applicable to all supported CE versions) procedure for enabling, capturing and viewing Swagger API documentation (valid ...
How to Create a Task In Neverfail Continuity Engine
Summary This Knowledge base article provides general information about how to create Tasks in Neverfail Continuity Engine. More Information Tasks are a generalization and extension of start, stop, and monitor scripts. Task types are grouped by when ...
File Server Plugin v201.5.8 - Release Notes
Summary This Knowledgebase article provides information about this specific release of the File Server Plugin. More information File Server Plugin automatically configures protection for all of your file shares as they are created, edited, or ...
File Server Plugin v201.5.7 - Release Notes
Summary This Knowledgebase article provides information about this specific release of the File Server Plugin. More information File Server Plugin automatically configures protection for all of your file shares as they are created, edited, or ...
Check Continuity Engine Server Status
This article describes how to check server status by reviewing several indicators, including the system tray icon, the Server Details page and Applications page in EMS, and Windows services. Check Server Status Learning objectives At the end of the ...