Unpacking Software Livestream

Join our monthly Unpacking Software livestream to hear about the latest news, chat and opinion on packaging, software deployment and lifecycle management!

Learn More

Chocolatey Product Spotlight

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You'll have a chance to have your questions answered in a live Ask Me Anything format.

Learn More

Chocolatey Coding Livestream

Join us for the Chocolatey Coding Livestream, where members of our team dive into the heart of open source development by coding live on various Chocolatey projects. Tune in to witness real-time coding, ask questions, and gain insights into the world of package management. Don't miss this opportunity to engage with our team and contribute to the future of Chocolatey!

Learn More

Calling All Chocolatiers! Whipping Up Windows Automation with Chocolatey Central Management

Webinar from
Wednesday, 17 January 2024

We are delighted to announce the release of Chocolatey Central Management v0.12.0, featuring seamless Deployment Plan creation, time-saving duplications, insightful Group Details, an upgraded Dashboard, bug fixes, user interface polishing, and refined documentation. As an added bonus we'll have members of our Solutions Engineering team on-hand to dive into some interesting ways you can leverage the new features available!

Watch On-Demand
Chocolatey Community Coffee Break

Join the Chocolatey Team as we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.

Watch The Replays
Chocolatey and Intune Overview

Webinar Replay from
Wednesday, 30 March 2022

At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Watch On-Demand
Chocolatey For Business. In Azure. In One Click.

Livestream from
Thursday, 9 June 2022

Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Watch On-Demand
The Future of Chocolatey CLI

Livestream from
Thursday, 04 August 2022

Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We'll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Watch On-Demand
Hacktoberfest Tuesdays 2022

Livestreams from
October 2022

For Hacktoberfest, Chocolatey ran a livestream every Tuesday! Re-watch Cory, James, Gary, and Rain as they share knowledge on how to contribute to open-source projects such as Chocolatey CLI.

Watch On-Demand

Downloads:

286,944

Downloads of v 0.0.6:

141,794

Last Update:

16 Mar 2021

Package Maintainer(s):

Software Author(s):

  • bcurran3

Tags:

bcurran3 unofficial choco upgrade all cup config schtasks scheduled task

(unofficial) Choco Upgrade All at (Task)

This is not the latest version of (unofficial) Choco Upgrade All at (Task) available.

  • 1
  • 2
  • 3

0.0.6 | Updated: 16 Mar 2021

Downloads:

286,944

Downloads of v 0.0.6:

141,794

Maintainer(s):

Software Author(s):

  • bcurran3

(unofficial) Choco Upgrade All at (Task) 0.0.6

This is not the latest version of (unofficial) Choco Upgrade All at (Task) available.

Legal Disclaimer: Neither this package nor Chocolatey Software, Inc. are affiliated with or endorsed by bcurran3. The inclusion of bcurran3 trademark(s), if any, upon this webpage is solely to identify bcurran3 goods or services and not for commercial purposes.

  • 1
  • 2
  • 3

Some Checks Have Failed or Are Not Yet Complete

Not All Tests Have Passed


Validation Testing Passed


Verification Testing Passed

Details

Scan Testing Resulted in Investigate

Details
Learn More

Deployment Method: Individual Install, Upgrade, & Uninstall

To install (unofficial) Choco Upgrade All at (Task), run the following command from the command line or from PowerShell:

>

To upgrade (unofficial) Choco Upgrade All at (Task), run the following command from the command line or from PowerShell:

>

To uninstall (unofficial) Choco Upgrade All at (Task), run the following command from the command line or from PowerShell:

>

Deployment Method:

NOTE

This applies to both open source and commercial editions of Chocolatey.

1. Enter Your Internal Repository Url

(this should look similar to https://community.chocolatey.org/api/v2/)


2. Setup Your Environment

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

2. Get the package into your environment

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Copy Your Script

choco upgrade choco-upgrade-all-at -y --source="'INTERNAL REPO URL'" --version="'0.0.6'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:


choco upgrade choco-upgrade-all-at -y --source="'INTERNAL REPO URL'" --version="'0.0.6'" 
$exitCode = $LASTEXITCODE

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0
}

Exit $exitCode

- name: Install choco-upgrade-all-at
  win_chocolatey:
    name: choco-upgrade-all-at
    version: '0.0.6'
    source: INTERNAL REPO URL
    state: present

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.


chocolatey_package 'choco-upgrade-all-at' do
  action    :install
  source   'INTERNAL REPO URL'
  version  '0.0.6'
end

See docs at https://docs.chef.io/resource_chocolatey_package.html.


