Update Windows software daily with PowerShell, Chocolatey, and Task Scheduler
Developers work hard so we can be lazy (about the boring tasks). :)
- Windows Setup for Developers
- Windows File Management
- Basic Tools for Web Development
- Git Started on Windows
Chocolatey offers a convenient way to install software packages. To upgrade all, open a PowerShell window and run:
choco upgrade all -y
refreshenv
Avoid typing (as easy as it is), by creating a PowerShell script named daily.ps1.
Clone (or fork and clone) this repo down to your local machine. Open a PowerShell as Admin in this folder and run:
.\daily.ps1
Alternatively, create a DOS command to run PowerShell and call the script from anywhere. Open a Windows Command Window as Administrator (hit Windows Start key, type CMD, then click the menu option to run as Administrator) in this folder and run:
PowerShell -File ".\daily.ps1"
Now use Windows Explorer to get the full path to your script and test the command. For example (replace with your path):
PowerShell.exe -NoExit -File "C:\Users\dcase\Documents\denisecase\windows-daily-software-upgrade\daily.ps1"
Verify the command is correct before continuing.
Be sure to use your path in the arguments below:
- Open Task Scheduler by hitting Windows Start key, and typing Task Scheduler until it appears. Click to open.
- In Actions Pane, click 'Create Basic Task'.
- In Name, type "_Daily Choco Upgrade", click 'Next'.
- Daily is selected, so click 'Next'.
- Set Start time, e.g., 8:00:00 AM, click 'Next'.
- 'Start a program' is selected, so click 'Next'.
- In Program/script:, type
PowerShell.exe
. - In Add arguments (optional), type
-NoExit -File "C:\Users\dcase\Documents\denisecase\windows-daily-software-upgrade\daily.ps1"
- Click 'Next'.
- Click 'Finish'.
- Open Task Scheduler, click "Task Scheduler Library" and under Name, find the task and double-click to open.
- Check the option "Run with highest privileges" and click OK.
- With the task still highlighted, under 'Selected Item' in the lower right, click 'Run'.
You can access the scheduled task to delete it, change the scheduled time, or make other modifications.