Browse Source

05.10.2021 v5.12.4

pull/264/head
Dmitry Nefedov 3 years ago
committed by GitHub
parent
commit
df94f191b2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Functions.ps1
  2. 3
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/de-DE/Sophia.psd1
  3. 1
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/en-US/Sophia.psd1
  4. 1
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/es-ES/Sophia.psd1
  5. 1
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/fr-FR/Sophia.psd1
  6. 1
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/hu-HU/Sophia.psd1
  7. 1
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/it-IT/Sophia.psd1
  8. 1
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/pt-BR/Sophia.psd1
  9. 1
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/ru-RU/Sophia.psd1
  10. 1
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/tr-TR/Sophia.psd1
  11. 3
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/uk-UA/Sophia.psd1
  12. 1
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/zh-CN/Sophia.psd1
  13. 2
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Manifest/Sophia.psd1
  14. 351
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Module/Sophia.psm1
  15. 4
      Sophia Script/Sophia Script for Windows 10 PowerShell 7/Sophia.ps1

6
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v5.12.3
Date: 19.09.2021
Version: v5.12.4
Date: 05.10.2021
Copyright (c) 20142021 farag
Copyright (c) 20192021 farag & Inestic
@ -54,7 +54,7 @@ function Sophia
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.12.3 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014–2021"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.12.4 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014–2021"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

3
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/de-DE/Sophia.psd1

@ -50,7 +50,7 @@ ErrorsFile = Datei
ErrorsMessage = Fehler/Warnungen
Add = Hinzufügen
AllFilesFilter = Alle Dateien (*.*)|*.*
Browse = Durchsuche
Browse = Durchsuchen
Change = Ändern
DialogBoxOpening = Anzeigen des Dialogfensters...
Disable = Deaktivieren
@ -75,6 +75,7 @@ Run = Starten
SelectAll = Wählen Sie Alle
Skip = Überspringen
Skipped = Übersprungen
FileExplorerRestartPrompt = Manchmal muss der Datei-Explorer neu gestartet werden, damit die Änderungen wirksam werden
TelegramGroupTitle = Treten Sie unserer offiziellen Telegram-Gruppe bei
TelegramChannelTitle = Treten Sie unserem offiziellen Telegram-Kanal bei
Uninstall = Deinstallieren

1
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/en-US/Sophia.psd1

@ -75,6 +75,7 @@ Run = Run
SelectAll = Select all
Skip = Skip
Skipped = Skipped
FileExplorerRestartPrompt = Sometimes in order for the changes to take effect the File Explorer process has to be restarted
TelegramGroupTitle = Join our official Telegram group
TelegramChannelTitle = Join our official Telegram channel
Uninstall = Uninstall

1
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/es-ES/Sophia.psd1

@ -75,6 +75,7 @@ Run = Iniciar
SelectAll = Seleccionar todo
Skip = Omitir
Skipped = Omitido
FileExplorerRestartPrompt = A veces, para que los cambios surtan efecto, hay que reiniciar el proceso del Explorador de archivos
TelegramGroupTitle = Únete a nuestro grupo oficial de Telegram
TelegramChannelTitle = Únete a nuestro canal oficial de Telegram
Uninstall = Desinstalar

1
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/fr-FR/Sophia.psd1

@ -75,6 +75,7 @@ Run = Démarrer
SelectAll = Tout sélectionner
Skip = Passer
Skipped = Passé
FileExplorerRestartPrompt = Parfois, pour que les modifications soient prises en compte, il faut redémarrer l'Explorateur de fichiers
TelegramGroupTitle = Rejoignez notre groupe Telegram officiel
TelegramChannelTitle = Rejoignez notre canal Telegram officiel
Uninstall = Désinstaller

1
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/hu-HU/Sophia.psd1

@ -75,6 +75,7 @@ Run = Futtatás
SelectAll = Összes kijelölése
Skip = Átugrás
Skipped = Átugorva
FileExplorerRestartPrompt = Néha ahhoz, hogy a módosítások hatályba lépjenek, a File Explorer folyamatot újra kell indítani
TelegramGroupTitle = Pridružite se našoj službenoj grupi Telegram
TelegramChannelTitle = Pridružite se našem službenom kanalu Telegram
Uninstall = Eltávolít

