Table of Contents

Powershell Handlers

Note

The following functionality is available with the report pack extension 7.3.0.10 and newer.

With the Powershell handlers, you can run scripts on a local computer from a Business Central running in a browser. This means that even if you use Business Central in the cloud, you can still interact with local devices such as scanners and scales.

Local device access

The direct print solution established a link between Business Central and a local device, which in this case was always a printer. Soon, people started asking about access to local files, and the file service was built to serve that purpose.

In addition to printers and files, we needed to communicate with other types of devices. These devices are often so special that we need a more generic way to access them. That is why the Powershell handlers were introduced.

What can they do?

Handlers are a script that can receive any data from Business Central, do some work, and return any data as a result.

This flexibility opens up a variety of use case scenarios. Powershell scripts can do virtually anything on a computer. Of course, they are limited by the permission context they run under.

Scripts can start other programs, work on files, use Microsoft.NET assemblies, communicate via FTP, call APIs, and many other cool things.

Service handlers or client handlers

Just as with direct print, jobs can be executed by the print and file service or by the client machine that runs the browser with Business Central.

Where the job is run is determined by the definition of the direct printer used with the handler. For each handler, a corresponding direct printer must be defined. The printer can be configured to create jobs on the queue used by the service or download the jobs to the browser, which is used for processing on the client.

Direct printers for handlers

One-way or two-way communication

Handlers can return data to Business Central after processing the package. You can create a one-way handler that receives a package, runs it, and terminates it. Alternatively, you can make a two-way handler that returns a response to Business Central.

Build a handler

You can create your first handler by using the link below.

Build your first handler