@ -2,8 +2,8 @@
. SYNOPSIS
. SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version : v5 . 12 . 1
Version : v5 . 12 . 2
Date : 06 . 08 . 2021
Date : 25 . 08 . 2021
Copyright ( c ) 2014 – 2021 farag
Copyright ( c ) 2014 – 2021 farag
Copyright ( c ) 2019 – 2021 farag & Inestic
Copyright ( c ) 2019 – 2021 farag & Inestic
@ -15,8 +15,8 @@
. NOTES
. NOTES
Supported Windows 10 versions
Supported Windows 10 versions
Versions : 2004 / 20H2 / 21H1
Versions : 2004 / 20H2 / 21H1 / 21H2
Builds : 19041 / 19042 / 19043
Builds : 19041 / 19042 / 19043 / 19044
Editions : Home / Pro / Enterprise
Editions : Home / Pro / Enterprise
Architecture : x64
Architecture : x64
@ -35,7 +35,7 @@
https : / / github . com / farag2
https : / / github . com / farag2
https : / / github . com / Inestic
https : / / github . com / Inestic
. NOTES
. LINK
https : / / forum . ru-board . com / topic . cgi ? forum = 62 & topic = 30617 #15
https : / / forum . ru-board . com / topic . cgi ? forum = 62 & topic = 30617 #15
https : / / habr . com / company / skillfactory / blog / 553800 /
https : / / habr . com / company / skillfactory / blog / 553800 /
https : / / forums . mydigitallife . net / threads / powershell-windows - 10 -sophia -script . 81675 /
https : / / forums . mydigitallife . net / threads / powershell-windows - 10 -sophia -script . 81675 /
@ -68,7 +68,7 @@ function Checkings
}
}
# Detect the OS build version
# Detect the OS build version
switch ( ( ( Get-CimInstance -ClassName Win32_OperatingSystem ) . BuildNumber -ge 19041 ) -and ( ( Get-CimInstance -ClassName Win32_OperatingSystem ) . BuildNumber -lt 22000 ) )
switch ( ( ( Get-CimInstance -ClassName Win32_OperatingSystem ) . BuildNumber -ge 19041 ) -and ( ( Get-CimInstance -ClassName Win32_OperatingSystem ) . BuildNumber -le 19044 ) )
{
{
$false
$false
{
{
@ -83,9 +83,13 @@ function Checkings
$false
$false
{
{
$Version = Get-ItemPropertyValue -Path " HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion " -Name UBR
$Version = Get-ItemPropertyValue -Path " HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion " -Name UBR
Write-Warning -Message ( $Localization . UpdateWarning -f $Version )
Write-Warning -Message ( $Localization . UpdateWarning -f $Version )
# Check for updates
Start-Process -FilePath " ms-settings:windowsupdate-action "
Start-Sleep -Seconds 3
Start-Process -FilePath " ms-settings:windowsupdate-optionalupdates "
exit
exit
}
}
}
}
@ -120,7 +124,7 @@ function Checkings
# Check whether the script was run via PowerShell 5.1
# Check whether the script was run via PowerShell 5.1
if ( $PSVersionTable . PSVersion . Major -ne 5 )
if ( $PSVersionTable . PSVersion . Major -ne 5 )
{
{
Write-Warning -Message ( $Localization . UnsupportedPowerShell -f $PSVersionTable . PSVersion . Major )
Write-Warning -Message ( $Localization . UnsupportedPowerShell -f $PSVersionTable . PSVersion . Major , $PSVersionTable . PSVersion . Minor )
exit
exit
}
}
@ -145,7 +149,10 @@ function Checkings
# Check if the current module version is the latest one
# Check if the current module version is the latest one
try
try
{
{
$LatestRelease = ( Invoke-RestMethod -Uri " https://api.github.com/repos/farag2/Sophia-Script-for-Windows/releases/latest " ) . tag_name
[Net.ServicePointManager] :: SecurityProtocol = [Net.SecurityProtocolType] :: Tls12
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$LatestRelease = ( Invoke-WebRequest -Uri " https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json " | ConvertFrom-Json ) . Sophia_Script_Windows_10_PowerShell_5_1
$CurrentRelease = ( Get-Module -Name Sophia ) . Version . ToString ( )
$CurrentRelease = ( Get-Module -Name Sophia ) . Version . ToString ( )
switch ( [System.Version] $LatestRelease -gt [System.Version] $CurrentRelease )
switch ( [System.Version] $LatestRelease -gt [System.Version] $CurrentRelease )
{
{
@ -705,6 +712,7 @@ function ScheduledTasks
function DisableButton
function DisableButton
{
{
Write-Information -MessageData " " -InformationAction Continue
Write-Verbose -Message $Localization . Patient -Verbose
Write-Verbose -Message $Localization . Patient -Verbose
[void] $Window . Close ( )
[void] $Window . Close ( )
@ -715,6 +723,7 @@ function ScheduledTasks
function EnableButton
function EnableButton
{
{
Write-Information -MessageData " " -InformationAction Continue
Write-Verbose -Message $Localization . Patient -Verbose
Write-Verbose -Message $Localization . Patient -Verbose
[void] $Window . Close ( )
[void] $Window . Close ( )
@ -779,6 +788,7 @@ function ScheduledTasks
}
}
}
}
Write-Information -MessageData " " -InformationAction Continue
Write-Verbose -Message $Localization . Patient -Verbose
Write-Verbose -Message $Localization . Patient -Verbose
# Getting list of all scheduled tasks according to the conditions
# Getting list of all scheduled tasks according to the conditions
@ -2764,6 +2774,8 @@ public static string GetString(uint strId)
Mail
Mail
{
{
# Start-Job is used due to that the calling this function before UninstallUWPApps breaks the retrieval of the localized UWP apps packages names
# Start-Job is used due to that the calling this function before UninstallUWPApps breaks the retrieval of the localized UWP apps packages names
if ( Get-AppxPackage -Name microsoft . windowscommunicationsapps )
{
Start-Job -ScriptBlock {
Start-Job -ScriptBlock {
$Apps = ( New-Object -ComObject Shell . Application ) . NameSpace ( " shell:::{4234d49b-0245-4df3-b780-3893943456e1} " ) . Items ( )
$Apps = ( New-Object -ComObject Shell . Application ) . NameSpace ( " shell:::{4234d49b-0245-4df3-b780-3893943456e1} " ) . Items ( )
( $Apps | Where-Object -FilterScript { $_ . Path -eq " microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.windowslive.mail " } ) . Verbs ( ) | Where-Object -FilterScript { $_ . Name -eq $Using : LocalizedString } | ForEach-Object -Process { $_ . DoIt ( ) }
( $Apps | Where-Object -FilterScript { $_ . Path -eq " microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.windowslive.mail " } ) . Verbs ( ) | Where-Object -FilterScript { $_ . Name -eq $Using : LocalizedString } | ForEach-Object -Process { $_ . DoIt ( ) }
@ -2772,6 +2784,7 @@ public static string GetString(uint strId)
}
}
}
}
}
}
}
<#
<#
. SYNOPSIS
. SYNOPSIS
@ -4718,6 +4731,7 @@ function WindowsFeatures
function DisableButton
function DisableButton
{
{
Write-Information -MessageData " " -InformationAction Continue
Write-Verbose -Message $Localization . Patient -Verbose
Write-Verbose -Message $Localization . Patient -Verbose
[void] $Window . Close ( )
[void] $Window . Close ( )
@ -4728,6 +4742,7 @@ function WindowsFeatures
function EnableButton
function EnableButton
{
{
Write-Information -MessageData " " -InformationAction Continue
Write-Verbose -Message $Localization . Patient -Verbose
Write-Verbose -Message $Localization . Patient -Verbose
[void] $Window . Close ( )
[void] $Window . Close ( )
@ -5907,6 +5922,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
while ( $k . Key -notin ( [ConsoleKey] :: Escape , [ConsoleKey] :: Enter ) )
while ( $k . Key -notin ( [ConsoleKey] :: Escape , [ConsoleKey] :: Enter ) )
}
}
# Get the localized user folders names
$Signature = @ {
$Signature = @ {
Namespace = " WinAPI "
Namespace = " WinAPI "
Name = " GetStr "
Name = " GetStr "
@ -5932,6 +5948,7 @@ public static string GetString(uint strId)
Add-Type @Signature -Using System . Text
Add-Type @Signature -Using System . Text
}
}
# The localized user folders names
$DesktopLocalizedString = [WinAPI.GetStr] :: GetString ( 21769 )
$DesktopLocalizedString = [WinAPI.GetStr] :: GetString ( 21769 )
$DocumentsLocalizedString = [WinAPI.GetStr] :: GetString ( 21770 )
$DocumentsLocalizedString = [WinAPI.GetStr] :: GetString ( 21770 )
$DownloadsLocalizedString = [WinAPI.GetStr] :: GetString ( 21798 )
$DownloadsLocalizedString = [WinAPI.GetStr] :: GetString ( 21798 )
@ -5944,6 +5961,7 @@ public static string GetString(uint strId)
" Root "
" Root "
{
{
Write-Verbose -Message $Localization . RetrievingDrivesList -Verbose
Write-Verbose -Message $Localization . RetrievingDrivesList -Verbose
Write-Information -MessageData " " -InformationAction Continue
# Store all drives letters to use them within ShowMenu function
# Store all drives letters to use them within ShowMenu function
$DriveLetters = @ ( ( Get-Disk | Where-Object -FilterScript { $_ . BusType -ne " USB " } | Get-Partition | Get-Volume | Where-Object -FilterScript { $null -ne $_ . DriveLetter } ) . DriveLetter | Sort-Object )
$DriveLetters = @ ( ( Get-Disk | Where-Object -FilterScript { $_ . BusType -ne " USB " } | Get-Partition | Get-Volume | Where-Object -FilterScript { $null -ne $_ . DriveLetter } ) . DriveLetter | Sort-Object )
@ -5960,8 +5978,16 @@ public static string GetString(uint strId)
# Desktop
# Desktop
Write-Verbose -Message ( $Localization . DriveSelect -f $DesktopLocalizedString ) -Verbose
Write-Verbose -Message ( $Localization . DriveSelect -f $DesktopLocalizedString ) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name Desktop
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $DesktopLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserFolderRequest -f $DesktopLocalizedString
$Message = $Localization . UserFolderRequest -f $DesktopLocalizedString
$Change = $Localization . Change
$Change = $Localization . Change
@ -5980,13 +6006,22 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Documents
# Documents
Write-Verbose -Message ( $Localization . DriveSelect -f $DocumentsLocalizedString ) -Verbose
Write-Verbose -Message ( $Localization . DriveSelect -f $DocumentsLocalizedString ) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name Personal
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $DocumentsLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserFolderRequest -f $DocumentsLocalizedString
$Message = $Localization . UserFolderRequest -f $DocumentsLocalizedString
$Change = $Localization . Change
$Change = $Localization . Change
@ -6005,13 +6040,22 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Downloads
# Downloads
Write-Verbose -Message ( $Localization . DriveSelect -f $DownloadsLocalizedString ) -Verbose
Write-Verbose -Message ( $Localization . DriveSelect -f $DownloadsLocalizedString ) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name " {374DE290-123F-4565-9164-39C4925E467B} "
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $DownloadsLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserFolderRequest -f $DownloadsLocalizedString
$Message = $Localization . UserFolderRequest -f $DownloadsLocalizedString
$Change = $Localization . Change
$Change = $Localization . Change
@ -6030,13 +6074,22 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Music
# Music
Write-Verbose -Message ( $Localization . DriveSelect -f $MusicLocalizedString ) -Verbose
Write-Verbose -Message ( $Localization . DriveSelect -f $MusicLocalizedString ) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name " My Music "
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $MusicLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserFolderRequest -f $MusicLocalizedString
$Message = $Localization . UserFolderRequest -f $MusicLocalizedString
$Change = $Localization . Change
$Change = $Localization . Change
@ -6055,13 +6108,21 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Pictures
# Pictures
Write-Verbose -Message ( $Localization . DriveSelect -f $PicturesLocalizedString ) -Verbose
Write-Verbose -Message ( $Localization . DriveSelect -f $PicturesLocalizedString ) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name " My Pictures "
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $PicturesLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserFolderRequest -f $PicturesLocalizedString
$Message = $Localization . UserFolderRequest -f $PicturesLocalizedString
$Change = $Localization . Change
$Change = $Localization . Change
@ -6080,13 +6141,22 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Videos
# Videos
Write-Verbose -Message ( $Localization . DriveSelect -f $VideosLocalizedString ) -Verbose
Write-Verbose -Message ( $Localization . DriveSelect -f $VideosLocalizedString ) -Verbose
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name " My Video "
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $VideosLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserFolderRequest -f $VideosLocalizedString
$Message = $Localization . UserFolderRequest -f $VideosLocalizedString
$Change = $Localization . Change
$Change = $Localization . Change
@ -6105,14 +6175,22 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
}
}
" Custom "
" Custom "
{
{
# Desktop
# Desktop
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name Desktop
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $DesktopLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserFolderSelect -f $DesktopLocalizedString
$Message = $Localization . UserFolderSelect -f $DesktopLocalizedString
$Browse = $Localization . Browse
$Browse = $Localization . Browse
@ -6143,12 +6221,20 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Documents
# Documents
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name Personal
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $DocumentsLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserFolderSelect -f $DocumentsLocalizedString
$Message = $Localization . UserFolderSelect -f $DocumentsLocalizedString
$Browse = $Localization . Browse
$Browse = $Localization . Browse
@ -6179,12 +6265,20 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Downloads
# Downloads
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name " {374DE290-123F-4565-9164-39C4925E467B} "
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $DownloadsLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserFolderSelect -f $DownloadsLocalizedString
$Message = $Localization . UserFolderSelect -f $DownloadsLocalizedString
$Browse = $Localization . Browse
$Browse = $Localization . Browse
@ -6215,12 +6309,20 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Music
# Music
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name " My Music "
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $MusicLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserFolderSelect -f $MusicLocalizedString
$Message = $Localization . UserFolderSelect -f $MusicLocalizedString
$Browse = $Localization . Browse
$Browse = $Localization . Browse
@ -6251,12 +6353,20 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Pictures
# Pictures
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name " My Pictures "
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $PicturesLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserFolderSelect -f $PicturesLocalizedString
$Message = $Localization . UserFolderSelect -f $PicturesLocalizedString
$Browse = $Localization . Browse
$Browse = $Localization . Browse
@ -6287,12 +6397,20 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Videos
# Videos
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name " My Video "
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $VideosLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserFolderSelect -f $VideosLocalizedString
$Message = $Localization . UserFolderSelect -f $VideosLocalizedString
$Browse = $Localization . Browse
$Browse = $Localization . Browse
@ -6323,14 +6441,22 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
}
}
" Default "
" Default "
{
{
# Desktop
# Desktop
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name Desktop
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $DesktopLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserDefaultFolder -f $DesktopLocalizedString
$Message = $Localization . UserDefaultFolder -f $DesktopLocalizedString
$Change = $Localization . Change
$Change = $Localization . Change
@ -6348,12 +6474,20 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Documents
# Documents
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name Personal
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $DocumentsLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserDefaultFolder -f $DocumentsLocalizedString
$Message = $Localization . UserDefaultFolder -f $DocumentsLocalizedString
$Change = $Localization . Change
$Change = $Localization . Change
@ -6371,12 +6505,20 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Downloads
# Downloads
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name " {374DE290-123F-4565-9164-39C4925E467B} "
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $DownloadsLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserDefaultFolder -f $DownloadsLocalizedString
$Message = $Localization . UserDefaultFolder -f $DownloadsLocalizedString
$Change = $Localization . Change
$Change = $Localization . Change
@ -6394,12 +6536,20 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Music
# Music
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name " My Music "
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $MusicLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserDefaultFolder -f $MusicLocalizedString
$Message = $Localization . UserDefaultFolder -f $MusicLocalizedString
$Change = $Localization . Change
$Change = $Localization . Change
@ -6417,12 +6567,20 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Pictures
# Pictures
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name " My Pictures "
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $PicturesLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserDefaultFolder -f $PicturesLocalizedString
$Message = $Localization . UserDefaultFolder -f $PicturesLocalizedString
$Change = $Localization . Change
$Change = $Localization . Change
@ -6440,12 +6598,20 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
# Videos
# Videos
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name " My Video "
Write-Verbose -Message ( $Localization . CurrentUserFolderLocation -f $VideosLocalizedString , $CurrentUserFolderLocation ) -Verbose
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Warning -Message $Localization . FilesWontBeMoved
Write-Information -MessageData " " -InformationAction Continue
$Title = " "
$Title = " "
$Message = $Localization . UserDefaultFolder -f $VideosLocalizedString
$Message = $Localization . UserDefaultFolder -f $VideosLocalizedString
$Change = $Localization . Change
$Change = $Localization . Change
@ -6463,6 +6629,7 @@ public static string GetString(uint strId)
" 1 "
" 1 "
{
{
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Verbose -Message $Localization . Skipped -Verbose
Write-Information -MessageData " " -InformationAction Continue
}
}
}
}
}
}
@ -8311,7 +8478,7 @@ function PinToStart
begin
begin
{
{
$Script:StartLayout = " $ PSScriptRoot\StartLayout.xml "
$Script:StartLayout = " $ PSScriptRoot\..\ StartLayout.xml "
# Unpin all the Start tiles
# Unpin all the Start tiles
if ( $UnpinAll )
if ( $UnpinAll )
@ -8665,7 +8832,7 @@ function UninstallUWPApps
xmlns : x = " http://schemas.microsoft.com/winfx/2006/xaml "
xmlns : x = " http://schemas.microsoft.com/winfx/2006/xaml "
Name = " Window "
Name = " Window "
MinHeight = " 400 " MinWidth = " 415 "
MinHeight = " 400 " MinWidth = " 415 "
SizeToContent = " WidthAndHeight " WindowStartupLocation = " CenterScreen "
SizeToContent = " Width " WindowStartupLocation = " CenterScreen "
TextOptions . TextFormattingMode = " Display " SnapsToDevicePixels = " True "
TextOptions . TextFormattingMode = " Display " SnapsToDevicePixels = " True "
FontFamily = " Candara " FontSize = " 16 " ShowInTaskbar = " True "
FontFamily = " Candara " FontSize = " 16 " ShowInTaskbar = " True "
Background = " #F1F1F1 " Foreground = " #262626 " >
Background = " #F1F1F1 " Foreground = " #262626 " >
@ -9389,6 +9556,7 @@ function HEIF
if ( $Package -like " Microsoft.HEVCVideoExtension_*_x64__8wekyb3d8bbwe.appx " )
if ( $Package -like " Microsoft.HEVCVideoExtension_*_x64__8wekyb3d8bbwe.appx " )
{
{
Write-Information -MessageData " " -InformationAction Continue
Write-Verbose -Message $Localization . HEVCDownloading -Verbose
Write-Verbose -Message $Localization . HEVCDownloading -Verbose
[Net.ServicePointManager] :: SecurityProtocol = [Net.SecurityProtocolType] :: Tls12
[Net.ServicePointManager] :: SecurityProtocol = [Net.SecurityProtocolType] :: Tls12
@ -9611,6 +9779,7 @@ function BackgroundUWPApps
# Check for UWP apps updates
# Check for UWP apps updates
function CheckUWPAppsUpdates
function CheckUWPAppsUpdates
{
{
Write-Information -MessageData " " -InformationAction Continue
Write-Verbose -Message $Localization . Patient -Verbose
Write-Verbose -Message $Localization . Patient -Verbose
Get-CimInstance -Namespace " Root\cimv2\mdm\dmmap " -ClassName " MDM_EnterpriseModernAppManagement_AppManagement01 " | Invoke-CimMethod -MethodName UpdateScanMethod
Get-CimInstance -Namespace " Root\cimv2\mdm\dmmap " -ClassName " MDM_EnterpriseModernAppManagement_AppManagement01 " | Invoke-CimMethod -MethodName UpdateScanMethod
}
}
@ -9811,8 +9980,7 @@ function SetAppGraphicsPerformance
GPUScheduling -Disable
GPUScheduling -Disable
. NOTES
. NOTES
Only with a dedicated GPU and WDDM verion is 2 . 7 or higher
Only with a dedicated GPU and WDDM verion is 2 . 7 or higher . Restart needed
Restart needed
. NOTES
. NOTES
Current user
Current user
@ -9881,7 +10049,6 @@ function GPUScheduling
. NOTES
. NOTES
A native interactive toast notification pops up every 30 days
A native interactive toast notification pops up every 30 days
The task runs every 30 days
. NOTES
. NOTES
Current user
Current user
@ -10142,8 +10309,7 @@ while (`$true)
SoftwareDistributionTask -Delete
SoftwareDistributionTask -Delete
. NOTES
. NOTES
The task will wait until the Windows Updates service finishes running
The task will wait until the Windows Updates service finishes running . The task runs every 90 days
The task runs every 90 days
. NOTES
. NOTES
Current user
Current user
@ -10248,7 +10414,7 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
TempTask -Delete
TempTask -Delete
. NOTES
. NOTES
The task runs every 60 days
Only files older than one day will be deleted . The task runs every 60 days
. NOTES
. NOTES
Current user
Current user
@ -10629,7 +10795,7 @@ function CommandLineProcessAudit
The " Process Creation " Event Viewer custom view
The " Process Creation " Event Viewer custom view
. PARAMETER Enable
. PARAMETER Enable
Create the " Process Creation " Event Viewer custom view
Create the " Process Creation " Event Viewer сustom view to log the executed processes and their arguments
. PARAMETER Disable
. PARAMETER Disable
Remove the " Process Creation " Event Viewer custom view
Remove the " Process Creation " Event Viewer custom view
@ -10641,7 +10807,7 @@ function CommandLineProcessAudit
EventViewerCustomView -Disable
EventViewerCustomView -Disable
. NOTES
. NOTES
In order this feature to work events auditing ( ProcessAudit -Enable ) and command line in process creation events will be enabled
In order this feature to work events auditing ( ProcessAudit -Enable ) and command line ( CommandLineProcessAudit -Enable ) in process creation events will be enabled
. NOTES
. NOTES
Machine-wide
Machine-wide
@ -12205,6 +12371,7 @@ public static void PostMessage()
Set-MpPreference -EnableControlledFolderAccess Enabled
Set-MpPreference -EnableControlledFolderAccess Enabled
}
}
Write-Information -MessageData " " -InformationAction Continue
Write-Warning -Message $Localization . RestartWarning
Write-Warning -Message $Localization . RestartWarning
[ Windows . UI . Notifications . ToastNotificationManager , Windows . UI . Notifications , ContentType = WindowsRuntime ] | Out-Null
[ Windows . UI . Notifications . ToastNotificationManager , Windows . UI . Notifications , ContentType = WindowsRuntime ] | Out-Null
@ -12271,10 +12438,16 @@ function Errors
{
{
if ( $Global:Error )
if ( $Global:Error )
{
{
# Some errors may have the Windows nature and don't have a path to any of the module's files
$ErrorInFile = if ( $_ . InvocationInfo . PSCommandPath )
{
Split-Path -Path $_ . InvocationInfo . PSCommandPath -Leaf
}
( $Global:Error | ForEach-Object -Process {
( $Global:Error | ForEach-Object -Process {
[PSCustomObject] @ {
[PSCustomObject] @ {
$Localization . ErrorsLine = $_ . InvocationInfo . ScriptLineNumber
$Localization . ErrorsLine = $_ . InvocationInfo . ScriptLineNumber
$Localization . ErrorsFile = Split-Path -Path $PSCommandPath -Leaf
$Localization . ErrorsFile = $ErrorInFile
$Localization . ErrorsMessage = $_ . Exception . Message
$Localization . ErrorsMessage = $_ . Exception . Message
}
}
} | Sort-Object -Property Line | Format-Table -AutoSize -Wrap | Out-String ) . Trim ( )
} | Sort-Object -Property Line | Format-Table -AutoSize -Wrap | Out-String ) . Trim ( )