cChocoPackageInstaller choco-upgrade-all-at
{
    Name     = "choco-upgrade-all-at"
    Version  = "0.0.6"
    Source   = "INTERNAL REPO URL"
}

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.


package { 'choco-upgrade-all-at':
  ensure   => '0.0.6',
  provider => 'chocolatey',
  source   => 'INTERNAL REPO URL',
}

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.


4. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

Package Approved

This package was approved by moderator TheCakeIsNaOH on 19 Mar 2021.

Description


choco://choco-upgrade-all-at
To use choco:// protocol URLs, install (unofficial) choco:// Protocol support


DO YOU WANT TO UPGRADE YOUR CHOCOLATEY PACKAGES EVERY DAY? OR MAYBE EVERY WEEK?

YOU JUST FOUND THE EASY WAY!

This package creates a Windows Scheduled Task to run "choco upgrade all -y" with enhanced options at a time and frequency you specify. And because sometimes package installations go wrong... it will also create a Windows Scheduled Task to run "taskkill /im choco.exe /f /t" to stop the Chocolatey (choco.exe) process and all child processes at a time you specify.

This package is a pseudo replacement for choco-upgrade-all-at-startup.

USAGE INSTRUCTIONS:

  • You can do nothing and it will run at the set it and forget it time. :)
  • You can manually run choco-upgrade-all from Command Prompt or PowerShell.
  • You can manually run choco-install packagename from Command Prompt or PowerShell to install packages with your choco-upgrade-all-at settings.

INSTALL INSTRUCTIONS:

You can install choco-upgrade-all-at with multiple parameters to make it run "choco upgrade all -y" daily or weekly (Monthly is just not often enough!) at your preferred time. If you enter no parameters at all, choco-upgrade-all-at will default to run "choco upgrade all -y" at 2 AM every day and abort the process at 4 AM. When entering the TIME and ABORTTIME parameters, use "Military Time." When entering the DAILY or WEEKLY parameter you can actually use anything, "yes" just makes sense though. When using the WEEKLY parameter, DAYS are entered as MON, TUE, WED, THU, FRI, SAT, or SUN. Not entering the correct format will fail the install. Please see the examples below.

INSTALL EXAMPLES:

  • choco install choco-upgrade-all-at --params "'/TIME:23:00'" - runs "choco upgrade all -y" daily (default) at 11 PM and aborts at 1 AM, ABORTTIME defaults to +2 hours.
  • choco install choco-upgrade-all-at --params "'/DAILY:yes /TIME:04:00 /ABORTTIME:08:00'" - runs "choco upgrade all -y" daily at 4 AM and aborts it at 8 AM.
  • choco install choco-upgrade-all-at --params "'/WEEKLY:yes /DAY:SUN /TIME:01:00'" - runs "choco upgrade all -y" every Sunday at 1 AM and aborts at 3 AM.
  • choco install choco-upgrade-all-at --params "'/NOTASK:true'" - installs choco-upgrade-all.ps1/bat without the scheduled task.

POST INSTALL CONFIGURATION:

  • To enable enhanced options such as automatically deleting newly installed Desktop and Start Menu icons, running pre and/or post processing scripts, or setting a default user profile, edit c:\tools\BCURRAN3\choco-upgrade-all.config or run choco-upgrade-all -EditConfig

SEE THE RELEASE NOTES FOR MORE INFORMATION

PACKAGE NOTES


tools\choco-install.ps1
$ErrorActionPreference = 'Stop'
#Requires -RunAsAdministrator
# choco-install.ps1 Copyleft 2021 by Bill Curran AKA BCURRAN3
# LICENSE: GNU GPL v3 - https://www.gnu.org/licenses/gpl.html
# Open a GitHub issue at https://github.com/bcurran3/ChocolateyPackages/issues if you have suggestions for improvement.

Write-Host "Choco-Install.ps1 (03/15/2021) - Install Chocolatey packages with enhanced options" -Foreground White
Write-Host "Copyleft 2021 Bill Curran ([email protected]) - free for personal and commercial use`n" -Foreground White

# Verify ChocolateyToolsLocation was created by Get-ToolsLocation during install and is in the environment
if (!($env:ChocolateyToolsLocation)) {$env:ChocolateyToolsLocation = "$env:SystemDrive\tools"}
if (!(Test-Path "$env:ChocolateyToolsLocation\BCURRAN3\choco-upgrade-all.config")) {Write-Warning "Configuration not found. Please re-install.";throw}

