Share via


Windows Server Administration One Liners

1.  Quickly Turn ON/OFF Windows Firewall Using Command Line 

To Turn Off:

NetSh Advfirewall set allprofiles state off

To Turn On:

NetSh Advfirewall set allrprofiles state on

**To check the status of Windows Firewall: ** 

Netsh Advfirewall show allprofiles

Domain Profile Settings:
----------------------------------------------------------------------
State                                 ON
Firewall Policy                       BlockInbound,AllowOutbound
LocalFirewallRules                    N/A (GPO-store only)
LocalConSecRules                      N/A (GPO-store only)
InboundUserNotification               Enable
RemoteManagement                      Disable
UnicastResponseToMulticast            Enable
 
Logging:
LogAllowedConnections                 Disable
LogDroppedConnections                 Disable
FileName                              %systemroot%\system32\LogFiles\Firewall\pf
irewall.log
MaxFileSize                           4096
 
 
Private Profile Settings:
----------------------------------------------------------------------
State                                 ON
Firewall Policy                       BlockInbound,AllowOutbound
LocalFirewallRules                    N/A (GPO-store only)
LocalConSecRules                      N/A (GPO-store only)
InboundUserNotification               Enable
RemoteManagement                      Disable
UnicastResponseToMulticast            Enable
 
Logging:
LogAllowedConnections                 Disable
LogDroppedConnections                 Disable
FileName                              %systemroot%\system32\LogFiles\Firewall\pf
irewall.log
MaxFileSize                           4096
 
 
Public Profile Settings:
----------------------------------------------------------------------
State                                 ON
Firewall Policy                       BlockInbound,AllowOutbound
LocalFirewallRules                    N/A (GPO-store only)
LocalConSecRules                      N/A (GPO-store only)
InboundUserNotification               Enable
RemoteManagement                      Disable
UnicastResponseToMulticast            Enable
 
Logging:
LogAllowedConnections                 Disable
LogDroppedConnections                 Disable
FileName                              %systemroot%\system32\LogFiles\Firewall\pf
irewall.log
MaxFileSize                           4096
 
Ok.

**2. How to find the installed  hot fix
**systeminfo | find ": KB"

3. A Quick Tip To Check Operating System Architecture
SET Processor

**4.Displaying DHCP server activity using Netsh
**C:\netsh dhcp server show mibinfo

5.Authorizing a DHCP server using Netsh

You can use the Netsh command to authorize a DHCP server from the command line. In an Active Directory environment, you must first authorize your DHCP server before it can lease addresses to clients. 
 
For example, to authorize a DHCP server named AAPAC-DHCP-SRV01 in the CONTOSO domain and which has IP address 10.224.34.51, type the following command: 
netsh dhcp add server AAPAC-DHCP-SRV01.contoso.com 10.224.34.51 
 
To verify the result, type this command:  
netsh dhcp show server
 
If you decide later to remove the server from your network, you can unauthorized it by typing: 
netsh dhcp delete server AAPAC-DHCP-SRV01.contoso.com 10.224.34.51

**6. Remote Serrver Administration
*How to check the current IP settings?
How to change the preferred DNS server IP?
shutdown events tracker
WMIC
*http://social.technet.microsoft.com/wiki/contents/articles/14047.remote-server-administration.aspx
**

7. Default Dynamic Port Range

To see the port range, you can use the following commands:

  • NetSh INT IPV4 Show DynamicPort TCP

  • NetSh INT IPV4 Show DynamicPort UDP

To set or change the Dynamic Port Range:

  • NetSh INT IPV4 SET DynamicPort TCP Start=1024 num=65535
  • NetSh INT IPV4 SET DynamicPort UDP Start=1024 num=65535

http://www.windowsnetworking.com/kbase/WindowsTips/WindowsServer2008/AdminTips/Admin/DefaultDynamicPortRange.html
http://go.microsoft.com/fwlink?linkid=121488
____________________________________________________________________________________________________________
Active Directory administration one liner:-
http://social.technet.microsoft.com/wiki/contents/articles/14349.active-directory-administration-one-liner-en-us.aspx
http://social.technet.microsoft.com/wiki/contents/articles/2195.dsquery-commands-en-us.aspx