Search This Blog

Thursday, December 1, 2011

Install Roles of 2008 from Command Line

DNS


start /w ocsetup DNS-Server-Core-Role



DHCP

start /w ocsetup DHCPServerCore



File Services (Server service is installed by default) but there are other role features



File Replication Service

start /w ocsetup FRS-Infrastructure



Distributed File System

start /w ocsetup DFSN-Server



Distributed File System Replication

start /w ocsetup DFSR-Infrastructure-ServerEdition



Services for Network File System (NFS)

start /w ocsetup ServerForNFS-Base

start /w ocsetup ClientForNFS-Base



Hyper V

start /w ocsetup Microsoft-Hyper-V



Print Server feature

start /w ocsetup Printing-ServerCore-Role



Line Printer Daemon (LPD) service

start /w ocsetup Printing-LPDPrintService



Active Directory Lightweight Directory Services

start /w ocsetup DirectoryServices-ADAM-ServerCore



Active Directory Domain Services

dcpromo /unattend:



Streaming Media Services

Follow directions found in Article ID 934518



IIS

start /w pkgmgr /iu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel

To uninstall IIS use the following command

start /w pkgmgr /uu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel



NOTE: If you need to install a Role that you installed with ocsetup all you need to do is to append the commands above with /uninstall.



Now let's take a look at how we install Features on Server Core:



Microsoft Failover Clustering

start /w ocsetup FailoverCluster-Core



Network Load Balancing

start /w ocsetup NetworkLoadBalancingHeadlessServer



Subsystem for UNIX-based applications

start /w ocsetup SUACore



Multipath IO

start /w ocsetup MultipathIo



Removable Storage

start /w ocsetup Microsoft-Windows-RemovableStorageManagementCore



Bitlocker Drive Encryption

start /w ocsetup BitLocker



Backup

start /w ocsetup WindowsServerBackup



Simple Network Management Protocol (SNMP)

start /w ocsetup SNMP-SC



Windows Internet Name Service (WINS)

start /w ocsetup WINS-SC



Telnet client

start /w ocsetup TelnetClient



Common Networking Commands 2008 Server

Server Core Common Networking Commands


To configure the IP address we will have to remember (or learn) Netsh.



Configure a Static IP Address on Server Core:

Netsh int ipv4 set address “Local Area Connection” static 10.1.1.10 255.255.255.0 10.1.1.1

Netsh int ipv4 set dnsserver “Local Area Connection” static 10.1.1.5 primary

Netsh int ipv4 set winsserver “Local Area Connection” static 10.1.1.6 primary



Configure a Dynamic (DHCP) IP Address on Server Core:

Netsh int ipv4 set address “Local Area Connection” source=dhcp



Change the name of the network interface on Server Core:

Netsh int set interface name = “Local Area Connection” newname = “Primary Network”



Server Core Common Windows Firewall Commands:




Disable firewall:

netsh firewall set opmode disable




MMC Snap-in - Event Viewer

Windows Firewall Rule Group - Remote Event Log Management



MMC Snap-in - Services

Windows Firewall Rule Group - Remote Services ManagementMMC Snap-in - Shared Folders

Windows Firewall Rule Group - File and Printer Sharing



MMC Snap-in - Task Scheduler

Windows Firewall Rule Group - Remote Scheduled Tasks Management



MMC Snap-in - Reliability and Performance

Windows Firewall Rule Group - Performance Logs and Alerts

Windows Firewall Rule Group - File and Printer Sharing



MMC Snap-in - Disk Management

Windows Firewall Rule Group - Remote Volume Management



MMC Snap-in - Windows Firewall with Advanced Security

Windows Firewall Rule Group - Windows Firewall Remote Management



To enable all of these rules follow use this command:

Netsh advfirewall firewall set rule group=“remote administration” new enable=yes



To enable specific commands follow this format:

Netsh advfirewall firewall set rule group=“” new enable=yes



Server Core Common Domain Management Commands

Join a domain:

netdom join ComputerName /domain:DomainName /userd:UserName /passwordd:*

Yes, /passwordd:*

needs to have that second d at the end of it.



Remove from domain:

netdom remove



Rename a Domain Member:

netdom renamecomputer %computername% /NewName: /userd: /passwordd:*



Rename Administrator:

wmic UserAccount where Name="Administrator" call Rename Name="new-name"



