<#====================================================================
Copyright © 2015, September. Michael Pomfret
The following updates the Network service registry permissions.
====================================================================#>
Write-Host “”
Write-Host “==============================================================================”
Write-Host “SharePoint 2013 – Updating registry permissions for the Network service…”
Write-Host “==============================================================================”
Write-Host “”
#HKEY_LOCAL_MACHINE\Software\Microsoft\Office Server\15.0\Search\Setup
# Read, Inheritance – Not Applicable
$RegKey = “HKLM:\Software\Microsoft\Office Server\15.0\Search\Setup”
$acl = Get-Acl $RegKey
$person = [System.Security.Principal.NTAccount]”Network Service”
$access = [System.Security.AccessControl.RegistryRights]”ReadKey”
$inheritance = [System.Security.AccessControl.InheritanceFlags]”ContainerInherit”
$propagation = [System.Security.AccessControl.PropagationFlags]”NoPropagateInherit” #This key and subkeys
$type = [System.Security.AccessControl.AccessControlType]”Allow”
$rule = New-Object System.Security.AccessControl.RegistryAccessRule($person,$access,$inheritance,$propagation,$type)
$acl.ResetAccessRule($rule)
Set-Acl $RegKey $acl