PowerShell with a Purpose Blog

Automate Branch Office Server Configuration (& a PowerShell Class!)

Automating Server Provisioning

I have a consulting client who maintains about fifty branch offices. Recently, they wanted to upgrade the core server at each office - and install servers in some offices that didn't previously have them. "Consistency" was the watchword: They wanted every server to be pretty much identical. Making things tougher was the fact that they wanted to use Server Core on these servers, limiting some of the automation options. PowerShell to the rescue!
import-module servermanager
cd c:\
$feature = get-windowsfeature 'ad-domain-services'
if ($feature.installed) {
  add-windowsfeature 'dhcp','file-services','print-services','branchcache','wins-server'
  dcpromo /unattend:ad-unattend.txt
} else {
  add-windowsfeature 'ad-domain-services'
  shutdown /r

That's a portion of the script I wrote for them. It starts by importing the Windows Server 2008 R2 ServerManager module. It then checks to see if Active Directory is installed. If it is, it adds the DHCP, File Server, Print Server, BranchCache, and WINS Server roles (it pains me that they still use WINS, but at least you can do this!). It then runs Dcpromo, using an unattended installation script to handle the DC installation (you can't run Dcpromo in "attended" mode on Server Core). If AD wasn't installed, it installs that role and then reboots the machine.

Note the use of the good ol' Shutdown.exe utility, rather than the Restart-Computer cmdlet? I did that explicitly to point out to them the fact that PowerShell can still use all the command-line utilities they know and love, thus shortening its learning curve.

What do you think? What else would you put into a basic server-building script?

A PowerShell Class for the Rest of Us
I know folks get frustrated with the lack of decent PowerShell training out there. I'm continuing to work with SAPIEN Technologies to deliver public classes; we did two in 2010, and are hoping to do at least that many in 2011. I've also been speaking at conferences like Windows Connections, TechEd, and TechMentor, offering half- and full-day workshops whenever possible. I even do private on-site training, and did a half-dozen classes in 2010 (I'm in Houston doing one this week, in fact). However, folks have also pressed me to put together something of my own. Something for real admins, with a really carefully-designed class agenda, something that really puts you on the right path. Something offered to the public. Thing is, classes are expensive to put on - and can be personally risky if I wind up not getting enough registrations.

After long debate, many requests, and much soul-searching (and bank account scrutiny), I've decided to run a public Windows PowerShell class in 2011. This is going to be done right: I've built a price that includes your hotel room, a gourmet dinner (at a Michelin-starred restaurant), breakfast and lunch every day, printed class materials (actually a copy of my new book) Internet access, an airport shuttle - the works. It'll be in an off-Strip, non-gaming hotel in my home town of Las Vegas. The all-inclusive price includes five days of hands-on PowerShell training, printed lab guide, copies of my slides (hey, go home and teach the class to your colleagues) and even a take-home DVD of narrated demos for key tasks and concepts. You can read the full details of the class here. I've offered followers of my Twitter feed a special early-bird discount, and I'll extend that same offer to my blog readers. That offer won't last forever, so start getting on the boss now.

If you choose to pay with a corporate PO, you won't be billed until the second quarter of next year - so you can register now and still use next year's training budget!

This class is going to be held with my own training materials, which are the culmination of all the training I've done since 2007. I've learned a lot about how people learn about PowerShell, and I'm bringing it all to play. Absolutely no experience is required (well, not true - if you can run "ping.exe," though, you'll be fine). I promise this will change the way you think about PowerShell, and really get you started on bring productive with it right away. This is also going to be a small class, so that I can give everyone as much personal attention as they need.

We haven't finalized the venue yet (a contract is pending), but the all-inclusive price covers your hotel room regardless. That, plus the fact that we're covering breakfast, lunch, and one awesome dinner, will hopefully stretch the hold per diem enough to let you enjoy a couple of nice meals on your own, or with some of the other students in the class.

In addition to all the "official" extras described on the class info page, I'm sure we'll come up with some extra fun stuff to do. This is my town, after all! I've also engaged a "Classroom Concierge" to help folks who want dining or show recommendations, to help get you reservations and tickets, and more. This is truly an experience - and one I'm planning to do only this one time in 2011. I'm calling it my "PowerShell Retreat," and I hope you'll join me. I guarantee it'll be the best-quality IT training experience you've ever had.

Please - tell a friend or colleague. I really want this class to happen, and I could use all y'all's help in getting the word out. Thanks.
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.