diff --git a/Sophia/PowerShell 5.1/Sophia.ps1 b/Sophia/PowerShell 5.1/Sophia.ps1 index bf9ca39c..bf73315e 100644 --- a/Sophia/PowerShell 5.1/Sophia.ps1 +++ b/Sophia/PowerShell 5.1/Sophia.ps1 @@ -2,17 +2,16 @@ .SYNOPSIS Default preset file for "Windows 10 Sophia Script" - Version: v5.8 - Date: 17.03.2021 + Version: v5.9 + Date: 27.03.2021 Copyright (c) 2015–2021 farag & oZ-Zo - https://github.com/farag2 - https://github.com/oz-zo - Thanks to all https://forum.ru-board.com members involved .DESCRIPTION Read carefully and configure the preset file before running + Comment out function with the "#" char if you don't want it to be run + Uncomment function by removing the "#" char if you want it to be run Every tweak in the preset file has its' corresponding function to restore the default settings Running the script is best done on a fresh install because running it on wrong tweaked system may result in errors occurring @@ -23,12 +22,6 @@ .EXAMPLE .\Sophia.ps1 -Functions "DiagTrackService -Disable", "DiagnosticDataLevel -Minimal", UninstallUWPApps - .NOTES - https://forum.ru-board.com/topic.cgi?forum=62&topic=30617#15 - https://habr.com/post/521202/ - https://forums.mydigitallife.net/threads/powershell-windows-10-sophia-script.81675/ - https://www.reddit.com/r/PowerShell/comments/go2n5v/powershell_script_setup_windows_10/ - .NOTES Supported Windows 10 versions Versions: 2004 (20H1)/20H2 (2009) @@ -40,6 +33,20 @@ Set execution policy to be able to run scripts only in the current PowerShell session: Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force + .NOTES + https://forum.ru-board.com/topic.cgi?forum=62&topic=30617#15 + https://habr.com/post/521202/ + https://forums.mydigitallife.net/threads/powershell-windows-10-sophia-script.81675/ + https://www.reddit.com/r/PowerShell/comments/go2n5v/powershell_script_setup_windows_10/ + + .LINK + https://t.me/sophianews + https://t.me/sophia_chat + + .LINK + https://github.com/farag2 + https://github.com/Inestic + .LINK https://github.com/farag2/Windows-10-Sophia-Script #> @@ -57,7 +64,7 @@ param Clear-Host -$Host.UI.RawUI.WindowTitle = "Windows 10 Sophia Script v5.8 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & oz-zo, 2015–2021" +$Host.UI.RawUI.WindowTitle = "Windows 10 Sophia Script v5.9 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & oz-zo, 2015–2021" Remove-Module -Name Sophia -Force -ErrorAction Ignore Import-Module -Name $PSScriptRoot\Sophia.psd1 -PassThru -Force @@ -423,7 +430,7 @@ MeetNow -Hide # Отобразить иконку "Провести собрание" в трее # MeetNow -Show -# Unpin "Microsoft Edge" and "Microsoft Store" from the taskbar +# Unpin Microsoft Edge and Microsoft Store from the taskbar # Открепить Microsoft Edge и Microsoft Store от панели задач UnpinTaskbarEdgeStore @@ -671,14 +678,6 @@ UpdateMicrosoftProducts -Enable # При обновлении Windows не получать обновления для других продуктов Майкрософт (значение по умолчанию) # UpdateMicrosoftProducts -Disable -# Do not let UWP apps run in the background -# Не разрешать UWP-приложениям работать в фоновом режиме -BackgroundUWPApps -Disable - -# Let all UWP apps run in the background (default value) -# Разрешить всем UWP-приложениям работать в фоновом режиме (значение по умолчанию) -# BackgroundUWPApps -Enable - # Set the power management scheme on "High performance" if device is a desktop # Установить схему управления питанием на "Высокая производительность", если устройство является стационарным ПК PowerManagementScheme -High @@ -707,7 +706,7 @@ PCTurnOffDevice -Disable # Переопределить метод ввода по умолчанию: английский SetInputMethod -English -# Override for default input method: use langiage list (default value) +# Override for default input method: use language list (default value) # Переопределить метод ввода по умолчанию: использовать список языков (значение по умолчанию) # SetInputMethod -Default @@ -942,11 +941,9 @@ PinToStart -Tiles ControlPanel, DevicesPrinters, PowerShell <# Uninstall UWP apps using the pop-up dialog box If the "For All Users" is checked apps packages will not be installed for new users - The "For All Users" checkbox isn't checked by default Удалить UWP-приложения, используя всплывающее диалоговое окно Пакеты приложений не будут установлены для новых пользователей, если отмечена галочка "Для всех пользователей" - Галочка "Для всех пользователей" не отмечена по умолчанию #> UninstallUWPApps @@ -982,6 +979,14 @@ CortanaAutostart -Disable # Включить автозагрузку Кортана (значение по умолчанию) # CortanaAutostart -Enable +# Do not let UWP apps run in the background +# Не разрешать UWP-приложениям работать в фоновом режиме +BackgroundUWPApps -Disable + +# Let all UWP apps run in the background (default value) +# Разрешить всем UWP-приложениям работать в фоновом режиме (значение по умолчанию) +# BackgroundUWPApps -Enable + # Check for UWP apps updates # Проверить обновления UWP-приложений CheckUWPAppsUpdates @@ -1223,7 +1228,7 @@ SaveZoneInformation -Disable # Enable Windows Sandbox # Включить Windows Sandbox -WindowsSandbox -Enable +# WindowsSandbox -Enable # Disable Windows Sandbox (default value) # Выключить Windows Sandbox (значение по умолчанию) diff --git a/Sophia/PowerShell 5.1/Sophia.psd1 b/Sophia/PowerShell 5.1/Sophia.psd1 index 9f051fe4..1bbe4eb1 100644 Binary files a/Sophia/PowerShell 5.1/Sophia.psd1 and b/Sophia/PowerShell 5.1/Sophia.psd1 differ diff --git a/Sophia/PowerShell 5.1/Sophia.psm1 b/Sophia/PowerShell 5.1/Sophia.psm1 index 0a270ccb..6692033e 100644 --- a/Sophia/PowerShell 5.1/Sophia.psm1 +++ b/Sophia/PowerShell 5.1/Sophia.psm1 @@ -2,24 +2,15 @@ .SYNOPSIS "Windows 10 Sophia Script" is a PowerShell module for Windows 10 fine-tuning and automating the routine tasks - Version: v5.8 - Date: 17.03.2021 + Version: v5.9 + Date: 27.03.2021 Copyright (c) 2015–2021 farag & oZ-Zo - https://github.com/farag2 - https://github.com/oz-zo - Thanks to all https://forum.ru-board.com members involved .DESCRIPTION Running the script is best done on a fresh install because running it on wrong tweaked system may result in errors occurring - .NOTES - https://forum.ru-board.com/topic.cgi?forum=62&topic=30617#15 - https://habr.com/post/521202/ - https://forums.mydigitallife.net/threads/powershell-windows-10-sophia-script.81675/ - https://www.reddit.com/r/PowerShell/comments/go2n5v/powershell_script_setup_windows_10/ - .NOTES Supported Windows 10 versions Versions: 2004 (20H1)/20H2 (2009) @@ -31,6 +22,20 @@ Set execution policy to be able to run scripts only in the current PowerShell session: Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force + .NOTES + https://forum.ru-board.com/topic.cgi?forum=62&topic=30617#15 + https://habr.com/post/521202/ + https://forums.mydigitallife.net/threads/powershell-windows-10-sophia-script.81675/ + https://www.reddit.com/r/PowerShell/comments/go2n5v/powershell_script_setup_windows_10/ + + .LINK Telegram channel & group + https://t.me/sophianews + https://t.me/sophia_chat + + .LINK + https://github.com/farag2 + https://github.com/Inestic + .LINK https://github.com/farag2/Windows-10-Sophia-Script #> @@ -144,7 +149,7 @@ function CreateRestorePoint # Revert the System Restore checkpoint creation frequency to 1440 minutes New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -Name SystemRestorePointCreationFrequency -PropertyType DWord -Value 1440 -Force - # Turn off System Protection for the system drive if it was turned off without deleting existing restore points + # Turn off System Protection for the system drive if it was turned off before without deleting the existing restore points if ($ComputerRestorePoint) { Disable-ComputerRestore -Drive $env:SystemDrive @@ -2133,6 +2138,8 @@ function 3DObjects # In order for the changes to take effect the File Explorer process has to be restarted Stop-Process -Name explorer -Force + Start-Sleep -Seconds 3 + # Restoring closed folders foreach ($OpenedFolder in $OpenedFolders) { @@ -2476,6 +2483,8 @@ function MeetNow # In order for the changes to take effect the File Explorer process has to be restarted Stop-Process -Name explorer -Force + Start-Sleep -Seconds 3 + # Restoring closed folders foreach ($OpenedFolder in $OpenedFolders) { @@ -2490,30 +2499,28 @@ function MeetNow .SYNOPSIS Unpin "Microsoft Edge" and "Microsoft Store" from the taskbar - .LINK - https://github.com/Disassembler0/Win10-Initial-Setup-Script/issues/8#issue-227159084 - .NOTES Current user #> function UnpinTaskbarEdgeStore { + # https://github.com/Disassembler0/Win10-Initial-Setup-Script/issues/8#issue-227159084 $Signature = @{ Namespace = "WinAPI" Name = "GetStr" Language = "CSharp" MemberDefinition = @" - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - public static extern IntPtr GetModuleHandle(string lpModuleName); - [DllImport("user32.dll", CharSet = CharSet.Auto)] - internal static extern int LoadString(IntPtr hInstance, uint uID, StringBuilder lpBuffer, int nBufferMax); - public static string GetString(uint strId) - { - IntPtr intPtr = GetModuleHandle("shell32.dll"); - StringBuilder sb = new StringBuilder(255); - LoadString(intPtr, strId, sb, sb.Capacity); - return sb.ToString(); - } +[DllImport("kernel32.dll", CharSet = CharSet.Auto)] +public static extern IntPtr GetModuleHandle(string lpModuleName); +[DllImport("user32.dll", CharSet = CharSet.Auto)] +internal static extern int LoadString(IntPtr hInstance, uint uID, StringBuilder lpBuffer, int nBufferMax); +public static string GetString(uint strId) +{ + IntPtr intPtr = GetModuleHandle("shell32.dll"); + StringBuilder sb = new StringBuilder(255); + LoadString(intPtr, strId, sb, sb.Capacity); + return sb.ToString(); +} "@ } if (-not ("WinAPI.GetStr" -as [type])) @@ -2524,22 +2531,20 @@ function UnpinTaskbarEdgeStore # Extract the localized "Unpin from taskbar" string from shell32.dll $LocalizedString = [WinAPI.GetStr]::GetString(5387) - $Apps = (New-Object -ComObject Shell.Application).NameSpace("shell:::{4234d49b-0245-4df3-b780-3893943456e1}").Items() - - $VerbExists = $Apps | Where-Object -FilterScript {$_.Path -eq "MSEdge"} | ForEach-Object -Process {$_.Verbs() | Where-Object -FilterScript {$_.Name -eq $LocalizedString}} - if ($VerbExists) - { - $VerbExists | ForEach-Object -Process {$_.DoIt()} - } - else + # 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") { - Remove-Item -Path "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Edge.lnk" -ErrorAction Ignore - $VerbExists | ForEach-Object -Process {$_.DoIt()} + $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 {$_.Name -eq $LocalizedString} | ForEach-Object -Process {$_.DoIt()} } - $Apps | Where-Object -FilterScript {$_.Name -eq "Microsoft Store"} | ForEach-Object -Process { - $_.Verbs() | Where-Object -FilterScript {$_.Name -eq $LocalizedString} | ForEach-Object -Process {$_.DoIt()} - } + # 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 } <# @@ -3234,17 +3239,50 @@ function OneDrive Start-Process -FilePath $OneDriveSetup[0] -ArgumentList $OneDriveSetup[1..2] -Wait } - # Getting the OneDrive user folder path + # Getting the OneDrive user folder path and removing it $OneDriveUserFolder = Get-ItemPropertyValue -Path HKCU:\Environment -Name OneDrive - if ((Get-ChildItem -Path $OneDriveUserFolder | Measure-Object).Count -eq 0) - { - Remove-Item -Path $OneDriveUserFolder -Recurse -Force + Remove-Item -Path $OneDriveUserFolder -Recurse -Force -ErrorAction Ignore + + # 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 + # The system moves the file immediately after AUTOCHK is executed, but before creating any paging files + $Signature = @{ + Namespace = "WinAPI" + Name = "DeleteFiles" + Language = "CSharp" + MemberDefinition = @" +public enum MoveFileFlags +{ + MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004 +} + +[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] +static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName, MoveFileFlags dwFlags); + +public static bool MarkFileDelete (string sourcefile) +{ + return MoveFileEx(sourcefile, null, MoveFileFlags.MOVEFILE_DELAY_UNTIL_REBOOT); +} +"@ } - else + + # If there are some files or folders left in $env:LOCALAPPDATA\Temp + if ((Get-ChildItem -Path $OneDriveUserFolder -Force -ErrorAction Ignore | Measure-Object).Count -ne 0) { - Write-Error -Message ($Localization.OneDriveNotEmptyFolder -f $OneDriveUserFolder) -ErrorAction SilentlyContinue + if (-not ("WinAPI.DeleteFiles" -as [type])) + { + Add-Type @Signature + } - Invoke-Item -Path $OneDriveUserFolder + try + { + Remove-Item -Path $OneDriveUserFolder -Recurse -Force -ErrorAction Stop + } + catch + { + # If files are in use remove them at the next boot + Get-ChildItem -Path $OneDriveUserFolder -Recurse -Force | ForEach-Object -Process {[WinAPI.DeleteFiles]::MarkFileDelete($_.FullName)} + } } Remove-ItemProperty -Path HKCU:\Environment -Name OneDrive, OneDriveConsumer -Force -ErrorAction Ignore @@ -3273,12 +3311,21 @@ function OneDrive if (Test-Path -Path $FileSyncShell64dll) { - Write-Error -Message ($Localization.OneDriveFileSyncShell64dllBlocked -f $FileSyncShell64dll) -ErrorAction SilentlyContinue + if (-not ("WinAPI.DeleteFiles" -as [type])) + { + Add-Type @Signature + } + + # If files are in use remove them at the next boot + Get-ChildItem -Path $FileSyncShell64dll -Recurse -Force | ForEach-Object -Process {[WinAPI.DeleteFiles]::MarkFileDelete($_.FullName)} } } + Start-Sleep -Seconds 1 + # Restoring closed folders Start-Process -FilePath explorer + foreach ($OpenedFolder in $OpenedFolders) { if (Test-Path -Path $OpenedFolder) @@ -3669,70 +3716,101 @@ function TempFolder { "SystemDrive" { - # Restart the Printer Spooler service (Spooler) - Restart-Service -Name Spooler -Force + if ($env:TEMP -ne "$env:SystemDrive\Temp") + { + # Restart the Printer Spooler service (Spooler) + Restart-Service -Name Spooler -Force - # Stop OneDrive processes - Stop-Process -Name OneDrive -Force -ErrorAction Ignore - Stop-Process -Name FileCoAuth -Force -ErrorAction Ignore + # Stop OneDrive processes + Stop-Process -Name OneDrive -Force -ErrorAction Ignore + Stop-Process -Name FileCoAuth -Force -ErrorAction Ignore - if (-not (Test-Path -Path $env:SystemDrive\Temp)) - { - New-Item -Path $env:SystemDrive\Temp -ItemType Directory -Force - } + if (-not (Test-Path -Path $env:SystemDrive\Temp)) + { + New-Item -Path $env:SystemDrive\Temp -ItemType Directory -Force + } - Remove-Item -Path $env:SystemRoot\Temp -Recurse -Force -ErrorAction Ignore - Get-Item -Path $env:LOCALAPPDATA\Temp -Force -ErrorAction Ignore | Where-Object -FilterScript {$_.LinkType -ne "SymbolicLink"} | Remove-Item -Recurse -Force -ErrorAction Ignore + # Cleaning up folders + Remove-Item -Path $env:SystemRoot\Temp -Recurse -Force -ErrorAction Ignore + Get-Item -Path $env:TEMP -Force -ErrorAction Ignore | Where-Object -FilterScript {$_.LinkType -ne "SymbolicLink"} | Remove-Item -Recurse -Force -ErrorAction Ignore - if (Test-Path -Path $env:LOCALAPPDATA\Temp -ErrorAction Ignore) - { - if ((Get-ChildItem -Path $env:LOCALAPPDATA\Temp -Force -ErrorAction Ignore | Measure-Object).Count -ne 0) + if (-not (Test-Path -Path $env:LOCALAPPDATA\Temp)) { - Invoke-Item -Path $env:LOCALAPPDATA\Temp + New-Item -Path $env:LOCALAPPDATA\Temp -ItemType Directory -Force + } - do + # If there are some files or folders left in $env:LOCALAPPDATA\Temp + if ((Get-ChildItem -Path $env:TEMP -Force -ErrorAction Ignore | Measure-Object).Count -ne 0) + { + # 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 + # The system moves the file immediately after AUTOCHK is executed, but before creating any paging files + $Signature = @{ + Namespace = "WinAPI" + Name = "DeleteFiles" + Language = "CSharp" + MemberDefinition = @" +public enum MoveFileFlags +{ + MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004 +} + +[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] +static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName, MoveFileFlags dwFlags); + +public static bool MarkFileDelete (string sourcefile) +{ + return MoveFileEx(sourcefile, null, MoveFileFlags.MOVEFILE_DELAY_UNTIL_REBOOT); +} +"@ + } + + if (-not ("WinAPI.DeleteFiles" -as [type])) { - $Title = "" - $Message = $Localization.ClearFolder -f "$env:LOCALAPPDATA\Temp" - $Delete = $Localization.Delete - $Skip = $Localization.Skip - $Options = "&$Delete", "&$Skip" - $DefaultChoice = 0 - - $Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice) - switch ($Result) - { - "0" - { - # Create a symbolic link to the %SystemDrive%\Temp folder - try - { - Get-Item -Path $env:LOCALAPPDATA\Temp -Force | Where-Object -FilterScript {$_.LinkType -ne "SymbolicLink"} | Remove-Item -Recurse -Force -ErrorAction Ignore - New-Item -Path $env:LOCALAPPDATA\Temp -ItemType SymbolicLink -Value $env:SystemDrive\Temp -Force -ErrorAction SilentlyContinue - } - catch [System.Exception] - { - Write-Verbose -Message $Localization.FilesBlocked -Verbose - Write-Verbose -Message ((Get-ChildItem -Path $env:LOCALAPPDATA\Temp -Force).FullName | Out-String) -Verbose - } - } - "1" - { - Write-Verbose -Message $Localization.SymbolicSkipped -Verbose - } - } + Add-Type @Signature + } + + try + { + Get-ChildItem -Path $env:TEMP -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Stop + } + catch + { + # If files are in use remove them at the next boot + Get-ChildItem -Path $env:TEMP -Recurse -Force | ForEach-Object -Process {[WinAPI.DeleteFiles]::MarkFileDelete($_.FullName)} } - until (((Get-ChildItem -Path $env:LOCALAPPDATA\Temp -Force -ErrorAction Ignore | Measure-Object).Count -eq 0) -or ($Result -eq 1)) + + $SymbolicLinkTask = @" +Get-ChildItem -Path `$env:LOCALAPPDATA\Temp -Recurse -Force | Remove-Item -Recurse -Force + +Get-Item -Path `$env:LOCALAPPDATA\Temp -Force | Where-Object -FilterScript {`$_.LinkType -ne """SymbolicLink"""} | Remove-Item -Recurse -Force +New-Item -Path `$env:LOCALAPPDATA\Temp -ItemType SymbolicLink -Value `$env:SystemDrive\Temp -Force + +Unregister-ScheduledTask -TaskName SymbolicLink -Confirm:`$false +"@ + + # Create a temporary scheduled task to create a symbolic link to the %SystemDrive%\Temp folder + $Action = New-ScheduledTaskAction -Execute powershell.exe -Argument "-WindowStyle Hidden -Command $SymbolicLinkTask" + $Trigger = New-ScheduledTaskTrigger -AtLogon -User $env:USERNAME + $Settings = New-ScheduledTaskSettingsSet -Compatibility Win8 + $Principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest + $Parameters = @{ + "TaskName" = "SymbolicLink" + "Principal" = $Principal + "Action" = $Action + "Settings" = $Settings + "Trigger" = $Trigger + } + Register-ScheduledTask @Parameters -Force + } + else + { + # Create a symbolic link to the %SystemDrive%\Temp folder + New-Item -Path $env:LOCALAPPDATA\Temp -ItemType SymbolicLink -Value $env:SystemDrive\Temp -Force } - } - else - { - # Create a symbolic link to the %SystemDrive%\Temp folder - New-Item -Path $env:LOCALAPPDATA\Temp -ItemType SymbolicLink -Value $env:SystemDrive\Temp -Force - } - if (Get-Item -Path $env:LOCALAPPDATA\Temp -ErrorAction Ignore | Where-Object -FilterScript {$_.LinkType -eq "SymbolicLink"}) - { + #region main + # Change the %TEMP% environment variable path to "%LOCALAPPDATA%\Temp" [Environment]::SetEnvironmentVariable("TMP", "$env:SystemDrive\Temp", "User") [Environment]::SetEnvironmentVariable("TMP", "$env:SystemDrive\Temp", "Machine") [Environment]::SetEnvironmentVariable("TMP", "$env:SystemDrive\Temp", "Process") @@ -3745,53 +3823,116 @@ function TempFolder New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name TMP -PropertyType ExpandString -Value $env:SystemDrive\Temp -Force New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name TEMP -PropertyType ExpandString -Value $env:SystemDrive\Temp -Force + # endregion main } } "Default" { - # Remove a symbolic link to the %SystemDrive%\Temp folder - if (Get-Item -Path $env:LOCALAPPDATA\Temp -Force -ErrorAction Ignore | Where-Object -FilterScript {$_.LinkType -eq "SymbolicLink"}) + if ($env:TEMP -ne "$env:LOCALAPPDATA\Temp") { - (Get-Item -Path $env:LOCALAPPDATA\Temp -Force).Delete() - } + # Restart the Printer Spooler service (Spooler) + Restart-Service -Name Spooler -Force - if (-not (Test-Path -Path $env:SystemRoot\Temp)) - { - New-Item -Path $env:SystemRoot\Temp -ItemType Directory -Force - } - if (-not (Test-Path -Path $env:LOCALAPPDATA\Temp)) - { - New-Item -Path $env:LOCALAPPDATA\Temp -ItemType Directory -Force - } + # Stop OneDrive processes + Stop-Process -Name OneDrive -Force -ErrorAction Ignore + Stop-Process -Name FileCoAuth -Force -ErrorAction Ignore - # Restart the Printer Spooler service (Spooler) - Restart-Service -Name Spooler -Force + # Remove a symbolic link to the %SystemDrive%\Temp folder + if (Get-Item -Path $env:LOCALAPPDATA\Temp -Force -ErrorAction Ignore | Where-Object -FilterScript {$_.LinkType -eq "SymbolicLink"}) + { + (Get-Item -Path $env:LOCALAPPDATA\Temp -Force).Delete() + } - # Stop OneDrive processes - Stop-Process -Name OneDrive -Force -ErrorAction Ignore - Stop-Process -Name FileCoAuth -Force -ErrorAction Ignore + if (-not (Test-Path -Path $env:SystemRoot\Temp)) + { + New-Item -Path $env:SystemRoot\Temp -ItemType Directory -Force + } + if (-not (Test-Path -Path $env:LOCALAPPDATA\Temp)) + { + New-Item -Path $env:LOCALAPPDATA\Temp -ItemType Directory -Force + } - if ((Get-ChildItem -Path $env:SystemDrive\Temp -Force -ErrorAction Ignore | Measure-Object).Count -eq 0) - { - Remove-Item -Path $env:SystemDrive\Temp -Recurse -Force - } - else - { - Write-Verbose -Message ($Localization.TempNotEmpty -f $env:TEMP) -Verbose - } + # Removing folders + Remove-Item -Path $env:TEMP -Recurse -Force -ErrorAction Ignore - [Environment]::SetEnvironmentVariable("TMP", "$env:LOCALAPPDATA\Temp", "User") - [Environment]::SetEnvironmentVariable("TMP", "$env:SystemRoot\TEMP", "Machine") - [Environment]::SetEnvironmentVariable("TMP", "$env:LOCALAPPDATA\Temp", "Process") - New-ItemProperty -Path HKCU:\Environment -Name TMP -PropertyType ExpandString -Value $env:LOCALAPPDATA\Temp -Force + if ((Get-ChildItem -Path $env:TEMP -Force -ErrorAction Ignore | Measure-Object).Count -ne 0) + { + # 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 + # The system moves the file immediately after AUTOCHK is executed, but before creating any paging files + $Signature = @{ + Namespace = "WinAPI" + Name = "DeleteFiles" + Language = "CSharp" + MemberDefinition = @" +public enum MoveFileFlags +{ + MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004 +} - [Environment]::SetEnvironmentVariable("TEMP", "$env:LOCALAPPDATA\Temp", "User") - [Environment]::SetEnvironmentVariable("TEMP", "$env:SystemRoot\TEMP", "Machine") - [Environment]::SetEnvironmentVariable("TEMP", "$env:LOCALAPPDATA\Temp", "Process") - New-ItemProperty -Path HKCU:\Environment -Name TEMP -PropertyType ExpandString -Value $env:LOCALAPPDATA\Temp -Force +[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] +static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName, MoveFileFlags dwFlags); - New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name TMP -PropertyType ExpandString -Value $env:SystemRoot\TEMP -Force - New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name TEMP -PropertyType ExpandString -Value $env:SystemRoot\TEMP -Force +public static bool MarkFileDelete (string sourcefile) +{ + return MoveFileEx(sourcefile, null, MoveFileFlags.MOVEFILE_DELAY_UNTIL_REBOOT); +} +"@ + } + + if (-not ("WinAPI.DeleteFiles" -as [type])) + { + Add-Type @Signature + } + + try + { + Remove-Item -Path $env:TEMP -Recurse -Force -ErrorAction Stop + } + catch + { + # If files are in use remove them at the next boot + Get-ChildItem -Path $env:TEMP -Recurse -Force -ErrorAction Ignore | ForEach-Object -Process {[WinAPI.DeleteFiles]::MarkFileDelete($_.FullName)} + } + + $TempFolder = [System.Environment]::ExpandEnvironmentVariables($env:TEMP) + $TempFolderCleanupTask = @" +Remove-Item -Path "$TempFolder" -Recurse -Force + +Unregister-ScheduledTask -TaskName TemporaryTask -Confirm:`$false +"@ + + # Create a temporary scheduled task to clean up the temporary folder + $Action = New-ScheduledTaskAction -Execute powershell.exe -Argument "-WindowStyle Hidden -Command $TempFolderCleanupTask" + $Trigger = New-ScheduledTaskTrigger -AtLogon -User $env:USERNAME + $Settings = New-ScheduledTaskSettingsSet -Compatibility Win8 + $Principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest + $Parameters = @{ + "TaskName" = "TemporaryTask" + "Principal" = $Principal + "Action" = $Action + "Settings" = $Settings + "Trigger" = $Trigger + } + Register-ScheduledTask @Parameters -Force + } + + #region main + # Change the %TEMP% environment variable path to "%LOCALAPPDATA%\Temp" + [Environment]::SetEnvironmentVariable("TMP", "$env:LOCALAPPDATA\Temp", "User") + [Environment]::SetEnvironmentVariable("TMP", "$env:SystemRoot\TEMP", "Machine") + [Environment]::SetEnvironmentVariable("TMP", "$env:LOCALAPPDATA\Temp", "Process") + New-ItemProperty -Path HKCU:\Environment -Name TMP -PropertyType ExpandString -Value "%USERPROFILE%\AppData\Local\Temp" -Force + + [Environment]::SetEnvironmentVariable("TEMP", "$env:LOCALAPPDATA\Temp", "User") + [Environment]::SetEnvironmentVariable("TEMP", "$env:SystemRoot\TEMP", "Machine") + [Environment]::SetEnvironmentVariable("TEMP", "$env:LOCALAPPDATA\Temp", "Process") + New-ItemProperty -Path HKCU:\Environment -Name TEMP -PropertyType ExpandString -Value "%USERPROFILE%\AppData\Local\Temp" -Force + + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name TMP -PropertyType ExpandString -Value "%SystemRoot%\TEMP" -Force + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name TEMP -PropertyType ExpandString -Value "%SystemRoot%\TEMP" -Force + # endregion main + } } } } @@ -4814,101 +4955,6 @@ function UpdateMicrosoftProducts } } -<# - .SYNOPSIS - Configure UWP apps running in the background - - .PARAMETER Disable - Do not let UWP apps run in the background - - .PARAMETER Enable - Let all UWP apps run in the background - - .EXAMPLE - BackgroundUWPApps -Disable - - .EXAMPLE - BackgroundUWPApps -Enable - - .NOTES - Current user -#> -function BackgroundUWPApps -{ - param - ( - [Parameter( - Mandatory = $true, - ParameterSetName = "Enable" - )] - [switch] - $Enable, - - [Parameter( - Mandatory = $true, - ParameterSetName = "Disable" - )] - [switch] - $Disable - ) - - switch ($PSCmdlet.ParameterSetName) - { - "Disable" - { - Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications | ForEach-Object -Process { - Remove-ItemProperty -Path $_.PsPath -Name * -Force - } - - $ExcludedBackgroundApps = @( - # Lock screen app - # Экран блокировки - "Microsoft.LockApp", - - # Content Delivery Manager (delivers Windows Spotlight wallpapers to the lock screen) - # Content Delivery Manager (доставляет обои для Windows Spotlight на экран блокировки) - "Microsoft.Windows.ContentDeliveryManager", - - # Cortana - "Microsoft.Windows.Cortana", - - # Windows Search - "Microsoft.Windows.Search", - - # Windows Security - # Безопасность Windows - "Microsoft.Windows.SecHealthUI", - - # Windows Shell Experience (Action center, snipping support, toast notification, touch screen keyboard) - # Windows Shell Experience (Центр уведомлений, приложение "Ножницы", тостовые уведомления, сенсорная клавиатура) - "Microsoft.Windows.ShellExperienceHost", - - # The Start menu - # Меню "Пуск" - "Microsoft.Windows.StartMenuExperienceHost", - - # Microsoft Store - "Microsoft.WindowsStore" - ) - $OFS = "|" - Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications | Where-Object -FilterScript {$_.PSChildName -notmatch "^$($ExcludedBackgroundApps.ForEach({[regex]::Escape($_)}))"} | ForEach-Object -Process { - New-ItemProperty -Path $_.PsPath -Name Disabled -PropertyType DWord -Value 1 -Force - New-ItemProperty -Path $_.PsPath -Name DisabledByUser -PropertyType DWord -Value 1 -Force - } - $OFS = " " - - # Open "Background apps" page - Start-Process -FilePath ms-settings:privacy-backgroundapps - } - "Enable" - { - Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications | ForEach-Object -Process { - Remove-ItemProperty -Path $_.PsPath -Name * -Force - } - } - } -} - <# .SYNOPSIS Configure the power management scheme @@ -6046,6 +6092,8 @@ function WinPrtScrFolder # In order for the changes to take effect the File Explorer process has to be restarted Stop-Process -Name explorer -Force + Start-Sleep -Seconds 3 + # Restoring closed folders foreach ($OpenedFolder in $OpenedFolders) { @@ -6794,7 +6842,7 @@ function Set-Association Param ( [Parameter( - Mandatory = $false, + Mandatory = $true, Position = 0 )] [String] @@ -6813,6 +6861,7 @@ function Set-Association ) $ProgramPath = [System.Environment]::ExpandEnvironmentVariables($ProgramPath) + $Icon = [System.Environment]::ExpandEnvironmentVariables($Icon) if (Test-Path -Path $ProgramPath) { @@ -6985,6 +7034,7 @@ namespace RegistryUtils $OpenSubKey = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey($SubKey,'ReadWriteSubTree','TakeOwnership') $Acl = [System.Security.AccessControl.RegistrySecurity]::new() + # Get current user SID $UserSID = (Get-CimInstance -ClassName Win32_UserAccount | Where-Object -FilterScript {$_.Name -eq $env:USERNAME}).SID $Acl.SetSecurityDescriptorSddlForm("O:$UserSID`G:$UserSID`D:AI(D;;DC;;;$UserSID)") $OpenSubKey.SetAccessControl($Acl) @@ -7012,6 +7062,20 @@ namespace RegistryUtils $OrigProgID = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Classes\$Extension" -Name "(default)" -ErrorAction Ignore)."(default)" + if ($OrigProgID) + { + # Save possible ProgIds history with extension + New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" -Name "$ProgID`_$Extension" -PropertyType String -Value 0 -Force + } + + $Name = (Get-Item -Path $ProgramPath).Name + $Extension + New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" -Name $Name -PropertyType String -Value 0 -Force + + if ("$ProgId`_$Extension" -ne $Name) + { + New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" -Name "$ProgId`_$Extension" -PropertyType String -Value 0 -Force + } + # If ProgId doesn't exist set the specified ProgId for the extansions if (-not $OrigProgID) { @@ -7022,7 +7086,7 @@ namespace RegistryUtils New-ItemProperty -Path "HKCU:\SOFTWARE\Classes\$Extension" -Name "(default)" -PropertyType String -Value $ProgId -Force } - # Set the specified ProgId в варианты возможных для назначения + # Set the specified ProgId in the possible options for the assignment if (-not (Test-Path -Path "HKCU:\SOFTWARE\Classes\$Extension\OpenWithProgids")) { New-Item -Path "HKCU:\SOFTWARE\Classes\$Extension\OpenWithProgids" -Force @@ -7038,14 +7102,12 @@ namespace RegistryUtils } New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$Extension\OpenWithProgids" -Name $OrigProgID -PropertyType None -Value ([byte[]]@()) -Force } - else + + if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$Extension\OpenWithProgids")) { - if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$Extension\OpenWithProgids")) - { - New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$Extension\OpenWithProgids" -Force - } - New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$Extension\OpenWithProgids" -Name $ProgID -PropertyType None -Value ([byte[]]@()) -Force + New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$Extension\OpenWithProgids" -Force } + New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$Extension\OpenWithProgids" -Name $ProgID -PropertyType None -Value ([byte[]]@()) -Force # Removing the UserChoice key Remove-UserChoiceKey -SubKey "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$Extension\UserChoice" @@ -7099,13 +7161,6 @@ namespace RegistryUtils New-ItemProperty -Path Registry::HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\FileAssociations\ProgIds -Name "_$Extension" -PropertyType DWord -Value 1 -Force } - # Save possible ProgIds with extension - if (-not (Test-Path -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts")) - { - New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" -Force - } - New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" -Name "$ProgId`_$Extension" -PropertyType String -Value 0 -Force - # Setting 'NoOpenWith' for all registered the extension ProgIDs [psobject]$OpenSubkey = Get-Item -Path "Registry::HKEY_CLASSES_ROOT\$Extension\OpenWithProgids" -ErrorAction Ignore | Select-Object -ExpandProperty Property @@ -7290,7 +7345,9 @@ namespace FileAssoc { [OutputType([array])] + # Secret static string stored in %SystemRoot%\SysWOW64\shell32.dll $userExperience = "User Choice set via Windows User Experience {D18B6DD5-6124-4341-9318-804003BAFA0B}" + # Get user SID $userSid = (Get-CimInstance -ClassName Win32_UserAccount | Where-Object -FilterScript {$_.Name -eq $env:USERNAME}).SID $KeyLastWriteTime = Get-KeyLastWriteTime -SubKey $SubKey $baseInfo = ("{0}{1}{2}{3}{4}" -f $Extension, $userSid, $ProgId, $KeyLastWriteTime, $userExperience).ToLowerInvariant() @@ -7948,7 +8005,7 @@ public static string GetString(uint strId) Uninstall UWP apps .PARAMETER ForAllUsers - Set the "For All Users" checkbox checked by default + Set the "For All Users" checkbox to unistall packages for all users .EXAMPLE UninstallUWPApps @@ -8160,24 +8217,24 @@ function UninstallUWPApps Write-Verbose -Message $Localization.Patient -Verbose - $AppxPackages = Get-AppxPackage -PackageTypeFilter Bundle -AllUsers:$AllUsers | Where-Object -FilterScript {$_.Name -notin $ExcludedAppxPackages} - $PackageManager = [Windows.Management.Deployment.PackageManager, Windows.Web, ContentType = WindowsRuntime]::new() - $PackagesIds = $PackageManager.FindPackages() + $AppxPackages = Get-AppxPackage -PackageTypeFilter Bundle -AllUsers:$AllUsers | Where-Object -FilterScript {$_.Name -notin $ExcludedAppxPackages} + $PackagesIds = [Windows.Management.Deployment.PackageManager, Windows.Web, ContentType = WindowsRuntime]::new().FindPackages() | Select-Object -Property DisplayName -ExpandProperty Id | Select-Object -Property Name, DisplayName foreach ($AppxPackage in $AppxPackages) { - $PackageId = $PackagesIds | Where-Object -FilterScript {$_.Id.Name -eq $AppxPackage.Name} + $PackageId = $PackagesIds | Where-Object -FilterScript {$_.Name -eq $AppxPackage.Name} if (-not $PackageId) { continue } - $AppxPackage | Add-Member -MemberType NoteProperty -Name DisplayName -Value $PackageId.DisplayName - $AppxPackage | Add-Member -MemberType NoteProperty -Name FullName -Value $PackageId.Id.FullName + [PSCustomObject]@{ + Name = $AppxPackage.Name + PackageFullName = $AppxPackage.PackageFullName + DisplayName = $PackageId.DisplayName + } } - - return $AppxPackages } function Add-Control @@ -8544,6 +8601,101 @@ function CortanaAutostart } } +<# + .SYNOPSIS + Configure UWP apps running in the background + + .PARAMETER Disable + Do not let UWP apps run in the background + + .PARAMETER Enable + Let all UWP apps run in the background + + .EXAMPLE + BackgroundUWPApps -Disable + + .EXAMPLE + BackgroundUWPApps -Enable + + .NOTES + Current user +#> +function BackgroundUWPApps +{ + param + ( + [Parameter( + Mandatory = $true, + ParameterSetName = "Enable" + )] + [switch] + $Enable, + + [Parameter( + Mandatory = $true, + ParameterSetName = "Disable" + )] + [switch] + $Disable + ) + + switch ($PSCmdlet.ParameterSetName) + { + "Disable" + { + Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications | ForEach-Object -Process { + Remove-ItemProperty -Path $_.PsPath -Name * -Force + } + + $ExcludedBackgroundApps = @( + # Lock screen app + # Экран блокировки + "Microsoft.LockApp", + + # Content Delivery Manager (delivers Windows Spotlight wallpapers to the lock screen) + # Content Delivery Manager (доставляет обои для Windows Spotlight на экран блокировки) + "Microsoft.Windows.ContentDeliveryManager", + + # Cortana + "Microsoft.Windows.Cortana", + + # Windows Search + "Microsoft.Windows.Search", + + # Windows Security + # Безопасность Windows + "Microsoft.Windows.SecHealthUI", + + # Windows Shell Experience (Action center, snipping support, toast notification, touch screen keyboard) + # Windows Shell Experience (Центр уведомлений, приложение "Ножницы", тостовые уведомления, сенсорная клавиатура) + "Microsoft.Windows.ShellExperienceHost", + + # The Start menu + # Меню "Пуск" + "Microsoft.Windows.StartMenuExperienceHost", + + # Microsoft Store + "Microsoft.WindowsStore" + ) + $OFS = "|" + Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications | Where-Object -FilterScript {$_.PSChildName -notmatch "^$($ExcludedBackgroundApps.ForEach({[regex]::Escape($_)}))"} | ForEach-Object -Process { + New-ItemProperty -Path $_.PsPath -Name Disabled -PropertyType DWord -Value 1 -Force + New-ItemProperty -Path $_.PsPath -Name DisabledByUser -PropertyType DWord -Value 1 -Force + } + $OFS = " " + + # Open "Background apps" page + Start-Process -FilePath ms-settings:privacy-backgroundapps + } + "Enable" + { + Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications | ForEach-Object -Process { + Remove-ItemProperty -Path $_.PsPath -Name * -Force + } + } + } +} + # Check for UWP apps updates function CheckUWPAppsUpdates { @@ -9102,7 +9254,7 @@ function SoftwareDistributionTask $SoftwareDistributionTask = @" (Get-Service -Name wuauserv).WaitForStatus('Stopped', '01:00:00') -Get-ChildItem -Path $env:SystemRoot\SoftwareDistribution\Download -Recurse -Force | Remove-Item -Recurse -Force +Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -Force | Remove-Item -Recurse -Force [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null @@ -9197,7 +9349,7 @@ function TempTask "Register" { $TempTask = @" -"Get-ChildItem -Path $env:TEMP -Force -Recurse | Remove-Item -Recurse -Force" +Get-ChildItem -Path `$env:TEMP -Force -Recurse | Remove-Item -Recurse -Force [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null @@ -9640,6 +9792,8 @@ function DismissSmartScreenFilter .EXAMPLE AuditProcess -Enable + + .NOTES Machine-wide #> function AuditProcess @@ -9692,6 +9846,8 @@ function AuditProcess .NOTES In order this feature to work events auditing ("AuditProcess -Enable" function) will be enabled + + .NOTES Machine-wide #> function AuditCommandLineProcess @@ -9747,6 +9903,8 @@ function AuditCommandLineProcess .NOTES In order this feature to work events auditing ("AuditProcess -Enable" function) and command line in process creation events will be enabled + + .NOTES Machine-wide #> function EventViewerCustomView @@ -9826,6 +9984,8 @@ function EventViewerCustomView .EXAMPLE PowerShellModulesLogging -Enable + + .NOTES Machine-wide #> function PowerShellModulesLogging @@ -9881,6 +10041,8 @@ function PowerShellModulesLogging .EXAMPLE PowerShellScriptsLogging -Enable + + .NOTES Machine-wide #> function PowerShellScriptsLogging @@ -9934,6 +10096,8 @@ function PowerShellScriptsLogging .EXAMPLE AppsSmartScreen -Enable + + .NOTES Machine-wide #> function AppsSmartScreen @@ -10041,6 +10205,8 @@ function SaveZoneInformation .NOTES Blocks WSH from executing .js and .vbs files + + .NOTES Current user #> function WindowsScriptHost @@ -10094,6 +10260,8 @@ function WindowsScriptHost .EXAMPLE WindowsSandbox -Enable + + .NOTES Current user #> function WindowsSandbox @@ -10189,6 +10357,8 @@ function WindowsSandbox .EXAMPLE MSIExtractContext -Add + + .NOTES Current user #> function MSIExtractContext @@ -10245,6 +10415,8 @@ function MSIExtractContext .EXAMPLE CABInstallContext -Add + + .NOTES Current user #> function CABInstallContext @@ -10301,6 +10473,8 @@ function CABInstallContext .EXAMPLE RunAsDifferentUserContext -Add + + .NOTES Current user #> function RunAsDifferentUserContext @@ -10350,6 +10524,8 @@ function RunAsDifferentUserContext .EXAMPLE CastToDeviceContext -Show + + .NOTES Current user #> function CastToDeviceContext @@ -10403,6 +10579,8 @@ function CastToDeviceContext .EXAMPLE ShareContext -Show + + .NOTES Current user #> function ShareContext @@ -10456,6 +10634,8 @@ function ShareContext .EXAMPLE EditWithPaint3DContext -Show + + .NOTES Current user #> function EditWithPaint3DContext @@ -10513,6 +10693,8 @@ function EditWithPaint3DContext .EXAMPLE EditWithPhotosContext -Show + + .NOTES Current user #> function EditWithPhotosContext @@ -10568,6 +10750,8 @@ function EditWithPhotosContext .EXAMPLE CreateANewVideoContext -Show + + .NOTES Current user #> function CreateANewVideoContext @@ -10623,6 +10807,8 @@ function CreateANewVideoContext .EXAMPLE ImagesEditContext -Show + + .NOTES Current user #> function ImagesEditContext @@ -10678,6 +10864,8 @@ function ImagesEditContext .EXAMPLE PrintCMDContext -Show + + .NOTES Current user #> function PrintCMDContext @@ -10729,6 +10917,8 @@ function PrintCMDContext .EXAMPLE IncludeInLibraryContext -Show + + .NOTES Current user #> function IncludeInLibraryContext @@ -10778,6 +10968,8 @@ function IncludeInLibraryContext .EXAMPLE SendToContext -Show + + .NOTES Current user #> function SendToContext @@ -10827,6 +11019,8 @@ function SendToContext .EXAMPLE BitLockerContext -Show + + .NOTES Current user #> function BitLockerContext @@ -10892,6 +11086,8 @@ function BitLockerContext .EXAMPLE BitmapImageNewContext -Add + + .NOTES Current user #> function BitmapImageNewContext @@ -10968,6 +11164,8 @@ function BitmapImageNewContext .EXAMPLE RichTextDocumentNewContext -Add + + .NOTES Current user #> function RichTextDocumentNewContext @@ -11044,6 +11242,8 @@ function RichTextDocumentNewContext .EXAMPLE CompressedFolderNewContext -Add + + .NOTES Current user #> function CompressedFolderNewContext @@ -11098,6 +11298,8 @@ function CompressedFolderNewContext .EXAMPLE MultipleInvokeContext -Disable + + .NOTES Current user #> function MultipleInvokeContext @@ -11147,6 +11349,8 @@ function MultipleInvokeContext .EXAMPLE UseStoreOpenWith -Show + + .NOTES Current user #> function UseStoreOpenWith @@ -11200,6 +11404,8 @@ function UseStoreOpenWith .EXAMPLE PreviousVersionsPage -Show + + .NOTES Current user #> function PreviousVersionsPage diff --git a/Sophia/PowerShell 5.1/cn-CN/Sophia.psd1 b/Sophia/PowerShell 5.1/cn-CN/Sophia.psd1 index 09923a35..7397d264 100644 --- a/Sophia/PowerShell 5.1/cn-CN/Sophia.psd1 +++ b/Sophia/PowerShell 5.1/cn-CN/Sophia.psd1 @@ -5,13 +5,8 @@ UnsupportedRelease = 找到新版本 ControlledFolderAccessDisabled = “受控文件夹访问”禁用 ScheduledTasks = 计划任务 OneDriveUninstalling = 卸载OneDrive…… -OneDriveNotEmptyFolder = “{0}“文件夹不为空。手动将其删除 -OneDriveFileSyncShell64dllBlocked = “{0}“被阻止。手动将其删除。 OneDriveInstalling = OneDrive正在安装...... OneDriveDownloading = 正在下载OneDrive...... ~33 MB -ClearFolder = 删除“{0}“文件夹中的所有文件? -FilesBlocked = 以下文件被第三方应用程序阻止。手动删除它们并继续 -TempNotEmpty = “{0}“文件夹不为空。 手动清除 WindowsFeaturesTitle = Windows功能 OptionalFeaturesTitle = 可选功能 EnableHardwareVT = UEFI中开启虚拟化 @@ -58,7 +53,6 @@ ErrorsMessage = 错误/警告 Add = 添加 AllFilesFilter = 所有文件 (*.*)|*.* Change = 更改 -Delete = 删除 DialogBoxOpening = 显示对话窗口…… Disable = 禁用 Dismiss = 解雇 diff --git a/Sophia/PowerShell 5.1/de-DE/Sophia.psd1 b/Sophia/PowerShell 5.1/de-DE/Sophia.psd1 index 9412d41b..0cd6e18e 100644 --- a/Sophia/PowerShell 5.1/de-DE/Sophia.psd1 +++ b/Sophia/PowerShell 5.1/de-DE/Sophia.psd1 @@ -5,13 +5,8 @@ UnsupportedRelease = Neue Version gefunden ControlledFolderAccessDisabled = Kontrollierter Ordnerzugriff deaktiviert ScheduledTasks = Geplante Aufgaben OneDriveUninstalling = Deinstalliere OneDrive... -OneDriveNotEmptyFolder = Der Ordner "{0}" ist nicht leer. Löschen Sie es manuell -OneDriveFileSyncShell64dllBlocked = "{0}" ist blockiert. Löschen Sie es manuell OneDriveInstalling = OneDrive wird installiert... OneDriveDownloading = OneDrive herunterladen... ~33 MB -ClearFolder = Löscht alle Dateien im Ordner "{0}"? -FilesBlocked = Die folgenden Dateien werden von Apps von Drittanbietern blockiert. 'nEntfernen Sie sie manuell und fahren Sie fort -TempNotEmpty = Der Ordner "{0}" ist nicht leer. Löschen Sie ihn manuell WindowsFeaturesTitle = Windows Eigenschaften OptionalFeaturesTitle = Optionale Eigenschaften EnableHardwareVT = Virtualisierung in UEFI aktivieren @@ -58,7 +53,6 @@ ErrorsMessage = Fehler/Warnungen Add = Hinzufügen AllFilesFilter = Alle Dateien (*.*)|*.* Change = Ändern -Delete = Löschen DialogBoxOpening = Anzeigen des Dialogfensters... Disable = Deaktivieren Dismiss = Stornieren diff --git a/Sophia/PowerShell 5.1/en-US/Sophia.psd1 b/Sophia/PowerShell 5.1/en-US/Sophia.psd1 index 618ab4a4..312602ab 100644 --- a/Sophia/PowerShell 5.1/en-US/Sophia.psd1 +++ b/Sophia/PowerShell 5.1/en-US/Sophia.psd1 @@ -1,17 +1,12 @@ ConvertFrom-StringData -StringData @' UnsupportedOSBitness = The script supports Windows 10 x64 only UnsupportedOSBuild = The script supports Windows 10 2004/20H1 versions and higher -UnsupportedRelease = New version found +UnsupportedRelease = A new version found ControlledFolderAccessDisabled = Controlled folder access disabled ScheduledTasks = Scheduled tasks OneDriveUninstalling = Uninstalling OneDrive... -OneDriveNotEmptyFolder = The "{0}" folder is not empty. Delete it manually -OneDriveFileSyncShell64dllBlocked = "{0}" is blocked. Delete it manually OneDriveInstalling = OneDrive is installing... OneDriveDownloading = Downloading OneDrive... ~33 MB -ClearFolder = Delete all files in the "{0}" folder? -FilesBlocked = The following files are being blocked by third-party party apps. Remove them manually and continue -TempNotEmpty = The "{0}" folder is not empty. Clear it manually WindowsFeaturesTitle = Windows features OptionalFeaturesTitle = Optional features EnableHardwareVT = Enable Virtualization in UEFI @@ -58,7 +53,6 @@ ErrorsMessage = Errors/Warnings Add = Add AllFilesFilter = All Files (*.*)|*.* Change = Change -Delete = Delete DialogBoxOpening = Displaying the dialog box... Disable = Disable Dismiss = Dismiss diff --git a/Sophia/PowerShell 5.1/es-ES/Sophia.psd1 b/Sophia/PowerShell 5.1/es-ES/Sophia.psd1 index 788712e5..29df353a 100644 --- a/Sophia/PowerShell 5.1/es-ES/Sophia.psd1 +++ b/Sophia/PowerShell 5.1/es-ES/Sophia.psd1 @@ -5,13 +5,8 @@ UnsupportedRelease = Nueva versión encontrada ControlledFolderAccessDisabled = Acceso a la carpeta controlada deshabilitado ScheduledTasks = Tareas programadas OneDriveUninstalling = Desinstalar OneDrive... -OneDriveNotEmptyFolder = La carpeta "{0}" no está vacía. Eliminarlo manualmente -OneDriveFileSyncShell64dllBlocked = "{0}" está bloqueado. Eliminarlo manualmente OneDriveInstalling = OneDrive se está instalando... OneDriveDownloading = Descargando OneDrive... ~33 MB -ClearFolder = Eliminar todos los archivos en la carpeta "{0}"? -FilesBlocked = Los siguientes archivos están siendo bloqueados por la Parte aplicaciones de terceros. Eliminarlos manualmente y continuar -TempNotEmpty = La carpeta "{0}" no está vacía. Desactivarla manualmente WindowsFeaturesTitle = Características de Windows OptionalFeaturesTitle = Características opcionales EnableHardwareVT = Habilitar la virtualización en UEFI @@ -58,7 +53,6 @@ ErrorsMessage = Errores/Advertencias Add = Agregar AllFilesFilter = Todos los archivos (*.*)|*.* Change = Cambio -Delete = Borrar DialogBoxOpening = Viendo el cuadro de diálogo... Disable = Desactivar Dismiss = Ignorar diff --git a/Sophia/PowerShell 5.1/fr-FR/Sophia.psd1 b/Sophia/PowerShell 5.1/fr-FR/Sophia.psd1 index 7aa5d43a..14e9a976 100644 --- a/Sophia/PowerShell 5.1/fr-FR/Sophia.psd1 +++ b/Sophia/PowerShell 5.1/fr-FR/Sophia.psd1 @@ -5,13 +5,8 @@ UnsupportedRelease = Nouvelle version trouvée ControlledFolderAccessDisabled = Contrôle d'accès aux dossiers désactivé ScheduledTasks = Tâches planifiées OneDriveUninstalling = Désinstalltion de OneDrive... -OneDriveNotEmptyFolder = Le dossier "{0}" est vide. Le supprimer manuellement -OneDriveFileSyncShell64dllBlocked = "{0}" est bloqué. Le supprimer manuellement OneDriveInstalling = OneDrive en cours d'installation... OneDriveDownloading = Téléchargement de OneDrive... ~33 Mo -ClearFolder = Supprimer tous les fichiers dans le dossier "{0}"? -FilesBlocked = Les fichiers suivants sont bloqués par une application tierce \nRetirer les manuellement et continuer -TempNotEmpty = Le dossier "{0}" n'est pas vide. L'effacer manuellement WindowsFeaturesTitle = Fonctionnalités OptionalFeaturesTitle = Fonctionnalités optionnelles EnableHardwareVT = Activer la virtualisation dans UEFI @@ -58,7 +53,6 @@ ErrorsMessage = Erreurs/Avertissements Add = Ajouter AllFilesFilter = Tous les Fichiers (*.*)|*.* Change = Changer -Delete = Effacer DialogBoxOpening = Afficher la boîte de dialogue... Disable = Désactiver Dismiss = Annuler diff --git a/Sophia/PowerShell 5.1/it-IT/Sophia.psd1 b/Sophia/PowerShell 5.1/it-IT/Sophia.psd1 index 60029dcd..a976b5ff 100644 --- a/Sophia/PowerShell 5.1/it-IT/Sophia.psd1 +++ b/Sophia/PowerShell 5.1/it-IT/Sophia.psd1 @@ -5,13 +5,8 @@ UnsupportedRelease = Nuova versione trovata ControlledFolderAccessDisabled = l'accesso alle cartelle controllata disattivata ScheduledTasks = Attività pianificate OneDriveUninstalling = Disinstalla OneDrive... -OneDriveNotEmptyFolder = La cartella "{0}" non è vuota. Eliminarlo manualmente -OneDriveFileSyncShell64dllBlocked = "{0}" è bloccato. Eliminarlo manualmente OneDriveInstalling = OneDrive si sta installando... OneDriveDownloading = Download di OneDrive... ~33 MB -ClearFolder = Eliminare tutti i file nella cartella "{0}"? -FilesBlocked = I seguenti file vengono bloccati da app di terze parti. Rimuovili manualmente e continua -TempNotEmpty = La cartella "{0}" non è vuota. Cancellare manualmente WindowsFeaturesTitle = Funzionalità di Windows OptionalFeaturesTitle = Caratteristiche opzionali EnableHardwareVT = Abilita virtualizzazione in UEFI @@ -58,7 +53,6 @@ ErrorsMessage = Errori/avvisi Add = Inserisci AllFilesFilter = Tutti i file (*.*)|*.* Change = Modificare -Delete = Elimina DialogBoxOpening = Visualizzazione della finestra di dialogo... Disable = Disattivare Dismiss = Ignorare diff --git a/Sophia/PowerShell 5.1/pt-BR/Sophia.psd1 b/Sophia/PowerShell 5.1/pt-BR/Sophia.psd1 index 5e381bb9..8f2c1a75 100644 --- a/Sophia/PowerShell 5.1/pt-BR/Sophia.psd1 +++ b/Sophia/PowerShell 5.1/pt-BR/Sophia.psd1 @@ -5,13 +5,8 @@ UnsupportedRelease = Nova versão encontrada ControlledFolderAccessDisabled = Acesso controlado a pasta desativada ScheduledTasks = Tarefas agendadas OneDriveUninstalling = Desinstalar OneDrive... -OneDriveNotEmptyFolder = A pasta "{0}" não está vazia. Exclua-la manualmente -OneDriveFileSyncShell64dllBlocked = "{0}" está bloqueado. Exclua-lo manualmente OneDriveInstalling = OneDrive está instalando... OneDriveDownloading = Baixando OneDrive... ~33 MB -ClearFolder = Exclua todos os arquivos na pasta "{0}"? -FilesBlocked = Os seguintes arquivos estão sendo bloqueados pelos apps de terceiros. Removê-los manualmente e continuar -TempNotEmpty = A pasta "{0}" não está vazia. Limpá-la manualmente WindowsFeaturesTitle = Recursos do Windows OptionalFeaturesTitle = Recursos opcionais EnableHardwareVT = Habilitar virtualização em UEFI @@ -58,7 +53,6 @@ ErrorsMessage = Erros/Avisos Add = Adicionar AllFilesFilter = Todos os arquivos (*.*)|*.* Change = Mudar -Delete = Excluir DialogBoxOpening = Exibindo a caixa de diálogo... Disable = Desativar Dismiss = Ignorar diff --git a/Sophia/PowerShell 5.1/ru-RU/Sophia.psd1 b/Sophia/PowerShell 5.1/ru-RU/Sophia.psd1 index 2976df90..33a5807c 100644 --- a/Sophia/PowerShell 5.1/ru-RU/Sophia.psd1 +++ b/Sophia/PowerShell 5.1/ru-RU/Sophia.psd1 @@ -5,13 +5,8 @@ UnsupportedRelease = Обнаружена новая ве ControlledFolderAccessDisabled = Контролируемый доступ к папкам выключен ScheduledTasks = Запланированные задания OneDriveUninstalling = Удаление OneDrive... -OneDriveNotEmptyFolder = Папка "{0}" не пуста. Удалите ее вручную -OneDriveFileSyncShell64dllBlocked = "{0}" заблокирован. Удалите его вручную OneDriveInstalling = OneDrive устанавливается... OneDriveDownloading = Скачивается OneDrive... ~33 МБ -ClearFolder = Удалить все файлы в папке "{0}"? -FilesBlocked = Следующие файлы блокируются сторонними приложениями. Удалите их вручную и продолжите -TempNotEmpty = Папка "{0}" не пуста. Очистите ее вручную WindowsFeaturesTitle = Компоненты Windows OptionalFeaturesTitle = Дополнительные компоненты EnableHardwareVT = Включите виртуализацию в UEFI @@ -58,7 +53,6 @@ ErrorsMessage = Ошибки/предупрежде Add = Добавить AllFilesFilter = Все файлы (*.*)|*.* Change = Изменить -Delete = Удалить DialogBoxOpening = Диалоговое окно открывается... Disable = Отключить Dismiss = Отмена diff --git a/Sophia/PowerShell 5.1/tr-TR/Sophia.psd1 b/Sophia/PowerShell 5.1/tr-TR/Sophia.psd1 index 633c0325..008d46c7 100644 --- a/Sophia/PowerShell 5.1/tr-TR/Sophia.psd1 +++ b/Sophia/PowerShell 5.1/tr-TR/Sophia.psd1 @@ -5,13 +5,8 @@ UnsupportedRelease = Yeni sürüm bulundu ControlledFolderAccessDisabled = Kontrollü klasör erişimi devre dışı bırakıldı ScheduledTasks = Zamanlanan görevler OneDriveUninstalling = OneDrive kaldırılıyor... -OneDriveNotEmptyFolder = "{0}" klasörü boş değil. Kendiniz silin -OneDriveFileSyncShell64dllBlocked = "{0}" engellendi. Kendiniz silin OneDriveInstalling = OneDrive kuruluyor... OneDriveDownloading = OneDrive indiriliyor... ~33 MB -ClearFolder = "{0}" klasöründeki tüm dosyaları silin? -FilesBlocked = Aşağıdaki dosyalar 3. parti uygulamalar tarafından engelleniyor. \nKendiniz silin ve devam edin -TempNotEmpty = "{0}" klasörü boş değil. Kendiniz temizleyin WindowsFeaturesTitle = Windows özellikleri OptionalFeaturesTitle = İsteğe bağlı özellikler EnableHardwareVT = UEFI'dan sanallaştırmayı aktifleştirin @@ -58,7 +53,6 @@ ErrorsMessage = Hatalar/Uyarılar Add = Ekle AllFilesFilter = Tüm Dosyalar (*.*)|*.* Change = Değiştir -Delete = Sil DialogBoxOpening = İletişim kutusu görüntüleniyor... Disable = Devre dışı bırak Dismiss = İptal diff --git a/Sophia/PowerShell 5.1/uk-UA/Sophia.psd1 b/Sophia/PowerShell 5.1/uk-UA/Sophia.psd1 index 9f89e599..7283aae9 100644 --- a/Sophia/PowerShell 5.1/uk-UA/Sophia.psd1 +++ b/Sophia/PowerShell 5.1/uk-UA/Sophia.psd1 @@ -5,13 +5,8 @@ UnsupportedRelease = Виявлено нову версі ControlledFolderAccessDisabled = Контрольований доступ до папок вимкнений ScheduledTasks = Заплановані задачі OneDriveUninstalling = Видалення OneDrive... -OneDriveNotEmptyFolder = Папка "{0}" не порожня. Видаліть її -OneDriveFileSyncShell64dllBlocked = "{0}" заблокований. Видаліть його вручну OneDriveInstalling = OneDrive встановлюється... OneDriveDownloading = Завантажується OneDrive... ~33 МБ -ClearFolder = Видаліть всі файли у папці "{0}"? -FilesBlocked = Наступні файли блокуються сторонніми програмами\nВидаліть їх вручну та продовжуйте -TempNotEmpty = Папка "{0}" не порожня. Очистіть її вручну WindowsFeaturesTitle = Компоненти Windows OptionalFeaturesTitle = Додаткові компоненти EnableHardwareVT = Увімкніть віртуалізацію в UEFI @@ -58,7 +53,6 @@ ErrorsMessage = Помилки/попереджен Add = Додати AllFilesFilter = Усі файли (*.*)|*.* Change = Змінити -Delete = Видалити DialogBoxOpening = Діалогове вікно відкривається... Disable = Вимкнути Dismiss = Відміна