Zachary Loeber

I eat complexity and am never without a meal.

Windows 2008 (and 2008 R2) Tips

Just a small list of 2008(R2) command line tips and tricks for the every day admin.

**Open A Windows Explorer window from the cmd.exe prompt
** start .
(note: the period is required)

Enable ping responses:

**(Use this for R2)
** netsh advfirewall firewall add rule name=”ICMPv4 Inbound” dir=in action=allow enable=yes profile=any localip=any remoteip=any protocol=icmpv4:8,any interfacetype=any edge=yes

**(or for just 2008)
** netsh firewall set icmpsetting 8 ENABLE

**Enable WinRM
** WinRM quickconfig

Disable WinRM
winrm delete winrm/config/Listener?Address=*+Transport=HTTP

List available features via command line
dism /online /get-features

Enable features via command line
dism /online /enable-feature

Enable SNMP via command line
dism /online /enable-feature /featurename:SNMP
dism /online /enable-feature /featurename:WMISnmpProvider
reg add HKLM\SYSTEM\CurrentControlSet\services\SNMP\Parameters\ValidCommunities /v /t REG_DWORD /d 4 /f
reg add HKLM\SYSTEM\CurrentControlSet\services\SNMP\Parameters\RFC1156Agent /v sysServices /t REG_DWORD /d 79 /f
reg delete HKLM\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers /v 1 /f

Enable Backup Role via command line
servermanagercmd -install Backup-Features

Enable Failover Clustering Feature via command line
dism /online /Enable-Feature /Featurename:FailoverCluster-FullServer
dism /online /Enable-Feature /Featurename:FailoverCluster-AdminPak

Enable .NET 3.5.1 feature
servermanagercmd -i NET-Framework
servermanagercmd -i NET-Framework-Core

Enable Roles Needed for SQL Cluster Install via command line
(specifically for msdtc)
ServerManagerCmd.exe -install AS-Incoming-Trans AS-Outgoing-Trans

Add windows 2008 core to domain:
netdom renamecomputer /NewName:
shutdown /r /t 0
netdom join computername /domain: /userd:userID PasswordD:* /Reboot

Enable remote management from any MMC snap-in:
netsh advfirewall firewall set rule group=”Remote Desktop” new enable=yes
netsh advfirewall firewall set rule group=”Remote Administration” new enable=yes

Enable Remote Management (Firewall):
netsh advfirewall set currentprofile settings remotemanagement enable

Rename computername:
NETDOM renamecomputer %computername% /newname:vshost

Restart the computer:
Shutdown /r /f /t 0

Logoff from the console:
Logoff.exe

Set the date and timezone:
control timedate.cpl

Query all the networkadapters :
netsh interface ipv4 show interfaces

Configure the networkadapter and Set a Static IP:
netsh interface ipv4 set address name=”2″ source=static address=172.168.2.2 mask=255.255.255.0 gateway=172.168.2.1Set a DNS server:netsh interface ipv4 add dnsserver name=”2″ address=172.168.2.1 index=1
netsh interface ipv4 add dnsserver name=”2″ address=172.168.2.10 index=1

Add a Windows 2008 Core Server to the domain:
netdom join W2K8DC04 /domain:domain.local /userd:DOMAIN\ACCOUNT /passwordd:YOURPASSWORD

Active Windows 2008 Core Server:
C:\Windows\System32\slmgr.vbs -ato

Set password for Administrator:
net user administrator *

**Use Windows Remote Shell:
** On Vista Sp1 :
start cmd (with a user who has administrator access to the remote machine)
winrs -r:SERVERNAME cmd
or start in a new window :
start winrs -r:SERVERNAME cmd

Add hardware to Core
pnputil -i -a

Display device driver list:
sc query type= driver

Forcibly stop a service:
tasklist
then
taskkill /PID

Configure Paging File:
wmic pagefileset where name=”
” set InitialSize=,MaximumSize=path/filename – is the path to and name of the paging file
initialsize – is the starting size of the paging file in bytes
maxsize – is the maximum size of the page file in bytes

Discover the available server roles:
oclist.exe

**Configure Service :
** Example : sc config dhcpserver start=auto

Check for new Windows Updates:
wmic.exe qfe

Remove a Windows Update:
wusa.exe patchname.msu

Disable teredo tunnelling (should be done for cluster server specifically)
netsh interface teredo set state disabled

**Setup an application for terminal services
** From a command line before installing the app
change user /install
After installation is complete
change user /execute

**To disable IPV6 fully on the 2008 server:
** Launch registry, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters. In the details pane, click New, and then click DWORD (32-bit) Value. Type “DisabledComponents” (without quotes) and then press enter. Double-click DisabledComponents and type 0xffffffff in Hexadecimal or 4294967295 in Decimal. Close the registry editor.

Now, navigate to C:\Windows\System32\Drivers\Etc and open the hosts file in notepad. Delete the IPV6 entry.