Skip to content

Posts from the ‘Windows Server 2008’ Category

Adding the Time to Server Core

Time in Server Core

This first one will be a flash back to the old MS-DOS days. Since Server Core doesn’t have the system tray, there is no clock. If you are used to having the time available on the screen, you can add it to your prompt in the Command Prompt window. Entering the following:

prompt [$t]$s$p$g

Will display:

[14:27:06.28] C:\users\default>

Install/View a role or optional feature

Start /w Ocsetup <packagename>

Note: For Active Directory, run Dcpromo

View role and optional feature package names and current installation state
oclist

Process This Message: I wonder how to add things to the body of the e-mail??

To activate server core

Cscript slmgr.vbs –ato

Activation in Server Core
There is a VBScript in Vista/Longhorn that can be used to activate from the command line: slmgr.vbs.
 

To activate Server Core you can run:

Cscript slmgr.vbs –ato

You can also verify your connection to the Internet and proxy settings (Netsh winhttp proxy)

To verify if activation was successful you can run:

Cscript slmgr.vbs –did

From the output, get the GUID for the appropriate product key, e.g. retail channel, and then run:

Cscript slmgr.vbs –dli GUID

If you didn’t activate before the grace period expired, you can also use slmgr.vbs to remotely activate. This can be done remotely by including the servername, username and password along with the –ato switch.

WMIC commands

WMIC commands.

If you want to determine a file’s version, for instance to see if it was patched, you can use WMIC:

wmic datafile where name=”d:\\windows\\system32\\ntdll.dll” get version

If you want to see what patches have been installed, WMIC will also show you that information:

wmic qfe list

Update static IP address
wmic nicconfig where index=9 call enablestatic(“192.168.16.4″), (“255.255.255.0″)

Change network gateway
wmic nicconfig where index=9 call setgateways(“192.168.16.4″, “192.168.16.5″),(1,2)

Enable DHCP
wmic nicconfig where index=9 call enabledhcp

Service Management
wmic service where caption=”DHCP Client” call changestartmode “Disabled”

Start an application
wmic process call create “calc.exe”

Terminate an application
wmic process where name=”calc.exe” call terminate

Change process priority
wmic process where name=”explorer.exe” call setpriority 64

Get list of process identifiers
wmic process where (Name=’svchost.exe’) get name,processid

Information about harddrives
wmic logicaldisk where drivetype=3 get name, freespace, systemname, filesystem, size, volumeserialnumber

Information about os
wmic os get bootdevice, buildnumber, caption, freespaceinpagingfiles, installdate, name, systemdrive, windowsdirectory /format:htable > c:\osinfo.htm

Information about files
wmic path cim_datafile where “Path=’\\windows\\system32\\wbem\\’ and FileSize>1784088″ > c:\wbemfiles.txt

Process list
wmic process get /format:htable > c:\process.htm

Retrieve list of warning and error events not from system or security logs
WMIC NTEVENT WHERE “EventType<3 AND LogFile != ‘System’ AND LogFile != ‘Security’” GET LogFile, SourceName, EventType, Message, TimeGenerated /FORMAT:”htable.xsl”:” datatype = number”:” sortby = EventType” > c:\appevent.htm

To set the pagefile size Disable system pagefile management

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

Configure the pagefile

wmic pagefileset where name=”C:\\pagefile.sys” set InitialSize=500,MaximumSize=1000

Manually installing a management tool or agent

Msiexec.exe /i

Logoff, shutdown, restart etc

logoff will log ya off

shutdown /r will reboot

shutdown /i will display a GUI of options for the shutdown command

To list installed drivers

Sc query type= driver

Follow

Get every new post delivered to your Inbox.