Windows Server Administration One Liners

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

Leave a Comment
  • Please add 4 and 5 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Richard Mueller edited Revision 18. Comment: Replace RGB values with color names in HTML to restore colors

  • Richard Mueller edited Revision 17. Comment: Removed (en-US) from title, modified title, modified tags, added language tag

Page 1 of 1 (2 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Cool, some cmdlets for my brain. :)

  • Richard Mueller edited Revision 17. Comment: Removed (en-US) from title, modified title, modified tags, added language tag

  • Richard Mueller edited Revision 18. Comment: Replace RGB values with color names in HTML to restore colors

Page 1 of 1 (3 items)