@ -100,12 +100,12 @@ public static string GetString(uint strId)
{
# Check the internet connection
$Parameters = @ {
Uri = " https://www.cloudflare .com"
Method = " Head "
DisableKeepAlive = $true
UseBasicParsing = $true
Name = " dns.msftncsi .com"
Server = " 1.1.1.1 "
DnsOnly = $true
ErrorAction = " Stop "
}
if ( -not ( Invoke-WebRequest @Parameters ) . StatusDescription )
if ( ( Resolve-DnsName @Parameters ) . IPAddress -notcontains " 131.107.255.255 " )
{
return
}
@ -171,7 +171,7 @@ public static string GetString(uint strId)
Write-Error -Message ( $Localization . NoResponse -f " https://c2rsetup.officeapps.live.com " ) -ErrorAction SilentlyContinue
}
}
catch [System.Net.Web Exception]
catch [System.ComponentModel.Win32 Exception]
{
Write-Warning -Message $Localization . NoInternetConnection
Write-Error -Message $Localization . NoInternetConnection -ErrorAction SilentlyContinue
@ -402,12 +402,12 @@ public static string GetString(uint strId)
{
# Check the internet connection
$Parameters = @ {
Uri = " https://www.cloudflare .com"
Method = " Head "
DisableKeepAlive = $true
UseBasicParsing = $true
Name = " dns.msftncsi .com"
Server = " 1.1.1.1 "
DnsOnly = $true
ErrorAction = " Stop "
}
if ( -not ( Invoke-WebRequest @Parameters ) . StatusDescription )
if ( ( Resolve-DnsName @Parameters ) . IPAddress -notcontains " 131.107.255.255 " )
{
return
}
@ -422,6 +422,7 @@ public static string GetString(uint strId)
}
$LatestRelease = ( Invoke-RestMethod @Parameters ) . Sophia_Script_Windows_10_PowerShell_5_1
$CurrentRelease = ( Get-Module -Name Sophia ) . Version . ToString ( )
if ( [System.Version] $LatestRelease -gt [System.Version] $CurrentRelease )
{
Write-Warning -Message $Localization . UnsupportedRelease
@ -439,7 +440,7 @@ public static string GetString(uint strId)
Write-Error -Message ( $Localization . NoResponse -f " https://github.com " ) -ErrorAction SilentlyContinue
}
}
catch [System.Net.Web Exception]
catch [System.ComponentModel.Win32 Exception]
{
Write-Warning -Message $Localization . NoInternetConnection
Write-Error -Message $Localization . NoInternetConnection -ErrorAction SilentlyContinue
@ -710,12 +711,12 @@ public static string GetString(uint strId)
{
# Check the internet connection
$Parameters = @ {
Uri = " https://www.cloudflare .com"
Method = " Head "
DisableKeepAlive = $true
UseBasicParsing = $true
Name = " dns.msftncsi .com"
Server = " 1.1.1.1 "
DnsOnly = $true
ErrorAction = " Stop "
}
if ( -not ( Invoke-WebRequest @Parameters ) . StatusDescription )
if ( ( Resolve-DnsName @Parameters ) . IPAddress -notcontains " 131.107.255.255 " )
{
return
}
@ -738,44 +739,44 @@ public static string GetString(uint strId)
# https://github.com/crazy-max/WindowsSpyBlocker/tree/master/data/hosts
$Parameters = @ {
Uri = " https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/extra.txt "
UseBasicParsing = $true
Verbose = $true
Uri = " https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/extra.txt "
UseBasicParsing = $true
Verbose = $true
}
$extra = ( Invoke-WebRequest @Parameters ) . Content
$Parameters = @ {
Uri = " https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/extra_v6.txt "
UseBasicParsing = $true
Verbose = $true
Uri = " https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/extra_v6.txt "
UseBasicParsing = $true
Verbose = $true
}
$extra_v6 = ( Invoke-WebRequest @Parameters ) . Content
$Parameters = @ {
Uri = " https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt "
UseBasicParsing = $true
Verbose = $true
Uri = " https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt "
UseBasicParsing = $true
Verbose = $true
}
$spy = ( Invoke-WebRequest @Parameters ) . Content
$Parameters = @ {
Uri = " https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy_v6.txt "
UseBasicParsing = $true
Verbose = $true
Uri = " https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy_v6.txt "
UseBasicParsing = $true
Verbose = $true
}
$spy_v6 = ( Invoke-WebRequest @Parameters ) . Content
$Parameters = @ {
Uri = " https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/update.txt "
UseBasicParsing = $true
Verbose = $true
Uri = " https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/update.txt "
UseBasicParsing = $true
Verbose = $true
}
$update = ( Invoke-WebRequest @Parameters ) . Content
$Parameters = @ {
Uri = " https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/update_v6.txt "
UseBasicParsing = $true
Verbose = $true
Uri = " https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/update_v6.txt "
UseBasicParsing = $true
Verbose = $true
}
$update_v6 = ( Invoke-WebRequest @Parameters ) . Content
@ -816,7 +817,7 @@ public static string GetString(uint strId)
Write-Error -Message ( $Localization . RestartFunction -f $MyInvocation . Line . Trim ( ) ) -ErrorAction SilentlyContinue
}
}
catch [System.Net.Web Exception]
catch [System.ComponentModel.Win32 Exception]
{
Write-Warning -Message $Localization . NoInternetConnection
Write-Error -Message $Localization . NoInternetConnection -ErrorAction SilentlyContinue
@ -4384,12 +4385,12 @@ function Cursors
{
# Check the internet connection
$Parameters = @ {
Uri = " https://www.cloudflare .com"
Method = " Head "
DisableKeepAlive = $true
UseBasicParsing = $true
Name = " dns.msftncsi .com"
Server = " 1.1.1.1 "
DnsOnly = $true
ErrorAction = " Stop "
}
if ( -not ( Invoke-WebRequest @Parameters ) . StatusDescription )
if ( ( Resolve-DnsName @Parameters ) . IPAddress -notcontains " 131.107.255.255 " )
{
return
}
@ -4490,7 +4491,7 @@ function Cursors
Write-Error -Message ( $Localization . RestartFunction -f $MyInvocation . Line . Trim ( ) ) -ErrorAction SilentlyContinue
}
}
catch [System.Net.Web Exception]
catch [System.ComponentModel.Win32 Exception]
{
Write-Warning -Message $Localization . NoInternetConnection
Write-Error -Message $Localization . NoInternetConnection -ErrorAction SilentlyContinue
@ -4504,12 +4505,12 @@ function Cursors
{
# Check the internet connection
$Parameters = @ {
Uri = " https://www.cloudflare .com"
Method = " Head "
DisableKeepAlive = $true
UseBasicParsing = $true
Name = " dns.msftncsi .com"
Server = " 1.1.1.1 "
DnsOnly = $true
ErrorAction = " Stop "
}
if ( -not ( Invoke-WebRequest @Parameters ) . StatusDescription )
if ( ( Resolve-DnsName @Parameters ) . IPAddress -notcontains " 131.107.255.255 " )
{
return
}
@ -4610,7 +4611,7 @@ function Cursors
Write-Error -Message ( $Localization . RestartFunction -f $MyInvocation . Line . Trim ( ) ) -ErrorAction SilentlyContinue
}
}
catch [System.Net.Web Exception]
catch [System.ComponentModel.Win32 Exception]
{
Write-Warning -Message $Localization . NoInternetConnection
Write-Error -Message $Localization . NoInternetConnection -ErrorAction SilentlyContinue
@ -4932,8 +4933,8 @@ public static bool MarkFileDelete (string sourcefile)
Remove-Item -Path $Path -Recurse -Force -ErrorAction Ignore
Unregister-ScheduledTask -TaskName * OneDrive * -Confirm : $false -ErrorAction Ignore
# Getting the OneDrive folder path
$OneDriveFolder = Split-Path -Path ( Split-Path -Path $OneDriveSetup [ 0 ] -Parent )
# Getting the OneDrive folder path and replacing quotes if exist
$OneDriveFolder = ( Split-Path -Path ( Split-Path -Path $OneDriveSetup [ 0 ] -Parent ) ) -replace '"' , " "
# Terminate the File Explorer process
New-ItemProperty -Path " HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon " -Name AutoRestartShell -PropertyType DWord -Value 0 -Force
@ -5002,12 +5003,12 @@ public static bool MarkFileDelete (string sourcefile)
{
# Check the internet connection
$Parameters = @ {
Uri = " https://www.cloudflare .com"
Method = " Head "
DisableKeepAlive = $true
UseBasicParsing = $true
Name = " dns.msftncsi .com"
Server = " 1.1.1.1 "
DnsOnly = $true
ErrorAction = " Stop "
}
if ( -not ( Invoke-WebRequest @Parameters ) . StatusDescription )
if ( ( Resolve-DnsName @Parameters ) . IPAddress -notcontains " 131.107.255.255 " )
{
return
}
@ -5050,7 +5051,7 @@ public static bool MarkFileDelete (string sourcefile)
Remove-Item -Path " $ DownloadsFolder\OneDriveSetup.exe " -Force
}
catch [System.Net.Web Exception]
catch [System.ComponentModel.Win32 Exception]
{
Write-Warning -Message $Localization . NoInternetConnection
Write-Error -Message $Localization . NoInternetConnection -ErrorAction SilentlyContinue
@ -6551,12 +6552,12 @@ function WindowsCapabilities
{
# Check the internet connection
$Parameters = @ {
Uri = " https://www.cloudflare .com"
Method = " Head "
DisableKeepAlive = $true
UseBasicParsing = $true
Name = " dns.msftncsi .com"
Server = " 1.1.1.1 "
DnsOnly = $true
ErrorAction = " Stop "
}
if ( -not ( Invoke-WebRequest @Parameters ) . StatusDescription )
if ( ( Resolve-DnsName @Parameters ) . IPAddress -notcontains " 131.107.255.255 " )
{
return
}
@ -6565,7 +6566,7 @@ function WindowsCapabilities
$ButtonContent = $Localization . Install
$ButtonAdd_Click = { InstallButton }
}
catch [System.Net.Web Exception]
catch [System.ComponentModel.Win32 Exception]
{
Write-Warning -Message $Localization . NoInternetConnection
Write-Error -Message $Localization . NoInternetConnection -ErrorAction SilentlyContinue
@ -6915,12 +6916,12 @@ function IPv6Component
{
# Check the internet connection
$Parameters = @ {
Uri = " https://www.cloudflare .com"
Method = " Head "
DisableKeepAlive = $true
UseBasicParsing = $true
Name = " dns.msftncsi .com"
Server = " 1.1.1.1 "
DnsOnly = $true
ErrorAction = " Stop "
}
if ( -not ( Invoke-WebRequest @Parameters ) . StatusDescription )
if ( ( Resolve-DnsName @Parameters ) . IPAddress -notcontains " 131.107.255.255 " )
{
return
}
@ -6955,7 +6956,7 @@ function IPv6Component
Write-Error -Message ( $Localization . RestartFunction -f $MyInvocation . Line . Trim ( ) ) -ErrorAction SilentlyContinue
}
}
catch [System.Net.Web Exception]
catch [System.ComponentModel.Win32 Exception]
{
Write-Warning -Message $Localization . NoInternetConnection
Write-Error -Message $Localization . NoInternetConnection -ErrorAction SilentlyContinue
@ -9956,12 +9957,12 @@ function InstallVCRedist
{
# Check the internet connection
$Parameters = @ {
Uri = " https://www.cloudflare .com"
Method = " Head "
DisableKeepAlive = $true
UseBasicParsing = $true
Name = " dns.msftncsi .com"
Server = " 1.1.1.1 "
DnsOnly = $true
ErrorAction = " Stop "
}
if ( -not ( Invoke-WebRequest @Parameters ) . StatusDescription )
if ( ( Resolve-DnsName @Parameters ) . IPAddress -notcontains " 131.107.255.255 " )
{
return
}
@ -10008,7 +10009,7 @@ function InstallVCRedist
Get-ChildItem -Path $Paths -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Ignore
}
}
catch [System.Net.Web Exception]
catch [System.ComponentModel.Win32 Exception]
{
Write-Warning -Message $Localization . NoInternetConnection
Write-Error -Message $Localization . NoInternetConnection -ErrorAction SilentlyContinue
@ -10036,12 +10037,12 @@ function InstallDotNetRuntimes
{
# Check the internet connection
$Parameters = @ {
Uri = " https://www.cloudflare .com"
Method = " Head "
DisableKeepAlive = $true
UseBasicParsing = $true
Name = " dns.msftncsi .com"
Server = " 1.1.1.1 "
DnsOnly = $true
ErrorAction = " Stop "
}
if ( -not ( Invoke-WebRequest @Parameters ) . StatusDescription )
if ( ( Resolve-DnsName @Parameters ) . IPAddress -notcontains " 131.107.255.255 " )
{
return
}
@ -10146,7 +10147,7 @@ function InstallDotNetRuntimes
Get-ChildItem -Path $Paths -Force -ErrorAction Ignore | Remove-Item -Recurse -Force -ErrorAction Ignore
}
}
catch [System.Net.Web Exception]
catch [System.ComponentModel.Win32 Exception]
{
Write-Warning -Message $Localization . NoInternetConnection
Write-Error -Message $Localization . NoInternetConnection -ErrorAction SilentlyContinue
@ -11769,17 +11770,17 @@ function HEVC
{
# Check the internet connection
$Parameters = @ {
Uri = " https://www.cloudflare .com"
Method = " Head "
DisableKeepAlive = $true
UseBasicParsing = $true
Name = " dns.msftncsi .com"
Server = " 1.1.1.1 "
DnsOnly = $true
ErrorAction = " Stop "
}
if ( -not ( Invoke-WebRequest @Parameters ) . StatusDescription )
if ( ( Resolve-DnsName @Parameters ) . IPAddress -notcontains " 131.107.255.255 " )
{
return
}
}
catch [System.Net.Web Exception]
catch [System.ComponentModel.Win32 Exception]
{
Write-Warning -Message $Localization . NoInternetConnection
Write-Error -Message $Localization . NoInternetConnection -ErrorAction SilentlyContinue
@ -11834,6 +11835,7 @@ function HEVC
Write-Information -MessageData " " -InformationAction Continue
# Extract the localized "Please wait..." string from shell32.dll
Write-Verbose -Message ( [WinAPI.GetStr] :: GetString ( 12612 ) ) -Verbose
Write-Verbose -Message $Localization . HEVCDownloading -Verbose
$DownloadsFolder = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name " {374DE290-123F-4565-9164-39C4925E467B} "
@ -14775,12 +14777,12 @@ function BitmapImageNewContext
{
# Check the internet connection
$Parameters = @ {
Uri = " https://www.cloudflare .com"
Method = " Head "
DisableKeepAlive = $true
UseBasicParsing = $true
Name = " dns.msftncsi .com"
Server = " 1.1.1.1 "
DnsOnly = $true
ErrorAction = " Stop "
}
if ( -not ( Invoke-WebRequest @Parameters ) . StatusDescription )
if ( ( Resolve-DnsName @Parameters ) . IPAddress -notcontains " 131.107.255.255 " )
{
return
}
@ -14790,7 +14792,7 @@ function BitmapImageNewContext
Get-WindowsCapability -Online -Name " Microsoft.Windows.MSPaint* " | Add-WindowsCapability -Online
}
catch [System.Net.Web Exception]
catch [System.ComponentModel.Win32 Exception]
{
Write-Warning -Message $Localization . NoInternetConnection
Write-Error -Message $Localization . NoInternetConnection -ErrorAction SilentlyContinue
@ -14866,12 +14868,12 @@ function RichTextDocumentNewContext
{
# Check the internet connection
$Parameters = @ {
Uri = " https://www.cloudflare .com"
Method = " Head "
DisableKeepAlive = $true
UseBasicParsing = $true
Name = " dns.msftncsi .com"
Server = " 1.1.1.1 "
DnsOnly = $true
ErrorAction = " Stop "
}
if ( -not ( Invoke-WebRequest @Parameters ) . StatusDescription )
if ( ( Resolve-DnsName @Parameters ) . IPAddress -notcontains " 131.107.255.255 " )
{
return
}
@ -14881,7 +14883,7 @@ function RichTextDocumentNewContext
Get-WindowsCapability -Online -Name " Microsoft.Windows.WordPad* " | Add-WindowsCapability -Online
}
catch [System.Net.Web Exception]
catch [System.ComponentModel.Win32 Exception]
{
Write-Warning -Message $Localization . NoInternetConnection
Write-Error -Message $Localization . NoInternetConnection -ErrorAction SilentlyContinue