Longhorn Server Core - Quick Command Dump
It's messy, I know. I went thru and grabbed lots of commands from http://blogs.technet.com/server_core/default.aspx, with brief summaries to operate Longhorn Server Core.
Command line reference for 2003 here: http://go.microsoft.com/fwlink/?LinkId=20331
Drvload <path>\<driver>.inf
For hardware that does not have a driver included in Longhorn Server, such as a new piece of hardware that comes out after release, as long as you have a PnP driver for it, it can be installed from the command line. To do this, you need to either copy the driver files to a temporary folder on the Server Core box or make them available on a network share. In Server Core beta 2, you then run the Drvload.exe command to install them, pointing the tool at the driver inf file.
Msiexec.exe /I <msipackage>
The recommended way is to use any unattend support the MSI has or the /quiet switch. However, most MSIs use pretty basic gui functionality so should display. The biggest area that is unlikely to work is if the MSI allows you to select the location to install and has a browse button. Very often, the browse button will use the browse common dialog box, which isn’t in Server Core because of dependencies.
sc.exe
SC.exe is a very powerful command line tool that has been around for awhile but doesn’t seem to be widely known about. When managing services from the command line, net start and net stop are widely used, however SC provides a lot more functionality. SC is in fact a command line equivalent plus more functionality then the Services MMC. Some of the terminology is a little different between the two, for example in the Services MMC you pause and resume services while with SC you pause and continue services.
To perform the equivalent the Properties dialog box in the Services MMC, take a look at the options available with “SC config”. You can use SC sdhow and sdset to view and set the permissions for a service.
SC can also be used to find out what hardware you have drivers installed for on your Server Core box by running:
Sc query type= driver
Netdom renamecomputer %computername% /NewName:new-name /UserD:domain-username /PasswordD:*
First up is how to rename the box, since there isn’t a remoteable gui to let you do this. This is straightforward if you are domain joined.
wmic computersystem where name="%computername%" rename name="new-name"
Using WMIC you can rename the computer
Cscript \windows\system32\scregedit.wsf /ar 0
Enable Remote TS Admin mode
Cscript \windows\system32\scregedit.wsf /cs 0
Turn off higher security admin mode (Vista and Longhorn clients only)
dir \windows\system32\ts*.*.
Find all TS related utilities
Access remote session drives via
\\tsclient\c etc
(net use as necessary)
Change resolution
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Video
\0000\DefaultSettings.XResolution
\0000\DefaultSettings.YResolution
logoff.exe
Log off session
Start /w ocsetup RolePackage
Install role
DHCP = DHCPServerCore
DNS = DNS-Server-Core-Role
File = File-Server-Core-Role
File Replication service = FRS-Infrastructure
Distributed File System service = DFSN-Server
Distributed File System Replication = DFSR-Infrastructure-ServerEdition
Network File System = ServerForNFS-Base
Single Instance Store = SIS
Failover Cluster = FailoverCluster-Core
Network Load Balancing = NetworkLoadBalancingHeadlessServer
Subsystem for UNIX-bases applications = SUA
Multipath IO = Microsoft-Windows-MultipathIO
Removable Storage Management = Microsoft-Windows-RemovableStorageManagementCore
Bitlocker Drive Encryption = BitLocker
Backup = WindowsServerBackup
Simple Network Management Protocol (SNMP) = SNMP-SC
To remove a server role or optional feature, you use the same command line but add /uninstall.
Ocsetup is currently case sensitive, so you need to use the names exactly as above.
Wusa.exe <patchname>.msu /quiet
Applying a patch to Server Core
You can also include the /norestart switch with the /quiet switch to prevent wusa.exe from automatically restarting the server. Note that the /norestart switch can only be used with /quiet, it can’t be used on its own.
You will need to download the patch on another box and expand it so that you can copy the .msu file to the Server Core box.
Of course, you can also turn on the Windows Update client, using the scregedit.wsf script if you don’t want to manually patch the box.
Event Log
Working with the event logs from the command line has improved in Longhorn Server. The old eventquery VBScript has been replaced by a new command line tool: wevtutil.exe. Using the el switch will provide a list of event logs you can query using the qe switch. However, this does much more then just let you query for events, it also lets you export, archive, clear, and configure the logs from the command line. Wevtutil.exe also supports remote operation, so could be used in scripts from a Vista or Server install.
Wevtutil el – This command will list out a lot of logs but the main logs you’ll want to look at are Application, System, and Security. In addition, the Setup log is helpful if you are having problems installing roles, features, or patches.
c:5 – Count. Specifies how many records you want returned, in this example 5
/rd – Reverse Direction. By default the oldest events are displayed first, so if you used the /c switch to dump 5 events you would get the first 5 in the log, probably not the events you’re most interested in. To see the 5 most recent events you would specify /c:5 /rd:True
/f: - Format. By default the output is raw xml and when dumped out to the screen it isn’t the most readable output. Use /f:text to see the events in plain text.
/e – Element. If you’re dumping your log in XML, you must use this switch and specify a root element to get well formed XML.
So if you wanted to see the most recent event in the system log in text format, you would run:
Wevtutil qe /f:text /c:1 /rd:true system
control intl.cpl
Change international settings
Server Core actually also includes datetime.cpl for setting the time zone
Cscript slmgr.vbs –ato
Activate Server Core
Verify activation
Cscript slmgr.vbs –did
get GUID, then Cscript slmgr.vbs –dli GUID
WinRM quickconfig
Before you can use WinRS to remotely manage a server, you need to first configure it with a WS-Management listener.
Prompt
prompt [$t]$s$p$g
Determine file version
wmic datafile where name="d:\\windows\\system32\\ntdll.dll" get version
What patches are installed
wmic qfe list
Serverweroptin.exe – This allows you to configure the Windows Error Reporting settings and replaces the /er option in scregedit.wsf (although I don’t think that change is in the build yet).
Oclist.exe – This tool displays the list of Server Roles and optional features that can be installed on Server Core, along with the package name that you need to use with ocsetup for installation. In addition, this displays the state (installed or not) of each package so you can easily tell which Server Roles or optional features are installed.
WINS
Install package name WINS-SC
