Trevor Sullivan's Tech Room - Minding the gap between administration and development

Clean up unused Azure VHD Disks

Introduction The Microsoft Azure platform maintains a list of VHD blobs that have been registered as “disks” in your Azure subscription. You can view a list of registered “disks” by opening the Azure Portal, going to the Virtual Machines node, and selecting the Disks link. Each Azure disk has a property called AttachedTo that indicates…

Read More

Implementing a .NET Class in PowerShell v5

Preface

To kick off this blog post, I just wanted to let you all know that I’ve just started working with a start-up company called Opsgility as Director of Training and Product Development. We are focused on the development and delivery of training content around Microsoft enterprise solutions, with a special focus on the Microsoft Azure public cloud platform.

Introduction

You might have heard that PowerShell version 5.0 has introduced support for building .NET classes. Indeed, this is a powerful, new capability that has not previously existed in native PowerShell syntax. Before the new class-building syntax existed, if you wanted to build custom objects in PowerShell, you generally would either: 1) use the [PSCustomObject] type, or 2) build a .NET class in C#, and use the Add-Type command to import it into the PowerShell session.

Read More

PowerShell 5.0: Debugging Background Jobs

By now, you’ve probably already heard about the Microsoft Windows PowerShell 5.0 September 2014 Preview. If you haven’t already, you really need to download it and get familiar with all of the new features that are coming out with it. PowerShell 5.0 is also included in the Windows 10 Technical Preview, so you can build…

Read More

PowerShell: Build Windows 10 Server Technical Preview VM in Azure

You’ve probably heard about Windows 10 and the Windows Server Technical Preview, right? You can download the Windows 10 Client operating system from https://insider.windows.com, and you can download the Windows Server Technical Preview from your MSDN account, if you have one. A lot of people have stated that the download of the ISO images is taking hours on their slower Internet connections, so what if I told you that you could get up and running with Windows 10 Server Technical Preview, in just a matter of minutes? Does that sound like a good thing to you?

Read More

Dog Food Conference 2014 Session Materials (DSC, Azure, PowerShell)

Trevor Sullivan presenting at Dog Food Conference 2014 in Columbus, Ohio on September 30th, 2014. Photo taken by Keith Mayer (Microsoft).

Trevor Sullivan presenting at Dog Food Conference 2014 in Columbus, Ohio on September 30th, 2014. Photo taken by Keith Mayer (Microsoft).

Some of you may have heard my present at Dog Food Conference in September 2014. I’d like to first say thank you to the organizers of Dog Food Conference, for having me out to speak. I’d especially like to thank Ryan Dennis from Blue Chip Consulting LLC, who contacted me on Twitter and invited me to submit sessions for the conference. You can follow Ryan on Twitter at @SharePointRyan, or visit his website at SharePointRyan.com.

At Dog Food Conference, I presented two different sessions.
Read More

Fix for Service Unavailable in PowerShell DSC Pull Server

Introduction

HTTP 503: Service Unavailable

I recently tried to setup a Microsoft Windows PowerShell Desired State Configuration (DSC) Pull Server, and was receiving an error from IIS. I used the xDscWebService DSC Resource, from the xPSDesiredStateConfiguration PowerShell module, to configure the DSC Pull Server. When I tried to browse to the IIS Web Service for the Pull Server, I was receiving a HTTP 503: Service Unavailable message from Internet Explorer. I believe it is important to note that the Microsoft Windows Azure Pack (WAP) is also installed on the same server where I am trying to deploy the DSC Pull Server.

Read More

Use PowerShell DSC to Install DSC Resources

Introduction

A lot of the functionality provided by Microsoft PowerShell Desired State Configuration (DSC) comes, not from the core product, but from the DSC Resources that are provided by Microsoft and the community. When you spin up a new Windows operating system, whether a physical machine, local virtual machine, or a Microsoft Azure virtual machine, you start out with a pretty barebones set of DSC resources. Those resources are listed here:

  • File
  • Archive
  • Environment
  • Group
  • Log
  • Package
  • Registry
  • Script
  • Service
  • User
  • WindowsFeature
  • WindowsProcess

Unfortunately, most people are going to need more capabilities than what is offered out of the box. To that end, Microsoft has been regularly providing “waves” of DSC resources to manage a variety of different applications. As of this article’s writing, the latest wave of DSC resources from Microsoft was “DSC Wave 6,” published on August 21, 2014. During the remainder of this article, our goal is to make sure that these additional DSC Resources are installed on our systems, in an automated fashion!

Read More

Use PowerShell DSC to Enable Screencast Recording on Azure VMs

Do you ever record screencasts, and post them to YouTube, or some other video sharing site? Well, maybe you do, maybe you don’t, but I sure do (when I find time)! For the sake of simplicity, I use an older, free Microsoft tool called Expresion Encoder 4.0 with Service Pack 2 (SP2). You can download it, again for free, from here! In some cases, it might be preferable to invoke screencast recording on a remote session, rather than recording on your local computer, however. In this post, we will take a look at how to use PowerShell Desired State Configuration (DSC) to automatically install Microsoft Expression Encoder 4.0 SP2 onto cloud-hosted Microsoft Azure Virtual Machines!

Unless you’re a MSDN subscriber, with access to Windows 8.1 VM images in Azure, most of your Azure Virtual Machines will be running some class of Windows Server. In this case, we’ll be using a Windows Server 2012 R2 VM. The first thing to point out is that Windows Server 2012 R2 requires the “Desktop-Experience” Windows Feature to be installed, in order to successfully run Microsoft Expression Encoder 4 SP2. If this Windows Feature isn’t installed, you’ll get a nasty error telling you that wmvcore.dll is missing, when you try to run the Expression Encoder program.

While working with Expression Encoder in Azure, one limitation you’ll want to keep in mind is that Expression Encoder has a problem rendering your screencast content inside the editor. So, if you want to make any modifications to your screencast, after you’ve recorded it, you’ll have to download the content locally onto your computer.

With all of that out of the way, let’s get DS-configuring! The first thing we need to do is ensure that the “Desktop-Experience” Windows Feature is installed. To do that, we will use the built-in WindowsFeature DSC resource. To start building our configuration, let’s use this code:

Read More

Learn how to use Compliance Settings in Configuration Manager

Have you ever wished that you could use the Compliance Settings feature in Microsoft System Center 2012 R2 Configuration Manager, but weren’t quite sure how it works? Well today’s your lucky day, because I recently developed a couple of example videos that will help you to get started! One of the videos covers how to…

Read More

PowerShell: Add Users to Active Directory Group from Text File

A customer recently requested a PowerShell script, to add Active Directory users to a security group. The list of users would come from a text file that resides on the filesystem. To that end, I wrote a short PowerShell script that does just that, complete with parameter validation. #requires -version 4.0 #requires -Module ActiveDirectory param…

Read More