I’m having big fun with PS today because I’m installing several new R2 boxes on Windows Server R2. Where does PS come into play you ask? Well, good question… I only wish I had a good answer. Ok, I do.
In order to install SQL Server R2 on Windows 2008 R2 you have to first install the .NET Framework. However, the SQL installer doesn’t do it for you. It just tells you that you have to install it. So the normal way is to go into the server manager and then to ‘roles’ and then ‘add a role’. Once you’re in the add role wizard choose ‘Application Server’. Here are some brief screens of the process.
As you can see I’ve already installed it on this server, but it’s pretty easy to figure out from here. Just install the .NET Framework (it’ll actually already be checked for you) and you’re golden. Now, that takes too much time for me, especially when I’m installing several boxes at once. So what I like to do is call on powershell for this task. I’m going to take some extra time here to show you a couple things, but the process once you get it down is much faster than the wizard.
First of all, you have to load the windows modules into your PS session. To do it manually, you can open PS and type the following command:
> Import-Module ServerManager
Here’s a screen:
However, now you’ll be able to run the next command.
This will show you all the features available and which ones are already installed. Here’s a screen of the output.
And of course, you’ll notice on mine, it’s already installed, but it’ll be unchecked on yours. OK, now you’re ready to do the install itself.
And for that, you need yet another command, but don’t worry, it’s easy.
> Add-WindowsFeature AS-NET-Framework
Notice I put an arror by the name of the feature above that you’ll feed to the Add-WindowsFeature cmdlet. So in case you didn’t catch it, the syntax is simply the cmdlet and the name of the feature you want to install.
Here’s a screen of the line as it’ll look when you type it.
And here’s what it looks like while it’s installing:
And that’s it guys. The install is actually much quicker from the cmdline and you don’t have to worry about making a mistake through the GUI. And of course you don’t have to go through all these steps every time. Why not write a short script to do it for you? It would look like this:
That’s it. That’s all it takes to install it from a script. Now you can save that off to the network somewhere and just use it whenever you like.
OK, that’s all I’ve got.
Oh y, one more thing… you don’t have to import the servermanager module every time you run this. You can use the PS shell that loads all the windows modules for you. You can find it here:
Ok, THAT’S all I’ve got.
The best database career advice you’ve never heard!
Become a DBA. Become a BETTER DBA. Use the Roadmap.
The DBA Roadmap Seminar is 7 MP3 tracks (over 5 hours!) of insider guidance on your database career. We'll teach you how and what to study as a DBA, weigh in on controversial resume debates, teach you to recognize a worthy recruiter, and discuss the new professionalism of interviews. Also some bonus materials, PDF companion guides, and really spiffy intro music!
Once your $99 PayPal payment is submitted, you'll get the download link in e-mail! (Download is a 370Mb ZIP file.)
Visit www.DBARoadmap.com for info, forums, and more!
TagsArchitecture blunders Camtasia Career Coding Standards CPU data generator DBA Development disaster firewall Idiots Inside SQL Server Interview ITBookworm Jobs Kalen Delaney Katmai Ken Henderson LiteSpeed MidnightDBA PASS Summit 2011 Pinnacle politics Powershell Powershell Hero Query techniques Red-Gate reporting restore SQL Express 1433 SCM SQL Server SQLServerDVD.com SSIS SSRS Training troubleshooting TSQL Tuesday tuning Tutorials Video post videos Yukon
Interview: Kalen Delaney!
Need help? Got an emergency? Write us at Support@MidnightDBA.com!
We can schedule time to help with your backup/restore issues, high availability and disaster recovery setup, performance problems, and a great deal more. Very often, we're even available on the moment for downtime issues and emergencies.
- Guest Review: Microsoft Wireless Sculpt Ergonomic Keyboard
- Quick Review: Anker Vertical Ergonomic Optical USB Wired Mouse
- Reading: Microsoft SQL Server 2012 High-Performance T-SQL Using Window Functions by Itzik Ben-Gan
- Repost: “Problems with my new book” by Grant Fritchey
- Announcing SQL Server 2012 Query Performance Tuning by Grant Fritchey