switchport Security

70-648, NAP, DHCP, IPNG, IPv4, IPV6, DNS, Global Names, WDS, Server Core, WAS, Server Manager, OCSP, WBAdmin, Group Policy, BitLocker, Active Directory, switch module, route module, firewall module, auto secure, network, router ospf, authentication, drupal.org

Tuesday, December 25, 2007

Server Manager CMD

It's Christmas in my timezone right now so I'll greet everyone a very, merry Christmas first!

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?
-What's ServermanagerCMD?
-Using ServerManagerCMD


What's ServerManagerCMD?
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

Using ServerManagerCMD

It's quite easy to use servermanagercmd. But first change your CLI properties.

I've changed mine to the following:
  • width: 150
  • height: 3000
Also, create an alias for servermanagercmd.

Why? It's soo long to type.

[Side_Note]

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. ^__^

Hint! Hint!

s1 -1 input

s2 -2 inputs

s3 -3 inputs

wahahahaha!
[/Side_Note]

Querying installed Roles and Features:
  • servermanagercmd -query Output.xml
Take note of what Roles and Features to install from an install file:
  • servermanagercmd -inputpath FILE.xml

Note:
Using this command won't work because on internal differences in the XML file
  • servermanagercmd - inputpath Output.xml
What works?

Download this:
Command Line Transformation Utility (msxsl.exe)
Brief Description

The msxsl.exe command line utility enables you to perform command line Extensible Stylesheet Language (XSL) transformations using the Microsoft® XSL processor.

These too:
http://rapidshare.com/files/78807142/view.xsl
http://rapidshare.com/files/78807141/remove.xsl
http://rapidshare.com/files/78807140/install.xsl

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
Example:



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?
There! Now you can make most out of ServermanagerCMD!

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.


Note: http://technet2.microsoft.com/windowsserver2008/en/library/e7edce1d-442c-4ec3-b324-c748e4f937551033.mspx?mfr=true



Hope you fellas enjoyed!




-Jaeson

No comments: