共用方式為


Quick Reference for Server Core Tasks

 

Applies To: Windows Server 2012 R2, Windows Server 2012

This topic is a collection of common administrative tasks for Server Core servers that you can perform locally or remotely from a command prompt.

Whenever possible, Windows PowerShell commands are used and are styled thus: Get-NetIPConfiguration. When no Windows PowerShell equivalent is available, run the indicated command at an ordinary command prompt or a Windows PowerShell prompt. These command are styled thus: Netdom remove

Task

Description

1.1. Configuration and installation

Configuration and installation

1.2. Networking and firewall

Networking and firewall

1.3. Updates and error reporting

Updates and error reporting

1.4. Services, processes, and performance

Services, processes, and performance

1.5. Event logs

Event logs

1.6. Disk and file system

Disk and file system

1.7. Hardware

Hardware

Note

This topic includes sample Windows PowerShell cmdlets that you can use to automate some of the procedures described. For more information, see Using Cmdlets.

1.1. Configuration and installation

Task

Steps

Set the local administrative password

Run:

Net user administrator *

Join a computer to a domain

Run Add-Computer

For more information see Configure a Server Core Server

Confirm that the domain has changed

Run:

set

Remove a computer from a domain

Run:

Remove-Computer

Add a user to the local Administrators group.

Run:

net localgroup Administrators /add <domain>\<username>

Remove a user from the local Administrators group

Run:

net localgroup Administrators /delete <domain\username>

Add a user to the local computer

Run:

net user <domain\user name> /add *

Add a group to the local computer

Run:

net localgroup <group name> /add

Change the name of a domain-joined computer

Run Rename-Computer

Confirm the new computer name

Run:

set c

Change the name of a computer in a work group

Run:

Rename-Computer

Disable paging file management

Run:

wmic computersystem where name="<computername>" set AutomaticManagedPagefile=False

Configure the paging file

Run:

wmic pagefileset where name=”<path/filename>” set InitialSize=<initialsize>,MaximumSize=<maxsize>

Where:

path/filename is the path to and name of the paging file

initialsize is the starting size of the paging file in bytes

maxsize is the maximum size of the paging file in bytes

Change to a static IP address

See https://technet.microsoft.com/library/hh826123.

Set a static DNS address

See https://technet.microsoft.com/library/hh826123.

Change to a DHCP-provided IP address from a static IP address

See https://technet.microsoft.com/library/hh826123.

Enter a product key

Run slmgr.vbs –ipk <product key>, and then run slmgr.vbs –ato. For more information, see Configure a Server Core Server.

Activate the server locally

Run slmgr.vbs -ato

Activate the server remotely

  1. Run cscript slmgr.vbs –ipk <product key><server name><username><password>

  2. Run cscript slmgr.vbs -ato <servername> <username> <password>

  3. Retrieve the GUID of the computer with cscript slmgr.vbs -did

  4. Run cscript slmgr.vbs -dli <GUID>

  5. Verify that License status is set to Licensed (activated).

Note

If Slmgr.vbs fails to activate the computer, the resulting error message advises you to run Slui.exe, along with the error code for more information. Slui.exe is not included in Server Core installations—it is available in <versions>.

1.2. Networking and firewall

Task

Steps

Configure your server to use a proxy server.

Run netsh Winhttp set proxy <servername>:<port number>

Note

Servers in Server Core mode cannot access the Internet through a proxy that requires a password to allow connections.

Configure your server to bypass the proxy for Internet addresses.

Run netsh winttp set proxy <servername>:<port number>bypass-list="<local>"

Display or modify IPSEC configuration.

Run netsh ipsec

Display or modify NAP configuration.

Run netsh nap

Display or modify IP-to-physical address translation.

Run arp

Display or configure the local routing table.

Run route

View or configure DNS server settings.

Run nslookup

Display protocol statistics and current TCP/IP network connections

Run netstat

Display protocol statistics and current TCP/IP connections using NetBIOS over TCP/IP (NBT).

Run nbtstat

Display hops for network connections.

Run pathping

Trace hops for network connections.

Run tracert

Display the configuration of the multicast router

Run mrinfo

Enable remote administration of the firewall.

Run netsh advfirewall firewall set rule group=”Windows Firewall Remote Management” new enable=yes

1.3. Updates and error reporting

Task

Steps

Install an update

Run wusa <update>.msu /quiet

List installed updates

Run systeminfo

Remove an update

  1. Run expand /f:* <update>.msu c:\test

  2. Navigate to c:\test\ and open <update>.xml in a text editor.

  3. In <update>.xml, replace Install with Remove and save the file.

  4. Run pkgmgr /n:<update>.xml

Configure automatic updates

  • To verify the current setting, run cscript scregedit.wsf /AU /v

  • To enable automatic updates, run cscript scregedit.wsf /AU 4

  • To disable automatic updates, run cscript scregedit.wsf /AU 1

Enable error reporting

  • To verify the current setting, run serverWerOptin /query

  • To automatically send detailed reports, run serverWerOptin /detailed

  • To automatically send summary reports, run serverWerOptin /summary

  • To disable error reporting, run serverWerOptin /disable

Participate in the Customer Experience Improvement Program (CEIP)

  • To verify the current setting, run serverCEIPOptin /query

  • To enable CEIP, run serverCEIPOptin /enable

  • To disable CEIP, run serverCEIPOptin /disable

1.4. Services, processes, and performance

Task

Steps

List running services

Run Get-Service

Start a service

Run Start-Service

Stop a service

Run Stop-Service

Retrieve a list of running applications and associated processes

See https://technet.microsoft.com/library/dd347650.aspx.

Stop a process forcibly

See https://technet.microsoft.com/library/dd347650.aspx.

Start Task Manager

Run taskmgr

Manage the performance counters and logging with commands such as typeperf, logman, relog, tracerprt.

See https://go.microsoft.com/fwlink/?LinkId=84872.

1.5. Event logs

Use Get-EventLog and related cmdlets; see https://technet.microsoft.com/library/ee176846.

1.6. Disk and file system

Task

Steps

Manage disk partitions

For a complete list of commands, run diskpart /?

Manage software RAID

For a complete list of commands, run diskraid /?

Manage volume mount points

For a complete list of commands, run mountvol /?

Defragment a volume

For a complete list of commands, run defrag /?

Convert a volume to the NTFS file system

Run convert <volume letter> /FS:NTFS

Compact a file

For a complete list of commands, run compact /?

Administer open files

For a complete list of commands, run openfiles /?

Administer VSS folders

For a complete list of commands, run vssadmin /?

Administer the file system

For a complete list of commands, run fsutil /?

Verify a file signature

For a complete list of commands, run sigverif /?

Take ownership of a file or folder

For a complete list of commands, run icacls /?

1.7. Hardware

Task

Steps

Add a driver for a new hardware device

  1. Copy the driver to a folder at %homedrive%\<driver folder>.

  2. Run pnputil -i -a %homedrive%\<driver folder>\<driver>.inf

Remove a driver for a hardware device

  1. Obtain a list of loaded drivers by running sc query type= driver

  2. Run sc delete <service_name>

See also