@ -2,8 +2,8 @@
. SYNOPSIS
" Windows 10 Sophia Script " is a PowerShell module for Windows 10 fine-tuning and automating the routine tasks
Version : v5 . 10 . 7
Date : 13 . 06 . 2021
Version : v5 . 10 . 8
Date : 20 . 06 . 2021
Copyright ( c ) 2014 – 2021 farag
Copyright ( c ) 2019 – 2021 farag & Inestic
@ -460,7 +460,7 @@ function WindowsFeedback
ScheduledTasks -Enable
. NOTES
A pop-up dialog box enables the user to select tasks
A pop-up dialog box lets a user select tasks
Current user
#>
function ScheduledTasks
@ -2386,7 +2386,7 @@ function TaskbarSearch
[ Parameter (
Mandatory = $true ,
ParameterSetName = " Show Icon "
ParameterSetName = " Searc hIcon "
) ]
[switch]
$SearchIcon ,
@ -2644,7 +2644,19 @@ function NewsInterests
<#
. SYNOPSIS
Unpin " Microsoft Edge " and " Microsoft Store " from the taskbar
Unpin shortcuts from the taskbar
. PARAMETER Edge
Unpin the " Microsoft Edge " shortcut from the taskbar
. PARAMETER Store
Unpin the " Microsoft Store " shortcut from the taskbar
. PARAMETER Mail
Unpin the " Mail " shortcut from the taskbar
. EXAMPLE
UnpinTaskbarShortcuts -Shortcuts Edge , Store , Mail
. NOTES
Current user
@ -2652,8 +2664,17 @@ function NewsInterests
. LINK
https : / / github . com / Disassembler0 / Win10-Initial -Setup -Script / issues / 8 #issue-227159084
#>
function UnpinTaskbarEdgeStore
function UnpinTaskbarShortcuts
{
[ CmdletBinding ( ) ]
param
(
[ Parameter ( Mandatory = $true ) ]
[ ValidateSet ( " Edge " , " Store " , " Mail " ) ]
[string[]]
$Shortcuts
)
# Extract strings from shell32.dll using its' number
$Signature = @ {
Namespace = " WinAPI "
@ -2683,20 +2704,39 @@ public static string GetString(uint strId)
# Extract the localized "Unpin from taskbar" string from shell32.dll
$LocalizedString = [WinAPI.GetStr] :: GetString ( 5387 )
# Call the shortcut context menu item to unpin Microsoft Edge
if ( Test-Path -Path " $ env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Edge.lnk " )
foreach ( $Shortcut in $Shortcuts )
{
$Shell = New-Object -ComObject Shell . Application
$Folder = $Shell . NameSpace ( " $ env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar " )
$Shortcut = $Folder . ParseName ( " Microsoft Edge.lnk " )
$Shortcut . Verbs ( ) | Where-Object -FilterScript { $_ . Name -eq $LocalizedString } | ForEach-Object -Process { $_ . DoIt ( ) }
switch ( $Shortcut )
{
Edge
{
if ( Test-Path -Path " $ env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Edge.lnk " )
{
# Call the shortcut context menu item
$Shell = New-Object -ComObject Shell . Application
$Folder = $Shell . NameSpace ( " $ env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar " )
$Shortcut = $Folder . ParseName ( " Microsoft Edge.lnk " )
$Shortcut . Verbs ( ) | Where-Object -FilterScript { $_ . Name -eq $LocalizedString } | ForEach-Object -Process { $_ . DoIt ( ) }
}
}
Store
{
# 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 -ScriptBlock {
$Apps = ( New-Object -ComObject Shell . Application ) . NameSpace ( " shell:::{4234d49b-0245-4df3-b780-3893943456e1} " ) . Items ( )
( $Apps | Where-Object -FilterScript { $_ . Name -eq " Microsoft Store " } ) . Verbs ( ) | Where-Object -FilterScript { $_ . Name -eq $Using : LocalizedString } | ForEach-Object -Process { $_ . DoIt ( ) }
} | Receive-Job -Wait -AutoRemoveJob
}
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 -ScriptBlock {
$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 ( ) }
} | Receive-Job -Wait -AutoRemoveJob
}
}
}
# 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 -ScriptBlock {
$Apps = ( New-Object -ComObject Shell . Application ) . NameSpace ( " shell:::{4234d49b-0245-4df3-b780-3893943456e1} " ) . Items ( )
( $Apps | Where-Object -FilterScript { $_ . Name -eq " Microsoft Store " } ) . Verbs ( ) | Where-Object -FilterScript { $_ . Name -eq $Using : LocalizedString } | ForEach-Object -Process { $_ . DoIt ( ) }
} | Receive-Job -Wait -AutoRemoveJob
}
<#
@ -3345,6 +3385,9 @@ function AppsLanguageSwitch
. EXAMPLE
OneDrive -Install
. NOTES
The OneDrive user folder won ' t be removed
. NOTES
Machine-wide
#>
@ -3391,9 +3434,16 @@ function OneDrive
Start-Process -FilePath $OneDriveSetup [ 0 ] -ArgumentList $OneDriveSetup [ 1 . . 2 ] -Wait
}
# Getting the OneDrive user folder path and removing it
# Get the OneDrive user folder path and remove it if it doesn't contain any user filesS
$OneDriveUserFolder = Get-ItemPropertyValue -Path HKCU : \ Environment -Name OneDrive
Remove-Item -Path $OneDriveUserFolder -Recurse -Force -ErrorAction Ignore
if ( ( Get-ChildItem -Path $OneDriveUserFolder -Force -ErrorAction Ignore | Measure-Object ) . Count -eq 0 )
{
Remove-Item -Path $OneDriveUserFolder -Recurse -Force -ErrorAction Ignore
}
else
{
Invoke-Item -Path $OneDriveUserFolder
}
# https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefileexa
# The system does not move the file until the operating system is restarted
@ -4474,7 +4524,7 @@ function WindowsManageDefaultPrinter
WindowsFeatures -Enable
. NOTES
A pop-up dialog box enables the user to select features
A pop-up dialog box lets a user select features
Current user
#>
function WindowsFeatures
@ -4525,9 +4575,9 @@ function WindowsFeatures
[string[]] $UncheckedFeatures = @ (
<#
Media Features
Компоненты работы с мультимедиа
If you want to leave " Multimedia settings " in the advanced settings of Power Options do not disable this feature
Компоненты работы с мультимедиа
Если вы хотите оставить параметр " Параметры мультимедиа " в дополнительных параметрах электропитания , не отключайте этот компонент
#>
" MediaPlayback "
@ -4797,7 +4847,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
WindowsCapabilities -Install
. NOTES
A pop-up dialog box enables the user to select features
A pop-up dialog box lets a user select features
Current user
#>
function WindowsCapabilities
@ -5223,25 +5273,25 @@ function UpdateMicrosoftProducts
<#
. SYNOPSIS
Configure the power management scheme
Configure a power plan
. PARAMETER High
Set the power management scheme on " High performance "
Set the power plan on " High performance "
. PARAMETER Balanced
Set the power management scheme on " Balanced "
Set the power plan on " Balanced "
. EXAMPLE
PowerManagementScheme -High
PowerPlan -High
. EXAMPLE
PowerManagementScheme -Balanced
PowerPlan -Balanced
. NOTES
Do not recommend turning " High performance " scheme o n on laptops
It isn ' t recommended to turn on the " High performance " power pla n on laptops
Current user
#>
function PowerManagementScheme
function PowerPlan
{
param
(
@ -8054,7 +8104,7 @@ function RunPowerShellShortcut
PinToStart -Tiles ControlPanel -UnpinAll
. NOTES
Separate arguments with comma
Separate arguments with a comma
Current user
#>
function PinToStart
@ -8330,7 +8380,7 @@ public static string GetString(uint strId)
UninstallUWPApps -ForAllUsers
. NOTES
A pop-up dialog box enables the user to select packages
A pop-up dialog box lets a user select packages
Current user
#>
function UninstallUWPApps
@ -8773,7 +8823,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
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
A pop-up dialog box lets a user select packages
Current user
#>
function RestoreUWPApps
@ -11128,7 +11178,7 @@ function CABInstallContext
" Add "
{
# Checking whether the File Explorer is associated with the .cab files
if ( -not ( ( Get-ItemProperty -Path HKCU : \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer \ FileExts \ . cab \ UserChoice -Name ProgId -ErrorAction Ignore ) -notmatch " cab " ) )
if ( -not ( ( Get-ItemPropertyValue -Path HKCU : \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer \ FileExts \ . cab \ UserChoice -Name ProgId ) -eq " CABFolder " ) )
{
# The "Install" context menu item won't be visible unless the File Explorer was assosiated with the .cab files
Set-Association -ProgramPath CABFolder -Extension . cab -Icon " %SystemRoot%\system32\cabview.dll,0 "