|
@ -85,7 +85,7 @@ public static string GetString(uint strId) |
|
|
Add-Type @Signature |
|
|
Add-Type @Signature |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Check if Microsoft Edge as being a system component was removed by harmful tweakers |
|
|
# Check whether Microsoft Edge as being a system component was removed by harmful tweakers |
|
|
if (-not (Test-Path -Path "${env:ProgramFiles(x86)}\Microsoft\Edge\Application\msedge.exe")) |
|
|
if (-not (Test-Path -Path "${env:ProgramFiles(x86)}\Microsoft\Edge\Application\msedge.exe")) |
|
|
{ |
|
|
{ |
|
|
Write-Information -MessageData "" -InformationAction Continue |
|
|
Write-Information -MessageData "" -InformationAction Continue |
|
@ -174,7 +174,7 @@ public static string GetString(uint strId) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Detect the OS bitness |
|
|
# Detect Windows bitness |
|
|
if (-not [System.Environment]::Is64BitOperatingSystem) |
|
|
if (-not [System.Environment]::Is64BitOperatingSystem) |
|
|
{ |
|
|
{ |
|
|
Write-Warning -Message $Localization.UnsupportedOSBitness |
|
|
Write-Warning -Message $Localization.UnsupportedOSBitness |
|
@ -185,17 +185,6 @@ public static string GetString(uint strId) |
|
|
exit |
|
|
exit |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Check if Get-WindowsEdition cmdlet is working |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
[void](Get-WindowsEdition -Online) |
|
|
|
|
|
} |
|
|
|
|
|
catch [System.Runtime.InteropServices.COMException] |
|
|
|
|
|
{ |
|
|
|
|
|
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Get-WindowsEdition") |
|
|
|
|
|
exit |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Check the language mode |
|
|
# Check the language mode |
|
|
if ($ExecutionContext.SessionState.LanguageMode -ne "FullLanguage") |
|
|
if ($ExecutionContext.SessionState.LanguageMode -ne "FullLanguage") |
|
|
{ |
|
|
{ |
|
@ -301,7 +290,7 @@ public static string GetString(uint strId) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Flibustier custom Windows image |
|
|
# Check whether this is a Flibustier custom Windows image |
|
|
if (Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\.NETFramework\Performance -Name *flibustier) |
|
|
if (Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\.NETFramework\Performance -Name *flibustier) |
|
|
{ |
|
|
{ |
|
|
Write-Warning -Message ($Localization.TweakerWarning -f "flblauncher") |
|
|
Write-Warning -Message ($Localization.TweakerWarning -f "flblauncher") |
|
@ -312,47 +301,21 @@ public static string GetString(uint strId) |
|
|
exit |
|
|
exit |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Check whether Windows Feature Experience Pack was removed by harmful tweakers |
|
|
# Check whether Get-WindowsEdition cmdlet is working |
|
|
if (-not (Get-AppxPackage -Name MicrosoftWindows.Client.CBS)) |
|
|
try |
|
|
{ |
|
|
{ |
|
|
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Windows Feature Experience Pack") |
|
|
[void](Get-WindowsEdition -Online) |
|
|
|
|
|
|
|
|
Start-Process -FilePath "https://t.me/sophia_chat" |
|
|
|
|
|
Start-Process -FilePath "https://discord.gg/sSryhaEv79" |
|
|
|
|
|
|
|
|
|
|
|
exit |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
catch [System.Runtime.InteropServices.COMException] |
|
|
# Check whether all necessary files exist in the bin folder |
|
|
|
|
|
$Files = @( |
|
|
|
|
|
"$PSScriptRoot\..\bin\LGPO.exe", |
|
|
|
|
|
"$PSScriptRoot\..\bin\Microsoft.Windows.SDK.NET.dll", |
|
|
|
|
|
"$PSScriptRoot\..\bin\WinRT.Runtime.dll" |
|
|
|
|
|
) |
|
|
|
|
|
if (($Files | Test-Path) -contains $false) |
|
|
|
|
|
{ |
|
|
{ |
|
|
Write-Warning -Message $Localization.Bin |
|
|
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Get-WindowsEdition") |
|
|
|
|
|
|
|
|
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" |
|
|
|
|
|
Start-Process -FilePath "https://t.me/sophia_chat" |
|
|
|
|
|
Start-Process -FilePath "https://discord.gg/sSryhaEv79" |
|
|
|
|
|
|
|
|
|
|
|
exit |
|
|
exit |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Check for a pending reboot |
|
|
# Check whether Windows Feature Experience Pack was removed by harmful tweakers |
|
|
$PendingActions = @( |
|
|
if (-not (Get-AppxPackage -Name MicrosoftWindows.Client.CBS)) |
|
|
# CBS pending |
|
|
|
|
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending", |
|
|
|
|
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootInProgress", |
|
|
|
|
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\PackagesPending", |
|
|
|
|
|
# Windows Update pending |
|
|
|
|
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting", |
|
|
|
|
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" |
|
|
|
|
|
) |
|
|
|
|
|
if (($PendingActions | Test-Path) -contains $true) |
|
|
|
|
|
{ |
|
|
{ |
|
|
Write-Warning -Message $Localization.RebootPending |
|
|
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Windows Feature Experience Pack") |
|
|
|
|
|
|
|
|
Start-Process -FilePath "https://t.me/sophia_chat" |
|
|
Start-Process -FilePath "https://t.me/sophia_chat" |
|
|
Start-Process -FilePath "https://discord.gg/sSryhaEv79" |
|
|
Start-Process -FilePath "https://discord.gg/sSryhaEv79" |
|
@ -360,10 +323,11 @@ public static string GetString(uint strId) |
|
|
exit |
|
|
exit |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Check if Microsoft Store being an important system component was removed |
|
|
# Check whether EventLog service is running in order to be sire that Event Logger is enabled |
|
|
if (-not (Get-AppxPackage -Name Microsoft.WindowsStore)) |
|
|
if ((Get-Service -Name EventLog).Status -eq "Stopped") |
|
|
{ |
|
|
{ |
|
|
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Store") |
|
|
# Extract the localized "Event Viewer" string from shell32.dll |
|
|
|
|
|
Write-Warning -Message ($Localization.WindowsComponentBroken -f $([WinAPI.GetStr]::GetString(22029)) |
|
|
|
|
|
|
|
|
Start-Process -FilePath "https://t.me/sophia_chat" |
|
|
Start-Process -FilePath "https://t.me/sophia_chat" |
|
|
Start-Process -FilePath "https://discord.gg/sSryhaEv79" |
|
|
Start-Process -FilePath "https://discord.gg/sSryhaEv79" |
|
@ -371,54 +335,16 @@ public static string GetString(uint strId) |
|
|
exit |
|
|
exit |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Check if the current module version is the latest one |
|
|
# Check whether Microsoft Store being an important system component was removed |
|
|
try |
|
|
if (-not (Get-AppxPackage -Name Microsoft.WindowsStore)) |
|
|
{ |
|
|
|
|
|
# Check the internet connection |
|
|
|
|
|
$Parameters = @{ |
|
|
|
|
|
Name = "dns.msftncsi.com" |
|
|
|
|
|
Server = "1.1.1.1" |
|
|
|
|
|
DnsOnly = $true |
|
|
|
|
|
ErrorAction = "Stop" |
|
|
|
|
|
} |
|
|
|
|
|
if ((Resolve-DnsName @Parameters).IPAddress -notcontains "131.107.255.255") |
|
|
|
|
|
{ |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json |
|
|
|
|
|
$Parameters = @{ |
|
|
|
|
|
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" |
|
|
|
|
|
Verbose = $true |
|
|
|
|
|
UseBasicParsing = $true |
|
|
|
|
|
} |
|
|
|
|
|
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_7 |
|
|
|
|
|
$CurrentRelease = (Get-Module -Name Sophia).Version.ToString() |
|
|
|
|
|
|
|
|
|
|
|
if ([System.Version]$LatestRelease -gt [System.Version]$CurrentRelease) |
|
|
|
|
|
{ |
|
|
{ |
|
|
Write-Warning -Message $Localization.UnsupportedRelease |
|
|
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Store") |
|
|
|
|
|
|
|
|
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" |
|
|
|
|
|
Start-Process -FilePath "https://t.me/sophia_chat" |
|
|
Start-Process -FilePath "https://t.me/sophia_chat" |
|
|
Start-Process -FilePath "https://discord.gg/sSryhaEv79" |
|
|
Start-Process -FilePath "https://discord.gg/sSryhaEv79" |
|
|
|
|
|
|
|
|
exit |
|
|
exit |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
catch [System.Net.WebException] |
|
|
|
|
|
{ |
|
|
|
|
|
Write-Warning -Message ($Localization.NoResponse -f "https://github.com") |
|
|
|
|
|
Write-Error -Message ($Localization.NoResponse -f "https://github.com") -ErrorAction SilentlyContinue |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
catch [System.ComponentModel.Win32Exception] |
|
|
|
|
|
{ |
|
|
|
|
|
Write-Warning -Message $Localization.NoInternetConnection |
|
|
|
|
|
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#region Defender checks |
|
|
#region Defender checks |
|
|
# Check whether necessary Microsoft Defender components exists |
|
|
# Check whether necessary Microsoft Defender components exists |
|
@ -504,7 +430,7 @@ public static string GetString(uint strId) |
|
|
# Defender is a currently used AV. Continue... |
|
|
# Defender is a currently used AV. Continue... |
|
|
$Script:DefenderProductState = $true |
|
|
$Script:DefenderProductState = $true |
|
|
|
|
|
|
|
|
# Check if Windows is Enterprise for Chineese Goverment which doesn't have Defender |
|
|
# Check whether Windows is Enterprise for Chineese Goverment which doesn't have Defender |
|
|
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG") |
|
|
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG") |
|
|
{ |
|
|
{ |
|
|
# Defender is a currently used AV. Continue... |
|
|
# Defender is a currently used AV. Continue... |
|
@ -580,7 +506,93 @@ public static string GetString(uint strId) |
|
|
} |
|
|
} |
|
|
#endregion Defender checks |
|
|
#endregion Defender checks |
|
|
|
|
|
|
|
|
# Detect the OS build version |
|
|
# Check for a pending reboot |
|
|
|
|
|
$PendingActions = @( |
|
|
|
|
|
# CBS pending |
|
|
|
|
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending", |
|
|
|
|
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootInProgress", |
|
|
|
|
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\PackagesPending", |
|
|
|
|
|
# Windows Update pending |
|
|
|
|
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting", |
|
|
|
|
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" |
|
|
|
|
|
) |
|
|
|
|
|
if (($PendingActions | Test-Path) -contains $true) |
|
|
|
|
|
{ |
|
|
|
|
|
Write-Warning -Message $Localization.RebootPending |
|
|
|
|
|
|
|
|
|
|
|
Start-Process -FilePath "https://t.me/sophia_chat" |
|
|
|
|
|
Start-Process -FilePath "https://discord.gg/sSryhaEv79" |
|
|
|
|
|
|
|
|
|
|
|
exit |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Check whether the current module version is the latest one |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
# Check the internet connection |
|
|
|
|
|
$Parameters = @{ |
|
|
|
|
|
Name = "dns.msftncsi.com" |
|
|
|
|
|
Server = "1.1.1.1" |
|
|
|
|
|
DnsOnly = $true |
|
|
|
|
|
ErrorAction = "Stop" |
|
|
|
|
|
} |
|
|
|
|
|
if ((Resolve-DnsName @Parameters).IPAddress -notcontains "131.107.255.255") |
|
|
|
|
|
{ |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json |
|
|
|
|
|
$Parameters = @{ |
|
|
|
|
|
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" |
|
|
|
|
|
Verbose = $true |
|
|
|
|
|
UseBasicParsing = $true |
|
|
|
|
|
} |
|
|
|
|
|
$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 |
|
|
|
|
|
|
|
|
|
|
|
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" |
|
|
|
|
|
Start-Process -FilePath "https://t.me/sophia_chat" |
|
|
|
|
|
Start-Process -FilePath "https://discord.gg/sSryhaEv79" |
|
|
|
|
|
|
|
|
|
|
|
exit |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
catch [System.Net.WebException] |
|
|
|
|
|
{ |
|
|
|
|
|
Write-Warning -Message ($Localization.NoResponse -f "https://github.com") |
|
|
|
|
|
Write-Error -Message ($Localization.NoResponse -f "https://github.com") -ErrorAction SilentlyContinue |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
catch [System.ComponentModel.Win32Exception] |
|
|
|
|
|
{ |
|
|
|
|
|
Write-Warning -Message $Localization.NoInternetConnection |
|
|
|
|
|
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Check whether all necessary files exist in the bin folder |
|
|
|
|
|
$Files = @( |
|
|
|
|
|
"$PSScriptRoot\..\bin\LGPO.exe", |
|
|
|
|
|
"$PSScriptRoot\..\bin\Microsoft.Windows.SDK.NET.dll", |
|
|
|
|
|
"$PSScriptRoot\..\bin\WinRT.Runtime.dll" |
|
|
|
|
|
) |
|
|
|
|
|
if (($Files | Test-Path) -contains $false) |
|
|
|
|
|
{ |
|
|
|
|
|
Write-Warning -Message $Localization.Bin |
|
|
|
|
|
|
|
|
|
|
|
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" |
|
|
|
|
|
Start-Process -FilePath "https://t.me/sophia_chat" |
|
|
|
|
|
Start-Process -FilePath "https://discord.gg/sSryhaEv79" |
|
|
|
|
|
|
|
|
|
|
|
exit |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Detect Windows build version |
|
|
switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber) |
|
|
switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber) |
|
|
{ |
|
|
{ |
|
|
{($_ -lt 19045) -or ($_ -gt 19045)} |
|
|
{($_ -lt 19045) -or ($_ -gt 19045)} |
|
@ -597,7 +609,7 @@ public static string GetString(uint strId) |
|
|
{ |
|
|
{ |
|
|
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 3803) |
|
|
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 3803) |
|
|
{ |
|
|
{ |
|
|
# Check whether the OS minor build version is 3803 minimum |
|
|
# Check whether Windows minor build version is 3803 minimum |
|
|
# https://learn.microsoft.com/en-us/windows/release-health/release-information#windows-10-current-versions-by-servicing-option |
|
|
# https://learn.microsoft.com/en-us/windows/release-health/release-information#windows-10-current-versions-by-servicing-option |
|
|
$CurrentBuild = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name CurrentBuild |
|
|
$CurrentBuild = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name CurrentBuild |
|
|
$UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR |
|
|
$UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR |
|
@ -730,7 +742,7 @@ public static string GetString(uint strId) |
|
|
# Extract the localized "Please wait..." string from shell32.dll |
|
|
# Extract the localized "Please wait..." string from shell32.dll |
|
|
Write-Verbose -Message ([WinAPI.GetStr]::GetString(12612)) -Verbose |
|
|
Write-Verbose -Message ([WinAPI.GetStr]::GetString(12612)) -Verbose |
|
|
|
|
|
|
|
|
# Check if hosts contains any of string from $IPArray array |
|
|
# Check whether hosts contains any of string from $IPArray array |
|
|
if ((Get-Content -Path "$env:SystemRoot\System32\drivers\etc\hosts" -Encoding Default -Force | ForEach-Object -Process {$_.Trim()} | ForEach-Object -Process { |
|
|
if ((Get-Content -Path "$env:SystemRoot\System32\drivers\etc\hosts" -Encoding Default -Force | ForEach-Object -Process {$_.Trim()} | ForEach-Object -Process { |
|
|
($_ -ne "") -and ($_ -ne " ") -and (-not $_.StartsWith("#")) -and ($IPArray -split "`r?`n" | Select-String -Pattern $_) |
|
|
($_ -ne "") -and ($_ -ne " ") -and (-not $_.StartsWith("#")) -and ($IPArray -split "`r?`n" | Select-String -Pattern $_) |
|
|
}) -contains $true) |
|
|
}) -contains $true) |
|
@ -5171,7 +5183,7 @@ function OneDrive |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Check if user is logged into OneDrive (Microsoft account) |
|
|
# Check whether user is logged into OneDrive (Microsoft account) |
|
|
$UserEmail = Get-ItemProperty -Path HKCU:\Software\Microsoft\OneDrive\Accounts\Personal -Name UserEmail -ErrorAction Ignore |
|
|
$UserEmail = Get-ItemProperty -Path HKCU:\Software\Microsoft\OneDrive\Accounts\Personal -Name UserEmail -ErrorAction Ignore |
|
|
if ($UserEmail) |
|
|
if ($UserEmail) |
|
|
{ |
|
|
{ |
|
@ -8215,7 +8227,7 @@ function WinPrtScrFolder |
|
|
$Default |
|
|
$Default |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
# Check if user is logged into OneDrive (Microsoft account) |
|
|
# Check whether user is logged into OneDrive (Microsoft account) |
|
|
$UserEmail = Get-ItemProperty -Path HKCU:\Software\Microsoft\OneDrive\Accounts\Personal -Name UserEmail -ErrorAction Ignore |
|
|
$UserEmail = Get-ItemProperty -Path HKCU:\Software\Microsoft\OneDrive\Accounts\Personal -Name UserEmail -ErrorAction Ignore |
|
|
if ($UserEmail) |
|
|
if ($UserEmail) |
|
|
{ |
|
|
{ |
|
@ -8297,7 +8309,7 @@ function WinPrtScrFolder |
|
|
RecommendedTroubleshooting -Default |
|
|
RecommendedTroubleshooting -Default |
|
|
|
|
|
|
|
|
.NOTES |
|
|
.NOTES |
|
|
In order this feature to work the OS level of diagnostic data gathering will be set to "Optional diagnostic data" and the error reporting feature will be turned on |
|
|
In order this feature to work Windows level of diagnostic data gathering will be set to "Optional diagnostic data" and the error reporting feature will be turned on |
|
|
|
|
|
|
|
|
.NOTES |
|
|
.NOTES |
|
|
Machine-wide |
|
|
Machine-wide |
|
@ -8341,7 +8353,7 @@ function RecommendedTroubleshooting |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Set the OS level of diagnostic data gathering to "Optional diagnostic data" |
|
|
# Set Windows level of diagnostic data gathering to "Optional diagnostic data" |
|
|
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack)) |
|
|
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack)) |
|
|
{ |
|
|
{ |
|
|
New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack -Force |
|
|
New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack -Force |
|
@ -10217,7 +10229,7 @@ function Import-Associations |
|
|
https://support.microsoft.com/en-us/windows/how-to-use-the-pc-health-check-app-9c8abd9b-03ba-4e67-81ef-36f37caa7844 |
|
|
https://support.microsoft.com/en-us/windows/how-to-use-the-pc-health-check-app-9c8abd9b-03ba-4e67-81ef-36f37caa7844 |
|
|
|
|
|
|
|
|
.NOTES |
|
|
.NOTES |
|
|
This application is installed with the KB5005463 update to check if PC meets the system requirements of Windows 11 |
|
|
This application is installed with the KB5005463 update to Check whether PC meets the system requirements of Windows 11 |
|
|
|
|
|
|
|
|
.NOTES |
|
|
.NOTES |
|
|
Machine-wide |
|
|
Machine-wide |
|
@ -11052,7 +11064,7 @@ function PinToStart |
|
|
# Extract the localized "Devices and Printers" string from shell32.dll |
|
|
# Extract the localized "Devices and Printers" string from shell32.dll |
|
|
$DevicesPrinters = [WinAPI.GetStr]::GetString(30493) |
|
|
$DevicesPrinters = [WinAPI.GetStr]::GetString(30493) |
|
|
|
|
|
|
|
|
# Check if an argument is "DevicesPrinters". The Devices and Printers's AppID attribute can be retrieved only if the shortcut was created |
|
|
# Check whether an argument is "DevicesPrinters". The Devices and Printers's AppID attribute can be retrieved only if the shortcut was created |
|
|
if (((Get-Command -Name PinToStart).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames}).Attributes.ValidValues | Where-Object -FilterScript {$_ -match "DevicesPrinters"}) |
|
|
if (((Get-Command -Name PinToStart).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames}).Attributes.ValidValues | Where-Object -FilterScript {$_ -match "DevicesPrinters"}) |
|
|
{ |
|
|
{ |
|
|
# Create the old-style "Devices and Printers" shortcut in the Start menu |
|
|
# Create the old-style "Devices and Printers" shortcut in the Start menu |
|
@ -12659,7 +12671,7 @@ function CleanupTask |
|
|
# Checking if we're trying to create the task when it was already created as another user |
|
|
# Checking if we're trying to create the task when it was already created as another user |
|
|
if (Get-ScheduledTask -TaskPath "\Sophia\" -TaskName "Windows Cleanup" -ErrorAction Ignore) |
|
|
if (Get-ScheduledTask -TaskPath "\Sophia\" -TaskName "Windows Cleanup" -ErrorAction Ignore) |
|
|
{ |
|
|
{ |
|
|
# Also we can parse "$env:SystemRoot\System32\Tasks\Sophia\Windows Cleanup" to check if the task was created |
|
|
# Also we can parse "$env:SystemRoot\System32\Tasks\Sophia\Windows Cleanup" to Check whether the task was created |
|
|
$ScheduleService = New-Object -ComObject Schedule.Service |
|
|
$ScheduleService = New-Object -ComObject Schedule.Service |
|
|
$ScheduleService.Connect() |
|
|
$ScheduleService.Connect() |
|
|
$ScheduleService.GetFolder("\Sophia").GetTasks(0) | Where-Object -FilterScript {$_.Name -eq "Windows Cleanup"} | Foreach-Object { |
|
|
$ScheduleService.GetFolder("\Sophia").GetTasks(0) | Where-Object -FilterScript {$_.Name -eq "Windows Cleanup"} | Foreach-Object { |
|
@ -13084,7 +13096,7 @@ function SoftwareDistributionTask |
|
|
# Checking if we're trying to create the task when it was already created as another user |
|
|
# Checking if we're trying to create the task when it was already created as another user |
|
|
if (Get-ScheduledTask -TaskPath "\Sophia\" -TaskName SoftwareDistribution -ErrorAction Ignore) |
|
|
if (Get-ScheduledTask -TaskPath "\Sophia\" -TaskName SoftwareDistribution -ErrorAction Ignore) |
|
|
{ |
|
|
{ |
|
|
# Also we can parse $env:SystemRoot\System32\Tasks\Sophia\SoftwareDistribution to check if the task was created |
|
|
# Also we can parse $env:SystemRoot\System32\Tasks\Sophia\SoftwareDistribution to Check whether the task was created |
|
|
$ScheduleService = New-Object -ComObject Schedule.Service |
|
|
$ScheduleService = New-Object -ComObject Schedule.Service |
|
|
$ScheduleService.Connect() |
|
|
$ScheduleService.Connect() |
|
|
$ScheduleService.GetFolder("\Sophia").GetTasks(0) | Where-Object -FilterScript {$_.Name -eq "SoftwareDistribution"} | Foreach-Object { |
|
|
$ScheduleService.GetFolder("\Sophia").GetTasks(0) | Where-Object -FilterScript {$_.Name -eq "SoftwareDistribution"} | Foreach-Object { |
|
@ -13388,7 +13400,7 @@ function TempTask |
|
|
# Checking if we're trying to create the task when it was already created as another user |
|
|
# Checking if we're trying to create the task when it was already created as another user |
|
|
if (Get-ScheduledTask -TaskPath "\Sophia\" -TaskName Temp -ErrorAction Ignore) |
|
|
if (Get-ScheduledTask -TaskPath "\Sophia\" -TaskName Temp -ErrorAction Ignore) |
|
|
{ |
|
|
{ |
|
|
# Also we can parse $env:SystemRoot\System32\Tasks\Sophia\Temp to check if the task was created |
|
|
# Also we can parse $env:SystemRoot\System32\Tasks\Sophia\Temp to Check whether the task was created |
|
|
$ScheduleService = New-Object -ComObject Schedule.Service |
|
|
$ScheduleService = New-Object -ComObject Schedule.Service |
|
|
$ScheduleService.Connect() |
|
|
$ScheduleService.Connect() |
|
|
$ScheduleService.GetFolder("\Sophia").GetTasks(0) | Where-Object -FilterScript {$_.Name -eq "Temp"} | Foreach-Object { |
|
|
$ScheduleService.GetFolder("\Sophia").GetTasks(0) | Where-Object -FilterScript {$_.Name -eq "Temp"} | Foreach-Object { |
|
@ -15458,7 +15470,7 @@ function UpdateLGPEPolicies |
|
|
{ |
|
|
{ |
|
|
foreach ($Item in $Path.Property) |
|
|
foreach ($Item in $Path.Property) |
|
|
{ |
|
|
{ |
|
|
# Check if property isn't equal to "(default)" and exists |
|
|
# Check whether property isn't equal to "(default)" and exists |
|
|
if (($null -ne $Item) -and ($Item -ne "(default)")) |
|
|
if (($null -ne $Item) -and ($Item -ne "(default)")) |
|
|
{ |
|
|
{ |
|
|
# Where all ADMX templates are located to compare with |
|
|
# Where all ADMX templates are located to compare with |
|
@ -15516,7 +15528,7 @@ function UpdateLGPEPolicies |
|
|
{ |
|
|
{ |
|
|
foreach ($Item in $Path.Property) |
|
|
foreach ($Item in $Path.Property) |
|
|
{ |
|
|
{ |
|
|
# Check if property isn't equal to "(default)" and exists |
|
|
# Check whether property isn't equal to "(default)" and exists |
|
|
if (($null -ne $Item) -and ($Item -ne "(default)")) |
|
|
if (($null -ne $Item) -and ($Item -ne "(default)")) |
|
|
{ |
|
|
{ |
|
|
# Where all ADMX templates are located to compare with |
|
|
# Where all ADMX templates are located to compare with |
|
@ -15686,7 +15698,7 @@ public static void PostMessage() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Check if any of scheduled tasks were created. Unless open Task Scheduler |
|
|
# Check whether any of scheduled tasks were created. Unless open Task Scheduler |
|
|
if ($Script:ScheduledTasks) |
|
|
if ($Script:ScheduledTasks) |
|
|
{ |
|
|
{ |
|
|
# Find and close taskschd.msc by its' argument |
|
|
# Find and close taskschd.msc by its' argument |
|
|