@ -2,8 +2,8 @@
. SYNOPSIS
. SYNOPSIS
" Windows 10 Sophia Script " ( LTSC version ) is a PowerShell module for Windows 10 fine-tuning and automating the routine tasks
" Windows 10 Sophia Script " ( LTSC version ) is a PowerShell module for Windows 10 fine-tuning and automating the routine tasks
Version : v5 . 2 . 6
Version : v5 . 2 . 7
Date : 0 1. 06 . 2021
Date : 13 . 06 . 2021
Copyright ( c ) 2014 – 2021 farag
Copyright ( c ) 2014 – 2021 farag
Copyright ( c ) 2019 – 2021 farag & Inestic
Copyright ( c ) 2019 – 2021 farag & Inestic
@ -137,7 +137,7 @@ function Checkings
{
{
" 0 "
" 0 "
{
{
Invoke-Item -Path $PSScriptRoot \ Sophia . ps1
Invoke-Item -Path $PSScriptRoot \ . . \ Sophia . ps1
exit
exit
}
}
" 1 "
" 1 "
@ -2632,11 +2632,11 @@ function StorageSense
. SYNOPSIS
. SYNOPSIS
Configure Storage Sense running
Configure Storage Sense running
. PARAMETER Disable
. PARAMETER Month
Run Storage Sense every month / during low free disk space
Run Storage Sense every month
. PARAMETER Enable
. PARAMETER Default
Run Storage Sense every month / during low free disk space
Run Storage Sense during low free disk space
. EXAMPLE
. EXAMPLE
StorageSenseFrequency -Month
StorageSenseFrequency -Month
@ -4583,73 +4583,73 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
Add-Type @Signature
Add-Type @Signature
}
}
foreach ( $guid in $KnownFolders [ $KnownFolder ] )
foreach ( $GUID in $KnownFolders [ $KnownFolder ] )
{
{
[WinAPI.KnownFolders] :: SHSetKnownFolderPath ( [ref] $guid , 0 , 0 , $Path )
[WinAPI.KnownFolders] :: SHSetKnownFolderPath ( [ref] $GUID , 0 , 0 , $Path )
}
}
( Get-Item -Path $Path -Force ) . Attributes = " ReadOnly "
( Get-Item -Path $Path -Force ) . Attributes = " ReadOnly "
}
}
$UserShellFoldersRegName = @ {
$UserShellFoldersRegistry Names = @ {
" Desktop " = " Desktop "
" Desktop " = " Desktop "
" Documents " = " Personal "
" Documents " = " Personal "
" Downloads " = " {374DE290-123F-4565-9164-39C4925E467B} "
" Downloads " = " {374DE290-123F-4565-9164-39C4925E467B} "
" Music " = " My Music "
" Music " = " My Music "
" Pictures " = " My Pictures "
" Pictures " = " My Pictures "
" Videos " = " My Video "
" Videos " = " My Video "
}
}
$UserShellFoldersGUID = @ {
$UserShellFoldersGUIDs = @ {
" Desktop " = " {754AC886-DF64-4CBA-86B5-F7FBF4FBCEF5} "
" Desktop " = " {754AC886-DF64-4CBA-86B5-F7FBF4FBCEF5} "
" Documents " = " {F42EE2D3-909F-4907-8871-4C22FC0BF756} "
" Documents " = " {F42EE2D3-909F-4907-8871-4C22FC0BF756} "
" Downloads " = " {7D83EE9B-2244-4E70-B1F5-5393042AF1E4} "
" Downloads " = " {7D83EE9B-2244-4E70-B1F5-5393042AF1E4} "
" Music " = " {A0C69A99-21C8-4671-8703-7934162FCF1D} "
" Music " = " {A0C69A99-21C8-4671-8703-7934162FCF1D} "
" Pictures " = " {0DDD015D-B06C-45D5-8C4C-F59713854639} "
" Pictures " = " {0DDD015D-B06C-45D5-8C4C-F59713854639} "
" Videos " = " {35286A68-3C57-41A1-BBB1-0EAE73D76C95} "
" Videos " = " {35286A68-3C57-41A1-BBB1-0EAE73D76C95} "
}
}
# Contents of the hidden desktop.ini file for each type of user folders
# Contents of the hidden desktop.ini file for each type of user folders
$DesktopINI = @ {
$DesktopINI = @ {
" Desktop " = " " ,
" Desktop " = " " ,
" [.ShellClassInfo] " ,
" [.ShellClassInfo] " ,
" LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21769 " ,
" LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21769 " ,
" IconResource=%SystemRoot%\system32\imageres.dll,-183 "
" IconResource=%SystemRoot%\system32\imageres.dll,-183 "
" Documents " = " " ,
" Documents " = " " ,
" [.ShellClassInfo] " ,
" [.ShellClassInfo] " ,
" LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21770 " ,
" LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21770 " ,
" IconResource=%SystemRoot%\system32\imageres.dll,-112 " ,
" IconResource=%SystemRoot%\system32\imageres.dll,-112 " ,
" IconFile=%SystemRoot%\system32\shell32.dll " ,
" IconFile=%SystemRoot%\system32\shell32.dll " ,
" IconIndex=-235 "
" IconIndex=-235 "
" Downloads " = " " ,
" Downloads " = " " ,
" [.ShellClassInfo] " , " LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21798 " ,
" [.ShellClassInfo] " , " LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21798 " ,
" IconResource=%SystemRoot%\system32\imageres.dll,-184 "
" IconResource=%SystemRoot%\system32\imageres.dll,-184 "
" Music " = " " ,
" Music " = " " ,
" [.ShellClassInfo] " , " LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21790 " ,
" [.ShellClassInfo] " , " LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21790 " ,
" InfoTip=@%SystemRoot%\system32\shell32.dll,-12689 " ,
" InfoTip=@%SystemRoot%\system32\shell32.dll,-12689 " ,
" IconResource=%SystemRoot%\system32\imageres.dll,-108 " ,
" IconResource=%SystemRoot%\system32\imageres.dll,-108 " ,
" IconFile=%SystemRoot%\system32\shell32.dll " , " IconIndex=-237 "
" IconFile=%SystemRoot%\system32\shell32.dll " , " IconIndex=-237 "
" Pictures " = " " ,
" Pictures " = " " ,
" [.ShellClassInfo] " ,
" [.ShellClassInfo] " ,
" LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21779 " ,
" LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21779 " ,
" InfoTip=@%SystemRoot%\system32\shell32.dll,-12688 " ,
" InfoTip=@%SystemRoot%\system32\shell32.dll,-12688 " ,
" IconResource=%SystemRoot%\system32\imageres.dll,-113 " ,
" IconResource=%SystemRoot%\system32\imageres.dll,-113 " ,
" IconFile=%SystemRoot%\system32\shell32.dll " ,
" IconFile=%SystemRoot%\system32\shell32.dll " ,
" IconIndex=-236 "
" IconIndex=-236 "
" Videos " = " " ,
" Videos " = " " ,
" [.ShellClassInfo] " ,
" [.ShellClassInfo] " ,
" LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21791 " ,
" LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21791 " ,
" InfoTip=@%SystemRoot%\system32\shell32.dll,-12690 " ,
" InfoTip=@%SystemRoot%\system32\shell32.dll,-12690 " ,
" IconResource=%SystemRoot%\system32\imageres.dll,-189 " ,
" IconResource=%SystemRoot%\system32\imageres.dll,-189 " ,
" IconFile=%SystemRoot%\system32\shell32.dll " , " IconIndex=-238 "
" IconFile=%SystemRoot%\system32\shell32.dll " , " IconIndex=-238 "
}
}
# Determining the current user folder path
# Determining the current user folder path
$UserShellFolderRegValue = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name $UserShellFoldersRegName [ $UserFolder ]
$UserShellFolderRegistry Value = Get-ItemPropertyValue -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name $UserShellFoldersRegistry Names [ $UserFolder ]
if ( $UserShellFolderRegValue -ne $FolderPath )
if ( $UserShellFolderRegistry Value -ne $FolderPath )
{
{
if ( ( Get-ChildItem -Path $UserShellFolderRegValue | Measure-Object ) . Count -ne 0 )
if ( ( Get-ChildItem -Path $UserShellFolderRegistry Value | Measure-Object ) . Count -ne 0 )
{
{
Write-Error -Message ( $Localization . UserShellFolderNotEmpty -f $UserShellFolderRegValue ) -ErrorAction SilentlyContinue
Write-Error -Message ( $Localization . UserShellFolderNotEmpty -f $UserShellFolderRegistry Value ) -ErrorAction SilentlyContinue
}
}
# Creating a new folder if there is no one
# Creating a new folder if there is no one
@ -4661,11 +4661,11 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
# Removing old desktop.ini
# Removing old desktop.ini
if ( $RemoveDesktopINI . IsPresent )
if ( $RemoveDesktopINI . IsPresent )
{
{
Remove-Item -Path " $ UserShellFolderRegValue\desktop.ini " -Force
Remove-Item -Path " $ UserShellFolderRegistry Value\desktop.ini " -Force
}
}
KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath
KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath
New-ItemProperty -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name $UserShellFoldersGUID [ $UserFolder ] -PropertyType ExpandString -Value $FolderPath -Force
New-ItemProperty -Path " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders " -Name $UserShellFoldersGUIDs [ $UserFolder ] -PropertyType ExpandString -Value $FolderPath -Force
# Save desktop.ini in the UTF-16 LE encoding
# Save desktop.ini in the UTF-16 LE encoding
Set-Content -Path " $ FolderPath\desktop.ini " -Value $DesktopINI [ $UserFolder ] -Encoding Unicode -Force
Set-Content -Path " $ FolderPath\desktop.ini " -Value $DesktopINI [ $UserFolder ] -Encoding Unicode -Force
@ -4958,9 +4958,9 @@ public static string GetString(uint strId)
$Title = " "
$Title = " "
$Message = $Localization . UserFolderSelect -f $DesktopLocalizedString
$Message = $Localization . UserFolderSelect -f $DesktopLocalizedString
$Select = $Localization . Select
$Select = $Localization . Browse
$Skip = $Localization . Skip
$Skip = $Localization . Skip
$Options = " & $ Select " , " & $ Skip "
$Options = " & $ Browse " , " & $ Skip "
$DefaultChoice = 1
$DefaultChoice = 1
$Result = $Host . UI . PromptForChoice ( $Title , $Message , $Options , $DefaultChoice )
$Result = $Host . UI . PromptForChoice ( $Title , $Message , $Options , $DefaultChoice )
@ -4994,9 +4994,9 @@ public static string GetString(uint strId)
$Title = " "
$Title = " "
$Message = $Localization . UserFolderSelect -f $DocumentsLocalizedString
$Message = $Localization . UserFolderSelect -f $DocumentsLocalizedString
$Select = $Localization . Select
$Select = $Localization . Browse
$Skip = $Localization . Skip
$Skip = $Localization . Skip
$Options = " & $ Select " , " & $ Skip "
$Options = " & $ Browse " , " & $ Skip "
$DefaultChoice = 1
$DefaultChoice = 1
$Result = $Host . UI . PromptForChoice ( $Title , $Message , $Options , $DefaultChoice )
$Result = $Host . UI . PromptForChoice ( $Title , $Message , $Options , $DefaultChoice )
@ -5030,9 +5030,9 @@ public static string GetString(uint strId)
$Title = " "
$Title = " "
$Message = $Localization . UserFolderSelect -f $DownloadsLocalizedString
$Message = $Localization . UserFolderSelect -f $DownloadsLocalizedString
$Select = $Localization . Select
$Select = $Localization . Browse
$Skip = $Localization . Skip
$Skip = $Localization . Skip
$Options = " & $ Select " , " & $ Skip "
$Options = " & $ Browse " , " & $ Skip "
$DefaultChoice = 1
$DefaultChoice = 1
$Result = $Host . UI . PromptForChoice ( $Title , $Message , $Options , $DefaultChoice )
$Result = $Host . UI . PromptForChoice ( $Title , $Message , $Options , $DefaultChoice )
@ -5066,9 +5066,9 @@ public static string GetString(uint strId)
$Title = " "
$Title = " "
$Message = $Localization . UserFolderSelect -f $MusicLocalizedString
$Message = $Localization . UserFolderSelect -f $MusicLocalizedString
$Select = $Localization . Select
$Select = $Localization . Browse
$Skip = $Localization . Skip
$Skip = $Localization . Skip
$Options = " & $ Select " , " & $ Skip "
$Options = " & $ Browse " , " & $ Skip "
$DefaultChoice = 1
$DefaultChoice = 1
$Result = $Host . UI . PromptForChoice ( $Title , $Message , $Options , $DefaultChoice )
$Result = $Host . UI . PromptForChoice ( $Title , $Message , $Options , $DefaultChoice )
@ -5102,9 +5102,9 @@ public static string GetString(uint strId)
$Title = " "
$Title = " "
$Message = $Localization . UserFolderSelect -f $PicturesLocalizedString
$Message = $Localization . UserFolderSelect -f $PicturesLocalizedString
$Select = $Localization . Select
$Select = $Localization . Browse
$Skip = $Localization . Skip
$Skip = $Localization . Skip
$Options = " & $ Select " , " & $ Skip "
$Options = " & $ Browse " , " & $ Skip "
$DefaultChoice = 1
$DefaultChoice = 1
$Result = $Host . UI . PromptForChoice ( $Title , $Message , $Options , $DefaultChoice )
$Result = $Host . UI . PromptForChoice ( $Title , $Message , $Options , $DefaultChoice )
@ -5138,9 +5138,9 @@ public static string GetString(uint strId)
$Title = " "
$Title = " "
$Message = $Localization . UserFolderSelect -f $VideosLocalizedString
$Message = $Localization . UserFolderSelect -f $VideosLocalizedString
$Select = $Localization . Select
$Select = $Localization . Browse
$Skip = $Localization . Skip
$Skip = $Localization . Skip
$Options = " & $ Select " , " & $ Skip "
$Options = " & $ Browse " , " & $ Skip "
$DefaultChoice = 1
$DefaultChoice = 1
$Result = $Host . UI . PromptForChoice ( $Title , $Message , $Options , $DefaultChoice )
$Result = $Host . UI . PromptForChoice ( $Title , $Message , $Options , $DefaultChoice )