# Import preferences from choco-upgrade-all.config
[xml]$ConfigFile = Get-Content "$env:ChocolateyToolsLocation\BCURRAN3\choco-upgrade-all.config"
$ConfigArguments         = $ConfigFile.Settings.Preferences.ConfigArguments
$DebugLogging            = $ConfigFile.Settings.Preferences.DebugLogging
$DeleteNewDesktopIcons   = $ConfigFile.Settings.Preferences.DeleteNewDesktopIcons
$DeleteNewStartMenuIcons = $ConfigFile.Settings.Preferences.DeleteNewStartMenuIcons
$PreProcessScript        = $ConfigFile.Settings.Preferences.PreProcessScript
$PostProcessScript       = $ConfigFile.Settings.Preferences.PostProcessScript

if (Test-Path $env:ChocolateyInstall\bin\notepad++.exe){
     $Editor="notepad++.exe"
    } else {
      $Editor="notepad.exe"
    }

if ($args -eq "-EditConfig") {
    Write-Host "  ** Editing contents of choco-upgrade-all.config." -Foreground Magenta
	&$Editor "$env:ChocolateyToolsLocation\BCURRAN3\choco-upgrade-all.config"
	return
}

# Run pre-processor if configured
if ($PreProcessScript){&$PreProcessScript}

# get existing Desktop and Start Menu icons
$UserDesktopIconsPre     = Get-ChildItem -Path "$env:USERPROFILE\Desktop\*.lnk"
$PublicDesktopIconsPre   = Get-ChildItem -Path "$env:PUBLIC\Desktop\*.lnk"
$UserStartMenuIconsPre   = Get-ChildItem -Path "$env:AppData\Microsoft\Windows\Start Menu\Programs\*.lnk" -Recurse
$PublicStartMenuIconsPre = Get-ChildItem -Path "$env:ProgramData\Microsoft\Windows\Start Menu\*.lnk" -Recurse

# Do the Chocolatey Humpty Hump
Start-Process -NoNewWindow -FilePath "$env:ChocolateyInstall\bin\choco.exe" -ArgumentList "install -y $ConfigArguments $args" -Wait

# get existing and new Desktop and Start Menu icons
$UserDesktopIconsPost     = Get-ChildItem -Path "$env:USERPROFILE\Desktop\*.lnk"
$PublicDesktopIconsPost   = Get-ChildItem -Path "$env:PUBLIC\Desktop\*.lnk"
$UserStartMenuIconsPost   = Get-ChildItem -Path "$env:AppData\Microsoft\Windows\Start Menu\Programs\*.lnk" -Recurse
$PublicStartMenuIconsPost = Get-ChildItem -Path "$env:ProgramData\Microsoft\Windows\Start Menu\*.lnk" -Recurse

# Delete new Desktop icons if configured to do so
if ($DeleteNewDesktopIcons -eq 'True'){
   $IconsNew = Compare-Object -ReferenceObject ($UserDesktopIconsPre) -DifferenceObject ($UserDesktopIconsPost) -PassThru
   if ($IconsNew -ne $null) { del $IconsNew.fullname }
   $IconsNew = Compare-Object -ReferenceObject ($PublicDesktopIconsPre) -DifferenceObject ($PublicDesktopIconsPost) -PassThru
   if ($IconsNew -ne $null) { del $IconsNew.fullname }
   }
# Delete new Start Menu icons if configured to do so
if ($DeleteNewStartMenuIcons -eq 'True'){
   $IconsNew = Compare-Object -ReferenceObject ($UserStartMenuIconsPre) -DifferenceObject ($UserStartMenuIconsPost) -PassThru
   if ($IconsNew -ne $null) { del $IconsNew.fullname }
   $IconsNew = Compare-Object -ReferenceObject ($PublicStartMenuIconsPre) -DifferenceObject ($PublicStartMenuIconsPost) -PassThru
   if ($IconsNew -ne $null) { del $IconsNew.fullname }
   }

# Run post-processor if configured
if ($PostProcessScript){&$PostProcessScript}

Write-Host "Found Choco-Install.ps1 useful?" -ForegroundColor White
Write-Host "Buy me a beer at https://www.paypal.me/bcurran3donations" -ForegroundColor White
Write-Host "Become a patron at https://www.patreon.com/bcurran3" -ForegroundColor White
tools\choco-upgrade-all.config
<?xml version="1.0"?>
<Settings>
  <Preferences>
    <ConfigArguments></ConfigArguments>
    <DebugLogging>false</DebugLogging>
    <DefaultUserProfile></DefaultUserProfile>
    <DeleteNewDesktopIcons>false</DeleteNewDesktopIcons>  
    <DeleteNewStartMenuIcons>false</DeleteNewStartMenuIcons>
    <StopCUAAfter></StopCUAAfter>
    <PreProcessScript></PreProcessScript>
    <PostProcessScript></PostProcessScript>
  </Preferences>