Add User to a Local Group

net localgroup GroupName /add \



Remove User from a Local Group

net localgroup GroupName /delete \



Confirm Domain and/ New Computer name

Set



Update User Passwords:

Net user [/domain] *



Server Core Common Server Management Commands

Toggle Remote Desktop on and off:

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



Enable reduced security for RDP connections:

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



Active Server Core:

Local method - Slmgr.vbs –ato

Remote method - Cscript windows\system32\slmgr.vbsServerName UserName password:-ato



Rename a Stand-Alone Member:

netdom renamecomputer /NewName:



List of installed patches:

wmic qfe list



Install Updates:

wusa .msu /quiet



Configure for AutoUpdates:

cscript scregedit.wsf /AU /4



Disable AutoUpdates:

cscript scregedit.wsf /AU /1



View AutoUpdate Setting:

cscript scregedit.wsf /AU /v



Configure the Page File:

wmic pagefileset where name=”” set InitialSize=,MaximumSize=



Configure a Proxy Server: 

netsh Winhttp set proxy :



List Running Services:


sc query



Start and/or Stop a Service:

sc start

sc stop



Task Manager: (Ctrl+Shift+Esc)

taskmgr



Manage Disk Volumes:

Diskpart /?



Defrag a Volume:

defrag /?



Change Time and Time Zone:

control timedate.cpl



Change the Desktop Resolution: (requires you to log off and back on)

Regedit - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Video

\0000\DefaultSettings.XResolution

\0000\DefaultSettings.YResolution



Display the Time in the Command Prompt:

prompt [$t]$s$p$g



Log off:

shutdown /l



Restart Now:

shutdown /r /t 0



Tuesday, April 19, 2011

Terminal services Manager commands for CLI

Hi Guys... This article will teach you how we can check the remote login sessions &amp how we can
 kill those sessions &amp also how we can view the remote processes &amp
 how we can kill those... this article will help you to use CLI when some times GUI is not responding.

 To view who and all users are connected to the system here i have given for local system

 C:\Users\reddy>quser
USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME
reddyjg console 1 Active none 4/19/2011 2:16 PM

If we want to check the remote system users
 C:>quser /server:REMOTEServername
USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME

if you want the help syntax you can check the help
quser /?

Here i have given one more command which will be usefull for the same work as above command does. QWinsta is different and better. It has more features and options.
 C:>qwinsta /?
Display information about Terminal Sessions.
QUERY SESSION [sessionname | username | sessionid] [/SERVER:servername] [/MODE] [/FLOW] [/CONNECT] [/COUNTER] sessionname Identifies the session named sessionname. username Identifies the session with user username. sessionid Identifies the session with ID sessionid. /SERVER:servername The server to be queried (default is current). /MODE Display current line settings. /FLOW Display current flow control settings. /CONNECT Display current connect settings. /COUNTER Display current Terminal Services counters information.

 To logoff the remote sessions

 C:\Users\reddy>logoff /?
Terminates a session.



LOGOFF [sessionname
sessionid] [/SERVER:servername] [/V] [/VM]

sessionname The name of the session.
sessionid The ID of the session.
/SERVER:servername Specifies the Remote Desktop server containing the user
session to log off (default is current).
/V Displays information about the actions performed.
/VM Logs off a session on server or within virtual machine. Th
e unique ID of the session needs to be specified.

 EXAMPLE
C:>logoff /server:Remoteservername 1 /v
Logging off session ID 1


There is one more command which will do the same task to logoff a session remotely as logoff command does... RWinsta has same parameters and does same thing as log off command. It simply means Reset Windows Station. The help goes as,

C:\Users\reddy>rwinsta /?
RESET SESSION {sessionname

sessionid} [/SERVER:servername] [/V]



sessionname Identifies the session with name sessionname.

sessionid Identifies the session with ID sessionid.

/SERVER:servername The server containing the session (default is current).

/V Display additional information.




EXAMPLE
C:>RWinsta /Server:MyWinServer 1
 the above command will reset the session with ID 1

How to view the remote running processes
>Tasklist /s Servername

 there are many options available for this command Just go through the help...

Kill the tasks remotely

To kill the tasks running on the server remotely is by using the taskkill command
>taskkill /s Servername

here is the help examples

Examples:

TASKKILL /S system /U domain\username /FI "USERNAME ne NT*" /IM *
TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"