Hi PI Square,

 

I revamped the backfill utility I wrote and included some additional features that I think would be helpful for users.  Here's a description:

This utility allow users to interact with Asset Analytics analyses (OSIsoft PI AF Server) from the command line.  Available switches:

 

/Mode:{{List|Print|Enable|Disable|Backfill|Recalc}}

        The operation that the utility will perform on the specified analyses.  All modes will search for the analyses according to the search criteria and and then:

        List: Lists the analyses. Use to check the analyses before executing other modes.

        Print: Prints information about the analysis inputs and outputs attributes.

        Enable: Enables the analyses and attempts to start them in the PI Analysis Service.

        Disable: Disables and stops the analyses.

        Backfill: Backfills the analyses for the time period.

        Recalc: Recalculates the analyses for the time period.

/FullPath:<PathToObject>

        The full path to the root AFObject. Full paths to server, database, and element are all supported. Use double quotes (") around the full path if it has spaces.

/ElementTemplate:<string>

        The exact name of the element template that the analysis belongs to. Requires AF Database to be specified.

/AnalysisName:<string>

        The name of the analysis. Supports wildcards.

/MaxItems:<integer>

        The maximum number of elements to return from the search.  Increase this value if not all analyses are being returned as expected. Default value: 100

/StartTime:<time>

        The start time for backfill/recalc of the analyses. Only required for Backfill and Recalc modes. Supports PI time format.

/EndTime:<time>

        The end time for backfill/recalc of the analyses. Only required for Backfill and Recalc modes. Supports PI time format.

/Delay:<integer>

        The time in seconds to delay queuing backfill/recalc requests. Only used for Backfill and Recalc modes. Default value: 10.  Use /delay:0 to immediately queue requests.

 

Examples:

        AnalysisUtil /fullpath:"\\AFServer1\Houston Plant" /elementTemplate:Pumps /mode:list

        AnalysisUtil /fullpath:\\AFServer1\Manufacturing\Line1 /analysisName:*rollup /mode:print > analysesSpreadsheet.csv

        AnalysisUtil /fullpath:\\AFServer1 /mode:enable

        AnalysisUtil /fullpath:\\AFServer1 /mode:disable

        AnalysisUtil /fullpath:\\AFServer1\Test\Line1 /analysisName:*rollup /starttime:*-7d /endtime:* /mode:backfill

        AnalysisUtil /fullpath:\\AFServer1\NAMER\South /analysisName:*daily* /starttime:2017-01-01 /endtime:2017-02-01 /delay:0 /mode:recalc

 

The code is on Github here.  You can download the compiled .exe and ReadMe.txt file here.  Feel free to use it under the GNU General Public License - this means that I'm not responsible for anything it breaks, so use it cautiously and intelligently! 

 

Feel free to download a fork and make your own edits, or make comments here (with your use case) for me to implement.  Thanks!