Create a Scheduled Task to keep all Chocolatey Packages up-to-date

Rebuilding your PC is always a drag, even with useful utilities like Ninite.

I recently created a PowerShell DSC script that I can use whenever I need to rebuild my PC. As part of that, I used the cChoco provider to automatically install applications using Chocolatey. I’ll be writing a blog post with more details shortly.

That’s a great way to get the applications installed, but not for keeping them up-to-date. Chocolatey allows you to run ‘choco upgrade all’ manually to do this:

Command prompt window showing the results of a 'choco upgrade all -y' command

Rather than manually create the scheduled task to automate this, I created this short PowerShell script:

# See if choco.exe is available. If not, stop execution
$chocoCmd = Get-Command Name 'choco' ErrorAction SilentlyContinue WarningAction SilentlyContinue | Select-Object ExpandProperty Source
if ($chocoCmd -eq $null) { break }
# Settings for the scheduled task
$taskAction = New-ScheduledTaskAction –Execute $chocoCmd Argument 'upgrade all -y'
$taskTrigger = New-ScheduledTaskTrigger AtStartup
$taskUserPrincipal = New-ScheduledTaskPrincipal UserId 'SYSTEM'
$taskSettings = New-ScheduledTaskSettingsSet Compatibility Win8
# Set up the task, and register it
$task = New-ScheduledTask Action $taskAction Principal $taskUserPrincipal Trigger $taskTrigger Settings $taskSettings
Register-ScheduledTask TaskName 'Run a Choco Upgrade All at Startup' InputObject $task Force

The script will:

  1. Locate the choco.exe binary (It’ll quit if it can’t find it in the path)
  2. Set up a scheduled task that runs said binary at system startup

Note that this script will only work on Windows 8 and newer machines, because it relies on the *-ScheduledTask cmdlets.

7-Zip tip – Quickly extract into a particular folder

If you need to extract a file into a particular folder, what do you normally do? Some people may copy the Zip file into the destination folder, and then unzip it. Others may launch their unzip tool of choice’s file manager and use the unzip wizard to point to the destination folder.

7-Zip provides a handy way to do this. All you need to do is right-mouse-drag the Zip file to the destination folder, release the right-mouse button, and go to 7-Zip –> Extract … from within the context menu.

20-10-2011 101712

20-10-2011 101905

I’d been using 7-Zip for years before I figured this one out.

Shoretel Call Manager: Outlook Integration issues

shoretel-productsSince we moved from Shoretel 7.5 –> 8.1, we’ve had a niggling issue that’s about to become a show-stopper on a new deployment for our entire Melbourne office.

The client software is easily deployed via Active Directory and Group Policy, but there’s a problem where the Outlook integration installer requires elevation, even though the only changes that are being made are restricted to the user’s profile. This is obviously ridiculous in a corporate environment, as new user setups require the user to be made a local administrator for their first login just to install Shoretel’s Outlook integration.

I lived with this as an inconvenience over the last few years, but the time has now come to plan for a replacement of our Melbourne office’s out-dated Ericsson PABX system. This issue, then, will be a show-stopper as we’re not going to make 80+ users local administrators – even temporarily.

Last week, I sat down to think about the problem and remembered something I’d read about “shimming” applications in Vista & Windows 7. This then led me to wonder if I could create a shim that stops UAC from being triggered by the Shoretel Outlook integration installer – %programfiles%Shoreline CommunicationsShoreWare ClientUninstWrpr.exe

The above process will obviously break any functionality within UninstWrpr.exe that does actually require elevated privileges, but that’s not a concern to me. I went ahead and created a new Security Database using Microsoft’s Application Compatibility Toolkit, and set up the shim as per one of the technet documents. I installed the resulting sdb file on a test machine using the inbuilt sdbinst.exe command, and voila! The Outlook integration installed without a single UAC prompt, and worked properly to boot.

The only part of the process left, is to figure out how to deploy the shim to the client machines. For the sake of brevity, I’ll detail the entire process in a new post shortly.

mRemote: A Remote Connections Manager

This tool should be a part of any self-respecting SysAdmin’s toolkit. mRemote is “a full-featured, open source, multi-tab remote connections manager”.

What does this mean?, you say. It means you’ve got one neat console where you can manage all your remote connections in one place. mRemote currently supports these protocols:

I haven’t set it up fully yet, but it will be really handy to have all my web-based admin areas and SSH to Linux boxes in there too.


A side note, it uses the same rendering engine as Firefox, so some web-based admin pages may not display properly. This, however is no fault of mRemote or Firefox’s.

Portable Apps

This fine project has packaged up a heap of open source applications to be run from a USB flashdisk or similar.

I’d seen the files on SourceForge before, but never had any use for them until today – when I had to boot a machine into BartPE and use ClamAV.

These will be moving into a permanent home on my new 4GB flashdrive when it arrives. – Portable software for USB drives | Your Digital Life, Anywhereâ„¢