Create an ACC plugin package
Package a PowerShell script, a Ruby script, and an execution allowlist into an Agent Client Collector (ACC) plugin to run remedial actions on endpoints from the platform.
Before you begin
Role required: admin
Procedure
-
Create a root folder for the ACC plugin on your local computer and name it.
For example,
acc-dex-custom. -
In the root folder, create two subfolders named
allowlistandbin. -
Create a PowerShell script using PowerShell or command prompt commands to define the remedial action to run on an endpoint device.
-
In the
binfolder, create a file with the.ps1extension.For example,
CustomScript.ps1. -
Open the
.ps1file and add the commands.For example, the following sample
.ps1file defines a custom remedial action using commands to stop and start the W32Time process, pause, and restart the Spooler service on a device.PowerShellsc.exe stop w32time $process = Get-Process -Name w32time -ErrorAction SilentlyContinueif ($process) { taskkill /f /t /im w32tm.exe} Start-Sleep -Seconds 5 sc.exe start w32timeStart-Process "C:\Windows\System32\w32tm.exe" Start-Sleep -Seconds 5 sc.exe stop spoolersc.exe start spoolerNote: You can configure the PowerShell script to accept input parameters defined in the ServiceNow instance during execution.
-
Save the file.
-
-
Create a Ruby script to call the
.ps1file from the ServiceNow instance.-
In the
binfolder, create a Ruby file and name it with the.rbextension. -
Open the
.rbfile and add your code using plain Ruby or any Ruby framework.The Ruby script must include the logic to:
- Call the
.ps1script you created, making sure that you enter the correct file path. - Validate if the command is successfully executed.
- Create an output JSON that includes the execution status, output, and errors, if any.
- Call the
-
Execute the command and review the output to confirm if the
.ps1file is called successfully or if there are any errors.For example, the following sample
.rbfile runs a.ps1file (CustomScript.ps1) using the acc-f-commons plugin run command, validates if the command runs successfully, and returns the result JSON.Javarequire "logger"require_relative "../../../acc-f-commons/bin/command_runner.rb"require "json" class CustomScript def initialize() @logger = Logger.new(STDOUT) @cmd_runner = CommandRunner.new @logger.level = "FATAL" end def execute_custom_script() status = "failure" msg = nil data = {} parent_cache_directory = File.expand_path("../..", File.dirname(__FILE__)).gsub(" ", "` ") query = "powershell -ExecutionPolicy Bypass " + parent_cache_directory + "/acc-dex-custom/bin/ps/customScript.ps1" output, error = @cmd_runner.runCmd(query, @logger, "mode con:cols=32766 lines=1 & chcp 65001 > nul & ", true, false) if !error && !output.empty? status = "success" msg = "Successfully ran script" data = output else msg = "Failed - #{error}" end result = { "status" => status, "type" => "device", "metric_type" => "remedial_action", "keys" => "custom_script", "data" => data, "message" => msg } puts JSON.generate(result) endend custom_script = CustomScript.newcustom_script.execute_custom_script()Note:
If the PowerShell script is configured to accept input parameters from the ServiceNow instance, the Ruby script passes these parameters to the PowerShell script during execution.
-
-
Create an allowlist file and specify the Ruby script permitted for execution on endpoint devices.
-
In the
allowlistsubfolder, create an allowlist JSON file.For example,
check-allowlist.json. -
Define any conditions such as arguments to be accepted as part of the
.rbscript, or create custom logic. -
Save the file.
-
-
Generate a
tar.gzfile for your ACC plugin folder using any utility.Note: The
tar.gzfile name must match the plugin root folder name. For example,acc-dex-custom.tar.gz.
---
title: Create an ACC plugin package
description: Package a PowerShell script, a Ruby script, and an execution allowlist into an Agent Client Collector \(ACC\) plugin to run remedial actions on endpoints from the platform.
locale: en-US
canonical_url: https://www.servicenow.com/docs/r/it-operations-management/digital-end-user-experience-dex/create-acc-plugin-structure.html
release: brazil
product: Digital End-User Experience \(DEX\)
classification: digital-end-user-experience-dex
topic_type: task
last_updated: "2026-10-23"
reading_time_minutes: 2
keywords: [acc plugin package, create plugin structure, acc plugin, remedial action plugin, powershell remedial action, ruby script plugin]
breadcrumb: [Creating a PowerShell remedial action, Creating DEX remedial actions, Configure, Digital End-User Experience, IT Operations Management]
---
# Create an ACC plugin package
Package a PowerShell script, a Ruby script, and an execution allowlist into an Agent Client Collector \(ACC\) plugin to run remedial actions on endpoints from the platform.
## Before you begin
Role required: admin
## Procedure
1. Create a root folder for the ACC plugin on your local computer and name it.
For example, `acc-dex-custom`.
2. In the root folder, create two subfolders named `allowlist` and `bin`.
3. Create a PowerShell script using PowerShell or command prompt commands to define the remedial action to run on an endpoint device.
1. In the `bin` folder, create a file with the `.ps1` extension.
For example, `CustomScript.ps1`.
2. Open the `.ps1` file and add the commands.
For example, the following sample `.ps1` file defines a custom remedial action using commands to stop and start the W32Time process, pause, and restart the Spooler service on a device.
```
sc.exe stop w32time
$process = Get-Process -Name w32time -ErrorAction SilentlyContinue
if ($process) {
taskkill /f /t /im w32tm.exe
}
Start-Sleep -Seconds 5
sc.exe start w32time
Start-Process "C:\Windows\System32\w32tm.exe"
Start-Sleep -Seconds 5
sc.exe stop spooler
sc.exe start spooler
```
**Note:** You can configure the PowerShell script to accept input parameters defined in the ServiceNow instance during execution.
3. Save the file.
4. Create a Ruby script to call the `.ps1` file from the ServiceNow instance.
1. In the `bin` folder, create a Ruby file and name it with the `.rb` extension.
2. Open the `.rb` file and add your code using plain Ruby or any Ruby framework.
The Ruby script must include the logic to:
- Call the `.ps1` script you created, making sure that you enter the correct file path.
- Validate if the command is successfully executed.
- Create an output JSON that includes the execution status, output, and errors, if any.
3. Execute the command and review the output to confirm if the `.ps1` file is called successfully or if there are any errors.
For example, the following sample `.rb` file runs a `.ps1` file \(`CustomScript.ps1`\) using the acc-f-commons plugin run command, validates if the command runs successfully, and returns the result JSON.
```
require "logger"
require_relative "../../../acc-f-commons/bin/command_runner.rb"
require "json"
class CustomScript
def initialize()
@logger = Logger.new(STDOUT)
@cmd_runner = CommandRunner.new
@logger.level = "FATAL"
end
def execute_custom_script()
status = "failure"
msg = nil
data = {}
parent_cache_directory = File.expand_path("../..", File.dirname(__FILE__)).gsub(" ", "` ")
query = "powershell -ExecutionPolicy Bypass " + parent_cache_directory + "/acc-dex-custom/bin/ps/customScript.ps1"
output, error = @cmd_runner.runCmd(query, @logger, "mode con:cols=32766 lines=1 & chcp 65001 > nul & ", true, false)
if !error && !output.empty?
status = "success"
msg = "Successfully ran script"
data = output
else
msg = "Failed - #{error}"
end
result = {
"status" => status,
"type" => "device",
"metric_type" => "remedial_action",
"keys" => "custom_script",
"data" => data,
"message" => msg
}
puts JSON.generate(result)
end
end
custom_script = CustomScript.new
custom_script.execute_custom_script()
```
**Note:**
If the PowerShell script is configured to accept input parameters from the ServiceNow instance, the Ruby script passes these parameters to the PowerShell script during execution.
5. Create an allowlist file and specify the Ruby script permitted for execution on endpoint devices.
1. In the `allowlist` subfolder, create an allowlist JSON file.
For example, `check-allowlist.json`.
2. Define any conditions such as arguments to be accepted as part of the `.rb` script, or create custom logic.
3. Save the file.
6. Generate a `tar.gz` file for your ACC plugin folder using any utility.
**Note:** The `tar.gz` file name must match the plugin root folder name. For example, `acc-dex-custom.tar.gz`.
| title | Create an ACC plugin package |
| description | Package a PowerShell script, a Ruby script, and an execution allowlist into an Agent Client Collector \(ACC\) plugin to run remedial actions on endpoints from the platform. |
| locale | en-US |
| canonical_url | https://www.servicenow.com/docs/r/it-operations-management/digital-end-user-experience-dex/create-acc-plugin-structure.html |
| release | brazil |
| product | Digital End-User Experience \(DEX\) |
| classification | digital-end-user-experience-dex |
| topic_type | task |
| last_updated | 2026-10-23 |
| reading_time_minutes | 2 |
| keywords | acc plugin packagecreate plugin structureacc pluginremedial action pluginpowershell remedial actionruby script plugin |
| breadcrumb | Creating a PowerShell remedial actionCreating DEX remedial actionsConfigureDigital End-User ExperienceIT Operations Management |