Hmm, need to script what you see in Server Manager? Well, don't fear. We have just the tool for that and it's called ServerManagerCMD.
Microsoft distinguishes Roles from Features in Windows Server 2008. This is obvious in the GUI and in the CLI as well.
What's in here?
Servermanagercmd.exe is a CLI tool designed to perform the following tasks listed below:
- Show roles and features installed on the server
- Show role services and features that would be installed if you made it perform results modeling
- Add/remove roles and features, settings are default
What it can't do are the following:
- Change settings
- Remoting (but you can use Winrs or was that Winrm?)
- Do stuff on ServerCore (but I'm including this though I'm still concentrated on ServerCOre)
- Manage non-base server roles and features, notably ISA, Exchange, or SQL server
It's quite easy to use servermanagercmd. But first change your CLI properties.
I've changed mine to the following:
- width: 150
- height: 3000
Why? It's soo long to type.
Creating an Alias
Create a file named smc.bat
Type in the following as its contents: %SystemRoot%\system32\servermanagercmd.exe %1
Solves your problem of typing a very long CLI command and works seemingly anywhere but I'm too lazy to think about how to resolve issues like multiple entries for servermanagercmd. ^__^
s1 -1 input
s2 -2 inputs
s3 -3 inputs
Querying installed Roles and Features:
- servermanagercmd -query Output.xml
- servermanagercmd -inputpath FILE.xml
Using this command won't work because on internal differences in the XML file
- servermanagercmd - inputpath Output.xml
Command Line Transformation Utility (msxsl.exe)
The msxsl.exe command line utility enables you to perform command line Extensible Stylesheet Language (XSL) transformations using the Microsoft® XSL processor.
All you need to do is to convert stuff.
How is that?
- Query Servermanagercmd and save it as a reference file
- Use the xsl file to convert individual xml files
PATH:\servermanagercmd -query Base.xml
For Installing Roles
PATH:\msxsl Base.xml install.xsl -o install.xml
For Removing Roles
PATH:\msxsl Base.xml remove.xsl -o remove.xml
For Viewing Roles and Features installed or not present PATH:\msxsl Base.xml view.xsl -o View.html
Using ResultPath for taking note of what happened during installation and removal
PATH:\servermanagercmd -installPath xmlName -resultPath rpName.xml [-restart | -whatIf] [-logPath
Actually, you can also use -install and -remove. Crazy, huh?
Note: Updating the Install, Remove, and View xml files created via msxsl seems fine with me but what do you think? I'm still experimenting.
Hope you fellas enjoyed!