diff --git a/utils/install-basic-software.ps1 b/utils/install-basic-software.ps1 index 8257d2d..a7341bd 100644 --- a/utils/install-basic-software.ps1 +++ b/utils/install-basic-software.ps1 @@ -32,6 +32,14 @@ $packages = @( echo "Setting up Chocolatey software package manager" Get-PackageProvider -Name chocolatey -Force +echo "Creating daily task to automatically upgrade Chocolatey packages" +# adapted from https://blogs.technet.microsoft.com/heyscriptingguy/2013/11/23/using-scheduled-tasks-and-scheduled-jobs-in-powershell/ +$taskName = "Chocolatey Daily Upgrade" +$taskAction = New-ScheduledTaskAction –Execute C:\programdata\chocolatey\choco.exe -Argument "upgrade all -y" +$taskTrigger = New-ScheduledTaskTrigger -At 2am -Daily +$taskUser = "Admin" +Register-ScheduledTask –TaskName $taskName -Action $taskAction –Trigger $taskTrigger -User $taskUser + echo "Installing Packages" Install-Package -Name $packages -Force -ProviderName chocolatey