</Settings>

<!--
#######################################################################################################################
# NOTE: All settings are disabled by default
# LEGEND:
# * ConfigArguments    - Additional options and switches to pass to choco.exe; e.g. Run choco upgrade /? to view options.
# * DebugLogging       - (True/False) Extra logging - EXPERIMENTAL
# * DefaultUserProfile - Default user profile to use when running as scheduled task; e.g. William, Robert, Benjamin (Look at C:\Users)
# * DeleteNewDesktopIcons   - (True/False) Delete newly created Desktop icons, user and public, after choco upgrade all
# * DeleteNewStartMenuIcons - (True/False) Delete newly created Start Menu icons, user and public, after choco upgrade all
# * StopCUAAfter       - Not implemented yet
# * PreProcessScript   - Script to run before choco upgrade all; e.g. c:\scripts\beforechoco.bat
# * PostProcessScript  - Script to run after choco upgrade all; e.g. c:\scripts\afterchoco.bat
#######################################################################################################################
-->
tools\choco-upgrade-all.ps1
$ErrorActionPreference = 'Stop'
#Requires -RunAsAdministrator
# choco-upgrade-all.ps1 Copyleft 2021 by Bill Curran AKA BCURRAN3
# LICENSE: GNU GPL v3 - https://www.gnu.org/licenses/gpl.html
# Open a GitHub issue at https://github.com/bcurran3/ChocolateyPackages/issues if you have suggestions for improvement.

Write-Host "Choco-Upgrade-All.ps1 (03/15/2021) - Upgrade your Chocolatey packages with enhanced options" -Foreground White
Write-Host "Copyleft 2021 Bill Curran ([email protected]) - free for personal and commercial use`n" -Foreground White

# Verify ChocolateyToolsLocation was created by Get-ToolsLocation during install and is in the environment
if (!($env:ChocolateyToolsLocation)) {$env:ChocolateyToolsLocation = "$env:SystemDrive\tools"}
if (!(Test-Path "$env:ChocolateyToolsLocation\BCURRAN3\choco-upgrade-all.config")) {Write-Warning "Configuration not found. Please re-install.";throw}

# Import preferences from choco-upgrade-all.config
[xml]$ConfigFile = Get-Content "$env:ChocolateyToolsLocation\BCURRAN3\choco-upgrade-all.config"
$ConfigArguments         = $ConfigFile.Settings.Preferences.ConfigArguments
$DebugLogging            = $ConfigFile.Settings.Preferences.DebugLogging
$DefaultUserProfile      = $ConfigFile.Settings.Preferences.DefaultUserProfile
$DeleteNewDesktopIcons   = $ConfigFile.Settings.Preferences.DeleteNewDesktopIcons
$DeleteNewStartMenuIcons = $ConfigFile.Settings.Preferences.DeleteNewStartMenuIcons
#$StopCUAAfter            = $ConfigFile.Settings.Preferences.StopCUAAfter            # Not implemented yet
$PreProcessScript        = $ConfigFile.Settings.Preferences.PreProcessScript
$PostProcessScript       = $ConfigFile.Settings.Preferences.PostProcessScript

if (Test-Path $env:ChocolateyInstall\bin\notepad++.exe){
     $Editor="notepad++.exe"
    } else {
      $Editor="notepad.exe"
    }

if ($args -eq "-EditConfig") {
    Write-Host "  ** Editing contents of choco-upgrade-all.config." -Foreground Magenta
	&$Editor "$env:ChocolateyToolsLocation\BCURRAN3\choco-upgrade-all.config"
	return
}

# Minor logging
if (Test-Path "$env:ChocolateyToolsLocation\BCURRAN3\choco-upgrade-all.log"){
   $LogSize=(Get-ChildItem -Path "$env:ChocolateyToolsLocation\BCURRAN3\choco-upgrade-all.log").length
   if ($LogSize -gt 51200) {
	   Remove-Item "$env:ChocolateyToolsLocation\BCURRAN3\choco-upgrade-all.log"
	   Write-Output "$(Get-Date) Choco-Upgrade-All Deleted log file" >> "$env:ChocolateyToolsLocation\BCURRAN3\choco-upgrade-all.log"
	  }
  }
if ($DebugLogging -eq 'True'){
	Start-Transcript -Path $env:ChocolateyToolsLocation\BCURRAN3\choco-upgrade-all.log -Append
   } else {
     Write-Output "$(Get-Date) Choco-Upgrade-All STARTED" >> "$env:ChocolateyToolsLocation\BCURRAN3\choco-upgrade-all.log"
   }

