Command Line

Permissions Reporter accepts several command line arguments to facilitate scheduling and automation. The command line can also be used just to load a specific project on start-up.

Each command line argument is explained in more detail below.

Syntax

Each argument starts with a forward slash and is not case-sensitive. Where an argument takes a value, the value follows it, separated by either a space or a colon - /export "c:\output.html" and /export:"c:\output.html" mean the same thing.

Enclose any value that contains spaces in quotation marks. Do not end a quoted path with a backslash when other arguments follow it: Windows reads a backslash followed by a quotation mark as a literal quotation mark, so "c:\folder\" takes in the rest of the command line. Write "c:\folder" instead.

The command line is checked before anything is run. An unrecognized argument, or an argument whose value is missing, is reported as an error and nothing is run (see "Results and Error Reporting" below).

Required Arguments

Execution via the command line requires that you use either the "/project" or "/compare" parameters to either execute an existing project or compare two existing XML exports (respectively).

/project [project.xml]

You must provide a fully qualified path to an existing project file to execute. If you haven't already created and saved a project file, you can do so from within the main program interface. The project file contains everything required to generate a permissions report, including folder paths, filter settings, etc.

/compare /source [source.xml] /target [target.xml] /export [results.xlsx]

Use this parameter if you wish to trigger the comparison of two existing source and target XML permissions data files and then export the result.

When using the compare parameter, the source, target, and export command line parameters are also required. All paths should be fully qualified (relative paths are not supported). The startPath argument can also be used (see below for details) when comparing reports.

Important: Permissions comparison data exports are available in two file formats - CSV (.csv) or Excel (.xlsx), depending on the export file extension you specify.

Additional Arguments

/export [results.html]

Use this parameter to trigger the creation of one or more export files after the permissions report has been generated. All export paths must be fully qualified.

The format of the resulting file is determined by the file name extension used in the export path. Supported output file types include HTML (.html), XML (.xml), MS Excel (.xlsx), CSV (.csv), PDF (.pdf) and JSON (.json, .ndjson or .jsonl).

Multiple file system paths can be specified by separating them with a pipe symbol.

/email [address@domain.com]

Use this parameter to send all export files created via the /export parameter to a user via email. By default, all export files are zipped into a single file prior to being emailed (see "/attachcompress" below). In order to use this feature, you must first configure and test email integration settings within the global options window. Multiple email addresses may be specified, separated by a comma or semicolon. Before using this feature, test to ensure that the size of export files being  generated are within acceptable limits for transmission via email.

/emailsubject [subject]

Use this parameter to override the email subject configured in the global options window for a single command line operation. Enclose the subject in quotation marks if it contains spaces.

/attachcompress [zip | none]

Controls how export files are attached to the email. Use zip (the default) to compress all export files into a single ZIP attachment, or none to attach each export file as it is.

/appenddate

Use this parameter to automatically append a date/time stamp to the name of any export files. The format of the appended date/time string is "yyyyMMdd_HHmmss" (so, for example, an export path of "c:\temp\report.html" might become "c:\temp\report_20150414_091000.html"). All files exported by the same operation receive the same date/time stamp. To delete older stamped copies automatically, see "/purgeolderthan" below.

/startpath [folder path]

When using the compare command line option, this parameter will start the comparison process at the specified folder node (if present). If you don't specify this option, the root folder paths will be compared.

/savelog [log.csv]

The parameter saves the current in-memory error log to the specified path in CSV file format. If the target log file already exists, it will be overwritten. Use this parameter when troubleshooting command line operations.

/logoccurrences

Use this parameter together with "/savelog". Repeated log entries for the same condition in the same folder are rolled up into a single entry with an occurrence count, and by default the saved log has one row per entry. With this parameter, it has one row for every occurrence instead, each with its own date/time and path, in the order they were logged. The columns are the same in both cases.

Paths are kept for as many occurrences as the "Maximum log entries" setting allows. Beyond that, occurrences are only counted, and a final row for the entry says how many paths were not kept. Without "/savelog", this parameter has no effect and a warning is recorded in the error log.

/exportconfig [config.xml]

This parameter will load export configuration data from the specified file path, thereby allowing you to specify which data elements (including columns) should be exported.

