Script Download:
The script is available for download from https://gallery.technet.microsoft.com//How-to-enable-the-Windows-6264035c. You can also use Microsoft Script Browser for Windows PowerShell ISE to download the sample with one button click from within your scripting environment.
This script sample can enable the Windows Search service on Windows Server.
By default, Windows Search Service feature is disabled on Windows Server. You must manually enable the Windows Search service in Windows Server 2008 R2 and in Windows Server 2012. There will be too much manual work if multiple server machines need to be enabled. We can use script to help you enable the Windows Search Service for Windows Server automatically
You can find more All-In-One Script Framework script samples at http://aka.ms/onescriptingallery