Invokes Microsofts builtin repairs for the bluetooth service. I also added a restart of the bluetooth service.
Only run this manually
• Under Evaluation Code:
If (Test-Path "$env:allusersprofile\SoftwareDistribution")
{
Exit 0
}
Else {
Exit 1
}
• Under Remediation Code:
$logfile = "C:\Temp\"
Get-Service -name bthserv | Restart-Service -Force
$service = (Get-Service -name bthserv).name
#check the status of the service to make sure it's started
$service_status = (Get-Service -name $service).Status
#if service is running
if ($service_status -eq 'Stopped')
{
#start service again
Start-Service -Name $service
Start-Sleep -seconds 5
}
#check if service is running again
if (((Get-Service -name $service).Status) -eq 'Running')
{
}
Else
{
Echo 1
}
Get-TroubleshootingPack -path "C:\Windows\Diagnostics\System\bluetooth" | Invoke-TroubleshootingPack -Unattended -Result $logfile