Skip to main content
Rate:  

Server Manager Command Line in Windows Server 2008 

Posted By:  Joey Snow 
Publish Date: 2/5/2008


On the heels of yesterdays Windows Server 2008 RTM announcement is a closer look at a new command line based management tool in Windows Server 2008: Server Manager Command. This tool allows, among other things, for unattended installation, configuration, and removal of roles and features in Windows Server 2008.

 

Who’s it for? IT Professionals who install and manage server roles and features.

 

What does it do?

· Installs and removes server roles and features via a command line.

· Displays roles and features installed on a server

· Allows for viewing the output of the tool in XML

· Query what dependencies will be installed with any given role or feature.

 

But why is that interesting?

Pretend for a moment you are an IT Pro at a large company. You have been assigned the task of setting up a role such as print services on a server that someone else configured. Prior to Windows Server 2008, we’d need to connect to the server and manually check to see if the service is installed and running or come up with a WMI query/script to check it for us. Today with Windows Server 2008 and Server Manager Command line it’s much easier.

To check to see what roles/features are installed we simply need to open a command prompt on the server (you need to make sure it’s running as Administrator) and type the following command: servermanagercmd.exe –query

· Printed to the console are all of the roles and features available on the server. Printed first are the roles in the exact hierarchy as displayed in the GUI version of Server Manager.

· Features are then listed after the roles.

· Look for the roles or features with the checkbox and you can easily determine what is installed.

Okay that was easy but what if I wanted to dump out the results of the query to an .xml file? Well we’ve got that covered as well. Just type servermanagercmd.exe-query query.xml (where query.xml is the path and filename of the export file) and you now have a nice .xml file with the servers and roles listed.

Another really good idea is to check and see what changes are going to be made when we install the role. This is made very easy by using the “what if” switch in Server Manager Command. Simply type (remember we are using an elevated command prompt) servermanagercmd.exe –whatif –install print-server. The –whatif switch gives me a list of all software installed as a result of the command, including any dependant roles, services, and features.

We now know what is installed and what is going to be installed, now let’s install that role. Again in that elevated command prompt window type servermanagercmd.exe –install print-server. When the installation is completed you get a message stating: Success: Installation succeded. At this point we have completed the installation of the role.

Removal of a role is just as simple. In that elevated command prompt window type: servermanagercmd.exe –remove print-services. That will completely remove the role, role services, and features that it installed in the previous step.

 

Now a quick recap:

· Prior versions of Windows provided few if any dependency checks when users had to add/remove server roles or other software. A simple command now can provide server administrators with a listing of the components that will be added or removed.

· Server manager command also provides a mechanism for performing unattended installation of server roles and features. You can choose to install a single role or feature or combine installation of multiple roles/features via an XML answer file.

· You can now easily gather information on the installed roles and/or features of any given server and export those results to XML for documentation.

· You can also determine what server components will be affected by the installation or removal of a server role or feature.

 

Get started:

Server Manager Command Line Syntax

Windows Server TechCenter