# Run pre-processor if configured
if ($PreProcessScript){&$PreProcessScript}

# When running as SYSTEM (scheduled task) use the $DefaultUserProfile as the default user profile if defined
if ($DefaultUserProfile) {
	$env:USERPROFILE="$env:SystemDrive\Users\$DefaultUserProfile"
	$env:APPDATA="$env:SystemDrive\Users\$DefaultUserProfile\AppData\Roaming"
	}

# get existing Desktop and Start Menu icons
if (Test-Path "$env:USERPROFILE\Desktop") {$UserDesktopIconsPre = Get-ChildItem -Path "$env:USERPROFILE\Desktop\*.lnk"}
if (Test-Path "$env:PUBLIC\Desktop") {$PublicDesktopIconsPre = Get-ChildItem -Path "$env:PUBLIC\Desktop\*.lnk"}
if (Test-Path "$env:APPDATA\Microsoft\Windows\Start Menu\Programs") {$UserStartMenuIconsPre = Get-ChildItem -Path "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\*.lnk" -Recurse}
if (Test-Path "$env:ProgramData\Microsoft\Windows\Start Menu") {$PublicStartMenuIconsPre = Get-ChildItem -Path "$env:ProgramData\Microsoft\Windows\Start Menu\*.lnk" -Recurse}

# Do the Chocolatey Humpty Hump
Start-Process -NoNewWindow -FilePath "$env:ChocolateyInstall\bin\choco.exe" -ArgumentList "upgrade all -y $ConfigArguments $args" -Wait

# Get existing and new Desktop and Start Menu icons
if (Test-Path "$env:USERPROFILE\Desktop") {$UserDesktopIconsPost = Get-ChildItem -Path "$env:USERPROFILE\Desktop\*.lnk"}
if (Test-Path "$env:PUBLIC\Desktop")  {$PublicDesktopIconsPost = Get-ChildItem -Path "$env:PUBLIC\Desktop\*.lnk"}
if (Test-Path "$env:APPDATA\Microsoft\Windows\Start Menu\Programs") {$UserStartMenuIconsPost = Get-ChildItem -Path "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\*.lnk" -Recurse}
if (Test-Path "$env:ProgramData\Microsoft\Windows\Start Menu") {$PublicStartMenuIconsPost = Get-ChildItem -Path "$env:ProgramData\Microsoft\Windows\Start Menu\*.lnk" -Recurse}

# Delete new Desktop icons if configured to do so
if ($DeleteNewDesktopIcons -eq 'True'){
   $IconsNew = Compare-Object -ReferenceObject ($UserDesktopIconsPre) -DifferenceObject ($UserDesktopIconsPost) -PassThru
   if ($IconsNew -ne $null) { del $IconsNew.fullname }
   $IconsNew = Compare-Object -ReferenceObject ($PublicDesktopIconsPre) -DifferenceObject ($PublicDesktopIconsPost) -PassThru
   if ($IconsNew -ne $null) { del $IconsNew.fullname }
   }
# Delete new Start Menu icons if configured to do so
if ($DeleteNewStartMenuIcons -eq 'True'){
   $IconsNew = Compare-Object -ReferenceObject ($UserStartMenuIconsPre) -DifferenceObject ($UserStartMenuIconsPost) -PassThru
   if ($IconsNew -ne $null) { del $IconsNew.fullname }
   $IconsNew = Compare-Object -ReferenceObject ($PublicStartMenuIconsPre) -DifferenceObject ($PublicStartMenuIconsPost) -PassThru
   if ($IconsNew -ne $null) { del $IconsNew.fullname }
   }

# Run post-processor if configured
if ($PostProcessScript){&$PostProcessScript}

Write-Host "Found Choco-Upgrade-All.ps1 useful?" -ForegroundColor White
Write-Host "Buy me a beer at https://www.paypal.me/bcurran3donations" -ForegroundColor White
Write-Host "Become a patron at https://www.patreon.com/bcurran3" -ForegroundColor White
if ($DebugLogging -eq 'True'){
    Stop-Transcript
   } else {
# Minor logging
	 Write-Output "$(Get-Date) Choco-Upgrade-All FINISHED" >> "$env:ChocolateyToolsLocation\BCURRAN3\choco-upgrade-all.log"
   }
