Continuing the long standing tradition of celebrating Windows PowerShell and the Holidays with such great classics as

“A PowerShell Carol”

“How Mr. Finch Learned Scripting”

“It’s a Wonderful Shell”

“’Twas the Night before Scripting”

The Scripting Guys proudly announce in brilliant shiny 32 bit colour with 7.1 DTS Surround Sound the newest Holiday Classic

“Oliver Script”

Available on from December 20th to 26th 2014

If you enjoy a good story, love PowerShell, live for the Holidays or just simply like to kill time in the bathroom with Twitter then please bookmark your calendar for this amazing story.

“Oliver Script”

A tale of an ordinary person who discovered a love of technology….and PowerShell

Here’s a little tune you can sing along to, or spam blast to your co-workers or simply crank up to drive the cat batty.  It’s the unofficial and completely horrid tune that even the estate of Charles Dickens is unwilling to hear for it’s pending litigation.   “Code Glorious Code”

So I was playing a few weeks back and thought I’d share on some of my fun.   Like many IT Pros I downloaded the Windows 10 CTP media to test out and try Windows 10.   In my case I spun it up inside a Virtual machine to see a side by side comparison on my production Windows 8.1 laptop.

During this process my boss’ hard drive went caput on his laptop.   Fortunately for him he was recently migrated to a honking cool Surface Pro 3 laptop.

Fortunately for ME there was minimal data loss and this gave me a chance to play with something else.   Windows To Go.

You see, apparently if you want to run an operating system you need SOME kind of data storage.   Since we didn’t have a spare drive for his particular model of laptop (or in my case all of the “spares” were holding backup copies of his data) I wanted to fire up Windows 10 to see what it looked like on his laptop.

So the answer was easy.  “I’ll just pop in my Kingston USB and make a Windows To Go version of Windows 10.”

The important rules have not changed.   Windows to Go still requires Windows Enterprise media, of which my CTP media is !

Ah but a small problem.   Although I can access the file structure on the key I am unable to create partitions.   Or for that matter running the built in Windows to Go Wizard.

Looking about online there are options however to bypass this issue.   It involves a Direct Passthru to the physical disk in Hyper-V and a little coolness in Windows PowerShell to generate the content on the key.   Now in TRUTH I COULD bypass the VM and just run the script and build it directly on the PC but Where’s the FUN in THAT?! Smile

So challenge one.  Connect the USB to the Host environment.  

In this scenario I have a Kingston DT Ultimate attached to my PC.   You’ll need to bring it offline in Disk Management First


Now that the disk is offline, I can enter my Virtual Machine Configuration and attach the disk in “Pass Thru” Mode.



With the USB Disk in Pass thru mode I can now access it directly within the Virtual Machine. 

Now of course we could have just done all this with PowerShell with the following Cmdlets.

# Identify the USB key which is Greater than 20GB in size

$disk=(GET-DISk) | where { $_.Bustype -eq 'USB' -and $_.Size -ge 20GB -and -not $_.isboot }

# Bring the key offline on the Hyper-V Host (Windows 8.1 laptop)

$disk | Set-Disk –isoffline:$True

# Attach said disk to the Virtual machine named “EOT-WIN10-CTP”

$disk | Add-VmHardDiskDrive –vmname EOT-WIN10-CTP

For this next amazing magic trick we’re going to be running a Windows PowerShell script to partition the key.    This comes courtesy of a Step by Step  article on Technet for creating the Windows To Go key directly without using the Wizard.   The script however is based upon the presumption that the attached disk in question in USB.  But Within the Virtual Machine it will appear as an ordinary disk.

To adapt to this scenario take the Microsoft script and edit the line reading

$Disk = Get-Disk | Where-Object {$_.Path -match "USBSTOR" -and $_.Size -gt 20Gb -and -not $_.IsBoot }

and replace it as

$Disk = Get-Disk | Where-Object {$_.Size -gt 20Gb –and $_.Size –le 64GB –and -not $_.IsBoot }