1
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/it-IT/Sophia.psd1

@ -75,6 +75,7 @@ Run = Eseguire
SelectAll = Seleziona tutto
Skip = Salta
Skipped = Saltato
FileExplorerRestartPrompt = A volte, affinché le modifiche abbiano effetto, il processo di File Explorer deve essere riavviato
TelegramGroupTitle = Unisciti al nostro gruppo ufficiale Telegram
TelegramChannelTitle = Unisciti al nostro canale ufficiale di Telegram
Uninstall = Disinstallare

1
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/pt-BR/Sophia.psd1

@ -75,6 +75,7 @@ Run = Executar
SelectAll = Selecionar tudo
Skip = Pular
Skipped = Ignorados
FileExplorerRestartPrompt = Por vezes, para que as alterações tenham efeito, o processo File Explorer tem de ser reiniciado
TelegramGroupTitle = Entre no grupo oficial do Telegram
TelegramChannelTitle = Entre no canal oficial do Telegram
Uninstall = Desinstalar

1
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/ru-RU/Sophia.psd1

@ -75,6 +75,7 @@ Run = Запустить
SelectAll = Выбрать всё
Skip = Пропустить
Skipped = Пропущено
FileExplorerRestartPrompt = Иногда для того, чтобы изменения вступили в силу, процесс проводника необходимо перезапустить
TelegramGroupTitle = Присоединяйтесь к нашей официальной группе в Telegram
TelegramChannelTitle = Присоединяйтесь к нашему официальному каналу в Telegram
Uninstall = Удалить

1
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/tr-TR/Sophia.psd1

@ -75,6 +75,7 @@ Run = Başlat
SelectAll = Hepsini seç
Skip = Atla
Skipped = Atlandı
FileExplorerRestartPrompt = Bazen değişikliklerin geçerli olması için Dosya Gezgini işleminin yeniden başlatılması gerekir
TelegramGroupTitle = Resmi Telegram grubumuza katılın
TelegramChannelTitle = Resmi Telegram kanalımıza katılın
Uninstall = Kaldır

3
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/uk-UA/Sophia.psd1

@ -75,7 +75,8 @@ Run = Запустити
SelectAll = Вибрати все
Skip = Пропустити
Skipped = Пропущено
TelegramGroupTitle = Приєднуйтесь до нашої офіційної групи Telegram
FileExplorerRestartPrompt = Іноді для того, щоб зміни вступили в силу, процес провідника необхідно перезапустити
TelegramGroupTitle = Приєднуйтесь до нашої офіційної групи в Telegram
TelegramChannelTitle = Приєднуйтесь до нашого офіційного каналу в Telegram
Uninstall = Видалити
'@

1
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Localizations/zh-CN/Sophia.psd1

@ -75,6 +75,7 @@ Run = 运行
SelectAll = 全选
Skip = 跳过
Skipped = 已跳过
FileExplorerRestartPrompt = 有时为了使更改生效必须重新启动文件管理器进程
TelegramGroupTitle = 加入我们的官方Telegram
TelegramChannelTitle = 加入我们的官方Telegram 频道
Uninstall = 卸载

2
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Manifest/Sophia.psd1

