# Configuration guide: Battery replacement scheduling

## **Introduction** <a href="#configurationguide-batteryreplacementscheduling-introduction" id="configurationguide-batteryreplacementscheduling-introduction"></a>

To get started with this workflow, please ensure all related content is installed and configured appropriately. This page provides guidance on which content is included and how to configure it.

Please keep in mind this is just a guide and represents suggested configurations. You are free to customize and edit content as you see fit based on your specific environment.

## Pre-requisites <a href="#configurationguide-batteryreplacementscheduling-pre-requisites" id="configurationguide-batteryreplacementscheduling-pre-requisites"></a>

This library pack contains content from the following [expansion products](https://nexthink.gitbook.io/opd/overview/products).

* [Employee Engagement - Campaigns](https://nexthink.gitbook.io/opd/user-guide/campaigns)
* [Remote Actions](https://nexthink.gitbook.io/opd/user-guide/remote-actions)
* [Flow - Workflows](https://nexthink.gitbook.io/opd/user-guide/workflows)

## Content list and dependency <a href="#configurationguide-batteryreplacementscheduling-contentanddependency" id="configurationguide-batteryreplacementscheduling-contentanddependency"></a>

| Type                                                                        | Name                           | Description                                                                                                                                                                                                                                                                               |
| --------------------------------------------------------------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Workflows](https://nexthink.gitbook.io/opd/user-guide/workflows)           | Battery replacement scheduling | Automate the end-to-end battery replacement process.                                                                                                                                                                                                                                      |
| [Campaigns](https://nexthink.gitbook.io/opd/user-guide/campaigns)           | Battery replacement advisory   | The campaign informs the user that their battery is due for replacement and ask for their permission to log an ITSM ticket to have it replaced                                                                                                                                            |
| [Remote Actions](https://nexthink.gitbook.io/opd/user-guide/remote-actions) | Get Battery Status             | Returns the health status of the battery installed on the laptop, in terms of capacity that it can still hold. It also retrieves for Windows devices the currently active power plan. Useful for identifying the batteries to be replaced and optimize the power settings of the devices. |
|                                                                             | Get Warranty Information       | Retrieves warranty information of Dell, HP, and Lenovo devices, via REST APIs. The warranty data obtained can be also related to the laptop batteries for Dell and Lenovo devices.                                                                                                        |

## Configuration <a href="#configurationguide-batteryreplacementscheduling-configuration" id="configurationguide-batteryreplacementscheduling-configuration"></a>

### Step 1) Install library pack content <a href="#configurationguide-batteryreplacementscheduling-step1-installlibrarypackcontent" id="configurationguide-batteryreplacementscheduling-step1-installlibrarypackcontent"></a>

Go to the [Nexthink Library](https://nexthink.gitbook.io/opd/user-guide/nexthink-library) and install all required content.

### Step 2) Configure ITSM API connector credentials <a href="#configurationguide-batteryreplacementscheduling-step2-configureitsmapiconnectorcredentials" id="configurationguide-batteryreplacementscheduling-step2-configureitsmapiconnectorcredentials"></a>

The configuration of connector credentials is essential for enabling API calls. See detailed information [here](https://nexthink.gitbook.io/opd/integrations/outbound-connectors/connector-credentials). Each Service/API thinklet has a dropdown field for credentials that needs to be filled out. When the workflow is installed or copied from the Library, this field will be blank as it is a local setup of each environment and is not included in the Library.

<div data-full-width="true"><figure><img src="/files/4eCvN5Dj6V66LVulVgjk" alt="Connector credential.png" width="760"><figcaption></figcaption></figure></div>

<div data-full-width="true"><figure><img src="/files/cyhFG4VRUTrQg0UFIlBQ" alt="image-20240119-144723.png" width="760"><figcaption></figcaption></figure></div>

### Step 3) Configure global parameters <a href="#configurationguide-batteryreplacementscheduling-step3-configureglobalparameters" id="configurationguide-batteryreplacementscheduling-step3-configureglobalparameters"></a>

There is one global parameter in this workflow:

* itsm\_sys\_id - the reference for a single global ITSM ticket created before running the workflow.

Before running the workflow, a ticket should be logged in ITSM for battery replacement. The ticket reference (sys\_id for ServiceNow) can then be added to the workflow as a global parameter. As the workflow progresses and tickets need to be logged, the workflow will append comments to this global ticket with essential details, such as the device name and the battery and warranty status.

### Step 4) Configure remote action(s) <a href="#configurationguide-batteryreplacementscheduling-step4-configureremoteaction-s" id="configurationguide-batteryreplacementscheduling-step4-configureremoteaction-s"></a>

<table><thead><tr><th width="190">Name</th><th>Trigger</th><th>Schedule Query</th><th>Parameters to edit</th></tr></thead><tbody><tr><td>Get Battery Status</td><td>API trigger should be enabled so that it can be triggered from the Workflow</td><td><pre><code>devices
| where device.hardware.manufacturer in ["Dell", "HP", "Lenovo", "Apple"]
| where hardware.type == laptop
| list name, hardware.manufacturer
</code></pre></td><td>Temperature output (Celsius/Fahrenheit)</td></tr><tr><td>Get Warranty Status</td><td>API trigger should be enabled so that it can be triggered from the Workflow</td><td><pre><code>devices
| where device.hardware.manufacturer in ["Dell", "HP", "Lenovo"]
| where hardware.type == laptop
| list name, hardware.manufacturer
</code></pre></td><td>In order to retrieve the warranty information of Dell and/or Lenovo devices, via REST APIs, there are certain input fields that need to be populated. Please refer to the table below for more details.</td></tr></tbody></table>

#### **Get warranty status - input parameters**

<table><thead><tr><th width="338">Name</th><th width="133">Default value</th><th>Description</th></tr></thead><tbody><tr><td>MaximumDelayInSeconds</td><td>30</td><td>Maximum delay in seconds to avoid overloading the vendor servers with too many API requests occurring at the same time</td></tr><tr><td>DellClientID</td><td>None</td><td>Dell Client ID</td></tr><tr><td>DellClientSecret</td><td>None</td><td>Dell Client Secret token</td></tr><tr><td>DellDeviceWarrantyItemNumbers</td><td>None</td><td>List of Dell's device warranty item numbers from where to retrieve the information. The elements should be separated by comma</td></tr><tr><td>DellBatteryWarrantyItemNumbers</td><td>None</td><td>List of Dell's battery warranty item numbers from where to retrieve the information. The elements should be separated by comma</td></tr><tr><td>LenovoClientToken</td><td>None</td><td>Lenovo Client token</td></tr><tr><td>LenovoDeviceWarrantyProductCodes</td><td>None</td><td>List of Lenovo's device warranty product codes from where to retrieve the information. The elements should be separated by comma</td></tr><tr><td>LenovoBatteryWarrantyProductCodes</td><td>None</td><td>List of Lenovo's battery warranty product codes from where to retrieve the information. The elements should be separated by comma</td></tr><tr><td>HPClientId</td><td>None</td><td>HP Client ID</td></tr><tr><td>HPClientSecret</td><td>None</td><td>HP Client Secret token</td></tr></tbody></table>

**Further Information**

The Warranty Item Number found in the API response is known as the SKU number on the Dell Invoice. Choose the SKUs for the support item that relates to the device warranties for each purchased model. Do the same for the batteries, which are typically included with shorter warranty period. These SKU values are what should be used in DeviceWarrantyItemNumbers input parameters.

### Step 5) Configure campaign <a href="#configurationguide-batteryreplacementscheduling-step5-configurecampaign" id="configurationguide-batteryreplacementscheduling-step5-configurecampaign"></a>

This workflow contains one Engage [campaign](https://nexthink.gitbook.io/opd/user-guide/campaigns) “Battery Replacement Advisory”. The purpose of this campaign is to inform the employee that their battery has been identified as being in need of replacement and to check with them whether or not they would like to proceed with ordering a replacement. This adds a crucial step to the process, as an employee's particular work habits may mean that they are not impacted by a poor battery.

<div data-full-width="true"><figure><img src="/files/pl8WexFCGOKwhA8onfvZ" alt="image-20231228-103646.png"><figcaption></figcaption></figure></div>

This campaign should be modified before use to ensure that it matches corporate communication guidelines. Navigate to the [manage campaigns](https://nexthink.gitbook.io/opd/user-guide/campaigns/managing-campaigns) administration page to review and edit your campaigns.

For each installed campaign, please ensure to:

* Customize the sender name and image.
* Review and adjust questions.
* Publish the campaign when you are ready to use it.

### Step 6) Configure battery replacement criteria <a href="#configurationguide-batteryreplacementscheduling-step6-configurebatteryreplacementcriteria" id="configurationguide-batteryreplacementscheduling-step6-configurebatteryreplacementcriteria"></a>

The workflow will identify devices with batteries that need to be replaced, using the same logic as the Battery Health dashboard. This logic can be adjusted within the workflow if required. By default devices are considered to be candidates for battery replacement if they fulfil the following requirements:

* Windows
  * Battery health < 60%
  * Battery Cycle Count > 300
* macOS
  * Battery Condition: Service Recommended

### Step 7) Schedule the workflow <a href="#configurationguide-batteryreplacementscheduling-step7-scheduletheworkflow" id="configurationguide-batteryreplacementscheduling-step7-scheduletheworkflow"></a>

The Battery replacement scheduling workflow can be triggered on all laptop devices but is designed to work best with Dell and Lenovo Windows devices, and MacBooks. The workflow will identify devices with batteries that need to be replaced, using the same logic as the Battery Health dashboard. For Dell and Lenovo devices it will then determine if the device, and/or the battery are covered by the manufacturer’s warranty. The workflow will then engage with the user to notify them that their battery is in need of replacement and ask them for feedback on their battery performance so that they can give their permission for the global ITSM ticket to be updated.

**Trigger configuration for the workflow**

This workflow is primarily designed to run periodically using a scheduled trigger. However, it can also be manually triggered for ad hoc usage on single or multiple devices as required, through the use of an [Investigation](https://nexthink.gitbook.io/opd/user-guide/investigations).\
The example below shows how the automatic schedule could be configured for a periodical check of laptop devices fully compatible with the workflow.

**NQL:**

<pre><code><strong>Code
</strong>1 devices
2 | where device.hardware.manufacturer in ["Dell", "HP", "Lenovo", "Apple"] 
3 | where hardware.type == laptop
4 | list name, hardware.manufacturer
</code></pre>

## **Usage guide** <a href="#configurationguide-batteryreplacementscheduling-usageguide" id="configurationguide-batteryreplacementscheduling-usageguide"></a>

Your content is now configured and ready to be used. For usage overview and recommendations, you can visit the usage guide:

[Usage guide: Battery replacement scheduling](/platform/library-packs/hardware-management/workflow_-battery-replacement-scheduling/usage-guide_-battery-replacement-scheduling.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nexthink.com/platform/library-packs/hardware-management/workflow_-battery-replacement-scheduling/configuration-guide_-battery-replacement-scheduling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
