#Requires -RunAsAdministrator #Requires -Version 7.2 [CmdletBinding()] param ( [Parameter(Mandatory = $false)] [string[]] $Functions ) Clear-Host $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.1.1 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022" Remove-Module -Name Sophia -Force -ErrorAction Ignore Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force # Import module for modifying registry.pol files (Administrative Templates) of local GPOs # https://www.powershellgallery.com/packages/PolicyFileEditor Remove-Module -Name PolicyFileEditor -Force -ErrorAction Ignore Import-Module -Name $PSScriptRoot\bin\PolicyFileEdit\PolicyFileEditor.psd1 -PassThru -Force Import-LocalizedData -BindingVariable Global:Localization -FileName Sophia -BaseDirectory $PSScriptRoot\Localizations <# .SYNOPSIS Run the script by specifying functions as an argument Запустить скрипт, указав в качестве аргумента функции .EXAMPLE .\Sophia.ps1 -Functions "DiagTrackService -Disable", "DiagnosticDataLevel -Minimal", UninstallUWPApps .NOTES Use commas to separate funtions Разделяйте функции запятыми #> if ($Functions) { Invoke-Command -ScriptBlock {Checkings} foreach ($Function in $Functions) { Invoke-Expression -Command $Function } # The "RefreshEnvironment" and "Errors" functions will be executed at the end Invoke-Command -ScriptBlock {RefreshEnvironment; Errors} exit } #region Protection Checkings -Warning CreateRestorePoint #endregion Protection #region Privacy & Telemetry DiagTrackService -Disable DiagnosticDataLevel -Minimal ErrorReporting -Disable FeedbackFrequency -Never ScheduledTasks -Disable SigninInfo -Disable LanguageListAccess -Disable AdvertisingID -Disable WindowsWelcomeExperience -Hide WindowsTips -Enable SettingsSuggestedContent -Hide AppsSilentInstalling -Disable WhatsNewInWindows -Disable TailoredExperiences -Disable BingSearch -Disable #endregion Privacy & Telemetry #region UI & Personalization ThisPC -Show CheckBoxes -Disable HiddenItems -Enable FileExtensions -Show MergeConflicts -Show OpenFileExplorerTo -ThisPC FileExplorerCompactMode -Disable OneDriveFileExplorerAd -Hide SnapAssistFlyout -Enable SnapAssist -Disable FileTransferDialog -Detailed RecycleBinDeleteConfirmation -Enable QuickAccessRecentFiles -Hide QuickAccessFrequentFolders -Hide TaskbarAlignment -Center TaskbarSearch -Hide TaskViewButton -Hide TaskbarWidgets -Hide TaskbarChat -Hide ControlPanelView -LargeIcons WindowsColorMode -Dark AppColorMode -Dark FirstLogonAnimation -Disable JPEGWallpapersQuality -Max TaskManagerWindow -Expanded RestartNotification -Show ShortcutsSuffix -Disable PrtScnSnippingTool -Enable AppsLanguageSwitch -Enable AeroShaking -Enable UnpinTaskbarShortcuts -Shortcuts Edge, Store #endregion UI & Personalization #region OneDrive #endregion OneDrive #region System StorageSense -Enable StorageSenseFrequency -Month StorageSenseTempFiles -Enable Hibernation -Disable Win32LongPathLimit -Disable BSoDStopError -Enable AdminApprovalMode -Never MappedDrivesAppElevatedAccess -Enable DeliveryOptimization -Disable WaitNetworkStartup -Enable WindowsManageDefaultPrinter -Disable WindowsFeatures -Disable WindowsCapabilities -Uninstall UpdateMicrosoftProducts -Enable PowerPlan -High LatestInstalled.NET -Enable NetworkAdaptersSavePower -Disable IPv6Component -Disable InputMethod -English SetUserShellFolderLocation -Root WinPrtScrFolder -Desktop RecommendedTroubleshooting -Automatically FoldersLaunchSeparateProcess -Enable ReservedStorage -Disable F1HelpPage -Disable NumLock -Enable StickyShift -Disable Autoplay -Disable ThumbnailCacheRemoval -Disable SaveRestartableApps -Enable NetworkDiscovery -Enable ActiveHours -Automatically RestartDeviceAfterUpdate -Enable DefaultTerminalApp -WindowsTerminal InstallVCRedistx64 InstallDotNetRuntime6 #endregion System #region WSL #endregion WSL #region Start menu RunPowerShellShortcut -Elevated #endregion Start menu #region UWP apps HEIF -Install CortanaAutostart -Disable TeamsAutostart -Disable UninstallUWPApps CheckUWPAppsUpdates #endregion UWP apps #region Gaming XboxGameBar -Disable XboxGameTips -Disable GPUScheduling -Enable SetAppGraphicsPerformance #endregion Gaming #region Scheduled tasks CleanupTask -Register SoftwareDistributionTask -Register TempTask -Register #endregion Scheduled tasks #region Microsoft Defender & Security NetworkProtection -Enable PUAppsDetection -Enable AuditProcess -Enable CommandLineProcessAudit -Enable EventViewerCustomView -Enable PowerShellModulesLogging -Enable PowerShellScriptsLogging -Enable AppsSmartScreen -Disable SaveZoneInformation -Disable DismissMSAccount DismissSmartScreenFilter #endregion Microsoft Defender & Security #region Context menu MSIExtractContext -Show CABInstallContext -Show RunAsDifferentUserContext -Show CastToDeviceContext -Hide ShareContext -Hide EditWithPhotosContext -Hide CreateANewVideoContext -Hide PrintCMDContext -Hide IncludeInLibraryContext -Hide SendToContext -Hide BitLockerContext -Hide CompressedFolderNewContext -Hide MultipleInvokeContext -Enable UseStoreOpenWith -Hide OpenWindowsTerminalContext -Hide OpenWindowsTerminalAdminContext -Show Windows10ContextMenu -Disable #endregion Context menu #region Update Policies UpdateLGPEPolicies #endregion Update Policies RefreshEnvironment Errors