@ -1,6 +1,6 @@
@{
RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.12.3'
ModuleVersion = '5.12.4'
GUID = 'aa0b47a7-1770-4b5d-8c9f-cc6c505bcc7a'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014–2021 farag & Inestic. All rights reserved'

351
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.12.3
Date: 19.09.2021
Version: v5.12.4
Date: 05.10.2021
Copyright (c) 20142021 farag
Copyright (c) 20192021 farag & Inestic
@ -170,10 +170,13 @@ function Checkings
# Check if the current module version is the latest one
try
{
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$LatestRelease = (Invoke-RestMethod -Uri "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" -UseBasicParsing).Sophia_Script_Windows_10_PowerShell_7
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
SslProtocol = "Tls13"
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_7
$CurrentRelease = (Get-Module -Name Sophia).Version.ToString()
switch ([System.Version]$LatestRelease -gt [System.Version]$CurrentRelease)
{
@ -247,6 +250,9 @@ function Checkings
$Script:ControlledFolderAccess = $false
}
}
# Save all opened folders in order to restore them after File Explorer restart
$Script:OpenedFolders = {(New-Object -ComObject Shell.Application).Windows() | ForEach-Object -Process {$_.Document.Folder.Self.Path}}.Invoke()
}
#endregion Checkings
@ -858,12 +864,12 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
Start-Sleep -Milliseconds 100
Start-Sleep -Seconds 1
# Force move the console window to the foreground
[WinAPI.ForegroundWindow]::SetForegroundWindow($_.MainWindowHandle)
Start-Sleep -Milliseconds 100
Start-Sleep -Seconds 1
# Emulate the Backspace key sending
[System.Windows.Forms.SendKeys]::SendWait("{BACKSPACE 1}")
@ -1320,10 +1326,10 @@ function WhatsNewInWindows
Tailored experiences
.PARAMETER Disable
Do not let Microsoft offer you tailored expereinces based on the diagnostic data setting you hava chosen
Do not let Microsoft offer you tailored expereinces based on the diagnostic data setting you have chosen
.PARAMETER Enable
Let Microsoft offer you tailored expereinces based on the diagnostic data setting you hava chosen
Let Microsoft offer you tailored expereinces based on the diagnostic data setting you have chosen
.EXAMPLE
TailoredExperiences -Disable
@ -1673,11 +1679,11 @@ function MergeConflicts
{
"Show"
{
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name HideMergeConflicts -PropertyType DWord -Value 1 -Force
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name HideMergeConflicts -PropertyType DWord -Value 0 -Force
}
"Hide"
{
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name HideMergeConflicts -PropertyType DWord -Value 0 -Force
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name HideMergeConflicts -PropertyType DWord -Value 1 -Force
}
}
}
@ -1774,14 +1780,20 @@ function CortanaButton
switch ($PSCmdlet.ParameterSetName)
{
"Hide"
{
if (Get-AppxPackage -Name Microsoft.549981C3F5F10)
{
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowCortanaButton -PropertyType DWord -Value 0 -Force
}
}
"Show"
{
if (Get-AppxPackage -Name Microsoft.549981C3F5F10)
{
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowCortanaButton -PropertyType DWord -Value 1 -Force
}
}
}
}
<#
@ -2112,24 +2124,6 @@ function 3DObjects
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Name ThisPCPolicy -Force -ErrorAction Ignore
}
}
# Save all opened folders in order to restore them after File Explorer restart
Clear-Variable -Name OpenedFolders -Force -ErrorAction Ignore
$OpenedFolders = {(New-Object -ComObject Shell.Application).Windows() | ForEach-Object -Process {$_.Document.Folder.Self.Path}}.Invoke()
# In order for the changes to take effect the File Explorer process has to be restarted
Stop-Process -Name explorer -Force
Start-Sleep -Seconds 3
# Restoring closed folders
foreach ($OpenedFolder in $OpenedFolders)
{
if (Test-Path -Path $OpenedFolder)
{
Invoke-Item -Path $OpenedFolder
}
}
}
<#
@ -2563,24 +2557,6 @@ function NotificationAreaIcons
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name EnableAutoTray -PropertyType DWord -Value 1 -Force
}
}
# Save all opened folders in order to restore them after File Explorer restart
Clear-Variable -Name OpenedFolders -Force -ErrorAction Ignore
$OpenedFolders = {(New-Object -ComObject Shell.Application).Windows() | ForEach-Object -Process {$_.Document.Folder.Self.Path}}.Invoke()
# In order for the changes to take effect the File Explorer process has to be restarted
Stop-Process -Name explorer -Force
Start-Sleep -Seconds 3
# Restoring closed folders
foreach ($OpenedFolder in $OpenedFolders)
{
if (Test-Path -Path $OpenedFolder)
{
Invoke-Item -Path $OpenedFolder
}
}
}
<#
@ -2636,24 +2612,6 @@ function MeetNow
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3 -Name Settings -PropertyType Binary -Value $Settings -Force
}
}
# Save all opened folders in order to restore them after File Explorer restart
Clear-Variable -Name OpenedFolders -Force -ErrorAction Ignore
$OpenedFolders = {(New-Object -ComObject Shell.Application).Windows() | ForEach-Object -Process {$_.Document.Folder.Self.Path}}.Invoke()
# In order for the changes to take effect the File Explorer process has to be restarted
Stop-Process -Name explorer -Force
Start-Sleep -Seconds 3
# Restoring closed folders
foreach ($OpenedFolder in $OpenedFolders)
{
if (Test-Path -Path $OpenedFolder)
{
Invoke-Item -Path $OpenedFolder
}
}
}
<#
@ -3491,7 +3449,7 @@ function AeroShaking
Uninstall OneDrive
.PARAMETER Install
Install OneDrive
Install OneDrive 64-bit
.EXAMPLE
OneDrive -Uninstall
@ -3619,11 +3577,22 @@ public static bool MarkFileDelete (string sourcefile)
# Save all opened folders in order to restore them after File Explorer restarting
Clear-Variable -Name OpenedFolders -Force -ErrorAction Ignore
$OpenedFolders = {(New-Object -ComObject Shell.Application).Windows() | ForEach-Object -Process {$_.Document.Folder.Self.Path}}.Invoke()
$Script:OpenedFolders = {(New-Object -ComObject Shell.Application).Windows() | ForEach-Object -Process {$_.Document.Folder.Self.Path}}.Invoke()
# Terminate the File Explorer process
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name AutoRestartShell -Value 0 -Force
Stop-Process -Name explorer -Force
Start-Sleep -Seconds 3
# Restoring closed folders
foreach ($Script:OpenedFolder in $Script:OpenedFolders)
{
if (Test-Path -Path $Script:OpenedFolder)
{
Invoke-Item -Path $Script:OpenedFolder
}
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name AutoRestartShell -Value 1 -Force
# Attempt to unregister FileSyncShell64.dll and remove
@ -3675,15 +3644,27 @@ public static bool MarkFileDelete (string sourcefile)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.OneDriveInstalling -Verbose
Start-Process -FilePath $env:SystemRoot\SysWOW64\OneDriveSetup.exe
}
else
{
try
{
# Downloading the latest OneDrive installer x64
if ((Invoke-WebRequest -Uri https://www.google.com -UseBasicParsing -DisableKeepAlive -Method Head).StatusDescription)
# Check the internet connection
$Parameters = @{
Uri = "https://www.google.com"
Method = "Head"
SslProtocol = "Tls13"
DisableKeepAlive = $true
UseBasicParsing = $true
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
return
}
# Downloading the latest OneDrive installer 64-bit
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.OneDriveDownloading -Verbose
@ -3691,6 +3672,7 @@ public static bool MarkFileDelete (string sourcefile)
# https://go.microsoft.com/fwlink/p/?LinkID=844652
$Parameters = @{
Uri = "https://g.live.com/1rewlive5skydrive/OneDriveProduction"
SslProtocol = "Tls13"
UseBasicParsing = $true
Verbose = $true
}
@ -3704,13 +3686,15 @@ public static bool MarkFileDelete (string sourcefile)
$Parameters = @{
Uri = $OneDriveURL
OutFile = "$DownloadsFolder\OneDriveSetup.exe"
SslProtocol = "Tls12"
SslProtocol = "Tls13"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
Start-Process -FilePath "$DownloadsFolder\OneDriveSetup.exe"
}
Start-Process -FilePath "$DownloadsFolder\OneDriveSetup.exe" -Wait
Remove-Item -Path "$DownloadsFolder\OneDriveSetup.exe" -Force
}
catch [System.Net.WebException]
{
@ -3718,12 +3702,11 @@ public static bool MarkFileDelete (string sourcefile)
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
return
}
}
Get-ScheduledTask -TaskName "Onedrive* Update*" | Enable-ScheduledTask
Get-ScheduledTask -TaskName "Onedrive* Update*" | Start-ScheduledTask
}
}
}
@ -4905,12 +4888,12 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
Start-Sleep -Milliseconds 100
Start-Sleep -Seconds 1
# Force move the console window to the foreground
[WinAPI.ForegroundWindow]::SetForegroundWindow($_.MainWindowHandle)
Start-Sleep -Milliseconds 100
Start-Sleep -Seconds 1
# Emulate the Backspace key sending
[System.Windows.Forms.SendKeys]::SendWait("{BACKSPACE 1}")
@ -5220,18 +5203,18 @@ function WindowsCapabilities
{
"Install"
{
# Check the internet connection
try
{
(Invoke-WebRequest -Uri https://www.google.com -UseBasicParsing -DisableKeepAlive -Method Head).StatusDescription
# Check the internet connection
$Parameters = @{
Uri = "https://www.google.com"
Method = "Head"
SslProtocol = "Tls13"
DisableKeepAlive = $true
UseBasicParsing = $true
}
catch [System.Net.WebException]
if (-not (Invoke-RestMethod @Parameters).StatusDescription)
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
return
}
@ -5239,6 +5222,14 @@ function WindowsCapabilities
$ButtonContent = $Localization.Install
$ButtonAdd_Click = {InstallButton}
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
"Uninstall"
{
$State = "Installed"
@ -5297,12 +5288,12 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
Start-Sleep -Milliseconds 100
Start-Sleep -Seconds 1
# Force move the console window to the foreground
[WinAPI.ForegroundWindow]::SetForegroundWindow($_.MainWindowHandle)
Start-Sleep -Milliseconds 100
Start-Sleep -Seconds 1
# Emulate the Backspace key sending
[System.Windows.Forms.SendKeys]::SendWait("{BACKSPACE 1}")
@ -5586,14 +5577,28 @@ function IPv6Component
$Enable
)
# Check the internet connection
try
{
if ((Invoke-WebRequest -Uri https://www.google.com -UseBasicParsing -DisableKeepAlive -Method Head).StatusDescription)
# Check the internet connection
$Parameters = @{
Uri = "https://www.google.com"
Method = "Head"
SslProtocol = "Tls13"
DisableKeepAlive = $true
UseBasicParsing = $true
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
return
}
# Check whether the ISP supports IPv6 protocol using https://ipv6-test.com
$IPv6Test = Invoke-RestMethod -Uri "https://v4v6.ipv6-test.com/api/myip.php?json" | Where-Object -FilterScript {$_.proto -eq "ipv6"}
$Parameters = @{
Uri = "https://v4v6.ipv6-test.com/api/myip.php?json"
SslProtocol = "Tls13"
UseBasicParsing = $true
}
$IPv6Test = Invoke-RestMethod @Parameters | Where-Object -FilterScript {$_.proto -eq "ipv6"}
}
catch [System.Net.WebException]
{
@ -5601,8 +5606,6 @@ function IPv6Component
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
return
}
switch ($PSCmdlet.ParameterSetName)
@ -6725,24 +6728,6 @@ function WinPrtScrFolder
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{B7BEDE81-DF94-4682-A7D8-57A52620B86F}" -Force -ErrorAction Ignore
}
}
# Save all opened folders in order to restore them after File Explorer restart
Clear-Variable -Name OpenedFolders -Force -ErrorAction Ignore
$OpenedFolders = {(New-Object -ComObject Shell.Application).Windows() | ForEach-Object -Process {$_.Document.Folder.Self.Path}}.Invoke()
# In order for the changes to take effect the File Explorer process has to be restarted
Stop-Process -Name explorer -Force
Start-Sleep -Seconds 3
# Restoring closed folders
foreach ($OpenedFolder in $OpenedFolders)
{
if (Test-Path -Path $OpenedFolder)
{
Invoke-Item -Path $OpenedFolder
}
}
}
<#
@ -8280,12 +8265,12 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
Start-Sleep -Milliseconds 100
Start-Sleep -Seconds 1
# Force move the console window to the foreground
[WinAPI.ForegroundWindow]::SetForegroundWindow($_.MainWindowHandle)
Start-Sleep -Milliseconds 100
Start-Sleep -Seconds 1
# Emulate the Backspace key sending
[System.Windows.Forms.SendKeys]::SendWait("{BACKSPACE 1}")
@ -9186,12 +9171,12 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
Start-Sleep -Milliseconds 100
Start-Sleep -Seconds 1
# Force move the console window to the foreground
[WinAPI.ForegroundWindow]::SetForegroundWindow($_.MainWindowHandle)
Start-Sleep -Milliseconds 100
Start-Sleep -Seconds 1
# Emulate the Backspace key sending to prevent the console window to freeze
[System.Windows.Forms.SendKeys]::SendWait("{BACKSPACE 1}")
@ -9516,12 +9501,12 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
Start-Sleep -Milliseconds 100
Start-Sleep -Seconds 1
# Force move the console window to the foreground
[WinAPI.ForegroundWindow]::SetForegroundWindow($_.MainWindowHandle)
Start-Sleep -Milliseconds 100
Start-Sleep -Seconds 1
# Emulate the Backspace key sending to prevent the console window to freeze
[System.Windows.Forms.SendKeys]::SendWait("{BACKSPACE 1}")
@ -9596,24 +9581,48 @@ function HEIF
try
{
# Check the internet connection
if ((Invoke-WebRequest -Uri https://www.google.com -UseBasicParsing -DisableKeepAlive -Method Head).StatusDescription)
$Parameters = @{
Uri = "https://www.google.com"
Method = "Head"
SslProtocol = "Tls13"
DisableKeepAlive = $true
UseBasicParsing = $true
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
return
}
try
{
# Check whether the https://store.rg-adguard.net site is alive
if ((Invoke-WebRequest -Uri https://store.rg-adguard.net/api/GetFiles -UseBasicParsing -DisableKeepAlive -Method Head).StatusDescription)
$Parameters = @{
Uri = "https://store.rg-adguard.net/api/GetFiles"
Method = "Head"
SslProtocol = "Tls13"
DisableKeepAlive = $true
UseBasicParsing = $true
}
if (-not (Invoke-RestMethod @Parameters).StatusDescription)
{
$API = "https://store.rg-adguard.net/api/GetFiles"
# HEVC Video Extensions from Device Manufacturer
$ProductURL = "https://www.microsoft.com/store/productId/9n4wgh0z6vhq"
return
}
$Body = @{
$Parameters = @{
Method = "Post"
Uri = "https://store.rg-adguard.net/api/GetFiles"
ContentType = "application/x-www-form-urlencoded"
Body = @{
type = "url"
url = $ProductURL
# HEVC Video Extensions from Device Manufacturer
url = "https://www.microsoft.com/store/productId/9n4wgh0z6vhq"
ring = "Retail"
lang = "en-US"
}
$Raw = Invoke-RestMethod -Method Post -Uri $API -ContentType 'application/x-www-form-urlencoded' -Body $Body
UseBasicParsing = $true
SslProtocol = "Tls13"
}
$Raw = Invoke-WebRequest @Parameters
# Parsing the page
$Raw | Select-String -Pattern '<tr style.*<a href=\"(?<url>.*)"\s.*>(?<text>.*)<\/a>' -AllMatches | ForEach-Object -Process {$_.Matches} | ForEach-Object -Process {
@ -9629,7 +9638,8 @@ function HEIF
$Parameters = @{
Uri = $TempURL
OutFile = "$DownloadsFolder\$Package"
SslProtocol = "Tls12"
SslProtocol = "Tls13"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
@ -9641,13 +9651,12 @@ function HEIF
}
}
}
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "https://store.rg-adguard.net")
Write-Error -Message ($Localization.NoResponse -f "https://store.rg-adguard.net") -ErrorAction SilentlyContinue
return
}
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
}
}
catch [System.Net.WebException]
@ -9656,8 +9665,6 @@ function HEIF
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
return
}
}
}
@ -9667,10 +9674,20 @@ function HEIF
{
try
{
if ((Invoke-WebRequest -Uri https://www.google.com -UseBasicParsing -DisableKeepAlive -Method Head).StatusDescription)
# Check the internet connection
$Parameters = @{
Uri = "https://www.google.com"
Method = "Head"
SslProtocol = "Tls13"
DisableKeepAlive = $true
UseBasicParsing = $true
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Start-Process -FilePath ms-windows-store://pdp/?ProductId=9n4wgh0z6vhq
return
}
Start-Process -FilePath ms-windows-store://pdp/?ProductId=9n4wgh0z6vhq
}
catch [System.Net.WebException]
{
@ -9678,8 +9695,6 @@ function HEIF
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
return
}
}
}
@ -12089,10 +12104,23 @@ function BitmapImageNewContext
{
try
{
if ((Invoke-WebRequest -Uri https://www.google.com -UseBasicParsing -DisableKeepAlive -Method Head).StatusDescription)
# Check the internet connection
$Parameters = @{
Uri = "https://www.google.com"
Method = "Head"
SslProtocol = "Tls13"
DisableKeepAlive = $true
UseBasicParsing = $true
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Get-WindowsCapability -Online -Name "Microsoft.Windows.MSPaint*" | Add-WindowsCapability -Online
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Patient -Verbose
Get-WindowsCapability -Online -Name "Microsoft.Windows.MSPaint*" | Add-WindowsCapability -Online
}
catch [System.Net.WebException]
{
@ -12100,8 +12128,6 @@ function BitmapImageNewContext
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
return
}
}
}
@ -12170,10 +12196,23 @@ function RichTextDocumentNewContext
{
try
{
if ((Invoke-WebRequest -Uri https://www.google.com -UseBasicParsing -DisableKeepAlive -Method Head).StatusDescription)
# Check the internet connection
$Parameters = @{
Uri = "https://www.google.com"
Method = "Head"
SslProtocol = "Tls13"
DisableKeepAlive = $true
UseBasicParsing = $true
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Get-WindowsCapability -Online -Name "Microsoft.Windows.WordPad*" | Add-WindowsCapability -Online
return
}
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Patient -Verbose
Get-WindowsCapability -Online -Name "Microsoft.Windows.WordPad*" | Add-WindowsCapability -Online
}
catch [System.Net.WebException]
{
@ -12181,8 +12220,6 @@ function RichTextDocumentNewContext
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line) -ErrorAction SilentlyContinue
return
}
}
}
@ -12420,6 +12457,38 @@ public static void PostMessage()
Set-MpPreference -EnableControlledFolderAccess Enabled
}
# In order for the changes to take effect the File Explorer process has to be restarted
$Title = ""
$Message = $Localization.FileExplorerRestartPrompt
$Yes = $Localization.Yes
$No = $Localization.No
$Options = "&$No", "&$Yes"
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
{
continue
}
"1"
{
Stop-Process -Name explorer -Force
Start-Sleep -Seconds 3
# Restoring closed folders
foreach ($Script:OpenedFolder in $Script:OpenedFolders)
{
if (Test-Path -Path $Script:OpenedFolder)
{
Invoke-Item -Path $Script:OpenedFolder
}
}
}
}
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.RestartWarning

4
Sophia Script/Sophia Script for Windows 10 PowerShell 7/Sophia.ps1

@ -235,11 +235,11 @@ WhatsNewInWindows -Disable
# Предлагать способы завершения настройки устройства для максимально эффективного использования Windows (значение по умолчанию)
# WhatsNewInWindows -Enable
# Do not let Microsoft offer you tailored expereinces based on the diagnostic data setting you hava chosen
# Do not let Microsoft offer you tailored expereinces based on the diagnostic data setting you have chosen
# Не разрешиать корпорации Майкософт использовать ваши диагностические данные для предоставления вам персонализированных советов, рекламы и рекомендаций, чтобы улучшить работу со службами Майкрософт
TailoredExperiences -Disable
# Let Microsoft offer you tailored expereinces based on the diagnostic data setting you hava chosen (default value)
# Let Microsoft offer you tailored expereinces based on the diagnostic data setting you have chosen (default value)
# Разрешите корпорации Майкософт использовать ваши диагностические данные для предоставления вам персонализированных советов, рекламы и рекомендаций, чтобы улучшить работу со службами Майкрософт (значение по умолчанию)
# TailoredExperiences -Enable

Loading…
Cancel
Save