chocolatey / choco-wiki

The content from this repository has been moved to https://github.com/chocolatey/docs. If you have found an issue, or want to submit a fix, then please open an issue, or a PR, on that repository.
Other
81 stars 70 forks source link

How to choco install, reboot, choco install? #61

Open Sirove opened 7 years ago

Sirove commented 7 years ago

Hi, I want to write a little script (one double klick) that automatically installs a predefined set of Software from Chocolatey but with some controlled reboots between the install commands to prevent interdependencies. How to accomplish that? :)

Example:

choco install ccleaner audacity firefox -y reboot & wait 30 seconds after user logon choco install thunderbird vlc gimp -y reboot & wait 30 seconds after user logon choco install app app app -y reboot & wait 30 seconds after user logon

rismoney commented 7 years ago

Why wait 30 seconds? Usually defined wait times aren't as reliable or cause excessive waits instead of checking for what you really want to be ready in a back off approach. Example testing a network connection is active, a service is started, or a some other catalyst to kick off the next step.

You can accomplish the user login trigger with numerous methods:

  1. Local gpedit user configuration scripts
  2. AD gpo
  3. Scheduled tasks
  4. Boxstarter
  5. User RunOnce keys
  6. Myriad of other approaches

Restart-Computer in powershell will bounce the box as will shutdown command.

HTH.