Skip to content
This repository was archived by the owner on Feb 17, 2021. It is now read-only.

How to for installing for PowerShell

Alec Clews edited this page Aug 6, 2019 · 3 revisions

Pure Powershell XML-RPC library

Note: This information is draft.

  1. Download the PSXmlRpcClient module from here https://github.com/PaperCutSoftware/PSXmlRpcClient

  2. You can then write some code like this

Import-Module .\PSXmlRpcClient\PSXmlRpcClient -Force
$appServer= $([url]]"http://localhost:9191/rpc/api/xmlrpc")
try {
     $r = Invoke-XmlRpcRequest -ServerUri $appServer  -MethodName  "api.getConfigValue"  -Params $('herbert', "auth.webservices.auth-token")
     if ($r.faultCode -and  $r.faultstring ) {
         Write-Error -message $r.faultstring
         throw $r.faultstring
     }
}

Powershell Binary lib installation information

https://docs.microsoft.com/en-us/powershell/module/packagemanagement/?view=powershell-6

https://stackoverflow.com/questions/3079346/how-to-reference-net-assemblies-using-powershell

https://www.red-gate.com/simple-talk/sysadmin/powershell/managing-packages-using-windows-powershell/

Note from @Joffcom

Add-Type -Path "$dllPath\ServerCommandProxy.dll"
Add-Type -Path "$dllPath\CookComputing.XmlRpcV2.dll"
$api = New-Object PaperCut.ServerCommandProxy($papercutHost, $papercutPort, $authToken);

# Get user count
$userCount = $api.getTotalUsers()
Clone this wiki locally