tools\chocolateyinstall.ps1
$ErrorActionPreference = 'Stop'
$packageName  = 'choco-upgrade-all-at'
$toolsDir     = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$pp           = Get-PackageParameters
$scriptDir    = "$(Get-ToolsLocation)\BCURRAN3"
$script       = 'choco-upgrade-all.ps1'
$ScriptConfig = 'choco-upgrade-all.config'

# New storage location moving forward for all my Chocolatey scripts
if (!(Test-Path "$ENV:ChocolateyToolsLocation\BCURRAN3")) { New-Item -Path "$ENV:ChocolateyToolsLocation" -Name "BCURRAN3" -ItemType "Directory" | Out-Null }

# Move new files and support files (if applicable)
Move-Item "$toolsDir\$script" "$scriptDir" -Force -ErrorAction SilentlyContinue
Move-Item "$toolsDir\choco-install.ps1" "$scriptDir" -Force -ErrorAction SilentlyContinue
if (!(Test-Path "$scriptDir\$ScriptConfig")) { Move-Item "$toolsDir\$ScriptConfig" "$scriptDir" -Force }

# Create "shim"
Install-ChocolateyPowershellCommand -PackageName 'choco-upgrade-all' -PSFileFullPath "$scriptDir\$script"
Install-ChocolateyPowershellCommand -PackageName 'choco-install' -PSFileFullPath "$scriptDir\choco-install.ps1"

# Cleanup
Remove-Item "$toolsDir\choco-upgrade-all.*" -Force -ErrorAction SilentlyContinue | Out-Null
if ($ENV:Path -NotMatch "BCURRAN3"){ Install-ChocolateyPath "$scriptDir" "Machine" ; refreshenv }

# delete old task name < v0.0.4 if it exists
$ErrorActionPreference = 'Continue'
$GotTask = (&schtasks /QUERY /TN "choco upgrade all at") 2> $null
$ErrorActionPreference = 'Stop'
if ($GotTask -ne $null){
     &SchTasks /DELETE /TN "choco upgrade all at" /F 
   }

$ErrorActionPreference = 'Continue'
$GotTask      = (&schtasks /QUERY /TN "choco-upgrade-all-at") 2> $null
$ErrorActionPreference = 'Stop'

# Change task to run new batch file and keep other existing settings (v0.0.0.5 to v0.0.0.6 upgrade)
if ($GotTask -ne $null){
     &SchTasks /CHANGE /TN "choco-upgrade-all-at" /TR "%ChocolateyInstall%\bin\choco-upgrade-all.bat"
   }

# check if choco-ugrade-all-at task already exists and exit if so
if ($GotTask -ne $null){
     Write-Host "  ** Existing choco-upgrade-all-at scheduled task found. Keeping existing scheduled task.`n     If you want to change the task runtime or abort time, uninstall and reinstall the package." -Foreground Magenta 
     exit
   }

# exit if a scheduled task is not wanted
if ($pp["NOTASK"] -eq 'true' -or $pp["NOSCHEDULE"] -eq 'true'){
       Write-Host "  ** NOTASK or NOSCHEDULE specified, not installing scheduled task." -Foreground Magenta
	   exit
   }

# begin setup of scheduled task if one doesn't exist
Write-Host "" 
Write-Host "CHOCO-UPGRADE-ALL-AT Summary:" -Foreground Magenta

if ($pp["USER"] -eq $null -or $pp["USER"] -eq ''){
       Write-Host "  ** USER NOT specified, defaulting to SYSTEM." -Foreground Magenta
	   $RunAsUser = 'SYSTEM'
     } else {
	   if ($pp["USER"] -eq 'CURRENTUSER'){
	       $RunAsUser = $env:USERNAME
	       } else {
	         $RunAsUser = $pp["USER"]
	         Write-Host " ** USER specified as $RunAsUser." -Foreground Magenta
            } 
	}

if ($pp["TIME"] -eq $null -or $pp["TIME"] -eq ''){
	   $RunTime = "02:00"
       Write-Host "  ** TIME NOT specified, defaulting to $RunTime." -Foreground Magenta
     } else {
	   $RunTime = $pp["TIME"]
	   Write-Host "  ** TIME specified as $RunTime." -Foreground Magenta
      } 

if ($pp["ABORTTIME"] -eq $null -or $pp["ABORTTIME"] -eq ''){
      $AbortTime = (Get-Date $RunTime).AddHours(2).ToString("HH:mm")
      Write-Host "  ** ABORTTIME NOT specified, defaulting to $AbortTime." -Foreground Magenta
    } else {
	  $AbortTime = $pp["ABORTTIME"]
	  Write-Host "  ** ABORTTIME specified as $AbortTime." -Foreground Magenta
    }
	  
