To configure one or more Server Roles during an unattended installation, you can use the PowerShell or Server Manager command-line tool. For more information about Server Roles, see this Microsoft Web site.

You can create a FirstLogonCommand in your answer file that specifies the proper parameters for the server role you want to configure. The FirstLogonCommand is configured in the oobeSystem configuration pass. The FirstLogonCommand settings run immediately after a user logs onto the computer and before the desktop is displayed.


You must run PowerShell and Server Manager commands from an account with administrator privileges.

For more information about adding a FirstLogonCommand, see Add a Custom Command to an Answer File.

The following example shows the PowerShell.exe syntax for installing the ServerManager module and the DHCP, FAX, DNS, and File-Services roles.

   <SynchronousCommand wcm:action="add">
	<CommandLine> >%WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe -command Import-Module ServerManager; Add-WindowsFeature DHCP; Add-WindowsFeature FAX; Add-WindowsFeature DNS; Add-WindowsFeature File-Services;</CommandLine>
	<Description>Configure Web Server Role</Description>

Not all server roles support Sysprep. You must configure some server roles after imaging and deployment. For more information, see Sysprep Support for Server Roles.

See Also