@ -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 . 2 . 12
Version : v5 . 2 . 13
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
@ -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 /
@ -107,7 +107,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
}
}
@ -132,19 +132,11 @@ function Checkings
# Check if the current module version is the latest one
# Check if the current module version is the latest one
try
try
{
{
$DownloadsFolder = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name " {374DE290-123F-4565-9164-39C4925E467B} "
[Net.ServicePointManager] :: SecurityProtocol = [Net.SecurityProtocolType] :: Tls12
$Parameters = @ {
Uri = " https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/Sophia/LTSC/Manifest/Sophia.psd1 "
OutFile = " $ DownloadsFolder\Manifest.psd1 "
Verbose = [switch] :: Present
}
Invoke-WebRequest @Parameters
$LatestRelease = ( Import-PowerShellDataFile -Path $DownloadsFolder \ Manifest . psd1 ) . ModuleVersion
# 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_LTSC
$CurrentRelease = ( Get-Module -Name Sophia ) . Version . ToString ( )
$CurrentRelease = ( Get-Module -Name Sophia ) . Version . ToString ( )
Remove-Item -Path $DownloadsFolder \ Manifest . psd1 -Force
switch ( [System.Version] $LatestRelease -gt [System.Version] $CurrentRelease )
switch ( [System.Version] $LatestRelease -gt [System.Version] $CurrentRelease )
{
{
$true
$true
@ -695,6 +687,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 ( )
@ -705,6 +698,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 ( )
@ -769,6 +763,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
@ -3614,6 +3609,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 ( )
@ -3624,6 +3620,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 ( )
@ -4785,6 +4782,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 "
@ -4810,18 +4808,20 @@ public static string GetString(uint strId)
Add-Type @Signature -Using System . Text
Add-Type @Signature -Using System . Text
}
}
$DesktopLocalizedString = [WinAPI.GetStr] :: GetString ( 21769 )
# The localized user folders names
$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 )
$MusicLocalizedString = [WinAPI.GetStr] :: GetString ( 21790 )
$MusicLocalizedString = [WinAPI.GetStr] :: GetString ( 21790 )
$PicturesLocalizedString = [WinAPI.GetStr] :: GetString ( 21779 )
$PicturesLocalizedString = [WinAPI.GetStr] :: GetString ( 21779 )
$VideosLocalizedString = [WinAPI.GetStr] :: GetString ( 21791 )
$VideosLocalizedString = [WinAPI.GetStr] :: GetString ( 21791 )
switch ( $PSCmdlet . ParameterSetName )
switch ( $PSCmdlet . ParameterSetName )
{
{
" 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 )
@ -4838,8 +4838,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
@ -4858,13 +4866,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
@ -4883,13 +4900,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
@ -4908,13 +4934,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
@ -4933,13 +4968,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
@ -4958,13 +5001,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
@ -4983,14 +5035,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
@ -5021,12 +5081,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
@ -5057,12 +5125,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
@ -5093,12 +5169,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
@ -5129,12 +5213,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
@ -5165,12 +5257,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
@ -5201,14 +5301,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
@ -5226,12 +5334,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
@ -5249,12 +5365,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
@ -5272,12 +5396,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
@ -5295,12 +5427,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
@ -5318,12 +5458,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
@ -5341,6 +5489,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
}
}
}
}
}
}
@ -6795,7 +6944,6 @@ function SetAppGraphicsPerformance
. 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
@ -7056,8 +7204,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
@ -7162,7 +7309,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
@ -7543,7 +7690,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
@ -7555,7 +7702,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
@ -8942,6 +9089,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
@ -9008,10 +9156,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 ( )