简体   繁体   中英

Powershell Checkpoint as Job or Workflow

Afternoon, I'm in the process of writing a powershell script to replace a file in 600 - 1000 folders. I've got process down and tested it on a small number of folders.

As its updating a large number of folders, it will probably run as a scheduled task overnight. Is it possible to create checkpoint when the script stops, and then for it to start from that checkpoint when the script runs again.

For exmaple -

  1. Script runs for 4 hours
  2. Creates CheckPoint
  3. Stops

Next day

  1. Continues from previous checkpoint....

I've tried creating a file which gets updated when folders are changed, then using this as a 'exclude' folder. But wondered if there is an better solution.

I'm not sure if there's any built-in function/class to do this, but this can be achieved by logging what the script is doing.
The general idea would be store all the folders that have been processed in a log file and the next time you run it you can skip the folder if it is listed in the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM