Automated Office Updates v1.1

This utility is available to download from the Microsoft TechNet Gallery the PowerShell Gallery and GitHub.

 

Features and Requirements

This script will check for and download update files for click-to-run Office installs such as Office 365 and Office 2019. All options are added via command line switches. Options include:

  • Location to store Office installation files.
  • Keep or remove old office update files to prevent bloat.
  • The directory to output a log file to.
  • An optional email address to send the log file to.

This script requires a certain folder structure in order to operate. The script expects the Office Deployment Tool and the configuration xml file to be in the same folder. Additionally, the source path of the Office installation files in the configuration xml file should be set to the same location.

For example:

Office Deployment Tool location: \\server\share\Office-2019-x64\setup.exe

Configuration xml file location: \\server\share\Office-2019-x64\config-2019-x64.xml

Source path in the configuration xml file: \\server\share\Office-2019-x64

This configuration will result in the Office update files being downloaded and stored in: \\server\share\Office-2019-x64\Office\Data.

 

This script has been tested running on Windows Server 2016 and Windows Server 2019, updating Office 2019 volume licensed installations on Windows 10 1809 and 1903.

 

Generating A Password File

The password used for SMTP server authentication must be in an encrypted text file. To generate the password file, run the following command in PowerShell, on the computer that is going to run the script and logged in with the user that will be running the script. When you run the command you will be prompted for a username and password. Enter the username and password you want to use to authenticate to your SMTP server.

Please note: This is only required if you need to authenticate to the SMTP server when send the log via e-mail.

$creds = Get-Credential
$creds.Password | ConvertFrom-SecureString | Set-Content c:\scripts\ps-script-pwd.txt

After running the commands, you will have a text file containing the encrypted password. When configuring the -Pwd switch enter the path and file name of this file.

 

Configuration

The table below shows all the command line options available with descriptions and example configurations.

Command Line Switch Mandatory Description Example
-Office Yes The folder containing the Office Deployment Tool (ODT). \\server\share\office-19-x64\setup.exe
-Config Yes The name of the configuration xml file for the Office ODT. It must be located in the same folder as the ODT. config-19-x64.xml
-Days No The number of days that you wish to keep old update files for. If you do not configure this option, no old files will be removed. 60
-L No Location to store the optional log file. The name of the log file is automatically generated. C:\foo
-Subject No The subject line that the email should have. Encapsulate with single or double quotes. ‘Server: Notification’
-SendTo No The email address to send the log file to. me@contoso.com
-From No* The email address that the log file should be sent from.

*This switch isn’t mandatory but is required if you wish to email the log file.

example@contoso.com
-Smtp No* SMTP server address to use for the email functionality.

*This switch isn’t mandatory but is required if you wish to email the log file.

mail01.contoso.com

OR

smtp.live.com

OR

smtp.office365.com

-User No* The username of the account to use for SMTP authentication.

*This switch isn’t mandatory but may be required depending on the configuration of the SMTP server.

example@contoso.com
-Pwd No* The location of the file containing the encrypted password of the account to use for SMTP authentication.

*This switch isn’t mandatory but may be required depending on your SMTP server.

c:\foo\ps-script-pwd.txt
-UseSsl No* Add this option if you wish to use SSL with the configured SMTP server.

Tip: If you wish to send email to outlook.com or office365.com you will need this.

*This switch isn’t mandatory but may be required depending on the configuration of the SMTP server.

N/A

 

Change Log

2019-09-04 v1.1

  • Added custom subject line for e-mail.

2019-06-16 v1.0

  • Initial release.

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: