共用方式為


Configure Windows Server Roles

Applies To: Windows 8, Windows 8.1, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2

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 FirstLogonCommands in your answer file that specifies the proper parameters for the server role you want to configure. The FirstLogonCommands setting is configured in the oobeSystem configuration pass. The FirstLogonCommands setting is run immediately after a user logs onto the computer and before the desktop is displayed.

Note

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

For more information about adding the FirstLogonCommands setting, 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.

<FirstLogonCommands>
   <SynchronousCommand wcm:action="add">
      <Order>1</Order>
      <CommandLine> Powershell.exe –command Import-Module ServerManager; Install-WindowsFeature DHCP,FAX,DNS,File-Services</CommandLine>
      <Description>Configure Server Role</Description>
   </SynchronousCommand>
</FirstLogonCommands>

Note

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

Other Resources

Windows Deployment Options