Creating Bootable USB From ISO on Mac OSX

Insert USB Media and Format

Insert your USB flash drive and use disk utility to format it (press command space to open spotlight search and type Disk Utility). Select the flash drive, choose edit erase and format to MSDOS.

Convert ISO to IMG Format

Once you’ve downloaded your ISO to your machine you will want to open terminal and cd to the directory. Once you’ve done this you’ll want to run the following commands (substituting your path):

hdiutil convert -format UDRW -o /path/to/target.img /path/to/source.iso
Once you’ve done this you’ll want to remove the .dmg extension by running the following (replacing the path with your path)
mv /path/to/target.img.dmg /path/to/target.img

DD the IMG to USB Stick

Next we’ll use the Unix dd command to block copy the img file to the USB. Pay attention to the size of your flash drive when doing these steps as you can cause yourself some headache if you aren’t careful.

diskutil list

Note the path to your drive and proceed to unmount it from the terminal (replacing # with the disk number for your USB stick):
diskutil unmountDisk /dev/disk#

Next we’ll use the dd command specifying the input file (if) which is your img file, and output file (of) which is the path to your USB flash drive, and specify block size (bs). Again where # is a placeholder for the disk number of your USB stick.
sudo dd if=/path/to/downloaded.img of=/dev/rdisk# bs=1m

Finally once this process completes we can eject the flash drive

diskutil eject /dev/disk#
That’s it, you’re ready to go.


Sample of Entire Process With Windows 10 ISO

Richards-MacBook-Pro:~ rstaats$ cd Downloads/
Richards-MacBook-Pro:Downloads rstaats$ hdiutil convert -format UDRW -o en_windows_10_multiple_editions_x64_dvd_6846432.img en_windows_10_multiple_editions_x64_dvd_6846432.iso
Reading J_CCSA_X64FRE_EN-US_DV5 (Apple_UDF : 0)…
Elapsed Time: 10.859s
Speed: 358.6Mbytes/sec
Savings: 0.0%
created: /Users/rstaats/Downloads/en_windows_10_multiple_editions_x64_dvd_6846432.img.dmg
Richards-MacBook-Pro:Downloads rstaats$ mv en_windows_10_multiple_editions_x64_dvd_6846432.img.dmg en_windows_10_multiple_editions_x64_dvd_6846432.img
Richards-MacBook-Pro:Downloads rstaats$ diskutil list
/dev/disk0 (internal):
0: GUID_partition_scheme 251.0 GB disk0
1: EFI EFI 314.6 MB disk0s1
2: Apple_CoreStorage APPLE SSD 250.0 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3

/dev/disk1 (internal, virtual):
0: Apple_HFS APPLE SSD +249.7 GB disk1
Logical Volume on disk0s2
Unlocked Encrypted

/dev/disk2 (external, physical):
0: FDisk_partition_scheme *16.0 GB disk2
1: DOS_FAT_32 U 16.0 GB disk2s1

Richards-MacBook-Pro:Downloads rstaats$ diskutil umountDisk /dev/disk2
Unmount of all volumes on disk2 was successful
Richards-MacBook-Pro:Downloads rstaats$ sudo dd if=en_windows_10_multiple_editions_x64_dvd_6846432.img of=/dev/rdisk2 bs=1m
3894+1 records in
3894+1 records out
4083853312 bytes transferred in 432.072596 secs (9451776 bytes/sec)
Richards-MacBook-Pro:Downloads rstaats$ diskutil eject /dev/disk2
Disk /dev/disk2 ejected
Richards-MacBook-Pro:Downloads rstaats$

Cleaning up Old XenServer Patches The Easy (Lazy) Way

Cleaning up patches on XenServer isn’t difficult but it can be annoying if you have a large number of hosts. Here’s the easy way to clean up your old patch files on all hosts….if you’re an extra lazy Linux admin you can use tmux to do this to all of them at the same time 🙂

for i in `xe patch-list | grep uuid | awk '{print $5}'` ; do xe patch-clean uuid=$i ; done

I’ve been wrapping up some large projects on the work front and several audio/music related projects so apologies for not posting here for a while. I have lots of good stuff coming down the pipe in the near future!

Managing IIS With Puppet via Powershell DSC

Use Case:

Many of us in DevOps/Cloud/Site Reliability/System Engineering have long been using Puppet to manage our Apache and Nginx configurations. However it seems like every Windows deployment I come across using IIS is either not in any form of config management, or is managed through a series of VBScript and PowerShell scripts or System Center. If your organization is big enough to afford System Center this isn’t really much of an issue for you; however for those of us managing IIS web farms without SCCM, Microsoft has extended a nice olive branch with the delivery of PowerShell Desired State Configuration.

Given that most of us work with such broad toolsets, the idea of adding yet another configuration management platform into the mix seems less than ideal. However, there is an official Puppet Forge module that allows you to leverage PowerShell DSC within your Puppet code. What I found in my journey of doing this is that, while there is some decent documentation, there are pieces that clearly seem not to be well documented that required figuring it out the hard way. In this blog post I’ll cover and distill what I’ve learned in configuration of IIS through PowerShell DSC via Puppet.


This blog post will assume that you have already installed the PowerShell DSC forge module. I will link the module and its dependencies below; if you are unsure how to install Forge modules, see the documentation on the link to the module below.

This blog post will also assume that you have already installed IIS either in your AMI/Template or via Puppet. Great, now that that’s all out of the way, let’s get started.


Overview Example Class:

Before diving into the weeds in each section, I wanted to provide a code sample of a single application pool, website, virtual directory, and web application, complete with the DSC dependencies:


class webhosting::clientname::sites::dev {
  dsc_ensure => 'Present',
  dsc_name => 'Web-Server',
  dsc_ensure => 'Present',
  dsc_name => 'Web-Asp-Net45',
  dsc_ensure => 'Present',
  dsc_name => 'Web-Scripting-Tools',
#App Pool Creation
  dsc_name => '',
  dsc_ensure => 'Present',
  dsc_enable32bitapponwin64 => true,
  dsc_managedruntimeversion => 'v4.0',
  dsc_managedpipelinemode => 'Integrated',
  dsc_identitytype => 'ApplicationPoolIdentity',
  dsc_state => 'Started',
  require => Dsc_windowsfeature['iis'],
#Website Creation
  dsc_ensure => 'Present',
  dsc_name => '',
  dsc_state => 'Started',
  dsc_physicalpath => 'D:\\www\\\\webroot',
  dsc_applicationpool => '',
  dsc_bindinginfo => [{
  ipaddress => '*',
    protocol => 'HTTP',
    port => 80,
    hostname => '',
    ipaddress => '*',
    protocol => 'HTTPS',
    port => 443,
    hostname => '',
    certificatethumbprint => '<certificatethumbprintgoeshere>',
    certificatestorename => 'WebHosting',
 require => Dsc_xwebapppool[''],
#Web Applications
  dsc_ensure => 'Present',
  dsc_name => '/AwesomeApp',
  dsc_website => '',
  dsc_webapppool => '',
  dsc_physicalpath => 'D:\\www\\\\webroot',
  require => Dsc_xwebsite[''],
#Virtual directories
  dsc_ensure => 'Present',
  dsc_name => 'AwesomeApp',
  dsc_website => '',
  dsc_webapplication => 'AwesomeApp',
  dsc_physicalpath => 'D:\\webapplicatons\\AwesomeApp',
  require => Dsc_xwebapplication['AwesomeApp'],

DSC Windows Feature

Starting at the top and taking this a chunk at a time, we see after the opening Puppet class statement that there are several dsc_windows_feature statements. These statements install the PowerShell DSC packages on the endpoint nodes. PowerShell DSC wrapped in Puppet assumes that you are using the pull model style of using DSC. What essentially happens on the Puppet run is that your Puppet DSC code gets converted into PowerShell DSC code and run locally on the machine. DSC module can be found at Note that modules beginning with an X are considered experimental. That said, most of the experimental modules in my experience have been stable.


Configuring The Rest

Beyond this point, the rest of the Puppet code you will see will be prefixed with dsc_. Essentially, to write DSC code in Puppet you will use the same values outlined in the DSC documentation, just prefixed with the dsc_ and using the Ruby hash rockets => instead of =. See the example below:

DSC Example:

    xWebsite DefaultSite
            Ensure          = "Present"
            Name            = "Default Web Site"
            State           = "Stopped"
            PhysicalPath    = "C:\inetpub\wwwroot"

Puppet Example:

            dsc_ensure       => 'Present',
            dsc_name         => 'Default Web Site',
            dsc_state        => 'Stopped',
            dsc_physicalpath => 'C:\\inetpub\\wwwroot',

At this point, you can configure your applications specific to your environments. Much like any other Puppet code there are obvious dependencies (can’t create a website that depends on an application pool unless the pool already exists). For this you can use the normal Puppet meta parameters such as before and require statements to resolve dependencies. For IIS-specific DSC parameters see the readme for Microsoft’s XWebAdministration module here:


Don’t forget to prefix the parameters in the readme with dsc_ when converting to Puppet code. Happy configuring and Puppeting! Until next time, may your servers always be up and your coffee mugs never empty!