powershelltestingscriptingchocolateydry-run

Performing a dry run of a Powershell script that uses Chocolatey


I'm working on a script to automate setting up new machines to a certain specification, which includes downloading a bunch of programs and changing user preferences.

I would just set a variable for the downloads and registry edits but most of the packages downloaded are through Chocolatey which appears not to have a dry-run (what-if) mode.

Is there a way to run the script in a mode that only prints what actions would be performed, so that nothing actually gets downloaded or changed while I'm testing the program?


Solution

  • choco has an option to "not do anything" - this ...

    --noop, --whatif, --what-if
    NoOp / WhatIf - Don't actually do anything.
    

    i have not tested it, but it looks like what you want.