Tuesday, 20 April 2010

Listing server features with Powershell

The scenario is this - you've got a machine running Windows 2008, and you want to check exactly what the machine's installed roles and services.

Two lines of Powershell are all you need:

import-module servermanager

get-windowsfeature

And that will give you a complete list. You can even redirect the output to a file (rather than the screen) by amending the 2nd line to read something like

get-windowsfeature >> c:\temp\output.txt

And where it really gets interesting is that you can run that on two servers and compare the results in your text-comparison tool of choice to see exactly what's different.

I love Powershell - it's effectively 21st Century QBasic, or DOS scripting on steroids ...

0 comments: