PowerShell script to set Chrome as default browser in Windows 10

PowerShell Script

# Simulate key presses to set Chrome as default browser in System Settings
Start-Sleep -Seconds 25
$StartOpenSettings = Get-Process SystemSettings | ForEach-Object {$._id}

# Open System Settings
Start-Process "ms-settings:defaultapps"

# Wait for the window to load
Start-Sleep -Seconds 2

# Simulate key presses to navigate to the "Web browser" section
$wshell = New-Object -ComObject WScript.Shell
$wshell.SendKeys('{TAB 5}') # Tab to the browser section
Start-Sleep -Milliseconds 500
$wshell.SendKeys('{ENTER}') # Press enter to select browser options
Start-Sleep -Milliseconds 500
$wshell.SendKeys('{TAB}') #Tab to Chrome
Start-Sleep -Millisconds 500
$wshell.SendKeys('{ENTER}')

Get-Process SystemSettings | ForEach-Object {
    if($StartOpenSettings -contains $._id -eq $false) {
        Stop-Process -Id $._Id;
    }
}

Start-Sleep -Seconds 2

Configure Task Schedule