Use PowerShell to Create Windows To Go Keys—Part 1


Summary: Use Windows PowerShell to identify Windows To Go devices.

Hey, Scripting Guy! Question Hey, Scripting Guy! I’ve heard a lot of talk about Windows To Go amongst the IT pros at our local user group. I was wondering how I would go about trying to create them with Windows PowerShell?

—DM

Hey, Scripting Guy! Answer Hello DM,

Honorary Scripting Guy, Sean Kearney, is here today, and I’m happy to share that knowledge with you.   

   Note  This is a five-part series that includes the following posts:

Before I start on the Windows PowerShell part, I’ll touch quickly on what Windows To Go is. It’s a fully operational version of a supported Windows Enterprise operating system on an external USB device.

The requirements to use Windows To Go are:

  • Software assurance
  • A qualified and supported hardware device (for more information, see Hardware considerations for Windows To Go)
  • One of the following  operating systems:
    • Windows 10 Enterprise
    • Windows 8.1 Enterprise
    • Windows 8 Enterprise

It’s a pretty cool option to put in to the hands of a business. What you end up with is the ability to have a Windows operating system that can be joined to your domain. It can be handed off to a contractor or even used for remote staff. When you boot it up from a USB device, the internal drives of the remote system are disabled, which allows you to use your system without foreign data easily corrupting the key.

So our first challenge is to identify a Windows To Go key for imaging. For proper support from Microsoft, it should only be deployed to the device list indicated earlier, so targeting is actually pretty easy.

I use the Get-Disk cmdlet in Windows to show the available devices. In the following example, I have an IronKey W300 attached to my computer.

Image of command output

I could do some magic by targeting for USB devices that are external hard disks, maybe larger than a certain size, but because the list from Microsoft is a very finite list, I can simplify this.

Get-Disk has a property that I can filter on called FriendlyName. This allows us to show only devices with a specific name that is assigned by a vendor.

To find the FriendlyName of our attached devices, I can pipe Get-Disk to Select-Object, and use the –ExpandProperty parameter to view the data.

Image of command output

If I want to see only devices that have a particular friendly name, I can use two approaches. I can filter by using the FriendlyName parameter with the Get-Disk cmdlet:

Get-Disk -FriendlyName 'Imation IronKey Wkspace'

If I wanted to trap for the IronKey W300 and a Kingston workspace, I can add them to the same list with the FriendlyName parameter:

Get-Disk -FriendlyName 'Imation IronKey Wkspace',’Kingston DT Ultimate’

But I have encountered a situation where FriendlyName is slightly different between Windows 10 and Windows 8.1. In Windows 8.1, the words USB Device get attached to the friendly name. To trap for this, I could list of every combination of FriendlyName, or I can filter in a different manner.

I can pipe Get-Disk to Where-Object and match the part of the name that is the same:

Get-Disk | Where-Object { 'Imation IronKey Wkspace','Kingston DT Ultimate') -match $_.Friendlyname }

I store this in an object called WTG so I can reference it later:

$WTG= Get-Disk | Where-Object { 'Imation IronKey Wkspace','Kingston DT Ultimate') -match $_.Friendlyname }

Stay tuned tomorrow when I’ll be using Windows PowerShell to partition this device because I’ll need it for use as a Windows to Go device.

I invite you to follow The Scripting Guys on Twitter and Facebook. If you have any questions, send an email to The Scripting Guys at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, remember to eat your cmdlets every day with a dash of creativity.

Sean Kearney, Windows PowerShell MVP and Honorary Scripting Guy 

Comments (2)

  1. ChrisS says:

    hi Sean

    it seems there an little typo in this :

    Get-Disk | Where-Object { ‘Imation IronKey Wkspace’,’Kingston DT Ultimate’) -match $_.Friendlyname }

    I would say there is a missing opening bracket after the {

    cu
    chriss

  2. @chriss

    Good point… it should actually read

    Get-Disk | Where-Object { (‘Imation IronKey Wkspace’,’Kingston DT Ultimate’) -match $_.Friendlyname }

    Which means the following line would also need the change of the addition of a "(" like this

    $WTG=Get-Disk | Where-Object { (‘Imation IronKey Wkspace’,’Kingston DT Ultimate’) -match $_.Friendlyname }

    Sean
    Honorary Scripting Guy…… and somebody who types faster than his brain thinks 😉

Skip to main content