Commands used in Windows 2008        van Microsoft

Activation:
How do I use the command line to set the Windows Server 2008 product key for activation?
Use the slmgr.vbs script and the -ipk switch to set the Server 2008 product key for activation, as in the following example:  cscript slmgr.vbs -ipk "(product key)"

mstsc.exe [<Connection File>] [/v:<Server>[:<Port>]] [/admin] [/f] [/w:<Width> /h:<Height>] [/public] [/span]

Parameter Description
<Connection File>   Specifies the name of an .rdp file for the connection.
/v:<Server[:<Port>] Specifies the remote computer and, optionally, the port number to which you want to connect.
/admin                     Connects you to a session for administering the server.
/f                             Starts Remote Desktop Connection in full-screen mode.
/w:<Width>             Specifies the width of the Remote Desktop window.
/h:<Height>             Specifies the height of the Remote Desktop window.
/public                     Runs Remote Desktop in public mode. In public mode, passwords and bitmaps are not cached.
/span                       Matches the Remote Desktop width and height with the local virtual desktop, spanning across multiple monitors if necessary.
/edit <Connection File> Opens the specified .rdp file for editing.
/migrate                   Migrates legacy connection files that were created with Client Connection Manager to new .rdp connection files.
/?                            Displays help at the command prompt.

 

Netsh
How to use the command line to configure Windows Server 2008 and Windows Vista IPv4
static IP information?

Netsh + firewall
Enable ping from remote computer - on the W2k8 server typ:   netsh firewall set icmpsetting 8

Netsh interface to configure Server 2008 and Vista static IP information has changed due to IPv6 inclusion. Here's how I used the command line toconfigure Server 2008 and Vista IPv4 static IP information.

I determined the interface to configure (because Server 2008 and Vista have several). I listed the interfaces using the command netsh interface ipv4 show interfaces

To view the output click here.
I designated the physical adapter index 2.
Then I configured a static IP address.
netsh interface ipv4 set address name="2" source=static address=10.1.1.11
mask=255.255.255.0 gateway=10.1.1.10


Next I added the DNS servers. The primary DNS server's index is 1.
netsh interface ipv4 add dnsserver name="2" address=192.168.1.230 index=1

To add a secondary DNS server, I repeated the add dnsserver command but designated the
new server's index as 2.
netsh interface ipv4 add dnsserver name="2" address=192.168.1.230 index=2

To configure primary and secondary WINS servers, I'd utilize exactly the same syntax I
employed to add the DNS servers, but in the code I'd substitute winsserver for dnsserver.
The first index would be the primary WINS server and the second index would be the
secondary WINS server.

How do I enable remote management of a Server Core installation?
Server Core installations have very few local-management capabilities, except through the command line. To use the remote-management graphical tools, you must enable the remote-administration firewall exception by using the following command:

netsh firewall set service type=remoteadmin mode=enable

Enable the Remote Desktop for Administration mode to accept connections, type:  cscript C:\Windows\System32\Scregedit.wsf /ar 0
BTW, in order to view your current settings you can type: cscript C:\Windows\System32\Scregedit.wsf /ar /v
To enable remote management from any MMC snap-in, type the following:  netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes

-------------------------------------------------------------------------------------------------------------

Tasklist

How to view active Svchost-instance services in Windows Server 2008 or Windows Vista?
Run the Server 2008 or Vista built-in Tasklist command with the /svc switch to view
the services running in each Svchost instance, as the following example demonstrates.
You'll notice that a list of services is shown for each Svchost instance. type: tasklist /svc
-----------------------------------------------------------------------------------------------------------------------------------

An overview of key commands and utilities you’ll use for managing server core installations while logged on locally:
Control desk.cpl - View or set display settings.
Control intl.cpl - View or set regional and language options, including formats and the
keyboard layout.
Control sysdm.cpl - View or set system properties.
Control timedate.cpl - View or set the date, time, and time zone.
Cscript slmgr.vbs –ato - Activate the operating system.
DiskRaid.exe - Configure software RAID.
ipconfig /all - List information about the computer’s IP address configuration.
NetDom RenameComputer - Set the server’s name and domain membership.
OCList.exe - List roles, role services, and features.
OCSetup.exe - Add or remove roles, role services, and features.
PNPUtil.exe - Install or update hardware device drivers.
Sc query type=driver - List installed device drivers.
Scregedit.wsf - Configure the operating system. Use the /cli parameter to list available
configuration areas.
ServerWerOptin.exe - Configure Windows Error Reporting.
SystemInfo - List the system configuration details.
WEVUtil.exe - View and search event logs.
Wmic datafile where name=“FullFilePath” get version - List a file’s version.
Wmic nicconfig index=9 call enabledhcp - Set the computer to use dynamic IP addressing
rather than static IP addressing.
Wmic nicconfig index=9 call enablestatic(“IPAddress”), (“SubnetMask”) - Set a computer’s
static IP address and network mask.
Wmic nicconfig index=9 call setgateways(“GatewayIPAddress”) - Set or change the default
gateway.
Wmic product get name /value “ - List installed MSI applications by name.
Wmic product where name=“Name” call uninstall - Uninstall an MSI application.
Wmic qfe list - List installed updates and hotfixes.
Wusa.exe PatchName.msu /quiet - Apply an update or hotfix to the operating system.

 

How to use the command line to obtain a list of all the applications installed on my computer?
You can obtain a list of installed applications via Windows Management Instrumentation command-line interface (WMIC). Use the Product get name command
users\administrator\wmic
wmic:root\cli>product get name