Logging and Error Handling Best Practices for Automating Windows Update Installs (MSU) with wusa.exe (And For Logging Any Called Process)

Automation of Windows Updates is generally done by calling wusa.exe against a .MSU file. When wusa.exe experiences a failure the messages are typically obscure and hard to diagnose. The underlying error messages, however, are frequently easy to understand and resolve.

The secret is to have wusa.exe do verbose logging in it’s standard exported windows event format and then use the PowerShell event message CMDLets to query that log - automatically, everytime you have an error.

Although focused on applying updates with wusa.exe, this article contains most of my logging best practices for automation coding when calling automated sub-processes.


Read more

Share Comments

PowerShell Core for Windows Chocolatey Package

I have been maintaining the PowerShell Core for Windows Chocolatey package for quite some time, however, since it is a pre-release package, it does not show up on Chocolatey’s search.

This post lets you know it is available and gives the commands for install, upgrade and uninstall.


Read more

Share Comments

The Universal PowerShell Core Installer (Install-PowerShell.sh)

Since PowerShell Core was announced not quite a year ago, I have had a surprising number of reasons to migrate or refit existing PowerShell code to run on PowerShell Core. In some cases keeping future development compatible with both environments adds strategic value.

The PowerShell Core project on github did have an early version of a multi-distro installer, but it required manual tweaks to be updated for each new release and was not using the repository links Microsoft has been putting up.

I believe the ability to quickly setup a sandbox environment is a critical capability for the adoption of any new technology. So, within the PowerShell Core open source project, I set out to build a universal installer that could be used to get the latest version, from repositories (to make updates easier) and optionally install a development environment consisting of Visual Studio Code and the VS Code PowerShell Extension.


Read more

Share Comments

Easy openssl for Windows via LibreSSL Chocolatey Package

The openssl command is frequently used to automate many certificate functions on Linux. I was recently working with a colleague who was very frustrated with the number of hoops they had to jump through to do similar things on Windows. “Why can’t there just be an openssl command for Windows?” was the general sense of their frustrations. Well, there is, but they can be painstaking to get onto a Windows machine for a just a few automation commands. Enter the LibreSSL Chocolatey package…


Read more

Share Comments

Fixed: Non-Functional Start Menu After Sysprep of Server 2016 - Including AWS

At Infor we are increasingly using Server Core due to it’s superior scaling time. However, when I do need to build a server with the GUI - having a non-functional start menu defeats the point. Windows 10 and Server 2016 suffer from a specific sysprep bug which causes the start menu to not pop when the start button is clicked. Here’s how to fix it - including a code snippet for automating the AWS build.


Read more

Share Comments

Back to Basics: Testable Reference Pattern Manifesto (With Testable Sample Code)

Think about how babies initially learn - purely by observing patterns - but more specifically “actual working patterns”. They watch people actually walking, actually talking and actually eating in order to learn these activities - and their shiny new brain is really, really good at it.

Recently I published a PluralSight course on implementing the Center for Internet Security (CIS) AWS Foundations Benchmark security standard. As a part of that course I wanted to provide a working script that could make a clean, test AWS account compliant with the benchmark (an “actual working pattern”) I am writing this post to release that code as open source, as well as to relate some lessons learned during the journey of building it.

Read more

Share Comments

Unveiling The OpenSSH Universal Automated Installer

You may have heard some of the buzz about the open source project undertaken by the Mirosoft PowerShell team to create a native, standards compliant edition of OpenSSH. I have been working on the installation packaging for the OpenSSH project and I wanted to make sure everyone knew about the universal automated installer available to install it on any version of Windows.

Read more

Share Comments

A Sufficiently Viable Implementation (SVI) for Running Code Under The System Account on Nano Server

In the world of computing it is the small changes that can cost you the most in the long run. One bright morning I decided I wanted to make the Chocolatey openssh package run under Nano Server (without Chocolatey). This led to a lot of code refactoring to account for the many little limiting differences of Nano. One of these differences ended up being the implementation of how to run some configuration code in the SYSTEM account context.

Read more

Share Comments

Easing PowerShell WMF 5.1 Deployment Challenges Using The Chocolatey Package

I co-maintain the Chocolatey package for PowerShell. With the recent release of PowerShell 5.1, the Chocolate packaging is able to handle one more challenging, but potentially common, deployment scenario.

Microsoft is moving fast to retire version 5.0 by June of 2017 - including removing the downloads for 5.0 - a distinct encouragement to evaluate and adopt 5.1 quickly.

Lets talk about this challenge as well as a brief summary of some other challenging deployment scenarios that were already handled by the Chocolatey Package.

Read more

Share Comments

Straight and Narrow Code For Safe Windows Path Updates

Windows automation inevitably involves updating path environment variables. The most common is the Windows path (Variable: PATH), but increasingly we are all having to pay attention to the PowerShell module path (Variable: PSModulePath).

Over time I have learned most of the mistakes you can make when manipulating these paths first hand (Yep, there is a special flat spot on my forehead just for where I’ve banged it on the desk due to path issues).

Read more

Share Comments