Just Add Code

Virtual machine copying with PowerShell

Believe it or not, PowerShell is more than just fun and games. You can even do productive things with it! A common scenario I run into is the need to create a new virtual machine. Usually I want to base it on one I’ve already created and I want it to join a domain. There are a couple issues that I run in to:

  1. Duplicate SID Error
  2. Too many clicks

The first problem can be solved with a free tool that Microsoft has released called NewSID. Running that will give my virtual a unique SID so that it can be added to the domain.

Now for the second problem..too many clicks! Renaming a machine and adding it to the domain takes almost 2 minutes and a nearly infinite number of clicks and keystrokes…or maybe not. At any rate, it’d be great to simplify this process. Enter PowerShell.
Rename a Computer and Join Domain

$comp = get-wmiobject Win32_ComputerSystem 
$comp.Rename("newComputerName","password","administrator") 
$comp.JoinDomainOrWorkGroup("MYDOMAIN","domainPassword","MYDOMAIN\domainAdmin",$null,3)

Add a call to NewSID, wrap those delicious lines in a function and you are well on your way to renaming a virtual and joining a domain in fewer keystrokes. Its so easy you might even find yourself creating new virtuals just to run it again.

5 comments Digg this

Code Camp Presentation

Here’s the presentation I did for the Twin Cities Code Camp around SharePoint as a Development Platform.

No comments Digg this

Twin Cities Code Camp

Welcome to those of you hitting here from the Twin Cities Code Camp. As you can probably see, there are a few cobwebs here.
I’ll be doing a presentation on using SharePoint as a Development Platform. With all the recent activity around the SharePoint 2007 release, developers (or at least their bosses) are more interested in how they can use SharePoint in their organization. I’ll be covering what things to consider when deciding whether or not to use SharePoint, and then how to actually develop againist it. There will be code examples for the three major approaches (object model, web services and RPC).
All the code and slides will be posted here for those who couldn’t make it, or really want to try out the code.

No comments Digg this

I’m Riding on Rails

After three years of failing my resolution, I finally have a blog. My goal is to have a blog filled with technical content, not just links to ‘cool’ things. My interests in Tech are pretty diverse, and I realize not everyone who reads this blog will be as interested in all of those things as I am. To better facilitate readers that only enjoy certain topics, I’ll be using Categories and providing Category level RSS feeds. For those trying to find a specific article, hopefully the Search bar will help you out.

The guts behind this blog is Typo. Typo is a Ruby on Rails blogging application. Why’d I decide to use this? Well, I develop with MS products for my day job and I decided that doing something different for fun is always good. I’ve been following Rails pretty much since its inception. Why didn’t I choose WordPress or Moveable Type/Typepad? They run on non-MS platforms too. I’ve looked at Moveable Type, and it just doesn’t feel like any fun. And I had been leaning toward using WordPress (and even had it installed for one of the year’s resolutions), and having a strong PHP background it definitely made sense. But the big reason was I’m tired of patching. PHP needs patching, WordPress needs patching…constantly. There’s only so much time in the day. Ruby and Typo have and will have similar problems, but the process for upgrading is simpler that I’d rather go with it. We’ll see how it works out.

Anyway, welcome. Take your shoes off, stay a while.

No comments Digg this

« Previous Page