if (($pp["DAILY"] -eq $null -or $pp["DAILY"] -eq '') -and ($pp["WEEKLY"] -eq $null -or $pp["WEEKLY"] -eq '')){
      Write-Host "  ** DAILY or WEEKLY NOT specified, defaulting to DAILY." -Foreground Magenta
      SchTasks /CREATE /SC DAILY /RU $RunAsUser /RL HIGHEST /TN choco-upgrade-all-at /TR "%ChocolateyInstall%\bin\choco-upgrade-all.bat" /ST $RunTime /F
	  SchTasks /QUERY /TN "choco-upgrade-all-at"
	  SchTasks /CREATE /SC DAILY /RU $RunAsUser /RL HIGHEST /TN choco-upgrade-all-at-abort /TR "taskkill /im choco.exe /f /t" /ST $AbortTime /F
      SchTasks /QUERY /TN "choco-upgrade-all-at-abort"
	  Start-Sleep -s 10
 	  exit
    }
		  
if ($pp["DAILY"] -eq $null -or $pp["DAILY"] -eq ''){
       Write-Host "  ** DAILY NOT specified." -Foreground Magenta
     } else {
	   Write-Host "  ** DAILY specified." -Foreground Magenta
	   SchTasks /CREATE /SC DAILY /RU $RunAsUser /RL HIGHEST /TN choco-upgrade-all-at /TR "%ChocolateyInstall%\bin\choco-upgrade-all.bat" /ST $RunTime /F
	   SchTasks /QUERY /TN "choco-upgrade-all-at"
	   SchTasks /CREATE /SC DAILY /RU $RunAsUser /RL HIGHEST /TN choco-upgrade-all-at-abort /TR "taskkill /im choco.exe /f /t" /ST $AbortTime /F
       SchTasks /QUERY /TN "choco-upgrade-all-at-abort"
	   Start-Sleep -s 10
	   exit
	   }  
		  
if ($pp["WEEKLY"] -eq $null -or $pp["WEEKLY"] -eq ''){
       Write-Host "  ** WEEKLY NOT specified." -Foreground Magenta
     } else {
	   Write-Host "  ** WEEKLY specified." -Foreground Magenta
       if ($pp["DAY"] -eq $null -or $pp["DAY"] -eq ''){
            Write-Host " * DAY NOT specified, defaulting to SUNDAY." -Foreground Magenta
            SchTasks /CREATE /SC WEEKLY /D SUN /RU $RunAsUser /RL HIGHEST /TN choco-upgrade-all-at /TR "%ChocolateyInstall%\bin\choco-upgrade-all.bat" /ST $RunTime /F
		    SchTasks /QUERY /TN "choco-upgrade-all-at"
			SchTasks /CREATE /SC WEEKLY /D SUN /RU $RunAsUser /RL HIGHEST /TN choco-upgrade-all-at-abort /TR "taskkill /im choco.exe /f /t" /ST $AbortTime /F
            SchTasks /QUERY /TN "choco-upgrade-all-at-abort"
          } else {
		    $RunDay = $pp["DAY"]
            Write-Host "  ** DAY specified as $RunDay." -Foreground Magenta
		    SchTasks /CREATE /SC WEEKLY /D $pp["DAY"] /RU $RunAsUser /RL HIGHEST /TN choco-upgrade-all-at /TR "%ChocolateyInstall%\bin\choco-upgrade-all.bat" /ST $RunTime /F
		    SchTasks /QUERY /TN "choco-upgrade-all-at"
            SchTasks /CREATE /SC WEEKLY /D $pp["DAY"] /RU $RunAsUser /RL HIGHEST /TN choco-upgrade-all-at-abort /TR "taskkill /im choco.exe /f /t" /ST $AbortTime /F
            SchTasks /QUERY /TN "choco-upgrade-all-at-abort"
	      }
		}
Start-Sleep -s 10
tools\chocolateyuninstall.ps1
$ErrorActionPreference = 'Stop'
$packageName = 'choco-upgrade-all-at'
$scriptDir   = "$(Get-ToolsLocation)\BCURRAN3"

SchTasks /Delete /TN choco-upgrade-all-at /F
SchTasks /Delete /TN choco-upgrade-all-at-abort /F

