Script for Debugging Windows Updates

Here’s a quick script I wrote to debug issues with Windows Update if you ever need to pass information along to IT.

To be run in git-bash and in it’s own folder.

###########################################
#### Declare Output Directory Settings ####
###########################################

OUTPUT_PATH="."
FOLDER_NAME=$(date +"%Y-%m-%d_%H-%M-%S")
FOLDER_PATH="$OUTPUT_PATH/$FOLDER_NAME"

mkdir -p "$FOLDER_PATH"

######################
####   Do Work    ####
######################

cp /c/Windows/Logs/WindowsUpdate/* "$FOLDER_PATH"
cat /c/Windows/Logs/CBS/CBS.log > "$FOLDER_PATH/CBS.log"
cp /c/ProgramData/USOShared/Logs/* "$FOLDER_PATH"

PowerShell.exe -command "Get-WindowsUpdateLog -LogPath \"$FOLDER_PATH/WindowsUpdate.log\""
cat "$FOLDER_PATH/WindowsUpdate.log"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s