From this point forward the script will work as designed WITHIN the Virtual machine and partition the key ready for the Windows To Go structure.

Be FULLY FOREWARNED! If you are running this in a Virtual Machine which has disks OTHER than the Bootable C: drive and your Windows To Go key which are bigger than 20gb and smaller than 64gb you WILL ABSOLUTELY LOSE THEM.   So PLEASE just run this inside a virtual machine you could consider a “throwaway” and not something critical to production like the Exchange or the BES server. 

For the purposes of fun and truly “throw away” I am running all of this inside a Virtualized Windows 10 CTP.   So if I goof up, it’s just a test machine.  You should do the same Smile

Going forward as per the instructions from Technet we can run DISM to apply the image.   In the case of this Virtual machine, I have the Windows 10 CTP mounted in the DVD drive and will be leveraging it’s WIM file to image this key.   The original document called for leveraging DISM.EXE

dism /apply-image /imagefile:D:\Sources\Install.wim /index:1 /applydir

But instead I’m going to use the PowerShell which does EXACTLY the same thing

Expand-WindowsImage –imagepath D:\Sources\Install.wim –index 1 –ApplyPath W:\

From this point (After some waiting time of the image dropping onto the key of course) we can run this command to make the key bootable

W:\Windows\System32\bcdboot W:\Windows /f ALL /s S:

Normally at this point you would apply the san_policy.xml file using this command in DISM. 

Dism.exe /Image:W:\ /Apply-Unattend:W:\san_policy.xml

Instead we’re going to jump ahead and just use the PowerShell Cmdlet instead (Does somebody out there smell a SINGLE PowerShell script we could use to do all of this now?)

Use-WindowsUnattend –unattendpath .\san_policy.xml –path W:\

Then of course the most critical piece, dropping in an Unattend.xml file to automate the startup of the WTG environment

Copy-item .\Unattend.xml –destination W:\Windows\System32\Sysprep

Then let’s disconnect that Disk from the virtual Machine

Get-VM EOT-WIN10-CTP | Get-VmHarddiskDrive | Where { $_.DiskNumber } | Remove-VMHarddiskDrive

Now just RIP that USB key off the side of your machine and enjoy your new Windows to Go!

It’s time for Trick or Treat this month and this month we give You a treat!

Some of the options for accessing and sharing media such as video and audio have truly opened up to the masses.

Pop in for a bit as we open up our basement doors to introduce you to the Xbox One and even a $35 computer!

Sean Kearney (Honorary Scripting Guy)'s avatarimage

Bio – Sean Kearney, Cistel Technology Inc.

Sean Kearney is a Senior Solutions Architect at the Advanced Microsoft Solutions team at Cistel Technology Inc. He lives in the world of Automation leveraging technologies such as System Center 2012 Orchestrator and will break out into song when the word “PowerShell” is even mumbled in the area.   He has recently presented at both TechEd in North America and Europe.

Also he has contributed three Unique Holiday Specials about PowerShell to Microsoft, is an Honorary Scripting Guy who regularly contributes to on Technet and is also a Charter Member of the Springboard Technical Experts Program. 

Rumor has it he is trying build a T.A.R.D.I.S. Out of dishwasher parts and old Commodore Vic 20 Datasettes.


Bio – Garth Gorling, Cistel Technology Inc.

Garth has been in the IT field for over 10 years now.  He has been awarded his MCITP in Windows 7: Enterprise Desktop Administration and many other certificates.  Recently he has been to the Microsoft Redmond campus to receive beta training for Operating System and Application deployment as well as participate in Windows 8 IS-SS sessions.

At Cistel, his main role is to act as the technical prime for a number of small to medium sized businesses in the Ottawa area.  He is also responsible for coordinating in-company training on a range of topics but takes special pleasure in Window 8.

Event location

Microsoft Office
100 Queen St
Suite 500
Ottawa, ON K1P 5T8
Thursday, 23 October 2014 from 6:00 PM to 8:00 PM (EST)