Performing a dry run of a Powershell script that uses Chocolatey
Asked Answered
I

1

6

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?

Isomagnetic answered 9/12, 2018 at 23:19 Comment(0)
P
7

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.

Piecework answered 9/12, 2018 at 23:54 Comment(2)
You can find all the common parameters that you can use here: chocolatey.org/docs/…Inquisitorial
@GaryEwanPark - yep! i got the above from the same choco -h that your link was generated from. [grin]Piecework

© 2022 - 2024 — McMap. All rights reserved.