/folders [paths.txt]

If this optional parameter is specified, it will be used to override the folder list specified in the project file (see "/project" parameter above).

This parameter can accept a set of paths in one of two formats. If you pass a text file path (ending in the .txt file extension), project folder paths will be read from it directly - assuming one path per line in the text file. Alternatively, you can pass in one or more explicit folder paths, each separated by pipe symbols. See below for examples.

/loadonly

Use this parameter together with "/project" to load the project without running it. The program stays open so that you can review the project and run it yourself.

/refreshtokens

Refreshes the Gmail or Microsoft 365 authorization used for email delivery, and then exits. The authorization is refreshed automatically each time a report is emailed, so this parameter is only needed when reports are emailed so infrequently that the authorization could expire in between (see Global Options for details). In that case, schedule a separate task that runs Permissions Reporter with this parameter alone. No other operation is performed when it is used.

Purging Old Export Files

/purgeolderthan [days]

Use this parameter together with "/appenddate" to keep a rolling window of reports. After the export files have been created, Permissions Reporter permanently deletes earlier date-stamped copies of each export file once the date in their name is more than the specified number of days ago. The value must be a whole number of days from 1 to 99999; any other value is reported as an error and nothing is run.

Only files whose name matches an export path apart from the date/time stamp are deleted. For example, with /export "c:\reports\finance.html" /appenddate /purgeolderthan 30, the file finance_20260101_090000.html is deleted once that date is more than 30 days ago. Files such as finance.html, finance_20260101_090000.xlsx, budget.xlsx or a project file in the same folder are never deleted. The age of a copy is taken from the date/time stamp in its name, so copying or restoring files does not change which ones are deleted.

Old copies are only deleted for exports that succeeded during the run, so a failed export never removes earlier reports. Each deleted file is recorded in the error log (see "/savelog").

Without "/appenddate" there are no date-stamped copies to delete, so "/purgeolderthan" has no effect and a warning is recorded in the error log.

Important Note

On modern Windows operating systems, the Windows task scheduler (which is leveraged by Permissions Reporter for scheduling) runs all tasks non-interactively (e.g. "hidden") unless you specifically configure them to "run only when user is logged on".

For this reason, when run via the scheduler Permissions Reporter will always run silently and exit automatically upon task completion.

Results and Error Reporting

When a command line operation ends, Permissions Reporter exits with one of the following codes. The Windows task scheduler shows this value as the task's Last Run Result, and scripts can test it.

  • 0 - Everything that was requested completed.
  • 1 - The operation could not be performed, or part of it failed. Examples include an invalid command line, a project file that cannot be found, a missing license, and an export, email or log file that could not be produced.

Problems encountered while scanning (a folder that cannot be read, for example) do not change the exit code, because the report is still produced. They are recorded in the error log, which you can save with the "/savelog" parameter.

When an operation fails, the reason is also added to the following file, whether or not "/savelog" was used:

%ProgramData%\Key Metric Software\Permissions Reporter\CommandLineErrors.log

Examples

permissionsreporter.exe /project "c:\project.xml" /export "c:\output.html"

Runs using the specified project file, and exports the resulting report as HTML.

permissionsreporter.exe /project "c:\project.xml" /export "c:\output.html|c:\output.xml" /email "address@domain.com"

Runs using the specified project file, and exports the resulting report as both HTML and XML. These export files are then both zipped and emailed to "address@domain.com".

permissionsreporter.exe /project "c:\project.xml" /folders "c:\folders.txt" /export "c:\output.html"

Overrides the folders specified in the project file by reading them (one path per line) from "c:\folders.txt".

permissionsreporter.exe /project "c:\project.xml" /folders "c:\folder1 | c:\folder2" /export "c:\output.html"

Overrides the folders specified in the project file by specifying one or more explicit folder paths (separated by pipe symbols).

permissionsreporter.exe /compare /source:"c:\source.xml" /target:"c:\target.xml" /export:"c:\output.xlsx"

Generates a permissions comparison report in Excel format based on the specified source and target XML files.

Safe. Trusted. Guaranteed.

  • 100% malware free
  • 100% spyware free
  • 100% adware free
  • 100% quality software