WindowsSearch-BingRegistryFix.ps1


<#PSScriptInfo
 
.VERSION 1.0.1
 
.GUID 915f2b4b-ba83-4f12-bbca-8080b5536c1f
 
.AUTHOR nave_k
 
.COMPANYNAME
 
.COPYRIGHT
 
.TAGS
 
.LICENSEURI
 
.PROJECTURI
 
.ICONURI
 
.EXTERNALMODULEDEPENDENCIES
 
.REQUIREDSCRIPTS
 
.EXTERNALSCRIPTDEPENDENCIES
 
.RELEASENOTES
 
 
#>


<#
 
.DESCRIPTION
 fix for windows search
 version 1.0.1 - added error handling
 
#>
 

Param()


#get the registry keys from the computer#
$bingexist = Get-ItemProperty -Path HKCU:\software\Microsoft\Windows\CurrentVersion\Search -Name 'BingSearchEnabled' -ErrorAction SilentlyContinue
$cortanaexist = Get-ItemProperty -Path HKCU:\software\Microsoft\Windows\CurrentVersion\Search -Name 'CortanaConsent' -ErrorAction SilentlyContinue


##Check If BingSearchEnabled is exist , if exist set the value to 0 , if not exist create new Registry key##
if ($bingexist = $true) {
Set-ItemProperty -Path HKCU:\software\Microsoft\Windows\CurrentVersion\Search -Name 'BingSearchEnabled' -Value 0 
}  
else {
New-ItemProperty -Path HKCU:\software\Microsoft\Windows\CurrentVersion\Search -Name 'BingSearchEnabled' -PropertyType Dword -Value 0
}


##Check If CortanaConsent is exist , if exist set the value to 0 , if not exist create new Registry key##
if  ($cortanaexist = $true ){
Set-ItemProperty -Path HKCU:\software\Microsoft\Windows\CurrentVersion\Search -Name 'CortanaConsent' -Value 0 
}

else {
New-ItemProperty -Path HKCU:\software\Microsoft\Windows\CurrentVersion\Search -Name 'CortanaConsent' -PropertyType Dword -Value 0
}

[System.Windows.MessageBox]::Show('Hello , Your IT Sysadmin has applied a fix to your computer for the search issue ,
Please restart your computer for the changes to take affect'
)