@ -2,9 +2,11 @@
. SYNOPSIS
" Windows 10 Sophia Script " is a PowerShell module for Windows 10 fine-tuning and automating the routine tasks
Version : v5 . 10
Date : 08 . 04 . 2021
Copyright ( c ) 2015 – 2021 farag & oZ-Zo
Version : v5 . 10 . 1
Date : 14 . 04 . 2021
Copyright ( c ) 2014 – 2021 farag
Copyright ( c ) 2019 – 2021 farag & oZ-Zo
Thanks to all https : / / forum . ru-board . com members involved
@ -13,7 +15,7 @@
. NOTES
Supported Windows 10 versions
Versions : 2004 ( 20H1 ) / 20H2 ( 2009 ) / 21H1
Versions : 2004 / 20H2 / 21H1
Builds : 19041 / 19042 / 19043
Editions : Home / Pro / Enterprise
Architecture : x64
@ -161,13 +163,13 @@ function CreateRestorePoint
#region Privacy & Telemetry
<#
. SYNOPSIS
Configure the DiagTrack service , firewall rule for Unified Telemetry Client Outbound Traffic and block connection
Configure the DiagTrack service , and connection for the Unified Telemetry Client Outbound Traffic
. PARAMETER Disable
Disable the DiagTrack service , firewall rule for Unified Telemetry Client Outbound Traffic and block connection
Disable the DiagTrack service , and block connection for the Unified Telemetry Client Outbound Traffic
. PARAMETER Enable
Enable the DiagTrack service , firewall rule for Unified Telemetry Client Outbound Traffic and allow connection
Enable the DiagTrack service , and allow connection for the Unified Telemetry Client Outbound Traffic
. EXAMPLE
DiagTrackService -Disable
@ -204,7 +206,7 @@ function DiagTrackService
Get-Service -Name DiagTrack | Set-Service -StartupType Automatic
Get-Service -Name DiagTrack | Start-Service
# Enable firewall rule for Unified Telemetry Client Outbound Traffic and allow connection
# Allow connection for the Unified Telemetry Client Outbound Traffic
Get-NetFirewallRule -Group DiagTrack | Set-NetFirewallRule -Enabled True -Action Allow
}
" Disable "
@ -212,7 +214,7 @@ function DiagTrackService
Get-Service -Name DiagTrack | Stop-Service -Force
Get-Service -Name DiagTrack | Set-Service -StartupType Disabled
# Disable firewall rule for Unified Telemetry Client Outbound Traffic and block connection
# Block connection for the Unified Telemetry Client Outbound Traffic
Get-NetFirewallRule -Group DiagTrack | Set-NetFirewallRule -Enabled False -Action Block
}
}
@ -1522,7 +1524,7 @@ function MergeConflicts
Open File Explorer to " This PC "
. PARAMETER QuickAccess
Open File Explorer to " Quick access "
Open File Explorer to Quick access
. EXAMPLE
OpenFileExplorerTo -ThisPC
@ -1881,13 +1883,13 @@ function SnapAssist
<#
. SYNOPSIS
Configure the file transfer dialog box
Configure the file transfer dialog box mode
. PARAMETER Detailed
Always open the file transfer dialog box in the detailed mode
Show the file transfer dialog box in the detailed mode
. PARAMETER Compact
Always open the file transfer dialog box in the compact mode
Show the file transfer dialog box in the compact mode
. EXAMPLE
FileTransferDialog -Detailed
@ -1999,13 +2001,13 @@ function FileExplorerRibbon
<#
. SYNOPSIS
Configure the recycle bin files delete confirmation
Configure the recycle bin files delete confirmation dialog
. PARAMETER Disable
Display / do not display the recycle bin files delete confirmation
Display / do not display the recycle bin files delete confirmation dialog
. PARAMETER Enable
Display / do not display the recycle bin files delete confirmation
Display / do not display the recycle bin files delete confirmation dialog
. EXAMPLE
RecycleBinDeleteConfirmation -Disable
@ -2081,13 +2083,13 @@ public static void PostMessage()
<#
. SYNOPSIS
Configure the " 3D Objects " folder in " This PC " and " Quick access "
Configure the " 3D Objects " folder in " This PC " and Quick access
. PARAMETER Show
Show the " 3D Objects " folder in " This PC " and " Quick access "
Show the " 3D Objects " folder in " This PC " and Quick access
. PARAMETER Hide
Hide the " 3D Objects " folder in " This PC " and " Quick access "
Hide the " 3D Objects " folder in " This PC " and Quick access
. EXAMPLE
3DObjects -Show
@ -2154,13 +2156,13 @@ function 3DObjects
<#
. SYNOPSIS
Configure frequently used folders in " Quick access "
Configure frequently used folders in Quick access
. PARAMETER Show
Show frequently used folders in " Quick access "
Show frequently used folders in Quick access
. PARAMETER Hide
Hide frequently used folders in " Quick access "
Hide frequently used folders in Quick access
. EXAMPLE
QuickAccessFrequentFolders -Show
@ -2324,13 +2326,13 @@ function TaskbarSearch
<#
. SYNOPSIS
Configure the " Windows Ink Workspace " button on the taskbar
Configure the Windows Ink Workspace button on the taskbar
. PARAMETER Show
Show the " Windows Ink Workspace " button on the taskbar
Show the Windows Ink Workspace button on the taskbar
. PARAMETER Hide
Hide the " Windows Ink Workspace " button on the taskbar
Hide the Windows Ink Workspace button on the taskbar
. EXAMPLE
WindowsInkWorkspace -Show
@ -2689,10 +2691,10 @@ function WindowsColorScheme
Configure the default app mode color scheme
. PARAMETER Light
Set the default app mode color scheme to the light
Set the app mode color scheme to the light
. PARAMETER Dark
Set the default app mode color scheme to the dark
Set the app mode color scheme to the dark
. EXAMPLE
AppMode -Light
@ -7766,25 +7768,24 @@ function PinToStart
$UnpinAll ,
[ Parameter (
Mandatory = $tru e ,
Mandatory = $fals e ,
Position = 1
) ]
[ ValidateSet ( " ControlPanel " , " DevicesPrinters " , " PowerShell " ) ]
[string[]]
$Tiles ,
[string]
$StartLayout = " $ PSScriptRoot\StartLayout.xml "
$Tiles
)
begin
{
$Script:StartLayout = " $ PSScriptRoot\StartLayout.xml "
# Unpin all the Start tiles
if ( $UnpinAll )
{
Export-StartLayout -Path $StartLayout -UseDesktopApplicationID
Export-StartLayout -Path $Script:S tartLayout -UseDesktopApplicationID
[xml] $XML = Get-Content -Path $StartLayout -Encoding UTF8 -Force
[xml] $XML = Get-Content -Path $Script:S tartLayout -Encoding UTF8 -Force
$Groups = $XML . LayoutModificationTemplate . DefaultLayoutOverride . StartLayoutCollection . StartLayout . Group
foreach ( $Group in $Groups )
@ -7793,7 +7794,7 @@ function PinToStart
$Group . ParentNode . RemoveChild ( $Group ) | Out-Null
}
$XML . Save ( $StartLayout )
$XML . Save ( $Script:S tartLayout )
}
}
@ -7828,8 +7829,22 @@ public static string GetString(uint strId)
# Extract the localized "Devices and Printers" string from shell32.dll
$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
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
$Shell = New-Object -ComObject Wscript . Shell
$Shortcut = $Shell . CreateShortcut ( " $ env:APPDATA\Microsoft\Windows\Start menu\Programs\System Tools\ $ DevicesPrinters.lnk " )
$Shortcut . TargetPath = " control "
$Shortcut . Arguments = " printers "
$Shortcut . IconLocation = " $ env:SystemRoot\system32\DeviceCenter.dll "
$Shortcut . Save ( )
Start-Sleep -Seconds 3
}
# Get the AppID because it's auto generated AppID for the "Devices and Printers" shortcut
$Script:DevicesPrintersAppID = ( Get-StartApps | Where-Object -FilterScript { $_ . Name -eq $DevicesPrinters } ) . AppID
$DevicesPrintersAppID = ( Get-StartApps | Where-Object -FilterScript { $_ . Name -eq $DevicesPrinters } ) . AppID
$Parameters = @ (
# Control Panel hash table
@ -7848,7 +7863,7 @@ public static string GetString(uint strId)
Size = " 2x2 "
Column = 2
Row = 0
AppID = $Script: DevicesPrintersAppID
AppID = $DevicesPrintersAppID
} ,
# Windows PowerShell hash table
@ {
@ -7893,13 +7908,13 @@ public static string GetString(uint strId)
$Table
}
if ( -not ( Test-Path -Path $StartLayout ) )
if ( -not ( Test-Path -Path $Script:S tartLayout ) )
{
# Export the current Start layout
Export-StartLayout -Path $StartLayout -UseDesktopApplicationID
Export-StartLayout -Path $Script:S tartLayout -UseDesktopApplicationID
}
[xml] $XML = Get-Content -Path $StartLayout -Encoding UTF8 -Force
[xml] $XML = Get-Content -Path $Script:S tartLayout -Encoding UTF8 -Force
foreach ( $Tile in $Tiles )
{
@ -7913,16 +7928,6 @@ public static string GetString(uint strId)
DevicesPrinters
{
Write-Verbose -Message ( $Localization . ShortcutPinning -f $DevicesPrinters ) -Verbose
# Create the old-style "Devices and Printers" shortcut in the Start menu
$Shell = New-Object -ComObject Wscript . Shell
$Shortcut = $Shell . CreateShortcut ( " $ env:APPDATA\Microsoft\Windows\Start menu\Programs\System Tools\ $ DevicesPrinters.lnk " )
$Shortcut . TargetPath = " control "
$Shortcut . Arguments = " printers "
$Shortcut . IconLocation = " $ env:SystemRoot\system32\DeviceCenter.dll "
$Shortcut . Save ( )
Start-Sleep -Seconds 3
}
PowerShell
{
@ -7962,7 +7967,7 @@ public static string GetString(uint strId)
}
}
$XML . Save ( $StartLayout )
$XML . Save ( $Script:S tartLayout )
}
end
@ -7973,7 +7978,7 @@ public static string GetString(uint strId)
New-Item -Path HKCU : \ SOFTWARE \ Policies \ Microsoft \ Windows \ Explorer -Force
}
New-ItemProperty -Path HKCU : \ SOFTWARE \ Policies \ Microsoft \ Windows \ Explorer -Name LockedStartLayout -Value 1 -Force
New-ItemProperty -Path HKCU : \ SOFTWARE \ Policies \ Microsoft \ Windows \ Explorer -Name StartLayoutFile -Value $StartLayout -Force
New-ItemProperty -Path HKCU : \ SOFTWARE \ Policies \ Microsoft \ Windows \ Explorer -Name StartLayoutFile -Value $Script:S tartLayout -Force
Start-Sleep -Seconds 3
@ -7992,7 +7997,7 @@ public static string GetString(uint strId)
Remove-ItemProperty -Path HKCU : \ SOFTWARE \ Policies \ Microsoft \ Windows \ Explorer -Name LockedStartLayout -Force -ErrorAction Ignore
Remove-ItemProperty -Path HKCU : \ SOFTWARE \ Policies \ Microsoft \ Windows \ Explorer -Name StartLayoutFile -Force -ErrorAction Ignore
Remove-Item -Path $StartLayout -Force
Remove-Item -Path $Script:S tartLayout -Force
Stop-Process -Name StartMenuExperienceHost -Force -ErrorAction Ignore
@ -8129,7 +8134,7 @@ function UninstallUWPApps
xmlns = " http://schemas.microsoft.com/winfx/2006/xaml/presentation "
xmlns : x = " http://schemas.microsoft.com/winfx/2006/xaml "
Name = " Window "
MinHeight = " 400 " MinWidth = " 410 "
MinHeight = " 400 " MinWidth = " 415 "
SizeToContent = " Width " WindowStartupLocation = " CenterScreen "
TextOptions . TextFormattingMode = " Display " SnapsToDevicePixels = " True "
FontFamily = " Candara " FontSize = " 16 " ShowInTaskbar = " True " >
@ -8418,7 +8423,7 @@ function UninstallUWPApps
RestoreUWPAppsUWPApps
. NOTES
UWP apps can be restored only if they were uninstalled only for the current user
UWP apps can be restored only if they were uninstalled for the current user
. NOTES
A pop-up dialog box enables the user to select packages
@ -8513,7 +8518,7 @@ function RestoreUWPApps
#region Functions
function Get-AppxManifest
{
Write-Verbose -Message " Patient " -Verbose
Write-Verbose -Message $Localization . Patient -Verbose
# Тут нельзя напрямую вписать -PackageTypeFilter Bundle, так как иначе не выдается нужное свойство InstallLocation. Только сравнивать с $Bundles
$Bundles = ( Get-AppXPackage -PackageTypeFilter Bundle -AllUsers ) . Name