Zoomed Image

How to Run an Approved Script

Endpoint Management Guide

How To

How to Run an Approved Script

A script runs on your computers only after your approvers have signed it. This page takes one script from first draft to a run on a set of computers. The worked example clears the print queue on two print servers.

Before you start

At least two people have paired their PCs with Become an Approver, and the keyring is published. A library script needs two approvals by default (DMPCApproveLibraryCount). See Approvers and the Keyring.

1. Write the script

  1. Open Endpoints > Endpoints Dashboard > Setup > Scripts and click New Script.
  2. Fill in the Script dialog:
Field Value
Name Clear Print Queue
What It Does Stops the spooler, deletes queued jobs, starts the spooler
Language powershell
Script the code below
Stop-Service Spooler -Force
Remove-Item "$env:SystemRoot\System32\spool\PRINTERS\*" -Force
Start-Service Spooler
  1. Click OK. The script is saved as Draft.

See Writing a Script.

2. Approve it

Each approver, in the browser they enrolled in:

  1. Clicks Approve and chooses Clear Print Queue.
  2. Reads the code in the Approve Script dialog.
  3. Enters the code xAssets emailed them and clicks OK.

When the last approver has signed, the status becomes Approved, and Runnable Until shows when the approval ends. See Approving a Script.

3. Run it

  1. Open Endpoints > Endpoint List and select the two print servers.
  2. Click Change > Software and Files > Run a Script.
  3. Choose Clear Print Queue in Script and click OK.

Follow the run in Activity > Jobs. Each computer's output is on its row. See Run a Script.

Key points

  • An approval lasts 3 days by default. After Runnable Until, approve the script again.
  • Any edit clears every approval.
  • The agent checks the approval again on the computer. A script changed on the way is refused there.
  • A script run cannot be undone.
  • In an emergency, an approver can use Emergency Approval to run a script alone for 4 hours, if your rule allows it. The run is labeled BREAK-GLASS in Activity. See Emergency Approval.