Command-line utility server.cli.exe may be used as a simple API to manage shared USB devices. Command-line utility returns 0 if the requested operation is completed successfully, or non-zero error code (HRESULT). It also prints error description to STDOUT unless the --silent parameter is specified.
The utility supports the following command-line parameters:
| Parameter | Value | Description |
|---|---|---|
-?, --help | Displays the list of supported parameters with short description. | |
--silent | Do not display any error or success messages. | |
| Main Commands | ||
-list | List local USB devices. | |
-list-shared | List shared USB devices. | |
-share | Share USB device(s) matching criteria. | |
-unshare | Stop sharing of USB device(s) matching criteria. | |
-show-public-key | Display the server's public key. | |
-renew-key | Renew server's encryption keys. | |
-set-port-fw | Configure port forwarding. | |
-clear-port-fw | Remove port forwarding configuration. | |
| Device Matching | ||
--vid | 16-bit hexadecimal number | Device Vendor ID. |
--pid | 16-bit hexadecimal number | Device Product ID. |
--serial-number | string | Device serial number. |
--name | string | Device name. |
--manufacturer | string | Device manufacturer. |
--location | string | Device connection location. |
--instance-id | string | Device instance ID. |
| Share Options | ||
--auth-key | string | Authentication key. |
| Unshare Options | ||
--instance-id | string | Instance ID of a device to stop sharing. |
| Port Forwarding Options | ||
--external-discovery-port | 1-65535 | External discovery port. If omitted, current default discovery port is used. |
--external-data-port | 1-65535 | External data port. If omitted, current default data port is used. |
The command-line utility must be launched from an elevated command-prompt, PowerShell or Windows Terminal window. Use one (or more) of the options under “Device Matching” group to specify which devices you want to share.