if (!(Test-Path "$ENV:ChocolateyInstall\lib\choco-upgrade-all-at-startup")) {
    Remove-Item "$ENV:ChocolateyInstall\bin\choco-upgrade-all.bat" -Force -ErrorAction SilentlyContinue
    Remove-Item "$ENV:ChocolateyInstall\bin\choco-install.bat" -Force -ErrorAction SilentlyContinue
    Remove-Item "$scriptDir\choco-upgrade-all.*" -Force -ErrorAction SilentlyContinue | Out-Null
    if (!(Get-ChildItem -Path "$ENV:ChocolateyToolsLocation\BCURRAN3" | Measure-Object | %{$_.Count})) {
        $ENV:Path.Replace("$ChocolateyToolsLocation\BCURRAN3","") | Out-Null
        Remove-Item "$ENV:ChocolateyToolsLocation\BCURRAN3" | Out-Null
    }
}

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Add to Builder Version Downloads Last Updated Status
(unofficial) Choco Upgrade All at (Task) 0.0.6 141794 Tuesday, March 16, 2021 Approved
(unofficial) Choco Upgrade All at (Task) 0.0.5 44556 Sunday, May 6, 2018 Approved
(unofficial) Choco Upgrade All at (Task) 0.0.4.1 715 Tuesday, April 24, 2018 Approved
(unofficial) Choco Upgrade All at (Task) 0.0.4 358 Sunday, April 22, 2018 Approved
(unofficial) choco upgrade all at (Task) 0.0.3 2323 Friday, August 18, 2017 Approved
choco (unofficial) upgrade all at (midnight?) (Task) 0.0.2 626 Wednesday, May 24, 2017 Approved

A NOTE ON DEFAULTS:

  • If you don't specify any parameters, choco-upgrade-all-at defaults to running daily at 2AM and aborting at 4 AM. (My preference!)
  • Not specifying a TIME will always default to 2 AM. Not specifying an ABORTTIME will always default to TIME +2 hours.
  • When WEEKLY is specified but a DAY isn't, default first run will be a week from installation date; i.e. next week on whatever day of the week you installed the package.

IF UPGRADING FROM A VERSION EARLIER THAN 0.0.4:

Your old scheduled task will be deleted and replaced with default (mentioned above) parameters. To ensure choco-upgrade-all-at runs when you want it to, you should uninstall and reinstall with the settings you prefer.
I have not tested with useRememberedArgumentsForUpgrades, you might get daily still with your preferred time.

IF UPGRADING FROM VERSION 0.0.4 or 0.0.4.1:

You're old scheduled task will be kept. You will need to uninstall and re-install to take advantage of the new ABORTTIME feature.

IF UPGRADING FROM A VERSION EARLIER THAN 0.0.6:

It is HIGHLY advised you read the Release Notes/ChangeLog and run choco-upgrade-all -EditConfig to enable the new enhanced features.

CHANGELOG:

  • 0.0.6 - Fixed wrong command in scheduled task. Added option to automatically delete newly created Desktop and Start Menu icons. Added option to run pre and post processing scripts. Added configurable arguments. Added ability to set default user profile. Edit C:\tools\BCURRAN3\choco-upgrade-all.config to enable the enhanced options. You can now run choco-upgrade-all from the command line to take advantage of these enhanced options. Added choco-install script which also uses the enhanced options. Added -EditConfig option to edit the config file. Changed default ABORTTIME to be TIME +2 hours.
  • 0.0.5 - Added abort stuck upgrades feature. "Um, why do I want this?" you're thinking. You want this because sometimes background package installations go wrong. "Go wrong?" you're thinking. Yes, there are a couple scenarios where a Chocolatey package installation/upgrade can hang: if a package needs input, if an AutoHotKey or AutoIt script fails, and all those times a program installer pops up a browser window to tell you "Thank you." These scenarios leave hung processes in the background with no way for you to easily interact with them (They're in the background!). This means they are taking up memory resources for no reason and might cause problems installing other packages or programs. If you knew there was a hung process, you could manually stop the task, but who wants to check every day? This will automate checking and stopping any Chocolatey package hung tasks at the time you specify. I recommend setting it to a time an hour or two after you run your updates.
  • 0.0.4.1 - Fixed compatibility with Windows 7 and 8 machines by using SchTasks.exe for everything and not using the Windows 10/Server 2016 only Get-ScheduledTask cmdlet. Removed PowerShell v4/v5 dependency.
  • 0.0.4 - Added option to run weekly.

ROADMAP

    • Move the ABORTTIME feature into the config file; i.e. Start-Job, Start-Sleep ABORTIME, Stop-Job
Discussion for the (unofficial) Choco Upgrade All at (Task) Package

Ground Rules:

  • This discussion is only about (unofficial) Choco Upgrade All at (Task) and the (unofficial) Choco Upgrade All at (Task) package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or (unofficial) Choco Upgrade All at (Task), or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus