Window Server 2008 - Using the ServerManagerCmd Utility

Server Manager is the graphical interface that you normally use to interact with the server. However, you may find that you want to automate some configuration tasks. Using the graphical utility isn’t the best way to automate tasks, so you want another method of performing the task. The command line utility equivalent of Server Manager is the ServerManagerCmd utility. This utility provides much of the same functionality as the graphical version. More importantly, it lets you automate tasks.

Before you can use the ServerManagerCmd utility, you must open a command prompt. The command prompt must have full administrator privileges.

Many command line utilities rely on commands or modes to accomplish tasks. Using one mode may help you retrieve the values that the command line utility supports while another mode helps you change a setting. The ServerManagerCmd utility provides six modes of operation. The first mode you commonly use is –query, as shown here.

ServerManagerCmd -query [< query.xml> ] [-logPath < log.txt> ]

When you use this mode, it displays all the roles and features that the server can support. All the entries have a box next to them. A check mark in this box shows that you installed the role or feature on the system. When you supply the name of an XML file, this mode also places the information in the named file for you. The ServerManagerCmd always logs the results of the –query mode. You use the –logPath command line argument to specify a different location for this log.

After you determine the status of your server, you likely want to install or remove roles or features. The –query mode tells you the names of all roles and features that the server supports. You can install roles or features only when you haven’t installed them already. Likewise, you can remove only features that you have installed. The ServerManagerCmd utility tells you when you make an error. Here’s the command line you use to install or remove roles or features:

ServerManagerCmd -install < name>
[-setting < setting name> =< setting value> ]*
[-allSubFeatures] [-resultPath < result.xml> [-restart]
| -whatIf] [-logPath < log.txt> ]

ServerManagerCmd -remove < name> [-resultPath < result.xml>
[-restart] | -whatIf] [-logPath < log.txt> ]
The –install and –remove modes contain a lot of optional arguments. If

In this case, all you have to provide is the name of the role or feature you want to install or remove. However, you may find that you also want to install all subfeatures for the role or feature. In this case, add the –allSubFeatures command line switch to the command line as well. Let’s say you want to install the Fax Server role. That’s its display name. However, the real name of this role is Fax, so you would type ServerManagerCmd –install Fax and press Enter.

Notice that ServerManagerCmd automatically installs the required Print Server features because Fax Server needs them in order to function. ServerManagerCmd doesn’t ask you about these support features — it assumes that you want to install them. Consequently, you have to review the output of any installation or removal that you perform because otherwise you could end up with features you never intended to install on the system. Use the –logPath argument to create a log of the installation so that you can review it later.

You may find that you want to install a number of roles and features at one time. It’s possible to use a batch file or script to perform this task. However, the ServerManagerCmd utility provides a better way. Simply create an XML file that contains a list of the roles and features you want to install and provide this file as input to the –inputPath mode. Here’s the command line for the –inputPath mode:

ServerManagerCmd -inputPath < answer.xml>
[-resultPath < result.xml> [-restart] | -whatIf]
[-logPath < log.txt> ]

ServerManagerCmd -help | -?

Finally, for those times when you’re not sure you have the most recent version of ServerManagerCmd, try the –version mode. Here’s all you need to type:

ServerManagerCmd –version

Of course, there’s one final issue to consider about the ServerManagerCmd utility — the format of the answer.xml file. Microsoft strove to keep the format of this file very simple. All you really need to provide is a list of what you want to install or remove. For example, if you want to install the Web Server role, you create an answer.xml file with the following content:

< ServerManagerConfiguration Action=”Install”
< Role Id=”Web-Server” />
< /ServerManagerConfiguration>

Even though the < ServerManagerConfiguration> element appears on multiple lines in this book, it should appear on a single line in your file. The Action attribute tells ServerManagerCmd which task to perform. You can specify Install or Remove as the actions. The < Role> element tells ServerManagerCmd that you want it to install a new role with an ID value of Web-Server. Notice that you must enclose the ID value in double quotes. Use the < RoleService> element to install role services and the < Feature> element to install features.

ServerManagerCmd Arguments and Switches

Specifies the name of the role or feature that you want to install. Make sure to use the feature’s ID rather than its display name. For example, the Active Directory Certificate Services role has an ID of AD-Certificate.

-setting < setting name> =
Provides any required settings to perform an installation. < setting value> These settings are the same ones you provide using the various pages in the graphical interface. If you don’t provide settings, ServerManagerCmd configures the role or feature using default settings.

Specifies that you want to install all subordinate role services and features along with the role, role service, or feature. The ServerManagerCmd utility automatically installs required roles, role services, and features. You use this option only when you want to install optional elements as well.

-resultPath < result.xml>
Saves the result of performing a particular task with ServerManagerCmd to the file specified by result.xml. You can use any filename; however, you should ensure that the file has an XML filename so that you can read it properly with an application.

Automatically restarts the computer when ServerManagerCmd determines that a restart is necessary to complete the operation. Use this option carefully when installing new roles or features on a production server, because you can disconnect users accidentally.

-inputPath < answer.xml>
Defines the path and filename that holds the list of roles, role services, and features you want to install.

Displays the operations that the system will perform to install or remove a particular feature without actually performing them. The output is the same as the format for the answer.xml file, so you can use this command line switch to help create an answer.xml file.

-logPath < log.txt>
Species a nondefault location for the log file. Even though ServerManagerCmd always creates a log file, you may want to place the file in a location that you can reach with greater ease.

Source of Information : For Dummies Windows Server 2008

No comments:

Cloud storage is for blocks too, not just files

One of the misconceptions about cloud storage is that it is only useful for storing files. This assumption comes from the popularity of file...