Administering PaperCut with PowerShell

KB Home   |   Administering PaperCut with PowerShell

PaperCut has a number of supported methods for configuring PaperCut programmatically. These include using the server-command tool from the PaperCut Application Server, or calling this tool from remote machines. PaperCut can also be called programmatically via our APIs from a number of programming languages such as C#, Java and more.

It is also possible to configure PaperCut from PowerShell. PowerShell allows for the import of libraries into the PowerShell environment to extend its capabilities. Administrators can then take advantage of the advanced features of PowerShell (when compared to the traditional command line) including the easy maintenance of scripts.


PaperCut already ships with a ServerCommandProxy class for C#, which presents all available API calls as methods of a class. This class can be compiled as a library with relative ease, and imported into PowerShell for usage;

  1. Use Visual Studio to create a new Project of type Class Library with the name of ServerCommandProxy.
  2. Remove the default Class1.cs Visual Studio will have added to the project.
  3. Choose Add Existing Item and navigate to
    [install path]\server\examples\webservices\csharp\
    and add the ServerCommandProxy.cs file to the project
  4. Double click this file/class and wrap everything after the using CookComputing.XmlRpc line in a namespace called PaperCut
  5. Add a reference to the CookComputing.XmlRpcV2.dll library to the project. If you donít have these libraries, you will need to download these from the XML-RPC website, found here:
    You’ll need to use something other than the Windows unzip method to find the libraries within, as they live in a folder the Windows archive tool doesnít acknowledge.
  6. Compile the project to create your ServerCommandProxy.dll

From PowerShell, itís now simply a case of importing these libraries to start configuring PaperCut from the shell.

  1. First, create a variable that saves the path the ServerCommandProxy.dll and CookComputing.XmlRpcV2.dll files live in. In my example this is;
    $libPath = C:\VS\ServerCommandProxy\bin\Debug
  2. Then, import the libraries into the environment;
    Add-Type -Path “$libPath\ServerCommandProxy.dll”
    Add-Type -Path “$libPath\CookComputing.XmlRpcV2.dll”
  3. Create a new instance of the ServerCommandProxy class;
    $s = New-Object PaperCut.ServerCommandProxy(“localhost”,9191,”password”);
  4. Finally, make your first call against the PaperCut server programmatically;

Thatís it! Youíre now able to make all valid calls against the PaperCut Application Server via the supported API set.

Categories: Scripting, Tips & Tricks, Configuration , Administration

Keywords: PaperCut, PowerShell


Share your findings and experience with other PaperCut users. Feel free to add comments and suggestions about this Knowledge Base article. Please don't use this for support requests.

Article last modified on December 08, 2014, at 05:25 AM
Printable View   |   Article History   |   Edit Article