Category: Automation/Scripting

PowerShell, Bash, Python, etc…

Prepare Multiple USB Drives for a Bootable Windows Installation

The All Covered Advanced Technology Solutions team writes scripts to help our engineers speed up repetitive tasks using automation, in this case I am improving upon a script written by Johan Arwidmark to prepare multiple USB drives for Windows installation.

Many thanks to Johan Arwidmark over at Deployment Research for creating the basic script to handle this process! All credit goes to Johan for his original script used here.

You can use this tool to create a bootable USB drive from any Windows installation media for Windows 8.1/Server 2012 and forward.

Improvements to the existing script

I chose to improve upon this basic script to make it more functional for the masses. Here’s what I’ve added:

  • Source location picker, so you can easily select the source location for the ISO contents
  • Drive label option, to set a label for the USB drive(s) you’re preparing
  • Administrative check to make sure you’re running the script as administrator, if you are not the script will exit
  • Check for connected USB drives, if the script doesn’t find any the script will exit

Getting Started

To get started, you’ll need some USB drives. In my case, I needed to format about 100 USB drives for imaging. I decided to follow Johans lead and grabbed this Anker 13 Port USB Hub. I also opted to use these Lexar 64 GB USB Drives. I recommend using a desktop computer with a good USB 3.0 controller. What does good mean? I don’t know, but something more powerful than what’s in a Lenovo W541 laptop! My controller became exhausted of all available power at 8 USB drives connected, which slowed my process slightly.

Be sure to connect the USB hub or drives to a USB 3.0 port on the system, or you’ll have rather dismal performance during the preparation of the drive(s).

In addition, I found that due to the intense load on the USB hub when formatting more than one batch of USB drives I had to cool mine with a desk-fan in order to keep the USB hub from becoming unstable during the process. In my case I believe it was overheating and as a result disconnecting and re-connecting from the system.

Do Not use this process if you have any other USB mass storage devices connected to the machine from which you are running this script. This will risk wiping any USB drives connected. You will be provided the opportunity to review the list of drives to be formatted and choose to proceed to the next step before formatting any drives.

Executing the script

Plug in your USB drives to your computer. Or, alternatively, the USB hub if you’re using one and follow these steps:

  1. Download and execute this script from an administrative PowerShell window
  2. Select the folder or drive which contains the contents of the ISO image you want to useSteps 1 and 2
  3. Select a Label for the drive(s)Step-3
  4. Validate the list provided to make sure only USB drives you want to format are connected and continue (Press Enter)Step-4
  5. Wait for the process to complete.Step-5

When complete, the script will attempt to eject the USB drives for safe removal. Note: Sometimes this process can fail just click retry and it should eventually properly eject the media.

The Code

This code can also be downloaded here on GitHub.


Johnathan Milgie

Suppressing the WSUS Configuration Wizard when installing and configuring with PowerShell

The All Covered Advanced Technology Solutions team writes scripts to help our engineers speed up repetitive tasks using automation, in this case I am writing a script to install and configure a new Windows Server Update Services (WSUS) server.

Many thanks to Boe Prox over at The Scripting Guys for sharing how to install and configure WSUS using the UpdateServices PowerShell module (Installing WSUS on Windows Server 2012).  A thank you also goes out to Trevor Jones for his article on Installing and Configuring WSUS with Powershell.

I found two issues with The Scripting Guys code and did not find any answers or solutions in the community.  I continued to troubleshoot these issues and found solutions for both.

Issue # 1 – All Office and Windows Products are enabled

I wanted to only enable select Microsoft Office and Windows products, although the parent categories “Office” and “Windows” were also selected which was not desired, this was the case if you used Product Title or the Product ID.  Here’s the commands that I tried to use to enable select Office products, Silverlight, and only Windows Server 2012 R2:

Or using the Product Id:

Then review what Products are enabled and you’ll see “Office” and “Windows”:


After enabling the desired products, disable the parent categories “Office” and “Windows” using their Product IDs.

Then review what Products are enabled and you will no longer see “Office” and “Windows”.

Issue # 2 – WSUS Configuration Wizard appears when opening the WSUS Management Console

After a PowerShell script completes a successful WSUS installation and configuration when you open the Windows Server Update Services Management Console you are still presented with the Windows Server Update Services Configuration Wizard which would be best to hide.  The wizard prompts you to configure your WSUS server which was already done using the PowerShell script.


Change the WSUS Configuration property OobeInitialized in $wsus.GetConfiguration() from $false to $true.

Mike Driest

PowerCLI: Remove Largest Snapshots First

Here is a nice PowerShell one-liner to remove the largest snapshots first.  This removes one snapshot at a time.

If you want to do it for VMs of only a certain size, where snaps are larger than 1GB:

© 2019 ATS Blog

Theme by Anders NorenUp ↑