Skip to content

Posts from the ‘Windows Server 2008’ Category

Configure Networks (IPv4): netsh> interface> ipv4>


Available Commands

set address
set dnsserver
set winsserver
show addresses
show dnsservers
show winsservers
 

Examples:

netsh

netsh:>interface

netsh interface:>ipv4 (or ipv6)

Then you can use any of the following

set address “Local Area Connection” static 10.0.0.44 255.255.0.0 10.0.0.1

set dnsserver “Local Area Connection” static 10.0.0.67 primary

add dnsserver “Local Area Connection” 10.0.0.68 index=2

(note it’s “add” dnsserver now, and also no “static” but you are indicating the hiaracy of use on the DNS Servers by “index” index=2 index=3 etc.)

You may have multiple nics in the machine, I would use “ipconfig /all” in order to view the cards names before entering the netsh command.

The next thing we should do is configure the system name, and join it to a domain!

how I configued my server:

Configuring My Local Area Connection (NIC)

There is “some” GUI in Windows Server Core


I’ll try and post all the GUI options I find for server core in this one post, here is what I have discovered thus far

gdi32.dll, shlwapi.dll, timedate.cpl, intl.cpl.. oh, and notepad!

You can also use the shutdown command GUI by running “shutdown -i”

Windows Update


Windows Update client using the scregedit.wsf script

 OR

Cscript c:\windows\system32\scregedit.wsf /au 4

Net stop wuauserv

Net start wuauserv

This will use the default time of 3am to check for patches. If you want to force an update check, you can run:

Wuauclt /detectnow

Event Logs and Remote Event Log access


You can use the Event Viewer MMC snap-in to remotely view the event logs on. With Windows XP/2003 you don’t get all the latest functionality available with the new event logs in Server 2007

Command Line Event Log access

Working with the event logs from the command line has improved in Server 2007 Core. 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.

Common switches that come in handy

/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

To show this event in xml and dump it to a network share, run:

Wevtutil qe /c:1 /rd:true /e:root system > \\computer\share\system.xml

Adding and Removing server roles and optional features on Server Core


To install a server role on Server Core, you need to use the following command line:

Start /w ocsetup “RolePackage” where RolePackage is one of the following: 

Use OClist.exe to view installable roles 

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
 

You may be wondering why Active Directory isn’t in the list above and that is because it is a bit different from the other roles. To install Active Directory, you need to use the following command line:

Dcpromo /unattend:Unattendfile

In Server Core 2008, the dcpromo tool that is installed by default performs the installation and removal of the rest of the Active Directory binaries. The unattend file is the same file and format that you can use when running dcpromo unattend on Server.

To install an optional feature on Server Core, you need to use the following command line:

Start /w ocsetup OptionalFeaturePackage

Where OptionalFeaturePackage is one of the following:

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 and listed roles seem like they are currently case sensitive, so you need to use the names exactly as above.

OcList   Installing DNS Server Role

Changing The System Name (Domain and non Domain computer account)


Netdom renamecomputer %computername% /NewName:new-name /UserD:domain-username /PasswordD:*

Netdom doesn’t currently provide a way to rename a non-domain joined computer.

It is a bit of a hassle to join and unjoin from a domain just to rename the computer.

WMI is the solution to this one. Using WMIC you can rename the computer using:

wmic computersystem where name=”%computername%” rename name=”new-name”

The one limitation to this is that it must be run while logged on with the default administrator account. You must also REBOOT for the changes to take effect

 If you want to view if this is successful just use “systeminfo” and if should display the computer name for you

Example Shown, I renamed my system before joining to my domain.

Changing the system name via WMIC   System Info of changed name

Working with Terminal Services Sessions


If you ever need to manage Terminal Services sessions from the command line, the query command is the tool you need. Running query sessions (which can also be used remotely) will tell you what Terminal Services sessions are active on the box as well as who is logged into them. This is handy if you need to restart the box.

Query has some other useful options and there are a variety of other Terminal Services command line tools, most of which can be found by running dir \windows\system32\ts*.*.

Restarting the Command Prompt


hen logged on locally, if you accidentally close the Command Prompt you can either logoff and on, or press ctrl+alt+del, start Task Manager (or just press ctrl+shift+esc), click file, run and run cmd.exe to restart it. In a Terminal Services session, you can use the above commands to logoff and then reconnect and log back on. You can also configure the Terminal Services client to have the windows keys pass to the remote session when not maximized so you can use ctrl+shift+esc to start task manager and run cmd.exe.

Remore Desktop (Terminal Services)


There is a script included to turn on and off remote desktop, turning it on is done by running:

Cscript \windows\system32\scregedit.wsf /ar 0

Server Core uses a new higher security mode that only allows Vista and Longhorn Server clients to connect. If you want to TS to your Server Core box from a pre-Vista\Longhorn Server Terminal Services client, you need to turn off the higher security mode, which can be done by running:

Cscript \windows\system32\scregedit.wsf /cs 0

Once enabled you can then use the TS MMC snap-ins to remotely manage TS on the Server Core box, or use the TS command line tools.

Logging off of a Terminal Services session

On Server Core, there is no Start button so no GUI option to logoff. Clicking the X in the corner of the window will disconnect your session, but the session will still be on the box. To logoff, you need to use the Terminal Services logoff command. While in your Terminal Services session you simply run: logoff. If you disconnect your session, you can either reconnect and use logoff, use the logoff command remotely, or use the Terminal Services MMC to logoff the session.

Example: Allowing all previous verisons of windows to connect

Secure Remote Desktop              All Previous versions of windows can now connect

Changing the Display Screen Size Resolution


To change the display resolution so you can run at a higher resolution then what you might have ended up with at the end of setup. To do this, requires editing the registry and if you pick a resolution your video card or monitor can’t display, you might have to reinstall – although you will hopefully boot and can again remotely modify the settings in the registry.

o do this you will need to use regedit.exe on another computer to remotely access the registry on the Server Core box and navigate to:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Video

Under this will be a list of GUIDs and you will need to determine which one cooresponds to your video card/driver. This might require some experimenting to determine the right one. Under the GUID, you can set:

000\DefaultSettings.XResolution
000\DefaultSettings.YResolution

To the resolution you would like to use. If these don’t exist, you can create them. This change requires you to log off and back on again to take effect.