Windows Server 2012 R2: How to add the DHCP role using PowerShell?

Found this blog quite helpful in the middle of a deployment, when getting “Failed to open the runspace pool. The Server Manager WinRM plug-in might be corrupted or missing” in GUI. So PowerShell is more capable if you are confident what you are doing. Here is what I put in the ISE to execute one by one.
Install-WindowsFeature DHCP -IncludeManagementTools
Install-WindowsFeature WINS -IncludeManagementTools

Bekim Dauti's Blog

The following is a sample chapter from the e-Book Windows Server 2012 R2: How to install and add roles? (Server Core). Enjoy reading!

This is what people need: an easy-to-deploy, easy-to-use tool.” Nat Friedman

What is Dynamic Host Configuration Protocol (DHCP)?

Basically, Dynamic Host Configuration Protocol (DHCP) is a computer network protocol that assigns IP addresses to computers on a network. The working principle of DHCP briefly is described through the acronym DORA which means Discovery, Offer, Request, and Acknowledgement. In a computer network, when you turn on your computer and the operating system boots up the DHCP Client service transmits the request for an IP address. In fact, this request is an attempt to identify whether or not a DHCP server is available on a LAN. If it is, the DHCP server accepts the DHCPDISCOVER message from the client, reserves an IP address for the client, and…

View original post 328 more words

“The RPC server is unavailable”

In the scenario of getting event logs remotely, using Event Viewer or PowerShell, some time in an unfamiliar environment, the system admin may get this error “The RPC server is unavailable” even the correct credential is supplied.

Why? The service is running on the remote host – most of the time it’s a Windows Server. There must be something block the traffic – Windows Server itself or the network.

Look into the Windows server – the target host, there are several places to check – The Windows Firewall, the Group Policy. Many online resources focused on WMI Group rules, such as running the following command to enable this group of firewall rules – 3 Inbound and 1 Outbound.

> netsh advfirewall firewall set rule group=”Windows Management Instrumentation (WMI)” new enable=yes

The same approach is to open 3 Inbound rules using Windows Firewall with Advanced Security or GP Editor:

Computer Configuration
– Windows Settings
— Security Settings
— Windows Firewall Advanced Security
—- Inbound Rules
—- Right-click and select ‘New Rule’ (Key point)
—- Predefined radio button
—- Choose Remote Event Log Management (Drop down list)
—- Click Next
—- Accept the defaults and click ‘Next’
—- Choose Allow the connection and click ‘Finish’

But, sometimes these local firewall rules are already enabled, by default, unless they are disabled on purpose. Then what?  There is another place to look at, despite the message “The RPC server is unavailable”, some newer operation systems give more information in a pop-up.


Now look at these two rules, they could be disabled, just enable them you will be able to access Event Logs remotely.

This is tested in both Event Viewer and PowerShell, on Windows Server 2012 R2.

p.s. I don’t think .Net Framework 3.5 is necessary in this case, some online article mentioned that though. But still worth to check if the following services are running on the target host:

  • Windows Management Instrumentation service
  • TCP/IP NetBIOS Helper service
  • Remote Procedure Call (RPC) service

Make a SharePoint site searchable or not searchable

Here are the steps to make a SharePoint site searchable in general:

A simple PowerShell script that makes a SharePoint site not searchable:

and a more complete PowerShell script: