diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore index 8250ba0..2b37bba 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,8 @@ $RECYCLE.BIN/ *.Package.ps1 CustomMenu.inf *.zip -ChangeLog_Full.md \ No newline at end of file +ChangeLog_Full.md +Optimize-Offline_*/* +OfflineTemp_*/* +oscdimg.exe +Configuration_custom.json diff --git a/AMOLED_black_theme.reg b/AMOLED_black_theme.reg new file mode 100644 index 0000000..9891bd1 --- /dev/null +++ b/AMOLED_black_theme.reg @@ -0,0 +1,87 @@ +Windows Registry Editor Version 5.00 + +; Pitch Black Theme preset by AveYo, AccentPalette idea by /u/Egg-Tricky +; for Ctrl+Alt+Del, Logon, Taskbar, Start Menu, Action Center, Title Bar (10 & 11) + +[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent] +[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent] +"AccentColorMenu"=dword:1f000000 ; Window borders and titlebar +"StartColorMenu"=dword:1f202020 ; Modals in UWP ex. Apply new refresh rate in 10 +"AccentPalette"=hex:\ + 00,9d,ff,1f,\ ; Links in action center and apps + 00,9d,ff,1f,\ ; Taskbar icons underline + 00,9d,ff,1f,\ ; Start button hover + 00,9d,ff,1f,\ ; Settings icons and links [Blue] + 00,00,00,00,\ ; Startmenu background / Active taskbar button - IF "EnableTransparency"=dword:00000000 + 00,00,00,00,\ ; Taskbar front and Folders on start list background [None] + 00,00,00,00,\ ; Taskbar background - IF "EnableTransparency"=dword:00000001 + 00,00,00,00 ; Unused + +[-HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent] +[HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent] +"AccentColorMenu"=dword:1f000000 ; Window borders and titlebar +"StartColorMenu"=dword:1f202020 ; Modals in UWP ex. Apply new refresh rate in 10 +"AccentPalette"=hex:\ + 00,9d,ff,1f,\ ; Links in action center and apps + 00,9d,ff,1f,\ ; Taskbar icons underline + 00,9d,ff,1f,\ ; Start button hover + 00,9d,ff,1f,\ ; Settings icons and links [Blue] + 00,00,00,00,\ ; Startmenu background / Active taskbar button - IF "EnableTransparency"=dword:00000000 + 00,00,00,00,\ ; Taskbar front and Folders on start list background [None] + 00,00,00,00,\ ; Taskbar background - IF "EnableTransparency"=dword:00000001 + 00,00,00,00 ; Unused + +[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\DWM] +[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\DWM] +"ColorPrevalence"=dword:00000001 ; Show accent color on Title bars and window borders [x] +"AccentColor"=dword:1f000000 ; Active title bars - black unsupported in the UI but works with AccentPalette +"AccentColorInactive"=dword:1f202020 ; Inactive title bars + +[-HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\DWM] +[HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\DWM] +"ColorPrevalence"=dword:00000001 ; Show accent color on Title bars and window borders [x] +"AccentColor"=dword:1f000000 ; Active title bars - black unsupported in the UI but works with AccentPalette +"AccentColorInactive"=dword:1f202020 ; Inactive title bars + +[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize] +[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize] +"ColorPrevalence"=dword:00000001 ; Show accent color on Start, taskbar and action center [x] +"AppsUseLightTheme"=dword:00000000 ; Apps mode [Dark] +"SystemUsesLightTheme"=dword:00000000 ; Windows mode [Dark] +"EnabledBlurBehind"=dword:00000001 ; Blur [x] +"EnableTransparency"=dword:00000000 ; Transparency [] + +[-HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize] +[HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize] +"ColorPrevalence"=dword:00000001 ; Show accent color on Start, taskbar and action center [x] +"AppsUseLightTheme"=dword:00000000 ; Apps mode [Dark] +"SystemUsesLightTheme"=dword:00000000 ; Windows mode [Dark] +"EnabledBlurBehind"=dword:00000001 ; Blur [x] +"EnableTransparency"=dword:00000000 ; Transparency [] + +[-HKEY_CURRENT_USER\Control Panel\Colors] +[HKEY_CURRENT_USER\Control Panel\Colors] +"Hilight"="0 157 255" ; [Blue] +"HotTrackingColor"="0 157 255" +"MenuHilight"="0 157 255" + +[-HKEY_USERS\.DEFAULT\Control Panel\Colors] +[HKEY_USERS\.DEFAULT\Control Panel\Colors] +"Hilight"="0 157 255" ; [Blue] +"HotTrackingColor"="0 157 255" +"MenuHilight"="0 157 255" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] +"Background"="0 0 0" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System] +"DisableAcrylicBackgroundOnLogon"=dword:00000001 ; AveYo: enable pure black logon on 11 +"DisableLogonBackgroundImage"=dword:00000001 ; enable solid color logon - separate undo.reg provided + +[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Personalization] +"PersonalColors_Background"="#000000" ; AveYo: this is what was missing to make Ctrl+Alt+Del background black as well +"PersonalColors_Accent"=- +"NoLockScreen"=dword:00000001 ; no lock screen entirely - separate undo.reg provided + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DWM] +; done - log off and back on to see all changes \ No newline at end of file diff --git a/ChangeLog.md b/ChangeLog.md index e81961b..0a73f7e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,14 @@ # ChangeLog # +## Build 4.0.1.9 (09-12-2021) ## + +- Optimize-Offline's native ISO creation function has been re-written and now supports PowerShell 6+. +- The names of the Biometric FOD packages that are automatically removed when the BioEnrollment System Application has been removed are now displayed and logged. +- Added the disabling of Windows Taskbar Interests and News. +- Additional framework code changes and other core module updates. + +**NOTE: A very small update was added on 09-16-2021 that adds 21H2 to the Get-ImageData function as well as the module manifest.** + ## Build 4.0.1.8 (06-22-2021) ## **NOTE: Updates should resume with the same frequency as before.** @@ -44,12 +53,3 @@ - Updated the Win32Calc integration image package to correct a bug where selecting 'Unit Conversion' from its drop-down list would cause the Win32Calc.exe to close immediately. - Updated the Resource Function that returns the metadata for any images being optimized. - Additional Optimize-Offline code improvements. - -## Build 4.0.1.4 (08-23-2020) ## - -- Added support for Windows 10 build 19042 (20H2). -- Added the new 20H2 Start Menu Experience to the applied registry settings. -- Corrected an issue for Windows 10 builds 19041+ where it occasionally would be returned as an unsupported image build. -- Updated the Windows Store bundle packages. -- Updated the optional Set-Additional runtime script. -- Multiple code improvements across the framework. diff --git a/ClassicFileExplorer.reg b/ClassicFileExplorer.reg new file mode 100644 index 0000000..c76d0f8 Binary files /dev/null and b/ClassicFileExplorer.reg differ diff --git a/Configuration.json b/Configuration.json index d5ca3aa..60eaf49 100644 --- a/Configuration.json +++ b/Configuration.json @@ -2,35 +2,57 @@ "_Info": [ "This is a JSON based Configuration file for Optimize-Offline.", "Ensure proper formatting is used when editing the JSON parameter values.", - "Boolean parameter values use true and false. String parameter values must be enclosed in double-quotes." + "Boolean parameter values use true and false. String parameter values must be enclosed in double-quotes.", + "WindowsApps, SystemApps, Capabilities, Packages : All | None | Select | Whitelist | Blacklist", + "FeaturesToEnable, FeaturesToDisable : All | None | Select | List", + "Services : None | Select | List | Advanced" ], - "SourcePath": "Path:\\To\\SourceImage", - "WindowsApps": "Select", - "SystemApps": true, - "Capabilities": true, - "Packages": false, - "Features": true, + "SourcePath": "D:\\1\\22000.651.220407-1302.CO_RELEASE_SVC_PROD2_CLIENT_X64FRE_EN-US.iso", + "WindowsApps": "Whitelist", + "SystemApps": "Whitelist", + "Capabilities": "Whitelist", + "Packages": "Whitelist", + "FeaturesToEnable": "List", + "FeaturesToDisable": "List", + "Services": "Advanced", "DeveloperMode": false, "WindowsStore": false, "MicrosoftEdge": false, "Win32Calc": true, - "Dedup": true, - "DaRT": [ - "Setup", - "Recovery" - ], + "DormantDefender": true, + "Dedup": false, + "DaRT": [], "Registry": true, "Additional": { - "Setup": false, + "Setup": true, "Wallpaper": false, "SystemLogo": false, "LockScreen": false, - "RegistryTemplates": false, + "RegistryTemplates": true, "LayoutModification": false, - "Unattend": false, - "Drivers": false, - "NetFx3": false + "Unattend": true, + "Drivers": true, + "NetFx3": true }, "ComponentCleanup": false, - "ISO": "No-Prompt" -} \ No newline at end of file + "ISO": "No-Prompt", + "CompressionType": "Solid", + "SelectiveRegistry": { + "DisableWindowsUpgrade": false, + "DisableWindowsUpdateMicrosoft": false, + "DisableDriverUpdate": true, + "DormantOneDrive": true, + "Disable3rdPartyApps": true, + "W11ClassicContextMenu": true, + "ClassicSearchExplorer": true, + "RemoveTaskbarPinnedIcons": true, + "DisableTeamsApp": true, + "DisableVirtualizationSecurity": true, + "RunAsTiContextMenu": true, + "AmoledBlackTheme": true, + "ClassicFileExplorer": true + }, + "Miscellaneous": { + "ShutDownOnComplete": false + } +} diff --git a/Content/Additional/RegistryTemplates/Additional Tweaks.reg b/Content/Additional/RegistryTemplates/Additional Tweaks.reg index 6d5f09a..5586212 100644 Binary files a/Content/Additional/RegistryTemplates/Additional Tweaks.reg and b/Content/Additional/RegistryTemplates/Additional Tweaks.reg differ diff --git a/Content/Additional/SelectiveRegistry/AMOLED_black_theme.reg b/Content/Additional/SelectiveRegistry/AMOLED_black_theme.reg new file mode 100644 index 0000000..9891bd1 --- /dev/null +++ b/Content/Additional/SelectiveRegistry/AMOLED_black_theme.reg @@ -0,0 +1,87 @@ +Windows Registry Editor Version 5.00 + +; Pitch Black Theme preset by AveYo, AccentPalette idea by /u/Egg-Tricky +; for Ctrl+Alt+Del, Logon, Taskbar, Start Menu, Action Center, Title Bar (10 & 11) + +[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent] +[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent] +"AccentColorMenu"=dword:1f000000 ; Window borders and titlebar +"StartColorMenu"=dword:1f202020 ; Modals in UWP ex. Apply new refresh rate in 10 +"AccentPalette"=hex:\ + 00,9d,ff,1f,\ ; Links in action center and apps + 00,9d,ff,1f,\ ; Taskbar icons underline + 00,9d,ff,1f,\ ; Start button hover + 00,9d,ff,1f,\ ; Settings icons and links [Blue] + 00,00,00,00,\ ; Startmenu background / Active taskbar button - IF "EnableTransparency"=dword:00000000 + 00,00,00,00,\ ; Taskbar front and Folders on start list background [None] + 00,00,00,00,\ ; Taskbar background - IF "EnableTransparency"=dword:00000001 + 00,00,00,00 ; Unused + +[-HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent] +[HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent] +"AccentColorMenu"=dword:1f000000 ; Window borders and titlebar +"StartColorMenu"=dword:1f202020 ; Modals in UWP ex. Apply new refresh rate in 10 +"AccentPalette"=hex:\ + 00,9d,ff,1f,\ ; Links in action center and apps + 00,9d,ff,1f,\ ; Taskbar icons underline + 00,9d,ff,1f,\ ; Start button hover + 00,9d,ff,1f,\ ; Settings icons and links [Blue] + 00,00,00,00,\ ; Startmenu background / Active taskbar button - IF "EnableTransparency"=dword:00000000 + 00,00,00,00,\ ; Taskbar front and Folders on start list background [None] + 00,00,00,00,\ ; Taskbar background - IF "EnableTransparency"=dword:00000001 + 00,00,00,00 ; Unused + +[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\DWM] +[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\DWM] +"ColorPrevalence"=dword:00000001 ; Show accent color on Title bars and window borders [x] +"AccentColor"=dword:1f000000 ; Active title bars - black unsupported in the UI but works with AccentPalette +"AccentColorInactive"=dword:1f202020 ; Inactive title bars + +[-HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\DWM] +[HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\DWM] +"ColorPrevalence"=dword:00000001 ; Show accent color on Title bars and window borders [x] +"AccentColor"=dword:1f000000 ; Active title bars - black unsupported in the UI but works with AccentPalette +"AccentColorInactive"=dword:1f202020 ; Inactive title bars + +[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize] +[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize] +"ColorPrevalence"=dword:00000001 ; Show accent color on Start, taskbar and action center [x] +"AppsUseLightTheme"=dword:00000000 ; Apps mode [Dark] +"SystemUsesLightTheme"=dword:00000000 ; Windows mode [Dark] +"EnabledBlurBehind"=dword:00000001 ; Blur [x] +"EnableTransparency"=dword:00000000 ; Transparency [] + +[-HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize] +[HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize] +"ColorPrevalence"=dword:00000001 ; Show accent color on Start, taskbar and action center [x] +"AppsUseLightTheme"=dword:00000000 ; Apps mode [Dark] +"SystemUsesLightTheme"=dword:00000000 ; Windows mode [Dark] +"EnabledBlurBehind"=dword:00000001 ; Blur [x] +"EnableTransparency"=dword:00000000 ; Transparency [] + +[-HKEY_CURRENT_USER\Control Panel\Colors] +[HKEY_CURRENT_USER\Control Panel\Colors] +"Hilight"="0 157 255" ; [Blue] +"HotTrackingColor"="0 157 255" +"MenuHilight"="0 157 255" + +[-HKEY_USERS\.DEFAULT\Control Panel\Colors] +[HKEY_USERS\.DEFAULT\Control Panel\Colors] +"Hilight"="0 157 255" ; [Blue] +"HotTrackingColor"="0 157 255" +"MenuHilight"="0 157 255" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] +"Background"="0 0 0" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System] +"DisableAcrylicBackgroundOnLogon"=dword:00000001 ; AveYo: enable pure black logon on 11 +"DisableLogonBackgroundImage"=dword:00000001 ; enable solid color logon - separate undo.reg provided + +[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Personalization] +"PersonalColors_Background"="#000000" ; AveYo: this is what was missing to make Ctrl+Alt+Del background black as well +"PersonalColors_Accent"=- +"NoLockScreen"=dword:00000001 ; no lock screen entirely - separate undo.reg provided + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DWM] +; done - log off and back on to see all changes \ No newline at end of file diff --git a/Content/Additional/SelectiveRegistry/RunAsTi.reg b/Content/Additional/SelectiveRegistry/RunAsTi.reg new file mode 100644 index 0000000..6eb192d --- /dev/null +++ b/Content/Additional/SelectiveRegistry/RunAsTi.reg @@ -0,0 +1,121 @@ +Windows Registry Editor Version 5.00 + +; Context Menu entries to use RunAsTI - lean and mean snippet by AveYo, 2018-2022 +; [FEATURES] +; - innovative HKCU load, no need for reg load / unload ping-pong; programs get the user profile +; - sets ownership privileges, high priority, and explorer support; get System if TI unavailable +; - accepts special characters in paths for which default run as administrator fails +; - show on the new 11 contextmenu via whitelisted id; plenty other available, f**k needing an app! +; 2022.01.28: workaround for 11 release (22000) hindering explorer as TI; fix 7 args + +[-HKEY_CLASSES_ROOT\RunAsTI] +[-HKEY_CLASSES_ROOT\batfile\shell\setdesktopwallpaper] +[-HKEY_CLASSES_ROOT\cmdfile\shell\setdesktopwallpaper] +[-HKEY_CLASSES_ROOT\exefile\shell\setdesktopwallpaper] +[-HKEY_CLASSES_ROOT\mscfile\shell\setdesktopwallpaper] +[-HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\shell\setdesktopwallpaper] +[-HKEY_CLASSES_ROOT\regfile\shell\setdesktopwallpaper] +[-HKEY_CLASSES_ROOT\Folder\shell\setdesktopwallpaper] +[-HKEY_CLASSES_ROOT\Directory\background\shell\extract] +; To remove entries, copy paste above into undo_RunAsTI.reg file, then import it + +; RunAsTI on .bat +[HKEY_CLASSES_ROOT\batfile\shell\setdesktopwallpaper] +"MUIVerb"="Run as trustedinstaller" +"HasLUAShield"="" +"Icon"="powershell.exe,0" +[HKEY_CLASSES_ROOT\batfile\shell\setdesktopwallpaper\command] +@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -win 1 -nop -c iex((10..39|%%{(gp 'Registry::HKCR\\RunAsTI' $_ -ea 0).$_})-join[char]10); # --%% \"%L\"" + +; RunAsTI on .cmd +[HKEY_CLASSES_ROOT\cmdfile\shell\setdesktopwallpaper] +"MUIVerb"="Run as trustedinstaller" +"HasLUAShield"="" +"Icon"="powershell.exe,0" +[HKEY_CLASSES_ROOT\cmdfile\shell\setdesktopwallpaper\command] +@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -win 1 -nop -c iex((10..39|%%{(gp 'Registry::HKCR\\RunAsTI' $_ -ea 0).$_})-join[char]10); # --%% \"%L\"" + +; RunAsTI on .exe +[HKEY_CLASSES_ROOT\exefile\shell\setdesktopwallpaper] +"MUIVerb"="Run as trustedinstaller" +"HasLUAShield"="" +"Icon"="powershell.exe,0" +[HKEY_CLASSES_ROOT\exefile\shell\setdesktopwallpaper\command] +@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -win 1 -nop -c iex((10..39|%%{(gp 'Registry::HKCR\\RunAsTI' $_ -ea 0).$_})-join[char]10); # --%% \"%L\"" + +; RunAsTI on .msc +[HKEY_CLASSES_ROOT\mscfile\shell\setdesktopwallpaper] +"MUIVerb"="Run as trustedinstaller" +"HasLUAShield"="" +"Icon"="powershell.exe,0" +[HKEY_CLASSES_ROOT\mscfile\shell\setdesktopwallpaper\command] +@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -win 1 -nop -c iex((10..39|%%{(gp 'Registry::HKCR\\RunAsTI' $_ -ea 0).$_})-join[char]10); # --%% \"%L\"" + +; RunAsTI on .ps1 +[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\shell\setdesktopwallpaper] +"MUIVerb"="Run as trustedinstaller" +"HasLUAShield"="" +"Icon"="powershell.exe,0" +[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\shell\setdesktopwallpaper\command] +@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -win 1 -nop -c iex((10..39|%%{(gp 'Registry::HKCR\\RunAsTI' $_ -ea 0).$_})-join[char]10); # --%% powershell -nop -c iex((gc -lit '%L')-join[char]10)" + +; RunAsTI on .reg +[HKEY_CLASSES_ROOT\regfile\shell\setdesktopwallpaper] +"MUIVerb"="Import as trustedinstaller" +"HasLUAShield"="" +"Icon"="powershell.exe,0" +[HKEY_CLASSES_ROOT\regfile\shell\setdesktopwallpaper\command] +@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -win 1 -nop -c iex((10..39|%%{(gp 'Registry::HKCR\\RunAsTI' $_ -ea 0).$_})-join[char]10); # --%% regedit /s \"%L\"" + +; RunAsTI on Folder +[HKEY_CLASSES_ROOT\Folder\shell\setdesktopwallpaper] +"MuiVerb"="Open as trustedinstaller" +"HasLUAShield"="" +"Icon"="powershell.exe,0" +"AppliesTo"="NOT System.ParsingName:=\"::{645FF040-5081-101B-9F08-00AA002F954E}\"" +[HKEY_CLASSES_ROOT\Folder\shell\setdesktopwallpaper\command] +@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -win 1 -nop -c iex((10..39|%%{(gp 'Registry::HKCR\\RunAsTI' $_ -ea 0).$_})-join[char]10); # --%% \"%L\"" + +; Open Powershell as trustedinstaller here +[HKEY_CLASSES_ROOT\Directory\background\shell\extract] +"MuiVerb"="Powershell as trustedinstaller" +"HasLUAShield"="" +"NoWorkingDirectory"="" +"Position"="Middle" +"Icon"="powershell.exe,0" +[HKEY_CLASSES_ROOT\Directory\background\shell\extract\command] +@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -win 1 -nop -c iex((10..39|%%{(gp 'Registry::HKCR\\RunAsTI' $_ -ea 0).$_})-join[char]10); # --%% cmd /c set \"1=%V\"& start powershell -nop -noe -c $host.ui.RawUI.WindowTitle=$(whoami); set-location -lit $env:1" + +; RunAsTI function +[HKEY_CLASSES_ROOT\RunAsTI] +"10"="function RunAsTI ($cmd,$arg) { $id='RunAsTI'; $key=\"Registry::HKU\\$(((whoami /user)-split' ')[-1])\\Volatile Environment\"; $code=@'" +"11"=" $I=[int32]; $M=$I.module.gettype(\"System.Runtime.Interop`Services.Mar`shal\"); $P=$I.module.gettype(\"System.Int`Ptr\"); $S=[string]" +"12"=" $D=@(); $T=@(); $DM=[AppDomain]::CurrentDomain.\"DefineDynami`cAssembly\"(1,1).\"DefineDynami`cModule\"(1); $Z=[uintptr]::size " +"13"=" 0..5|% {$D += $DM.\"Defin`eType\"(\"AveYo_$_\",1179913,[ValueType])}; $D += [uintptr]; 4..6|% {$D += $D[$_].\"MakeByR`efType\"()}" +"14"=" $F='kernel','advapi','advapi', ($S,$S,$I,$I,$I,$I,$I,$S,$D[7],$D[8]), ([uintptr],$S,$I,$I,$D[9]),([uintptr],$S,$I,$I,[byte[]],$I)" +"15"=" 0..2|% {$9=$D[0].\"DefinePInvok`eMethod\"(('CreateProcess','RegOpenKeyEx','RegSetValueEx')[$_],$F[$_]+'32',8214,1,$S,$F[$_+3],1,4)}" +"16"=" $DF=($P,$I,$P),($I,$I,$I,$I,$P,$D[1]),($I,$S,$S,$S,$I,$I,$I,$I,$I,$I,$I,$I,[int16],[int16],$P,$P,$P,$P),($D[3],$P),($P,$P,$I,$I)" +"17"=" 1..5|% {$k=$_; $n=1; $DF[$_-1]|% {$9=$D[$k].\"Defin`eField\"('f' + $n++, $_, 6)}}; 0..5|% {$T += $D[$_].\"Creat`eType\"()}" +"18"=" 0..5|% {nv \"A$_\" ([Activator]::CreateInstance($T[$_])) -fo}; function F ($1,$2) {$T[0].\"G`etMethod\"($1).invoke(0,$2)}" +"19"=" $TI=(whoami /groups)-like'*1-16-16384*'; $As=0; if(!$cmd) {$cmd='control';$arg='admintools'}; if ($cmd-eq'This PC'){$cmd='file:'}" +"20"=" if (!$TI) {'TrustedInstaller','lsass','winlogon'|% {if (!$As) {$9=sc.exe start $_; $As=@(get-process -name $_ -ea 0|% {$_})[0]}}" +"21"=" function M ($1,$2,$3) {$M.\"G`etMethod\"($1,[type[]]$2).invoke(0,$3)}; $H=@(); $Z,(4*$Z+16)|% {$H += M \"AllocHG`lobal\" $I $_}" +"22"=" M \"WriteInt`Ptr\" ($P,$P) ($H[0],$As.Handle); $A1.f1=131072; $A1.f2=$Z; $A1.f3=$H[0]; $A2.f1=1; $A2.f2=1; $A2.f3=1; $A2.f4=1" +"23"=" $A2.f6=$A1; $A3.f1=10*$Z+32; $A4.f1=$A3; $A4.f2=$H[1]; M \"StructureTo`Ptr\" ($D[2],$P,[boolean]) (($A2 -as $D[2]),$A4.f2,$false)" +"24"=" $Run=@($null, \"powershell -win 1 -nop -c iex `$env:R; # $id\", 0, 0, 0, 0x0E080600, 0, $null, ($A4 -as $T[4]), ($A5 -as $T[5]))" +"25"=" F 'CreateProcess' $Run; return}; $env:R=''; rp $key $id -force; $priv=[diagnostics.process].\"GetM`ember\"('SetPrivilege',42)[0]" +"26"=" 'SeSecurityPrivilege','SeTakeOwnershipPrivilege','SeBackupPrivilege','SeRestorePrivilege' |% {$priv.Invoke($null, @(\"$_\",2))}" +"27"=" $HKU=[uintptr][uint32]2147483651; $NT='S-1-5-18'; $reg=($HKU,$NT,8,2,($HKU -as $D[9])); F 'RegOpenKeyEx' $reg; $LNK=$reg[4]" +"28"=" function L ($1,$2,$3) {sp 'Registry::HKCR\\AppID\\{CDCBCFCA-3CDC-436f-A4E2-0E02075250C2}' 'RunAs' $3 -force -ea 0" +"29"=" $b=[Text.Encoding]::Unicode.GetBytes(\"\\Registry\\User\\$1\"); F 'RegSetValueEx' @($2,'SymbolicLinkValue',0,6,[byte[]]$b,$b.Length)}" +"30"=" function Q {[int](gwmi win32_process -filter 'name=\"explorer.exe\"'|?{$_.getownersid().sid-eq$NT}|select -last 1).ProcessId}" +"31"=" $11bug=($((gwmi Win32_OperatingSystem).BuildNumber)-eq'22000')-AND(($cmd-eq'file:')-OR(test-path -lit $cmd -PathType Container))" +"32"=" if ($11bug) {'System.Windows.Forms','Microsoft.VisualBasic' |% {$9=[Reflection.Assembly]::LoadWithPartialName(\"'$_\")}}" +"33"=" if ($11bug) {$path='^(l)'+$($cmd -replace '([\\+\\^\\%\\~\\(\\)\\[\\]])','{$1}')+'{ENTER}'; $cmd='control.exe'; $arg='admintools'}" +"34"=" L ($key-split'\\\\')[1] $LNK ''; $R=[diagnostics.process]::start($cmd,$arg); if ($R) {$R.PriorityClass='High'; $R.WaitForExit()}" +"35"=" if ($11bug) {$w=0; do {if($w-gt40){break}; sleep -mi 250;$w++} until (Q); [Microsoft.VisualBasic.Interaction]::AppActivate($(Q))}" +"36"=" if ($11bug) {[Windows.Forms.SendKeys]::SendWait($path)}; do {sleep 7} while(Q); L '.Default' $LNK 'Interactive User'" +"37"="'@; $V='';'cmd','arg','id','key'|%{$V+=\"`n`$$_='$($(gv $_ -val)-replace\"'\",\"''\")';\"}; sp $key $id $($V,$code) -type 7 -force -ea 0" +"38"=" start powershell -args \"-win 1 -nop -c `n$V `$env:R=(gi `$key -ea 0).getvalue(`$id)-join''; iex `$env:R\" -verb runas" +"39"="}; $A=([environment]::commandline-split'-[-]%+ ?',2)[1]-split'\"([^\"]+)\"|([^ ]+)',2|%{$_.Trim(' \"')}; RunAsTI $A[1] $A[2]; # AveYo, 2022.01.28" +; diff --git a/Content/Additional/SelectiveRegistry/SelectiveRegistry.ps1 b/Content/Additional/SelectiveRegistry/SelectiveRegistry.ps1 new file mode 100644 index 0000000..128c9c1 --- /dev/null +++ b/Content/Additional/SelectiveRegistry/SelectiveRegistry.ps1 @@ -0,0 +1,182 @@ +RegHives -Load +If($SelectiveRegistry.DisableWindowsUpgrade) { + + $TargetReleaseVersionInfo = $null + + Switch ($Global:InstallInfo.Build) { + "17134" { $TargetReleaseVersionInfo = "1803" } + "17763" { $TargetReleaseVersionInfo = "1809" } + "18362" { $TargetReleaseVersionInfo = "1903" } + "18363" { $TargetReleaseVersionInfo = "1909" } + "19041" { $TargetReleaseVersionInfo = "2004" } + "19042" { $TargetReleaseVersionInfo = "2009" } + "19043" { $TargetReleaseVersionInfo = "21H1" } + } + + If ($Global:InstallInfo.Build -ge "19044") { + $TargetReleaseVersionInfo = "21H2" + } + + If ($Global:InstallInfo.Build -ge "22500") { + $TargetReleaseVersionInfo = "22H2" + } + + If ($TargetReleaseVersionInfo){ + + Log $OptimizeData.SelectiveRegistryWindowsUpgrade + + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -Type DWord -Value "2" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoUpdate" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "DeferUpdatePeriod" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "DeferUpgrade" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "DeferUpgradePeriod" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "TargetReleaseVersion" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "TargetReleaseVersionInfo" -Type String -Value $TargetReleaseVersionInfo + + If ($Global:InstallInfo.Build -ge "17134" -and $Global:InstallInfo.Build -le "20348") { RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "ProductVersion" -Type String -Value "Windows 10" } + + If ($Global:InstallInfo.Build -ge "22000") { RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "ProductVersion" -Type String -Value "Windows 11" } + + } + Start-Sleep 1 +} +If($SelectiveRegistry.DisableWindowsUpdateMicrosoft) { + Log $OptimizeData.SelectiveRegistryWindowsUpdateMS + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "DoNotConnectToWindowsUpdateInternetLocations" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "DisableWindowsUpdateAccess" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "WUServer" -Type String -Value " " + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "WUStatusServer" -Type String -Value " " + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "UpdateServiceUrlAlternate" -Type String -Value " " + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "UseWUServer" -Type DWord -Value "1" + Start-Sleep 1 +} + +If($SelectiveRegistry.DisableDriverUpdate) { + Log $OptimizeData.SelectiveRegistryDriverUpdate + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Device Metadata" -Name "PreventDeviceMetadataFromNetwork" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "DontPromptForWindowsUpdate" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "DontSearchWindowsUpdate" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "DriverUpdateWizardWuSearchEnabled" -Type DWord -Value "0" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "SearchOrderConfig" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "ExcludeWUDriversInQualityUpdate" -Type DWord -Value "1" + Start-Sleep 1 +} + +If($SelectiveRegistry.DormantOneDrive) { + Log $OptimizeData.SelectiveRegistryDormantOneDrive + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "OneDriveSetup" -Type DWord -Value "0" + Start-Sleep 1 +} + +If ($SelectiveRegistry.Disable3rdPartyApps) { + + Log $OptimizeData.SelectiveRegistryDisable3rdPartyApps + + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "OemPreInstalledAppsEnabled" -Type Dword -Value "0" + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "PreInstalledAppsEnabled" -Type Dword -Value "0" + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SilentInstalledAppsEnabled" -Type Dword -Value "0" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Type Dword -Value "1" + + If ($Global:InstallInfo.Build -ge "22000") { + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\PolicyManager\current\device\Start" -Name "ConfigureStartPins" -Type String -Value '{"pinnedList": [{}]}' + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\PolicyManager\current\device\Start" -Name "ConfigureStartPins_ProviderSet" -Type Dword -Value "0" + } + Start-Sleep 1 +} + +# classic search in explorer +If($SelectiveRegistry.ClassicSearchExplorer -and $Global:InstallInfo.Build -ge '18363') { + + Log $OptimizeData.SelectiveRegistryClassicSearchExplorer + + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{1d64637d-31e9-4b06-9124-e83fb178ac6e}\TreatAs" -Name "(default)" -Value "{64bc32b5-4eec-4de7-972d-bd8bd0324537}" -Type String -Force + + Start-Sleep 1 +} + +If($SelectiveRegistry.RemoveTaskbarPinnedIcons){ + + Log $OptimizeData.SelectiveRegistryRemoveTaskbarPinnedIcons + + ## Disable taskbar taskview button + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" -Type Dword -Value "0" -Force + + If($Global:InstallInfo.Build -ge '18362') { + #Hide MeetNow icon in taskbar + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "HideSCAMeetNow" -Type dword -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "HideSCAMeetNow" -Type dword -Value "1" + } + + if($Global:InstallInfo.Build -le '19044'){ + RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\Windows\Explorer" -Name "NoPinningStoreToTaskbar" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins" -Name "MailPin" -Value 2 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" -Name "PeopleBand" -Value 0 -Type DWord + } + + # Disable News & Interests icon + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Feeds" -Name "ShellFeedsTaskbarViewMode" -Type dword -Value "2" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" -Name "EnableFeeds" -Type dword -Value "0" + + If($Global:InstallInfo.Build -ge '22000') { + #Remove Chat icon in taskbar + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Chat" -Name "ChatIcon" -Type dword -Value "3" + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarMn" -Type dword -Value "0" + + ## Disable widgets button + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarDa" -Type Dword -Value "0" -Force + } + + Start-Sleep 1 + +} + +If($SelectiveRegistry.W11ClassicContextMenu -and $Global:InstallInfo.Build -ge '22000') { + Log $OptimizeData.SelectiveRegistryW11ClassicContextMenu + # Classic context menus + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" -Name "(default)" -Value "" -Type String -Force + Start-Sleep 1 +} + +if($SelectiveRegistry.DisableTeamsApp -and $Global:InstallInfo.Build -ge '10240') { + Log $OptimizeData.SelectiveRegistryDisableTeamsApp + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" -Name "ConfigureChatAutoInstall" -Value "0" -Type DWord -Force + Start-Sleep 1 +} + +if($SelectiveRegistry.DisableVirtualizationSecurity -and $Global:InstallInfo.Build -ge '22000') { + Log $OptimizeData.SelectiveRegistryDisableVirtualizationSecurity + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Control\DeviceGuard\Scenarios" -Name "HypervisorEnforcedCodeIntegrity" -Value "0" -Type DWord -Force + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Control\DeviceGuard" -Name "EnableVirtualizationBasedSecurity" -Value "0" -Type DWord -Force + Start-Sleep 1 +} + +if($SelectiveRegistry.RunAsTiContextMenu){ + Log $OptimizeData.SelectiveRegistryRunAsTiContextMenu + Import-Registry -Path (Get-ChildItem -Path $OptimizeOffline.SelectiveRegistry -Filter RunAsTi.reg).FullName + Start-Sleep 1 +} + +if ($SelectiveRegistry.ExplorerUIRibbon) { + if ($Global:InstallInfo.Build -le "19044"){ + Log $OptimizeData.SelectiveRegistryExplorerUIRibbon + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{e2bf9676-5f8f-435c-97eb-11607a5bedf7}" -Value "" -Type String -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{e2bf9676-5f8f-435c-97eb-11607a5bedf7}" -Value "" -Type String -Force + Start-Sleep 1 + } elseif ($Global:InstallInfo.Build -eq "22000") { + Log $OptimizeData.SelectiveRegistryExplorerUIRibbon + # RegKey -Path "HKLM:\WIM_HKCU\Software\Classes\CLSID\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\InprocServer32" -Name "(default)" -Value "" -Type String -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\InprocServer32" -Name "(default)" -Value "" -Type String -Force + Start-Sleep 1 + } +} + + +if($SelectiveRegistry.AmoledBlackTheme -and $Global:InstallInfo.Build -ge '10240') { + Log $OptimizeData.SelectiveRegistryAmoledBlackTheme + Import-Registry -Path (Get-ChildItem -Path $OptimizeOffline.SelectiveRegistry -Filter AMOLED_black_theme.reg).FullName + Start-Sleep 1 +} + +RegHives -Unload + +Clear-Host diff --git a/Content/Additional/Setup/README.md b/Content/Additional/Setup/README.md index 749d8d7..bc22beb 100644 --- a/Content/Additional/Setup/README.md +++ b/Content/Additional/Setup/README.md @@ -1,7 +1,15 @@ If adding additional user content, place any setup files, scripts or content to be added to the image here. +## Consider the following to assure a successful application of SetupComplete.cmd ## + Any setup content, including answer files, scripts and executables, should ALWAYS be removed immediately after they are run by the installing Administrator unless they are designed for specific tasks when a new user account is created or logs in. Not doing so can allow other users with access to the system to run this content or extract potential sensitive data. This can be automated by adding their automatic removal to the SetupComplete.cmd that is supplied by default. +Typically %WINDIR%\Setup\Scripts\SetupComplete.cmd runs with local system permissions and starts immediately after image installation reaches the desktop. However, if you're image uses "OEM activation" also referred to as "System Locked Pre-installation (SLP)" then SetupComplete.cmd is potentially blocked from running. This is by Microsoft design as stated: SetupComplete.cmd is "disabled when using OEM product keys" [Microsoft Document](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-a-custom-script-to-windows-setup?view=windows-11) + +For the above reasons, post image installation best practice is to is to inspect the contents of the %WINDIR%\Setup\Scripts folder. (1) Confirm successful script application or (2) resolve discovery that SetupComplete.cmd was disabled by running %WINDIR%\Setup\Scripts\Run_TI_SetupComplete_online.cmd which applies the SetupComplete.cmd as Trusted Installer. + +## Additional Script folder Content ## + The Set-Additional and Remove-OneDrive PowerShell scripts can be run by executing their associated Set-Additional.cmd and Remove-OneDrive.cmd scripts by right-clicking them and selecting 'Run as Administrator.' The Set-Additional script is supplied to only be run by users who are familiar with disabling Windows 10 default services and scheduled tasks. If you are unfamiliar with how the Set-Additional script works, or are unsure of what services and/or scheduled tasks it disables, it is strongly recommended to NOT run the script until you understand it in its entirity. The Set-Additional script does back-up the default states of all services and scheduled tasks before it processes their disabling so any can be reverted back to its default state if required. Moreover, prior to running the Set-Additional script, thoroughly inspect both the Services.json and ScheduledTasks.json files to make sure nothing is set to be disabled that will be either be required by the running system or by the end-user. diff --git a/Content/Additional/Setup/Run_TI_SetupComplete_online.cmd b/Content/Additional/Setup/Run_TI_SetupComplete_online.cmd new file mode 100644 index 0000000..ff46d09 --- /dev/null +++ b/Content/Additional/Setup/Run_TI_SetupComplete_online.cmd @@ -0,0 +1,41 @@ +@ECHO OFF +TITLE Run SetupComplete.cmd online as TrustedInstaller + +:: RunAsTI (part 1 of 2) - lean and mean snippet by AveYo Source: https://github.com/AveYo/LeanAndMean +whoami|findstr /i /c:"nt authority\system" >nul || ( call :RunAsTI "%~f0" %* & exit/b ) + +pushd "%~dp0" + +CALL "%~dp0SetupComplete.cmd" + +EXIT + +:: RunAsTI (part 2 of 2) - lean and mean snippet by AveYo Source: https://github.com/AveYo/LeanAndMean +#:RunAsTI: #1 snippet to run as TI/System, with /high priority, /priv ownership, explorer and HKCU load +set ^ #=& set "0=%~f0"& set 1=%*& powershell -nop -c iex(([io.file]::ReadAllText($env:0)-split':RunAsTI\:.*')[1])& exit/b +$_CAN_PASTE_DIRECTLY_IN_POWERSHELL='^,^'; function RunAsTI ($cmd) { $id='RunAsTI'; $sid=((whoami /user)-split' ')[-1]; $code=@' +$ti=(whoami /groups)-like"*1-16-16384*"; $DM=[AppDomain]::CurrentDomain."DefineDynamicAss`embly"(1,1)."DefineDynamicMod`ule"(1) +$D=@(); 0..5|% {$D+=$DM."DefineT`ype"("M$_",1179913,[ValueType])}; $I=[int32];$P=$I.module.gettype("System.Int`Ptr"); $U=[uintptr] +$D+=$U; 4..6|% {$D+=$D[$_]."MakeB`yRefType"()};$M=$I.module.gettype("System.Runtime.Interop`Services.Mar`shal");$Z=[uintptr]::size +$S=[string]; $F="kernel","advapi","advapi",($S,$S,$I,$I,$I,$I,$I,$S,$D[7],$D[8]),($U,$S,$I,$I,$D[9]),($U,$S,$I,$I,[byte[]],$I) +0..2|% {$9=$D[0]."DefinePInvokeMeth`od"(("CreateProcess","RegOpenKeyEx","RegSetValueEx")[$_],$F[$_]+'32',8214,1,$S,$F[$_+3],1,4)} +$DF=0,($P,$I,$P),($I,$I,$I,$I,$P,$D[1]),($I,$S,$S,$S,$I,$I,$I,$I,$I,$I,$I,$I,[int16],[int16],$P,$P,$P,$P),($D[3],$P),($P,$P,$I,$I) +1..5|% {$k=$_;$n=1;$AveYo=1; $DF[$_]|% {$9=$D[$k]."DefineFie`ld"('f'+$n++,$_,6)}}; $T=@(); 0..5|% {$T+=$D[$_]."CreateT`ype"()} +0..5|% {nv "A$_" ([Activator]::CreateInstance($T[$_])) -force}; function F ($1,$2) {$T[0]."GetMeth`od"($1).invoke(0,$2)}; +if (!$ti) { $g=0; "TrustedInstaller","lsass"|% {if (!$g) {net1 start $_ 2>&1 >$null; $g=@(get-process -name $_ -ea 0|% {$_})[0]}} + function M($1,$2,$3){$M."GetMeth`od"($1,[type[]]$2).invoke(0,$3)}; $H=@(); $Z,(4*$Z+16)|% {$H+=M "AllocHG`lobal" $I $_}; + M "WriteInt`Ptr" ($P,$P) ($H[0],$g.Handle); $A1.f1=131072;$A1.f2=$Z;$A1.f3=$H[0];$A2.f1=1;$A2.f2=1;$A2.f3=1;$A2.f4=1;$A2.f6=$A1 + $A3.f1=10*$Z+32;$A4.f1=$A3;$A4.f2=$H[1]; M "StructureTo`Ptr" ($D[2],$P,[boolean]) (($A2 -as $D[2]),$A4.f2,$false); $w=0x0E080600 + $out=@($null,"powershell -win 1 -nop -c iex `$env:A",0,0,0,$w,0,$null,($A4 -as $T[4]),($A5 -as $T[5])); F "CreateProcess" $out +} else { $env:A=''; $PRIV=[uri].module.gettype("System.Diagnostics.Process")."GetMeth`ods"(42) |? {$_.Name -eq "SetPrivilege"} + "SeSecurityPrivilege","SeTakeOwnershipPrivilege","SeBackupPrivilege","SeRestorePrivilege" |% {$PRIV.Invoke(0, @("$_",2))} + $HKU=[uintptr][uint32]2147483651; $LNK=$HKU; $reg=@($HKU,"S-1-5-18",8,2,($LNK -as $D[9])); F "RegOpenKeyEx" $reg; $LNK=$reg[4] + function SYM($1,$2){$b=[Text.Encoding]::Unicode.GetBytes("\Registry\User\$1");@($2,"SymbolicLinkValue",0,6,[byte[]]$b,$b.Length)} + F "RegSetValueEx" (SYM $(($key-split'\\')[1]) $LNK); $EXP="HKLM:\Software\Classes\AppID\{CDCBCFCA-3CDC-436f-A4E2-0E02075250C2}" + $r="explorer"; if (!$cmd) {$cmd='C:\'}; $dir=test-path -lit ((($cmd -split '^("[^"]+")|^([^\s]+)') -ne'')[0].trim('"')) -type 1 + if (!$dir) {$r="start `"$id`" /high /w"}; sp $EXP RunAs '' -force; start cmd -args ("/q/x/d/r title $id && $r",$cmd) -wait -win 1 + do {sleep 7} while ((gwmi win32_process -filter 'name="explorer.exe"'|? {$_.getownersid().sid -eq "S-1-5-18"})) + F "RegSetValueEx" (SYM ".Default" $LNK); sp $EXP RunAs "Interactive User" -force } # lean and mean snippet by AveYo, 2018-2021 +'@; $key="Registry::HKEY_USERS\$sid\Volatile Environment"; $a1="`$id='$id';`$key='$key';";$a2="`$cmd='$($cmd-replace"'","''")';`n" +sp $key $id $($a1,$a2,$code) -type 7 -force; $arg="$a1 `$env:A=(gi `$key).getvalue(`$id)-join'';rp `$key `$id -force; iex `$env:A" +$_PRESS_ENTER='^,^'; start powershell -args "-win 1 -nop -c $arg" -verb runas }; <#,#> RunAsTI $env:1; #:RunAsTI: diff --git a/Content/Additional/Setup/Set-Additional.cmd b/Content/Additional/Setup/Set-Additional.cmd index 99c7670..061cc7c 100644 --- a/Content/Additional/Setup/Set-Additional.cmd +++ b/Content/Additional/Setup/Set-Additional.cmd @@ -9,9 +9,6 @@ IF %ERRORLEVEL% NEQ 0 ( EXIT ) ELSE ( PowerShell.exe -NoProfile -ExecutionPolicy Bypass -File .\Set-Additional.ps1 -Argument 2> .\Set-Additional.error - DEL /F /Q "%~dp0Set-Additional.error" >NUL 2>&1 - DEL /F /Q "%~dp0Set-Additional.ps1" >NUL 2>&1 - DEL /F /Q "%~f0" >NUL 2>&1 ) PAUSE EXIT diff --git a/Content/Additional/Setup/Set-Additional.ps1 b/Content/Additional/Setup/Set-Additional.ps1 index 55576c7..3b7fa57 100644 --- a/Content/Additional/Setup/Set-Additional.ps1 +++ b/Content/Additional/Setup/Set-Additional.ps1 @@ -17,7 +17,7 @@ Function Set-Additional If ((Get-ExecutionPolicy -Scope CurrentUser) -ne 'RemoteSigned') { Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm:$false } If ((Get-ExecutionPolicy -Scope LocalMachine) -ne 'RemoteSigned') { Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Confirm:$false } - # Get the current build number for the Windows 10 version. + # Get the current build number for the Windows version. $Build = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber If (Test-Path -Path .\ScheduledTasks.json) @@ -127,7 +127,10 @@ Function Set-Additional Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Terminal Server Client" -Name DisableClipboardRedirection -Value 1 -Force If (!(Test-Path -Path "HKCU:\Software\Microsoft\Clipboard")) { New-Item -Path "HKCU:\Software\Microsoft\Clipboard" -ItemType Directory -Force | Out-Null } Set-ItemProperty -Path "HKCU:\Software\Microsoft\Clipboard" -Name EnableClipboardHistory -Value 0 -Force - Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\cbdhsvc" -Name Start -Value 4 -Force + } + + If ($Build -ge 18363) { + Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\CLSID\{1d64637d-31e9-4b06-9124-e83fb178ac6e}\TreatAs" -Name "(Default)" -Value "{64bc32b5-4eec-4de7-972d-bd8bd0324537}" -Force } # Uninstall Cortana. @@ -146,7 +149,9 @@ Function Set-Additional If ($QueryReFS) { Invoke-Expression -Command ('FSUTIL BEHAVIOR SET DISABLEDELETENOTIFY REFS 0') | Out-Null } # Disable Swapfile.sys which can improve SSD performance. - Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Name SwapfileControl -Value 0 -Force + If(!(Get-AppxProvisionedPackage -Online | Where-Object -Property DisplayName -EQ Microsoft.WindowsStore)){ + Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Name SwapfileControl -Value 0 -Force + } # Disable Prefetch and Superfetch (optimal for SSD drives). If (!(Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters")) { New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters" -ItemType Directory -Force | Out-Null } @@ -180,8 +185,15 @@ Function Set-Additional $Memory = (Get-CimInstance -ClassName Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum).Sum / 1KB If ($Memory -is [Double]) { Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control" -Name SvcHostSplitThresholdInKB -Value $Memory -Force } - # If the Windows 10 build is 19041, use the new DISM PowerShell cmdlet to disable the Reserved Storage feature for future updates. - If ($Build -eq 19041 -and (Get-WindowsReservedStorageState | Select-Object -ExpandProperty ReservedStorageState) -ne 'Disabled') { Set-WindowsReservedStorageState -State Disabled } + # If the Windows build is 19041, use the new DISM PowerShell cmdlet to disable the Reserved Storage feature for future updates. + If ($Build -ge 19041 -and (Get-WindowsReservedStorageState | Select-Object -ExpandProperty ReservedStorageState) -ne 'Disabled') { Set-WindowsReservedStorageState -State Disabled } + + <#Try{ + If ($Build -ge 19041 -and (Get-WmiObject -Class Win32_Processor | Select-Object -Property Name).Name.ToLower() -Like "*amd*") { + Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Name FeatureSettingsOverride -Value 3 -Force + Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Name FeatureSettingsOverrideMask -Value 3 -Force + } + } Catch {}#> # Remove the dism log file if present. If (Test-Path -Path $Env:SystemRoot\Logs\DISM\dism.log) { Remove-Item -Path $Env:SystemRoot\Logs\DISM\dism.log -Force } diff --git a/Content/Additional/Setup/SetupComplete.cmd b/Content/Additional/Setup/SetupComplete.cmd index 6617bdb..ea57998 100644 --- a/Content/Additional/Setup/SetupComplete.cmd +++ b/Content/Additional/Setup/SetupComplete.cmd @@ -4,6 +4,7 @@ REM Answer files should ALWAYS be removed from the 'Windows\Panther' and 'Window PowerShell.exe -NoProfile -ExecutionPolicy Bypass -File "%WINDIR%\Setup\Scripts\Refresh-Explorer.ps1" DEL /F /Q "%WINDIR%\Setup\Scripts\Refresh-Explorer.ps1" >NUL 2>&1 +DEL /F /Q "%WINDIR%\Setup\Scripts\Run_TI_SetupComplete_online.cmd >NUL 2>&1 DEL /F /Q "%WINDIR%\Panther\unattend.xml" >NUL 2>&1 DEL /F /Q "%WINDIR%\System32\Sysprep\unattend.xml" >NUL 2>&1 -DEL "%~f0" \ No newline at end of file +DEL "%~f0" diff --git a/Content/AppxWhitelist.json b/Content/AppxWhitelist.json deleted file mode 100644 index f9436bb..0000000 Binary files a/Content/AppxWhitelist.json and /dev/null differ diff --git a/Content/Lists/Capabilities/CapabilitiesBlacklist.json b/Content/Lists/Capabilities/CapabilitiesBlacklist.json new file mode 100644 index 0000000..4dc8bbe --- /dev/null +++ b/Content/Lists/Capabilities/CapabilitiesBlacklist.json @@ -0,0 +1,13 @@ +{ + "Name": [ + "App.StepsRecorder*", + "App.Support.QuickAssist*", + "OneCoreUAP.OneSync*", + "DirectX.Configuration.Database*", + "Hello.Face.*", + "Language.*", + "MathRecognizer*", + "Microsoft.Windows.MSPaint*", + "Microsoft.Windows.WordPad*" + ] +} diff --git a/Content/Lists/Capabilities/CapabilitiesTemplate.json b/Content/Lists/Capabilities/CapabilitiesTemplate.json new file mode 100644 index 0000000..4990a12 --- /dev/null +++ b/Content/Lists/Capabilities/CapabilitiesTemplate.json @@ -0,0 +1,51 @@ +{ + "Name": [ + "App.StepsRecorder~~~~0.0.1.0", + "App.Support.QuickAssist~~~~0.0.1.0", + "Browser.InternetExplorer~~~~0.0.11.0", + "DirectX.Configuration.Database~~~~0.0.1.0", + "Hello.Face.20134~~~~0.0.1.0", + "Language.Handwriting~~~en-US~0.0.1.0", + "Language.OCR~~~en-US~0.0.1.0", + "Language.Speech~~~en-US~0.0.1.0", + "MathRecognizer~~~~0.0.1.0", + "Media.WindowsMediaPlayer~~~~0.0.12.0", + "Microsoft.Windows.Ethernet.Client.Intel.E1i68x64~~~~0.0.1.0", + "Microsoft.Windows.Ethernet.Client.Intel.E2f68~~~~0.0.1.0", + "Microsoft.Windows.Ethernet.Client.Realtek.Rtcx21x64~~~~0.0.1.0", + "Microsoft.Windows.Notepad.System~~~~0.0.1.0", + "Microsoft.Windows.PowerShell.ISE~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Broadcom.Bcmpciedhd63~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Broadcom.Bcmwl63a~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Broadcom.Bcmwl63al~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Intel.Netwbw02~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Intel.Netwew00~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Intel.Netwew01~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Intel.Netwlv64~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Intel.Netwns64~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Intel.Netwsw00~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Intel.Netwtw02~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Intel.Netwtw04~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Intel.Netwtw06~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Intel.Netwtw08~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Marvel.Mrvlpcie8897~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Qualcomm.Athw8x~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Qualcomm.Athwnx~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Qualcomm.Qcamain10x64~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Ralink.Netr28x~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Realtek.Rtl8187se~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Realtek.Rtl8192se~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Realtek.Rtl819xp~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Realtek.Rtl85n64~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Realtek.Rtwlane~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Realtek.Rtwlane01~~~~0.0.1.0", + "Microsoft.Windows.Wifi.Client.Realtek.Rtwlane13~~~~0.0.1.0", + "Microsoft.Windows.WordPad~~~~0.0.1.0", + "OneCoreUAP.OneSync~~~~0.0.1.0", + "OpenSSH.Client~~~~0.0.1.0", + "Print.Fax.Scan~~~~0.0.1.0", + "Print.Management.Console~~~~0.0.1.0", + "Windows.Client.ShellComponents~~~~0.0.1.0", + "Windows.Kernel.LA57~~~~0.0.1.0" + ] +} diff --git a/Content/Lists/Capabilities/CapabilitiesWhitelist.json b/Content/Lists/Capabilities/CapabilitiesWhitelist.json new file mode 100644 index 0000000..037e713 --- /dev/null +++ b/Content/Lists/Capabilities/CapabilitiesWhitelist.json @@ -0,0 +1,6 @@ +{ + "Name": [ + + ] + } + \ No newline at end of file diff --git a/Content/Lists/FeaturesToDisable/FeaturesToDisableList.json b/Content/Lists/FeaturesToDisable/FeaturesToDisableList.json new file mode 100644 index 0000000..a0fcf19 --- /dev/null +++ b/Content/Lists/FeaturesToDisable/FeaturesToDisableList.json @@ -0,0 +1,7 @@ +{ + "FeatureName" : [ + "MSRDC-Infrastructure", + "WorkFolders-Client", + "Printing-XPSServices-Features" + ] +} diff --git a/Content/Lists/FeaturesToDisable/FeaturesToDisableTemplate.json b/Content/Lists/FeaturesToDisable/FeaturesToDisableTemplate.json new file mode 100644 index 0000000..2912fc7 --- /dev/null +++ b/Content/Lists/FeaturesToDisable/FeaturesToDisableTemplate.json @@ -0,0 +1,20 @@ +{ + "FeatureName": [ + "MediaPlayback", + "MicrosoftWindowsPowerShellV2", + "MicrosoftWindowsPowerShellV2Root", + "MSRDC-Infrastructure", + "NetFx4-AdvSrvs", + "Printing-Foundation-Features", + "Printing-Foundation-InternetPrinting-Client", + "Printing-PrintToPDFServices-Features", + "Printing-XPSServices-Features", + "SearchEngine-Client-Package", + "SmbDirect", + "WCF-Services45", + "WCF-TCP-PortSharing45", + "Windows-Defender-Default-Definitions", + "WindowsMediaPlayer", + "WorkFolders-Client" + ] +} diff --git a/Content/Lists/FeaturesToEnable/FeaturesToEnableList.json b/Content/Lists/FeaturesToEnable/FeaturesToEnableList.json new file mode 100644 index 0000000..e475097 --- /dev/null +++ b/Content/Lists/FeaturesToEnable/FeaturesToEnableList.json @@ -0,0 +1,6 @@ +{ + "FeatureName" : [ + "Microsoft-Windows-Subsystem-Linux", + "VirtualMachinePlatform" + ] +} diff --git a/Content/Lists/FeaturesToEnable/FeaturesToEnableTemplate.json b/Content/Lists/FeaturesToEnable/FeaturesToEnableTemplate.json new file mode 100644 index 0000000..ef414c3 --- /dev/null +++ b/Content/Lists/FeaturesToEnable/FeaturesToEnableTemplate.json @@ -0,0 +1,117 @@ +{ + "FeatureName": [ + "AppServerClient", + "Client-DeviceLockdown", + "Client-EmbeddedBootExp", + "Client-EmbeddedLogon", + "Client-EmbeddedShellLauncher", + "ClientForNFS-Infrastructure", + "Client-KeyboardFilter", + "Client-ProjFS", + "Client-UnifiedWriteFilter", + "Containers", + "Containers-DisposableClientVM", + "Containers-HNS", + "Containers-SDN", + "DataCenterBridging", + "DirectoryServices-ADAM-Client", + "DirectPlay", + "HostGuardian", + "HypervisorPlatform", + "IIS-ApplicationDevelopment", + "IIS-ApplicationInit", + "IIS-ASP", + "IIS-ASPNET", + "IIS-ASPNET45", + "IIS-BasicAuthentication", + "IIS-CertProvider", + "IIS-CGI", + "IIS-ClientCertificateMappingAuthentication", + "IIS-CommonHttpFeatures", + "IIS-CustomLogging", + "IIS-DefaultDocument", + "IIS-DigestAuthentication", + "IIS-DirectoryBrowsing", + "IIS-FTPExtensibility", + "IIS-FTPServer", + "IIS-FTPSvc", + "IIS-HealthAndDiagnostics", + "IIS-HostableWebCore", + "IIS-HttpCompressionDynamic", + "IIS-HttpCompressionStatic", + "IIS-HttpErrors", + "IIS-HttpLogging", + "IIS-HttpRedirect", + "IIS-HttpTracing", + "IIS-IIS6ManagementCompatibility", + "IIS-IISCertificateMappingAuthentication", + "IIS-IPSecurity", + "IIS-ISAPIExtensions", + "IIS-ISAPIFilter", + "IIS-LegacyScripts", + "IIS-LegacySnapIn", + "IIS-LoggingLibraries", + "IIS-ManagementConsole", + "IIS-ManagementScriptingTools", + "IIS-ManagementService", + "IIS-Metabase", + "IIS-NetFxExtensibility", + "IIS-NetFxExtensibility45", + "IIS-ODBCLogging", + "IIS-Performance", + "IIS-RequestFiltering", + "IIS-RequestMonitor", + "IIS-Security", + "IIS-ServerSideIncludes", + "IIS-StaticContent", + "IIS-URLAuthorization", + "IIS-WebDAV", + "IIS-WebServer", + "IIS-WebServerManagementTools", + "IIS-WebServerRole", + "IIS-WebSockets", + "IIS-WindowsAuthentication", + "IIS-WMICompatibility", + "LegacyComponents", + "Microsoft-Hyper-V", + "Microsoft-Hyper-V-All", + "Microsoft-Hyper-V-Hypervisor", + "Microsoft-Hyper-V-Management-Clients", + "Microsoft-Hyper-V-Management-PowerShell", + "Microsoft-Hyper-V-Services", + "Microsoft-Hyper-V-Tools-All", + "Microsoft-Windows-Subsystem-Linux", + "MSMQ-ADIntegration", + "MSMQ-Container", + "MSMQ-DCOMProxy", + "MSMQ-HTTP", + "MSMQ-Multicast", + "MSMQ-Server", + "MSMQ-Triggers", + "MultiPoint-Connector", + "MultiPoint-Connector-Services", + "MultiPoint-Tools", + "NetFx4Extended-ASPNET45", + "NFS-Administration", + "Printing-Foundation-LPDPrintService", + "Printing-Foundation-LPRPortMonitor", + "ServicesForNFS-ClientOnly", + "SimpleTCP", + "TelnetClient", + "TFTP", + "TIFFIFilter", + "VirtualMachinePlatform", + "WAS-ConfigurationAPI", + "WAS-NetFxEnvironment", + "WAS-ProcessModel", + "WAS-WindowsActivationService", + "WCF-HTTP-Activation", + "WCF-HTTP-Activation45", + "WCF-MSMQ-Activation45", + "WCF-NonHTTP-Activation", + "WCF-Pipe-Activation45", + "WCF-TCP-Activation45", + "Windows-Defender-ApplicationGuard", + "Windows-Identity-Foundation" + ] +} diff --git a/Content/Lists/Packages/PackagesBlacklist.json b/Content/Lists/Packages/PackagesBlacklist.json new file mode 100644 index 0000000..198d702 --- /dev/null +++ b/Content/Lists/Packages/PackagesBlacklist.json @@ -0,0 +1,9 @@ +{ + "PackageName": [ + "Microsoft-Windows-Hello-Face-*", + "Microsoft-Windows-LanguageFeatures-*", + "Microsoft-Windows-QuickAssist-Package*", + "Microsoft-Windows-StepsRecorder-Package*", + "Microsoft-Windows-TabletPCMath-Package*" + ] +} diff --git a/Content/Lists/Packages/PackagesTemplate.json b/Content/Lists/Packages/PackagesTemplate.json new file mode 100644 index 0000000..c948ac8 --- /dev/null +++ b/Content/Lists/Packages/PackagesTemplate.json @@ -0,0 +1,68 @@ +{ + "PackageName": [ + "Microsoft-OneCore-ApplicationModel-Sync-Desktop-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.348", + "Microsoft-OneCore-DirectX-Database-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.376", + "Microsoft-Windows-Ethernet-Client-Intel-E1i68x64-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Ethernet-Client-Intel-E2f68-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Ethernet-Client-Realtek-Rtcx21x64-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-FodMetadata-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Hello-Face-Package~31bf3856ad364e35~amd64~~10.0.22000.120", + "Microsoft-Windows-InternetExplorer-Optional-Package~31bf3856ad364e35~amd64~~11.0.22000.120", + "Microsoft-Windows-InternetExplorer-Optional-Package~31bf3856ad364e35~amd64~en-US~11.0.22000.1", + "Microsoft-Windows-Kernel-LA57-FoD-Package~31bf3856ad364e35~amd64~~10.0.22000.376", + "Microsoft-Windows-LanguageFeatures-Handwriting-en-us-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-LanguageFeatures-OCR-en-us-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-LanguageFeatures-Speech-en-us-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-MediaPlayer-Package~31bf3856ad364e35~amd64~~10.0.22000.376", + "Microsoft-Windows-Notepad-System-FoD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Notepad-System-FoD-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1", + "Microsoft-Windows-Notepad-System-FoD-Package~31bf3856ad364e35~wow64~~10.0.22000.1", + "Microsoft-Windows-Notepad-System-FoD-Package~31bf3856ad364e35~wow64~en-US~10.0.22000.1", + "Microsoft-Windows-PowerShell-ISE-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-PowerShell-ISE-FOD-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1", + "Microsoft-Windows-PowerShell-ISE-FOD-Package~31bf3856ad364e35~wow64~~10.0.22000.1", + "Microsoft-Windows-PowerShell-ISE-FOD-Package~31bf3856ad364e35~wow64~en-US~10.0.22000.1", + "Microsoft-Windows-Printing-PMCPPC-FoD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Printing-PMCPPC-FoD-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1", + "Microsoft-Windows-Printing-WFS-FoD-Package~31bf3856ad364e35~amd64~~10.0.22000.376", + "Microsoft-Windows-Printing-WFS-FoD-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1", + "Microsoft-Windows-QuickAssist-Package~31bf3856ad364e35~amd64~~10.0.22000.282", + "Microsoft-Windows-StepsRecorder-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-StepsRecorder-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1", + "Microsoft-Windows-StepsRecorder-Package~31bf3856ad364e35~wow64~~10.0.22000.1", + "Microsoft-Windows-StepsRecorder-Package~31bf3856ad364e35~wow64~en-US~10.0.22000.1", + "Microsoft-Windows-TabletPCMath-Package~31bf3856ad364e35~amd64~~10.0.22000.65", + "Microsoft-Windows-UserExperience-Desktop-Package~31bf3856ad364e35~amd64~~10.0.22000.376", + "Microsoft-Windows-Wifi-Client-Broadcom-Bcmpciedhd63-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Broadcom-Bcmwl63a-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Broadcom-Bcmwl63al-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Intel-Netwbw02-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Intel-Netwew00-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Intel-Netwew01-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Intel-Netwlv64-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Intel-Netwns64-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Intel-Netwsw00-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Intel-Netwtw02-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Intel-Netwtw04-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Intel-Netwtw06-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Intel-Netwtw08-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Marvel-Mrvlpcie8897-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Qualcomm-Athw8x-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Qualcomm-Athwnx-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Qualcomm-Qcamain10x64-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Ralink-Netr28x-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Realtek-Rtl8187se-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Realtek-Rtl8192se-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Realtek-Rtl819xp-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Realtek-Rtl85n64-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Realtek-Rtwlane01-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Realtek-Rtwlane13-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-Wifi-Client-Realtek-Rtwlane-FOD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-WordPad-FoD-Package~31bf3856ad364e35~amd64~~10.0.22000.1", + "Microsoft-Windows-WordPad-FoD-Package~31bf3856ad364e35~amd64~en-US~10.0.22000.1", + "Microsoft-Windows-WordPad-FoD-Package~31bf3856ad364e35~wow64~~10.0.22000.1", + "Microsoft-Windows-WordPad-FoD-Package~31bf3856ad364e35~wow64~en-US~10.0.22000.1", + "OpenSSH-Client-Package~31bf3856ad364e35~amd64~~10.0.22000.1" + ] +} diff --git a/Content/Lists/Packages/PackagesWhitelist.json b/Content/Lists/Packages/PackagesWhitelist.json new file mode 100644 index 0000000..d2d905f --- /dev/null +++ b/Content/Lists/Packages/PackagesWhitelist.json @@ -0,0 +1,5 @@ +{ + "PackageName": [ + + ] +} \ No newline at end of file diff --git a/Content/Lists/Services/ServicesAdvanced.json b/Content/Lists/Services/ServicesAdvanced.json new file mode 100644 index 0000000..3a9a6f5 --- /dev/null +++ b/Content/Lists/Services/ServicesAdvanced.json @@ -0,0 +1,27 @@ +{ + "__Info": [ + "start key values", + "0 = Boot", + "1 = System", + "2 = Automatic", + "3 = Manual", + "4 = Disabled" + ], + "Services": [ + { + "name": "BDESVC", + "description": "BitLocker Drive Encryption Service", + "start": 3 + }, + { + "name": "ConsentUxUserSvc", + "description": "ConsentUX", + "start": 3 + }, + { + "name": "CredentialEnrollmentManagerUserSvc", + "description": "CredentialEnrollmentManagerUserSvc", + "start": 3 + } + ] +} \ No newline at end of file diff --git a/Content/Lists/Services/ServicesList.json b/Content/Lists/Services/ServicesList.json new file mode 100644 index 0000000..90b5917 --- /dev/null +++ b/Content/Lists/Services/ServicesList.json @@ -0,0 +1,24 @@ +{ + "__Info": [ + "Insert the services display names as a list, the names are found in the ./ServicesTemplate.json in the 'name' key" + ], + "Services": [ + "BDESVC", + "lmhosts", + "DiagTrack", + "DusmSvc", + "edgeupdate", + "edgeupdatem", + "FontCache", + "iphlpsvc", + "PimIndexMaintenanceSvc", + "SSDPSRV", + "PcaSvc", + "Spooler", + "VSS", + "UsoSvc", + "WaaSMedicSvc", + "WSearch", + "wuauserv" + ] +} diff --git a/Content/Lists/Services/ServicesTemplate.json b/Content/Lists/Services/ServicesTemplate.json new file mode 100644 index 0000000..01a5e05 --- /dev/null +++ b/Content/Lists/Services/ServicesTemplate.json @@ -0,0 +1,1782 @@ +{ + "__Info": [ + "start key values", + "0 = Boot", + "1 = System", + "2 = Automatic", + "3 = Manual", + "4 = Disabled" + ], + "Services": [ + { + "description": "Agent Activation Runtime", + "name": "AarSvc", + "start": 3 + }, + { + "description": "Acx01000", + "name": "Acx01000", + "start": 3 + }, + { + "description": "AllJoyn Router Service", + "name": "AJRouter", + "start": 3 + }, + { + "description": "Application Layer Gateway Service", + "name": "ALG", + "start": 3 + }, + { + "description": "AppID Driver", + "name": "AppID", + "start": 3 + }, + { + "description": "Application Identity", + "name": "AppIDSvc", + "start": 3 + }, + { + "description": "Application Information", + "name": "Appinfo", + "start": 3 + }, + { + "description": "Smartlocker Filter Driver", + "name": "applockerfltr", + "start": 3 + }, + { + "description": "Application Management", + "name": "AppMgmt", + "start": 3 + }, + { + "description": "App Readiness", + "name": "AppReadiness", + "start": 3 + }, + { + "description": "Microsoft App-V Client", + "name": "AppVClient", + "start": 4 + }, + { + "description": "AppvStrm", + "name": "AppvStrm", + "start": 3 + }, + { + "description": "AppvVemgr", + "name": "AppvVemgr", + "start": 3 + }, + { + "description": "AppvVfs", + "name": "AppvVfs", + "start": 3 + }, + { + "description": "AppX Deployment Service (AppXSVC)", + "name": "AppXSvc", + "start": 3 + }, + { + "description": "AssignedAccessManager Service", + "name": "AssignedAccessManagerSvc", + "start": 3 + }, + { + "description": "Windows Audio Endpoint Builder", + "name": "AudioEndpointBuilder", + "start": 2 + }, + { + "description": "Windows Audio", + "name": "Audiosrv", + "start": 2 + }, + { + "description": "Cellular Time", + "name": "autotimesvc", + "start": 3 + }, + { + "description": "ActiveX Installer (AxInstSV)", + "name": "AxInstSV", + "start": 3 + }, + { + "description": "GameDVR and Broadcast User Service", + "name": "BcastDVRUserService", + "start": 3 + }, + { + "description": "BitLocker Drive Encryption Service", + "name": "BDESVC", + "start": 3 + }, + { + "description": "Base Filtering Engine", + "name": "BFE", + "start": 2 + }, + { + "description": "Windows Bind Filter Driver", + "name": "bindflt", + "start": 2 + }, + { + "description": "Background Intelligent Transfer Service", + "name": "BITS", + "start": 3 + }, + { + "description": "Bluetooth User Support Service", + "name": "BluetoothUserService", + "start": 3 + }, + { + "description": "Browser", + "name": "bowser", + "start": 3 + }, + { + "description": "Background Tasks Infrastructure Service", + "name": "BrokerInfrastructure", + "start": 2 + }, + { + "description": "Bluetooth Audio Gateway Service", + "name": "BTAGService", + "start": 3 + }, + { + "description": "AVCTP service", + "name": "BthAvctpSvc", + "start": 3 + }, + { + "description": "Bluetooth Support Service", + "name": "bthserv", + "start": 3 + }, + { + "description": "Capability Access Manager Service", + "name": "camsvc", + "start": 3 + }, + { + "description": "CaptureService", + "name": "CaptureService", + "start": 3 + }, + { + "description": "Clipboard User Service", + "name": "cbdhsvc", + "start": 2 + }, + { + "description": "CD/DVD File System Reader", + "name": "cdfs", + "start": 4 + }, + { + "description": "Connected Devices Platform Service", + "name": "CDPSvc", + "start": 2 + }, + { + "description": "Connected Devices Platform User Service", + "name": "CDPUserSvc", + "start": 2 + }, + { + "description": "Certificate Propagation", + "name": "CertPropSvc", + "start": 3 + }, + { + "description": "Windows Cloud Files Filter Driver", + "name": "CldFlt", + "start": 2 + }, + { + "description": "Client License Service (ClipSVC)", + "name": "ClipSVC", + "start": 3 + }, + { + "description": "Microsoft Cloud Identity Service", + "name": "cloudidsvc", + "start": 3 + }, + { + "description": "COM+ System Application", + "name": "COMSysApp", + "start": 3 + }, + { + "description": "Console Driver", + "name": "condrv", + "start": 3 + }, + { + "description": "ConsentUX", + "name": "ConsentUxUserSvc", + "start": 3 + }, + { + "description": "CoreMessaging", + "name": "CoreMessagingRegistrar", + "start": 2 + }, + { + "description": "CredentialEnrollmentManagerUserSvc", + "name": "CredentialEnrollmentManagerUserSvc", + "start": 3 + }, + { + "description": "Cryptographic Services", + "name": "CryptSvc", + "start": 2 + }, + { + "description": "Offline Files", + "name": "CscService", + "start": 3 + }, + { + "description": "DCOM Server Process Launcher", + "name": "DcomLaunch", + "start": 2 + }, + { + "description": "Optimize drives", + "name": "defragsvc", + "start": 3 + }, + { + "description": "DeviceAssociationBroker", + "name": "DeviceAssociationBrokerSvc", + "start": 3 + }, + { + "description": "Device Association Service", + "name": "DeviceAssociationService", + "start": 3 + }, + { + "description": "Device Install Service", + "name": "DeviceInstall", + "start": 3 + }, + { + "description": "DevicePicker", + "name": "DevicePickerUserSvc", + "start": 3 + }, + { + "description": "DevicesFlow", + "name": "DevicesFlowUserSvc", + "start": 3 + }, + { + "description": "DevQuery Background Discovery Broker", + "name": "DevQueryBroker", + "start": 3 + }, + { + "description": "DHCP Client", + "name": "Dhcp", + "start": 2 + }, + { + "description": "Microsoft (R) Diagnostics Hub Standard Collector Service", + "name": "diagnosticshub.standardcollector.service", + "start": 3 + }, + { + "description": "Diagnostic Execution Service", + "name": "diagsvc", + "start": 3 + }, + { + "description": "Connected User Experiences and Telemetry", + "name": "DiagTrack", + "start": 2 + }, + { + "description": "DialogBlockingService", + "name": "DialogBlockingService", + "start": 4 + }, + { + "description": "Display Policy Service", + "name": "DispBrokerDesktopSvc", + "start": 2 + }, + { + "description": "Display Enhancement Service", + "name": "DisplayEnhancementService", + "start": 3 + }, + { + "description": "Device Management Enrollment Service", + "name": "DmEnrollmentSvc", + "start": 3 + }, + { + "description": "Device Management Wireless Application Protocol (WAP) Push message Routing Service", + "name": "dmwappushservice", + "start": 3 + }, + { + "description": "DNS Client", + "name": "Dnscache", + "start": 2 + }, + { + "description": "Delivery Optimization", + "name": "DoSvc", + "start": 3 + }, + { + "description": "Wired AutoConfig", + "name": "dot3svc", + "start": 3 + }, + { + "description": "Diagnostic Policy Service", + "name": "DPS", + "start": 2 + }, + { + "description": "Device Setup Manager", + "name": "DsmSvc", + "start": 3 + }, + { + "description": "Data Sharing Service", + "name": "DsSvc", + "start": 3 + }, + { + "description": "Data Usage", + "name": "DusmSvc", + "start": 2 + }, + { + "description": "Extensible Authentication Protocol", + "name": "EapHost", + "start": 3 + }, + { + "description": "Microsoft Edge Update Service (edgeupdate)", + "name": "edgeupdate", + "start": 2 + }, + { + "description": "Microsoft Edge Update Service (edgeupdatem)", + "name": "edgeupdatem", + "start": 3 + }, + { + "description": "Encrypting File System (EFS)", + "name": "EFS", + "start": 3 + }, + { + "description": "Embedded Mode", + "name": "embeddedmode", + "start": 3 + }, + { + "description": "Enterprise App Management Service", + "name": "EntAppSvc", + "start": 3 + }, + { + "description": "Windows Event Log", + "name": "EventLog", + "start": 2 + }, + { + "description": "COM+ Event System", + "name": "EventSystem", + "start": 2 + }, + { + "description": "", + "name": "ExecutionContext", + "start": 3 + }, + { + "description": "exFAT File System Driver", + "name": "exfat", + "start": 3 + }, + { + "description": "FAT12/16/32 File System Driver", + "name": "fastfat", + "start": 3 + }, + { + "description": "Fax", + "name": "Fax", + "start": 3 + }, + { + "description": "Function Discovery Provider Host", + "name": "fdPHost", + "start": 3 + }, + { + "description": "Function Discovery Resource Publication", + "name": "FDResPub", + "start": 3 + }, + { + "description": "File History Service", + "name": "fhsvc", + "start": 3 + }, + { + "description": "Filetrace", + "name": "Filetrace", + "start": 3 + }, + { + "description": "Windows Font Cache Service", + "name": "FontCache", + "start": 2 + }, + { + "description": "Windows Camera Frame Server", + "name": "FrameServer", + "start": 3 + }, + { + "description": "", + "name": "FrameServerMonitor", + "start": 3 + }, + { + "description": "File System Dependency Minifilter", + "name": "FsDepends", + "start": 3 + }, + { + "description": "Microsoft GPIO Class Extension Driver", + "name": "GPIOClx0101", + "start": 3 + }, + { + "description": "Group Policy Client", + "name": "gpsvc", + "start": 2 + }, + { + "description": "GraphicsPerfSvc", + "name": "GraphicsPerfSvc", + "start": 3 + }, + { + "description": "Human Interface Device Service", + "name": "hidserv", + "start": 3 + }, + { + "description": "", + "name": "HidSpiCx", + "start": 3 + }, + { + "description": "HTTP Service", + "name": "HTTP", + "start": 3 + }, + { + "description": "HV Host Service", + "name": "HvHost", + "start": 3 + }, + { + "description": "Microsoft Hardware Notifications Class Extension Driver", + "name": "HwNClx0101", + "start": 3 + }, + { + "description": "Windows Mobile Hotspot Service", + "name": "icssvc", + "start": 3 + }, + { + "description": "IKE and AuthIP IPsec Keying Modules", + "name": "IKEEXT", + "start": 3 + }, + { + "description": "Indirect Displays Kernel-Mode Driver", + "name": "IndirectKmd", + "start": 3 + }, + { + "description": "Microsoft Store Install Service", + "name": "InstallService", + "start": 3 + }, + { + "description": "IP Traffic Filter Driver", + "name": "IpFilterDriver", + "start": 3 + }, + { + "description": "IP Helper", + "name": "iphlpsvc", + "start": 2 + }, + { + "description": "IP Network Address Translator", + "name": "IPNAT", + "start": 3 + }, + { + "description": "IPT", + "name": "IPT", + "start": 2 + }, + { + "description": "IP Translation Configuration Service", + "name": "IpxlatCfgSvc", + "start": 3 + }, + { + "description": "kbldfltr", + "name": "kbldfltr", + "start": 3 + }, + { + "description": "CNG Key Isolation", + "name": "KeyIso", + "start": 3 + }, + { + "description": "Kernel Streaming Thunks", + "name": "ksthunk", + "start": 3 + }, + { + "description": "KtmRm for Distributed Transaction Coordinator", + "name": "KtmRm", + "start": 3 + }, + { + "description": "Server", + "name": "LanmanServer", + "start": 2 + }, + { + "description": "Workstation", + "name": "LanmanWorkstation", + "start": 2 + }, + { + "description": "Geolocation Service", + "name": "lfsvc", + "start": 3 + }, + { + "description": "Windows License Manager Service", + "name": "LicenseManager", + "start": 3 + }, + { + "description": "Link-Layer Topology Discovery Mapper I/O Driver", + "name": "lltdio", + "start": 2 + }, + { + "description": "Link-Layer Topology Discovery Mapper", + "name": "lltdsvc", + "start": 3 + }, + { + "description": "TCP/IP NetBIOS Helper", + "name": "lmhosts", + "start": 3 + }, + { + "description": "Local Session Manager", + "name": "LSM", + "start": 2 + }, + { + "description": "UAC File Virtualization", + "name": "luafv", + "start": 2 + }, + { + "description": "Language Experience Service", + "name": "LxpSvc", + "start": 3 + }, + { + "description": "Downloaded Maps Manager", + "name": "MapsBroker", + "start": 2 + }, + { + "description": "MBB Network Adapter Class Extension", + "name": "MbbCx", + "start": 3 + }, + { + "description": "", + "name": "McpManagementService", + "start": 3 + }, + { + "description": "MessagingService", + "name": "MessagingService", + "start": 3 + }, + { + "description": "", + "name": "MixedRealityOpenXRSvc", + "start": 3 + }, + { + "description": "Multimedia Class Scheduler", + "name": "MMCSS", + "start": 2 + }, + { + "description": "Modem", + "name": "Modem", + "start": 3 + }, + { + "description": "Windows Defender Firewall Authorization Driver", + "name": "mpsdrv", + "start": 3 + }, + { + "description": "Windows Defender Firewall", + "name": "mpssvc", + "start": 2 + }, + { + "description": "WebDav Client Redirector Driver", + "name": "MRxDAV", + "start": 3 + }, + { + "description": "SMB MiniRedirector Wrapper and Engine", + "name": "mrxsmb", + "start": 3 + }, + { + "description": "SMB 2.0 MiniRedirector", + "name": "mrxsmb20", + "start": 3 + }, + { + "description": "Microsoft MAC Bridge", + "name": "MsBridge", + "start": 3 + }, + { + "description": "Distributed Transaction Coordinator", + "name": "MSDTC", + "start": 3 + }, + { + "description": "Microsoft iSCSI Initiator Service", + "name": "MSiSCSI", + "start": 3 + }, + { + "description": "Windows Installer", + "name": "msiserver", + "start": 3 + }, + { + "description": "Microsoft Keyboard Filter", + "name": "MsKeyboardFilter", + "start": 4 + }, + { + "description": "Microsoft Link-Layer Discovery Protocol", + "name": "MsLldp", + "start": 2 + }, + { + "description": "MsQuic", + "name": "MsQuic", + "start": 3 + }, + { + "description": "MsRPC", + "name": "MsRPC", + "start": 3 + }, + { + "description": "NativeWiFi Filter", + "name": "NativeWifiP", + "start": 3 + }, + { + "description": "Natural Authentication", + "name": "NaturalAuthentication", + "start": 3 + }, + { + "description": "Network Connectivity Assistant", + "name": "NcaSvc", + "start": 3 + }, + { + "description": "Network Connection Broker", + "name": "NcbService", + "start": 3 + }, + { + "description": "Network Connected Devices Auto-Setup", + "name": "NcdAutoSetup", + "start": 3 + }, + { + "description": "Microsoft Network Adapter Multiplexor Protocol", + "name": "NdisImPlatform", + "start": 3 + }, + { + "description": "Remote Access NDIS TAPI Driver", + "name": "NdisTapi", + "start": 3 + }, + { + "description": "NDIS Usermode I/O Protocol", + "name": "Ndisuio", + "start": 3 + }, + { + "description": "Remote Access LEGACY NDIS WAN Driver", + "name": "ndiswanlegacy", + "start": 3 + }, + { + "description": "", + "name": "NDKPerf", + "start": 3 + }, + { + "description": "NDKPing Driver", + "name": "NDKPing", + "start": 3 + }, + { + "description": "NDIS Proxy Driver", + "name": "ndproxy", + "start": 3 + }, + { + "description": "Windows Network Data Usage Monitoring Driver", + "name": "Ndu", + "start": 2 + }, + { + "description": "Network Adapter Wdf Class Extension Library", + "name": "NetAdapterCx", + "start": 3 + }, + { + "description": "Netlogon", + "name": "Netlogon", + "start": 3 + }, + { + "description": "Network Connections", + "name": "Netman", + "start": 3 + }, + { + "description": "Network List Service", + "name": "netprofm", + "start": 3 + }, + { + "description": "Network Setup Service", + "name": "NetSetupSvc", + "start": 2 + }, + { + "description": "Net.Tcp Port Sharing Service", + "name": "NetTcpPortSharing", + "start": 4 + }, + { + "description": "Microsoft Passport Container", + "name": "NgcCtnrSvc", + "start": 3 + }, + { + "description": "Microsoft Passport", + "name": "NgcSvc", + "start": 3 + }, + { + "description": "Network Location Awareness", + "name": "NlaSvc", + "start": 3 + }, + { + "description": "", + "name": "NPSMSvc", + "start": 3 + }, + { + "description": "Network Store Interface Service", + "name": "nsi", + "start": 2 + }, + { + "description": "Ntfs", + "name": "Ntfs", + "start": 3 + }, + { + "description": "", + "name": "OneSyncSvc", + "start": 2 + }, + { + "description": "Peer Networking Identity Manager", + "name": "p2pimsvc", + "start": 3 + }, + { + "description": "Peer Networking Grouping", + "name": "p2psvc", + "start": 3 + }, + { + "description": "", + "name": "P9Rdr", + "start": 3 + }, + { + "description": "", + "name": "P9RdrService", + "start": 3 + }, + { + "description": "Program Compatibility Assistant Service", + "name": "PcaSvc", + "start": 3 + }, + { + "description": "PEAUTH", + "name": "PEAUTH", + "start": 2 + }, + { + "description": "BranchCache", + "name": "PeerDistSvc", + "start": 3 + }, + { + "description": "", + "name": "PenService", + "start": 3 + }, + { + "description": "Windows Perception Simulation Service", + "name": "perceptionsimulation", + "start": 3 + }, + { + "description": "Performance Counter DLL Host", + "name": "PerfHost", + "start": 3 + }, + { + "description": "Phone Service", + "name": "PhoneSvc", + "start": 3 + }, + { + "description": "Contact Data", + "name": "PimIndexMaintenanceSvc", + "start": 3 + }, + { + "description": "Packet Monitor Driver", + "name": "PktMon", + "start": 3 + }, + { + "description": "Performance Logs \u0026 Alerts", + "name": "pla", + "start": 3 + }, + { + "description": "Plug and Play", + "name": "PlugPlay", + "start": 3 + }, + { + "description": "PNRP Machine Name Publication Service", + "name": "PNRPAutoReg", + "start": 3 + }, + { + "description": "Peer Name Resolution Protocol", + "name": "PNRPsvc", + "start": 3 + }, + { + "description": "IPsec Policy Agent", + "name": "PolicyAgent", + "start": 3 + }, + { + "description": "portcfg", + "name": "portcfg", + "start": 3 + }, + { + "description": "Power", + "name": "Power", + "start": 2 + }, + { + "description": "PrintWorkflow", + "name": "PrintWorkflowUserSvc", + "start": 3 + }, + { + "description": "User Profile Service", + "name": "ProfSvc", + "start": 2 + }, + { + "description": "Windows PushToInstall Service", + "name": "PushToInstall", + "start": 3 + }, + { + "description": "Quality Windows Audio Video Experience", + "name": "QWAVE", + "start": 3 + }, + { + "description": "QWAVE driver", + "name": "QWAVEdrv", + "start": 3 + }, + { + "description": "Remote Access Auto Connection Driver", + "name": "RasAcd", + "start": 3 + }, + { + "description": "Remote Access Auto Connection Manager", + "name": "RasAuto", + "start": 3 + }, + { + "description": "Remote Access Connection Manager", + "name": "RasMan", + "start": 3 + }, + { + "description": "Remote Desktop Device Redirector Driver", + "name": "RDPDR", + "start": 3 + }, + { + "description": "Remote Desktop Video Miniport Driver", + "name": "RdpVideoMiniport", + "start": 3 + }, + { + "description": "ReFS", + "name": "ReFS", + "start": 3 + }, + { + "description": "ReFSv1", + "name": "ReFSv1", + "start": 3 + }, + { + "description": "Routing and Remote Access", + "name": "RemoteAccess", + "start": 4 + }, + { + "description": "Remote Registry", + "name": "RemoteRegistry", + "start": 4 + }, + { + "description": "Retail Demo Service", + "name": "RetailDemo", + "start": 3 + }, + { + "description": "Radio Management Service", + "name": "RmSvc", + "start": 3 + }, + { + "description": "RPC Endpoint Mapper", + "name": "RpcEptMapper", + "start": 2 + }, + { + "description": "Remote Procedure Call (RPC) Locator", + "name": "RpcLocator", + "start": 3 + }, + { + "description": "Remote Procedure Call (RPC)", + "name": "RpcSs", + "start": 2 + }, + { + "description": "Link-Layer Topology Discovery Responder", + "name": "rspndr", + "start": 2 + }, + { + "description": "Security Accounts Manager", + "name": "SamSs", + "start": 2 + }, + { + "description": "Smart Card", + "name": "SCardSvr", + "start": 3 + }, + { + "description": "Smart Card Device Enumeration Service", + "name": "ScDeviceEnum", + "start": 3 + }, + { + "description": "Smart card PnP Class Filter Driver", + "name": "scfilter", + "start": 3 + }, + { + "description": "Task Scheduler", + "name": "Schedule", + "start": 2 + }, + { + "description": "Smart Card Removal Policy", + "name": "SCPolicySvc", + "start": 3 + }, + { + "description": "Windows Backup", + "name": "SDRSVC", + "start": 3 + }, + { + "description": "Secondary Logon", + "name": "seclogon", + "start": 3 + }, + { + "description": "Windows Security Service", + "name": "SecurityHealthService", + "start": 3 + }, + { + "description": "Payments and NFC/SE Manager", + "name": "SEMgrSvc", + "start": 3 + }, + { + "description": "System Event Notification Service", + "name": "SENS", + "start": 2 + }, + { + "description": "Windows Defender Advanced Threat Protection Service", + "name": "Sense", + "start": 3 + }, + { + "description": "Sensor Data Service", + "name": "SensorDataService", + "start": 3 + }, + { + "description": "Sensor Service", + "name": "SensorService", + "start": 3 + }, + { + "description": "Sensor Monitoring Service", + "name": "SensrSvc", + "start": 3 + }, + { + "description": "Serial UART Support Library", + "name": "SerCx", + "start": 3 + }, + { + "description": "Serial UART Support Library", + "name": "SerCx2", + "start": 3 + }, + { + "description": "Remote Desktop Configuration", + "name": "SessionEnv", + "start": 3 + }, + { + "description": "System Guard Runtime Monitor Broker", + "name": "SgrmBroker", + "start": 2 + }, + { + "description": "Internet Connection Sharing (ICS)", + "name": "SharedAccess", + "start": 3 + }, + { + "description": "Spatial Data Service", + "name": "SharedRealitySvc", + "start": 3 + }, + { + "description": "Shell Hardware Detection", + "name": "ShellHWDetection", + "start": 2 + }, + { + "description": "Shared PC Account Manager", + "name": "shpamsvc", + "start": 4 + }, + { + "description": "smbdirect", + "name": "smbdirect", + "start": 3 + }, + { + "description": "Microsoft Storage Spaces SMP", + "name": "smphost", + "start": 3 + }, + { + "description": "Microsoft Windows SMS Router Service.", + "name": "SmsRouter", + "start": 3 + }, + { + "description": "SNMP Trap", + "name": "SNMPTrap", + "start": 3 + }, + { + "description": "Space Parser", + "name": "spaceparser", + "start": 3 + }, + { + "description": "", + "name": "SpatialGraphFilter", + "start": 3 + }, + { + "description": "Simple Peripheral Bus Support Library", + "name": "SpbCx", + "start": 3 + }, + { + "description": "Windows Perception Service", + "name": "spectrum", + "start": 3 + }, + { + "description": "Print Spooler", + "name": "Spooler", + "start": 2 + }, + { + "description": "Software Protection", + "name": "sppsvc", + "start": 2 + }, + { + "description": "Server SMB 2.xxx Driver", + "name": "srv2", + "start": 3 + }, + { + "description": "srvnet", + "name": "srvnet", + "start": 3 + }, + { + "description": "SSDP Discovery", + "name": "SSDPSRV", + "start": 3 + }, + { + "description": "OpenSSH Authentication Agent", + "name": "ssh-agent", + "start": 4 + }, + { + "description": "Secure Socket Tunneling Protocol Service", + "name": "SstpSvc", + "start": 3 + }, + { + "description": "State Repository Service", + "name": "StateRepository", + "start": 2 + }, + { + "description": "Windows Image Acquisition (WIA)", + "name": "StiSvc", + "start": 3 + }, + { + "description": "Storage QoS Filter Driver", + "name": "storqosflt", + "start": 2 + }, + { + "description": "Storage Service", + "name": "StorSvc", + "start": 2 + }, + { + "description": "Spot Verifier", + "name": "svsvc", + "start": 3 + }, + { + "description": "Microsoft Software Shadow Copy Provider", + "name": "swprv", + "start": 3 + }, + { + "description": "SysMain", + "name": "SysMain", + "start": 2 + }, + { + "description": "System Events Broker", + "name": "SystemEventsBroker", + "start": 2 + }, + { + "description": "Touch Keyboard and Handwriting Panel Service", + "name": "TabletInputService", + "start": 3 + }, + { + "description": "Telephony", + "name": "TapiSrv", + "start": 3 + }, + { + "description": "@todo.dll,-100;Microsoft IPv6 Protocol Driver", + "name": "Tcpip6", + "start": 3 + }, + { + "description": "TCP/IP Registry Compatibility", + "name": "tcpipreg", + "start": 2 + }, + { + "description": "Remote Desktop Services", + "name": "TermService", + "start": 3 + }, + { + "description": "Themes", + "name": "Themes", + "start": 2 + }, + { + "description": "Storage Tiers Management", + "name": "TieringEngineService", + "start": 3 + }, + { + "description": "Time Broker", + "name": "TimeBrokerSvc", + "start": 3 + }, + { + "description": "Web Account Manager", + "name": "TokenBroker", + "start": 3 + }, + { + "description": "Distributed Link Tracking Client", + "name": "TrkWks", + "start": 2 + }, + { + "description": "Recommended Troubleshooting Service", + "name": "TroubleshootingSvc", + "start": 3 + }, + { + "description": "Windows Modules Installer", + "name": "TrustedInstaller", + "start": 2 + }, + { + "description": "Remote Desktop USB Hub Class Filter Driver", + "name": "TsUsbFlt", + "start": 3 + }, + { + "description": "Microsoft Tunnel Miniport Adapter Driver", + "name": "tunnel", + "start": 3 + }, + { + "description": "Auto Time Zone Updater", + "name": "tzautoupdate", + "start": 4 + }, + { + "description": "USB Connector Manager KMDF Class Extension", + "name": "UcmCx0101", + "start": 3 + }, + { + "description": "UCM-TCPCI KMDF Class Extension", + "name": "UcmTcpciCx0101", + "start": 3 + }, + { + "description": "UCM-UCSI KMDF Class Extension", + "name": "UcmUcsiCx0101", + "start": 3 + }, + { + "description": "USB Host Support Library", + "name": "Ucx01000", + "start": 3 + }, + { + "description": "USB Device Emulation Support Library", + "name": "UdeCx", + "start": 3 + }, + { + "description": "udfs", + "name": "udfs", + "start": 4 + }, + { + "description": "Udk User Service", + "name": "UdkUserSvc", + "start": 3 + }, + { + "description": "UevAgentDriver", + "name": "UevAgentDriver", + "start": 4 + }, + { + "description": "User Experience Virtualization Service", + "name": "UevAgentService", + "start": 4 + }, + { + "description": "USB Function Class Extension", + "name": "Ufx01000", + "start": 3 + }, + { + "description": "Remote Desktop Services UserMode Port Redirector", + "name": "UmRdpService", + "start": 3 + }, + { + "description": "User Data Storage", + "name": "UnistoreSvc", + "start": 3 + }, + { + "description": "UPnP Device Host", + "name": "upnphost", + "start": 3 + }, + { + "description": "USB Role-Switch Support Library", + "name": "UrsCx01000", + "start": 3 + }, + { + "description": "User Data Access", + "name": "UserDataSvc", + "start": 3 + }, + { + "description": "User Manager", + "name": "UserManager", + "start": 2 + }, + { + "description": "Update Orchestrator Service", + "name": "UsoSvc", + "start": 2 + }, + { + "description": "Volumetric Audio Compositor Service", + "name": "VacSvc", + "start": 3 + }, + { + "description": "Credential Manager", + "name": "VaultSvc", + "start": 3 + }, + { + "description": "Virtual Disk", + "name": "vds", + "start": 3 + }, + { + "description": "Driver Verifier Extension", + "name": "VerifierExt", + "start": 3 + }, + { + "description": "Hyper-V Guest Service Interface", + "name": "vmicguestinterface", + "start": 3 + }, + { + "description": "Hyper-V Heartbeat Service", + "name": "vmicheartbeat", + "start": 3 + }, + { + "description": "Hyper-V Data Exchange Service", + "name": "vmickvpexchange", + "start": 3 + }, + { + "description": "Hyper-V Remote Desktop Virtualization Service", + "name": "vmicrdv", + "start": 3 + }, + { + "description": "Hyper-V Guest Shutdown Service", + "name": "vmicshutdown", + "start": 3 + }, + { + "description": "Hyper-V Time Synchronization Service", + "name": "vmictimesync", + "start": 3 + }, + { + "description": "Hyper-V PowerShell Direct Service", + "name": "vmicvmsession", + "start": 3 + }, + { + "description": "Hyper-V Volume Shadow Copy Requestor", + "name": "vmicvss", + "start": 3 + }, + { + "description": "Volume Shadow Copy", + "name": "VSS", + "start": 3 + }, + { + "description": "Windows Time", + "name": "W32Time", + "start": 3 + }, + { + "description": "Windows Update Medic Service", + "name": "WaaSMedicSvc", + "start": 3 + }, + { + "description": "WalletService", + "name": "WalletService", + "start": 3 + }, + { + "description": "Remote Access IP ARP Driver", + "name": "wanarp", + "start": 3 + }, + { + "description": "Remote Access IPv6 ARP Driver", + "name": "wanarpv6", + "start": 3 + }, + { + "description": "WarpJITSvc", + "name": "WarpJITSvc", + "start": 3 + }, + { + "description": "Block Level Backup Engine Service", + "name": "wbengine", + "start": 3 + }, + { + "description": "Windows Biometric Service", + "name": "WbioSrvc", + "start": 3 + }, + { + "description": "Windows Container Isolation", + "name": "wcifs", + "start": 2 + }, + { + "description": "Windows Connection Manager", + "name": "Wcmsvc", + "start": 2 + }, + { + "description": "Windows Connect Now - Config Registrar", + "name": "wcncsvc", + "start": 3 + }, + { + "description": "Diagnostic Service Host", + "name": "WdiServiceHost", + "start": 3 + }, + { + "description": "Diagnostic System Host", + "name": "WdiSystemHost", + "start": 3 + }, + { + "description": "WDI Driver Framework", + "name": "wdiwifi", + "start": 3 + }, + { + "description": "WdmCompanionFilter", + "name": "WdmCompanionFilter", + "start": 3 + }, + { + "description": "Microsoft Defender Antivirus Network Inspection System Driver", + "name": "WdNisDrv", + "start": 3 + }, + { + "description": "Microsoft Defender Antivirus Network Inspection Service", + "name": "WdNisSvc", + "start": 3 + }, + { + "description": "WebClient", + "name": "WebClient", + "start": 3 + }, + { + "description": "Windows Event Collector", + "name": "Wecsvc", + "start": 3 + }, + { + "description": "Windows Encryption Provider Host Service", + "name": "WEPHOSTSVC", + "start": 3 + }, + { + "description": "Problem Reports Control Panel Support", + "name": "wercplsupport", + "start": 3 + }, + { + "description": "Windows Error Reporting Service", + "name": "WerSvc", + "start": 3 + }, + { + "description": "Wi-Fi Direct Services Connection Manager Service", + "name": "WFDSConMgrSvc", + "start": 3 + }, + { + "description": "Still Image Acquisition Events", + "name": "WiaRpc", + "start": 3 + }, + { + "description": "", + "name": "WifiCx", + "start": 3 + }, + { + "description": "WIMMount", + "name": "WIMMount", + "start": 3 + }, + { + "description": "Microsoft Defender Antivirus Service", + "name": "WinDefend", + "start": 2 + }, + { + "description": "WinHTTP Web Proxy Auto-Discovery Service", + "name": "WinHttpAutoProxySvc", + "start": 3 + }, + { + "description": "Windows Management Instrumentation", + "name": "Winmgmt", + "start": 2 + }, + { + "description": "Windows NAT Driver", + "name": "WinNat", + "start": 3 + }, + { + "description": "Windows Remote Management (WS-Management)", + "name": "WinRM", + "start": 3 + }, + { + "description": "Windows Insider Service", + "name": "wisvc", + "start": 3 + }, + { + "description": "WLAN AutoConfig", + "name": "WlanSvc", + "start": 3 + }, + { + "description": "Microsoft Account Sign-in Assistant", + "name": "wlidsvc", + "start": 3 + }, + { + "description": "Local Profile Assistant Service", + "name": "wlpasvc", + "start": 3 + }, + { + "description": "Windows Management Service", + "name": "WManSvc", + "start": 3 + }, + { + "description": "WMI Performance Adapter", + "name": "wmiApSrv", + "start": 3 + }, + { + "description": "Windows Media Player Network Sharing Service", + "name": "WMPNetworkSvc", + "start": 3 + }, + { + "description": "Work Folders", + "name": "workfolderssvc", + "start": 3 + }, + { + "description": "Parental Controls", + "name": "WpcMonSvc", + "start": 3 + }, + { + "description": "Portable Device Enumerator Service", + "name": "WPDBusEnum", + "start": 3 + }, + { + "description": "WPD Upper Class Filter Driver", + "name": "WpdUpFltr", + "start": 3 + }, + { + "description": "Windows Push Notifications System Service", + "name": "WpnService", + "start": 2 + }, + { + "description": "Windows Push Notifications User Service", + "name": "WpnUserService", + "start": 2 + }, + { + "description": "Winsock IFS Driver", + "name": "ws2ifsl", + "start": 4 + }, + { + "description": "Security Center", + "name": "wscsvc", + "start": 2 + }, + { + "description": "Windows Search", + "name": "WSearch", + "start": 2 + }, + { + "description": "Windows Update", + "name": "wuauserv", + "start": 3 + }, + { + "description": "User Mode Driver Frameworks Platform Driver", + "name": "WudfPf", + "start": 3 + }, + { + "description": "WWAN AutoConfig", + "name": "WwanSvc", + "start": 3 + }, + { + "description": "Xbox Live Auth Manager", + "name": "XblAuthManager", + "start": 3 + }, + { + "description": "Xbox Live Game Save", + "name": "XblGameSave", + "start": 3 + }, + { + "description": "Xbox Accessory Management Service", + "name": "XboxGipSvc", + "start": 3 + }, + { + "description": "Xbox Live Networking Service", + "name": "XboxNetApiSvc", + "start": 3 + } + ] +} diff --git a/Content/Lists/SystemApps/SystemAppsBlacklist.json b/Content/Lists/SystemApps/SystemAppsBlacklist.json new file mode 100644 index 0000000..498aa80 --- /dev/null +++ b/Content/Lists/SystemApps/SystemAppsBlacklist.json @@ -0,0 +1,5 @@ +{ + "DisplayName": [ + + ] +} \ No newline at end of file diff --git a/Content/Lists/SystemApps/SystemAppsTemplate.json b/Content/Lists/SystemApps/SystemAppsTemplate.json new file mode 100644 index 0000000..872dae1 --- /dev/null +++ b/Content/Lists/SystemApps/SystemAppsTemplate.json @@ -0,0 +1,43 @@ +{ + "DisplayName": [ + "Microsoft.AAD.BrokerPlugin", + "Microsoft.AccountsControl", + "Microsoft.AsyncTextService", + "Microsoft.BioEnrollment", + "Microsoft.CredDialogHost", + "Microsoft.ECApp", + "Microsoft.LockApp", + "Microsoft.MicrosoftEdge", + "Microsoft.MicrosoftEdgeDevToolsClient", + "Microsoft.UI.Xaml.CBS", + "Microsoft.Win32WebViewHost", + "Microsoft.Windows.AddSuggestedFoldersToLibarayDialog", + "Microsoft.Windows.AppRep.ChxApp", + "Microsoft.Windows.AppResolverUX", + "Microsoft.Windows.AssignedAccessLockApp", + "Microsoft.Windows.CallingShellApp", + "Microsoft.Windows.CapturePicker", + "Microsoft.Windows.CloudExperienceHost", + "Microsoft.Windows.ContentDeliveryManager", + "Microsoft.Windows.FileExplorer", + "Microsoft.Windows.FilePicker", + "Microsoft.Windows.NarratorQuickStart", + "Microsoft.Windows.OOBENetworkCaptivePortal", + "Microsoft.Windows.OOBENetworkConnectionFlow", + "Microsoft.Windows.ParentalControls", + "Microsoft.Windows.PeopleExperienceHost", + "Microsoft.Windows.PinningConfirmationDialog", + "Microsoft.Windows.Search", + "Microsoft.Windows.SecureAssessmentBrowser", + "Microsoft.Windows.ShellExperienceHost", + "Microsoft.Windows.StartMenuExperienceHost", + "Microsoft.Windows.XGpuEjectDialog", + "Microsoft.XboxGameCallableUI", + "MicrosoftWindows.Client.CBS", + "MicrosoftWindows.UndockedDevKit", + "NcsiUwpApp", + "Windows.CBSPreview", + "windows.immersivecontrolpanel", + "Windows.PrintDialog" + ] +} diff --git a/Content/Lists/SystemApps/SystemAppsWhitelist.json b/Content/Lists/SystemApps/SystemAppsWhitelist.json new file mode 100644 index 0000000..53c6c2e --- /dev/null +++ b/Content/Lists/SystemApps/SystemAppsWhitelist.json @@ -0,0 +1,20 @@ +{ + "DisplayName": [ + "Microsoft.AccountsControl", + "Microsoft.CredDialogHost", + "Microsoft.MicrosoftEdge", + "Microsoft.MicrosoftEdgeDevToolsClient", + "Microsoft.UI.Xaml.CBS", + "Microsoft.Windows.CloudExperienceHost", + "Microsoft.Windows.OOBENetworkCaptivePortal", + "Microsoft.Windows.OOBENetworkConnectionFlow", + "Microsoft.Windows.ShellExperienceHost", + "Microsoft.Windows.StartMenuExperienceHost", + "Microsoft.Windows.SecureAssessmentBrowser", + "MicrosoftWindows.Client.CBS", + "MicrosoftWindows.UndockedDevKit", + "NcsiUwpApp", + "windows.immersivecontrolpanel", + "Windows.PrintDialog" + ] +} diff --git a/Content/Lists/WindowsApps/WindowsAppsBlacklist.json b/Content/Lists/WindowsApps/WindowsAppsBlacklist.json new file mode 100644 index 0000000..498aa80 --- /dev/null +++ b/Content/Lists/WindowsApps/WindowsAppsBlacklist.json @@ -0,0 +1,5 @@ +{ + "DisplayName": [ + + ] +} \ No newline at end of file diff --git a/Content/Lists/WindowsApps/WindowsAppsTemplate.json b/Content/Lists/WindowsApps/WindowsAppsTemplate.json new file mode 100644 index 0000000..5fd1188 --- /dev/null +++ b/Content/Lists/WindowsApps/WindowsAppsTemplate.json @@ -0,0 +1,47 @@ +{ + "DisplayName": [ + "CortanaApp.View.App", + "Microsoft.BingNews", + "Microsoft.BingWeather", + "Microsoft.DesktopAppInstaller", + "Microsoft.GamingApp", + "Microsoft.GetHelp", + "Microsoft.Getstarted", + "Microsoft.HEIFImageExtension", + "Microsoft.MicrosoftOfficeHub", + "Microsoft.MicrosoftSolitaireCollection", + "Microsoft.MicrosoftStickyNotes", + "Microsoft.Paint", + "Microsoft.People", + "Microsoft.PowerAutomateDesktop", + "Microsoft.ScreenSketch", + "Microsoft.SecHealthUI", + "Microsoft.StorePurchaseApp", + "Microsoft.Todos", + "Microsoft.UI.Xaml.2.4", + "Microsoft.VCLibs.140.00", + "Microsoft.VP9VideoExtensions", + "Microsoft.WebMediaExtensions", + "Microsoft.WebpImageExtension", + "Microsoft.Windows.Photos", + "Microsoft.WindowsAlarms", + "Microsoft.WindowsCalculator", + "Microsoft.WindowsCamera", + "microsoft.windowscommunicationsapps", + "Microsoft.WindowsFeedbackHub", + "Microsoft.WindowsMaps", + "Microsoft.WindowsNotepad", + "Microsoft.WindowsSoundRecorder", + "Microsoft.WindowsStore", + "Microsoft.WindowsTerminal", + "Microsoft.Xbox.TCUI", + "Microsoft.XboxGameOverlay", + "Microsoft.XboxGamingOverlay", + "Microsoft.XboxIdentityProvider", + "Microsoft.XboxSpeechToTextOverlay", + "Microsoft.YourPhone", + "Microsoft.ZuneMusic", + "Microsoft.ZuneVideo", + "MicrosoftWindows.Client.WebExperience" + ] +} diff --git a/Content/Lists/WindowsApps/WindowsAppsWhitelist.json b/Content/Lists/WindowsApps/WindowsAppsWhitelist.json new file mode 100644 index 0000000..04ac16a --- /dev/null +++ b/Content/Lists/WindowsApps/WindowsAppsWhitelist.json @@ -0,0 +1,7 @@ +{ + "DisplayName": [ + "Microsoft.VCLibs.*", + "Microsoft.UI.Xaml.*", + "Microsoft.WindowsTerminal" + ] +} diff --git a/Optimize-Offline.psd1 b/Optimize-Offline.psd1 index a7744f6..88f93d8 100644 --- a/Optimize-Offline.psd1 +++ b/Optimize-Offline.psd1 @@ -1,6 +1,6 @@ <# =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2019 v5.7.182 + Created with: SAPIEN Technologies, Inc., PowerShell Studio 2021 v5.8.194 Created on: 11/20/2019 11:53 AM Created by: BenTheGreat Filename: Optimize-Offline.psd1 @@ -14,10 +14,10 @@ @{ GUID = '86c4db30-1a45-43c7-a96b-46d2a1d84671' RootModule = 'Optimize-Offline.psm1' - ModuleVersion = '4.0.1.7' + ModuleVersion = '4.0.1.9' Author = 'Ben White' - Copyright = '(c) 2020. All rights reserved.' - Description = 'The Optimize-Offline module enables the offline optimizing of Windows 10 image (WIM/ESD) files for optimal runtime environments.' + Copyright = '(c) 2021. All rights reserved.' + Description = 'The Optimize-Offline module enables the offline optimizing of Windows images (WIM/ESD) files for optimal runtime environments.' HelpInfoUri = 'https://github.com/DrEmpiricism/Optimize-Offline/blob/master/en-US/Optimize-Offline-help.xml' PowerShellVersion = '5.1' DotNetFrameworkVersion = '4.0' @@ -30,7 +30,7 @@ CmdletsToExport = @() PrivateData = @{ PSData = @{ - Tags = @('Image Optimization', 'WIM Optimization', 'Offline Windows Image', 'Offline Servicing', 'Offline Imaging', 'WIM', 'SWM', 'ESD', 'Windows 10', 'LTSC', 'Enterprise', '19H1', '19H2', '20H1', '20H2', 'Deployment', 'Debloat', 'DISM', 'PSModule') + Tags = @('Image Optimization', 'WIM Optimization', 'Offline Windows Image', 'Offline Servicing', 'Offline Imaging', 'WIM', 'SWM', 'ESD', 'Windows 10', 'Windows 11', 'LTSC', 'Enterprise', '19H1', '19H2', '20H1', '20H2', '21H1', '21H2', 'Deployment', 'Debloat', 'DISM', 'PSModule') LicenseUri = 'https://github.com/DrEmpiricism/Optimize-Offline/blob/master/LICENSE' ProjectUri = 'https://github.com/DrEmpiricism/Optimize-Offline' ReleaseNotes = 'https://github.com/DrEmpiricism/Optimize-Offline/blob/master/ChangeLog.md' diff --git a/Optimize-Offline.psm1 b/Optimize-Offline.psm1 index fc991f3..261f0d3 100644 --- a/Optimize-Offline.psm1 +++ b/Optimize-Offline.psm1 @@ -4,18 +4,20 @@ #Requires -Module Dism <# =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2021 v5.8.191 + Created with: SAPIEN Technologies, Inc., PowerShell Studio 2021 v5.8.194 Created on: 11/20/2019 11:53 AM Created by: BenTheGreat Filename: Optimize-Offline.psm1 - Version: 4.0.1.8 - Last updated: 06/22/2021 + Version: 4.0.1.9 + Last updated: 09/12/2021 ------------------------------------------------------------------------- Module Name: Optimize-Offline =========================================================================== #> + Function Optimize-Offline { + <# .EXTERNALHELP Optimize-Offline-help.xml #> @@ -25,23 +27,26 @@ Function Optimize-Offline ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, - HelpMessage = 'The full path to a Windows 10 Installation Media ISO, or a Windows 10 WIM, SWM or ESD file.')] - [ValidateScript( { - If ($PSItem.Exists -and $PSItem.Extension -eq '.ISO' -or $PSItem.Extension -eq '.WIM' -or $PSItem.Extension -eq '.SWM' -or $PSItem.Extension -eq '.ESD') { $true } - Else { Throw ('Invalid source path: "{0}"' -f $PSItem.FullName) } - })] - [IO.FileInfo]$SourcePath, + HelpMessage = 'The full path to a Windows Installation Media ISO, or a Windows WIM, SWM or ESD file.')] + [Object]$SourcePath, [Parameter(HelpMessage = 'Selectively or automatically deprovisions Windows Apps and removes their associated provisioning packages (.appx or .appxbundle).')] - [ValidateSet('Select', 'Whitelist', 'All')] + [ValidateSet('None', 'Select', 'Whitelist', 'Blacklist', 'All')] [String]$WindowsApps, [Parameter(HelpMessage = 'Populates and outputs a Gridview list of System Apps for selective removal.')] - [Switch]$SystemApps, + [ValidateSet('None', 'Select', 'Whitelist', 'Blacklist', 'All')] + [String]$SystemApps, [Parameter(HelpMessage = 'Populates and outputs a Gridview list of Capability Packages for selective removal.')] - [Switch]$Capabilities, + [ValidateSet('None', 'Select', 'Whitelist', 'Blacklist', 'All')] + [String]$Capabilities, [Parameter(HelpMessage = 'Populates and outputs a Gridview list of Windows Cabinet File Packages for selective removal.')] - [Switch]$Packages, + [ValidateSet('None', 'Select', 'Whitelist', 'Blacklist', 'All')] + [String]$Packages, + [ValidateSet('None', 'Select', 'List', 'All')] [Parameter(HelpMessage = 'Populates and outputs a Gridview list of Windows Optional Features for selective disabling and enabling.')] - [Switch]$Features, + [String]$FeaturesToEnable, + [ValidateSet('None', 'Select', 'List', 'All')] + [Parameter(HelpMessage = 'Populates and outputs a Gridview list of Windows Optional Features for selective disabling and enabling.')] + [String]$FeaturesToDisable, [Parameter(HelpMessage = 'Integrates the Developer Mode Feature into the image.')] [Switch]$DeveloperMode, [Parameter(HelpMessage = 'Integrates the Microsoft Windows Store and its required dependencies into the image.')] @@ -50,6 +55,8 @@ Function Optimize-Offline [Switch]$MicrosoftEdge, [Parameter(HelpMessage = 'Integrates the traditional Win32 Calculator into the image.')] [Switch]$Win32Calc, + [Parameter(HelpMessage = 'Disable Windows defender while retaining the option to reactivate it.')] + [Switch]$DormantDefender, [Parameter(HelpMessage = 'Integrates the Windows Server Data Deduplication Feature into the image.')] [Switch]$Dedup, [Parameter(HelpMessage = 'Integrates the Microsoft Diagnostic and Recovery Toolset (DaRT 10) and Windows 10 Debugging Tools into Windows Setup and Windows Recovery.')] @@ -63,7 +70,34 @@ Function Optimize-Offline [Switch]$ComponentCleanup, [Parameter(HelpMessage = 'Creates a new bootable Windows Installation Media ISO.')] [ValidateSet('Prompt', 'No-Prompt')] - [String]$ISO + [String]$ISO, + [Parameter(Mandatory=$false)] $populateLists, + [Parameter(Mandatory=$false)] $populateTemplates, + [Parameter(Mandatory=$false)] + [ValidateSet('Select', 'None', 'Fast', 'Maximum', 'Solid')] + [String]$CompressionType, + [Parameter(Mandatory=$false)] + [Hashtable]$SelectiveRegistry = @{ + DisableWindowsUpgrade = $false + DisableWindowsUpdateMicrosoft = $false + DisableDriverUpdate = $false + DormantOneDrive = $false + Disable3rdPartyApps = $false + W11ClassicContextMenu = $false + ClassicSearchExplorer = $false + RemoveTaskbarPinnedIcons = $false + DisableTeamsApp = $false + DisableVirtualizationSecurity = $false + RunAsTiContextMenu = $false + AmoledBlackTheme = $false + ClassicFileExplorer = $false + }, + [Hashtable]$Miscellaneous = @{ + ShutDownOnComplete = $false + }, + [Parameter(HelpMessage = 'Removal of windows services.')] + [ValidateSet('None', 'List', 'Advanced', 'Select')] + [String]$Services ) Begin @@ -100,12 +134,43 @@ Function Optimize-Offline #endregion Create the Working File Structure #region Media Export + $SourcePath = [IO.FileInfo]$SourcePath + $allowedExtensions = @('.iso', '.wim', '.swm', '.esd') + If (-not $SourcePath.Exists -or [String]$SourcePath.Extension.ToLower() -notin $allowedExtensions) { + Add-Type -AssemblyName System.Windows.Forms + + $FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{ + InitialDirectory = [Environment]::GetFolderPath('Desktop') + Filter = 'All allowed types|*.wim;*.swm;*.iso;*.esd;*.WIM;*.SWM;*.ISO;*.ESD' + Multiselect = $false + AddExtension = $true + CheckPathExists = $true + } + + $null = $FileBrowser.ShowDialog() + + if($FileBrowser.FileName){ + $SourcePath = Get-Item -Path $FileBrowser.FileName + } + } + + if(-not $SourcePath.Exists) { Throw ('Invalid source path: "{0}"' -f [String]$SourcePath) } + Switch ($SourcePath.Extension) { '.ISO' { - $ISOMount = (Mount-DiskImage -ImagePath $SourcePath.FullName -StorageType ISO -PassThru | Get-Volume).DriveLetter + ':' - [Void](Get-PSDrive) + Try{ + $DrivesBefore = [System.Collections.ArrayList]@() + Get-PSDrive -PSProvider FileSystem | Where-Object {$_.Free -eq 0} | ForEach-Object -Process { + [Void]$DrivesBefore.Add($PSItem.Name) + } + [Void](Mount-DiskImage -ImagePath $SourcePath.FullName -StorageType ISO) + $ISOMount = "$((Get-PSDrive -PSProvider FileSystem | Where-Object {$_.Free -eq 0 -and $_.Name -notin $DrivesBefore}).Name):" + } Catch { + $ISOMount = "" + } + If (!(Get-ChildItem -Path (GetPath -Path $ISOMount -Child sources) -Filter install* -File)) { $PSCmdlet.WriteWarning($OptimizeData.InvalidWindowsInstallMedia -f $SourcePath.Name) @@ -200,7 +265,7 @@ Function Optimize-Offline Do { $Host.UI.RawUI.WindowTitle = $OptimizeData.SelectWindowsEdition - $EditionList = Get-WindowsImage -ImagePath $InstallWim -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Select-Object -Property @{ Label = 'Index'; Expression = { ($PSItem.ImageIndex) } }, @{ Label = 'Name'; Expression = { ($PSItem.ImageName) } }, @{ Label = 'Size (GB)'; Expression = { '{0:N2}' -f ($PSItem.ImageSize / 1GB) } } | Out-GridView -Title "Select the Windows 10 Edition to Optimize." -OutputMode Single + $EditionList = Get-WindowsImage -ImagePath $InstallWim -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Select-Object -Property @{ Label = 'Index'; Expression = { ($PSItem.ImageIndex) } }, @{ Label = 'Name'; Expression = { ($PSItem.ImageName) } }, @{ Label = 'Size (GB)'; Expression = { '{0:N2}' -f ($PSItem.ImageSize / 1GB) } } | Out-GridView -Title $OptimizeData.SelectWindowsEdition -OutputMode Single } While ($EditionList.Length -eq 0) $ImageIndex = $EditionList.Index @@ -211,6 +276,7 @@ Function Optimize-Offline { $Host.UI.RawUI.WindowTitle = "Validating Image Metadata." $InstallInfo = $InstallWim | Get-ImageData -Index $ImageIndex -ErrorAction Stop + $Global:InstallInfo = $InstallInfo } Catch { @@ -219,6 +285,13 @@ Function Optimize-Offline Break } + If ($InstallInfo.Build -ge 22000 -and -not $BootWim -and $ISOMedia.Exists) + { + Try { $BootWim = Get-ChildItem -Path (GetPath -Path $ISOMedia.FullName -Child sources) -Filter boot.* -File | Move-Item -Destination $ImageFolder -PassThru -ErrorAction Stop | Set-ItemProperty -Name IsReadOnly -Value $false -PassThru | Get-Item | Select-Object -ExpandProperty FullName } + Catch [Management.Automation.ItemNotFoundException] { Break } + $DynamicParams.BootImage = $true + } + If ($InstallInfo.VersionTable.Major -ne 10) { $PSCmdlet.WriteWarning($OptimizeData.UnsupportedImageVersion -f $InstallInfo.Version) @@ -233,19 +306,19 @@ Function Optimize-Offline Break } - If ($InstallInfo.InstallationType.Contains('Server') -or $InstallInfo.InstallationType.Contains('WindowsPE')) + If ($InstallInfo.InstallationType.Contains('WindowsPE')) { $PSCmdlet.WriteWarning($OptimizeData.UnsupportedImageType -f $InstallInfo.InstallationType) $TempDirectory | Purge Break } - If ($InstallInfo.Build -ge '17134' -and $InstallInfo.Build -le '19041') + If ($InstallInfo.Build -ge '17134') { If ($InstallInfo.Name -like "*LTSC*") { $DynamicParams.LTSC = $true - If ($WindowsApps) { Remove-Variable -Name WindowsApps } + If ($WindowsApps -notin @('None')) { Remove-Variable -Name WindowsApps } If ($Win32Calc.IsPresent) { $Win32Calc = ![Switch]::Present } } Else @@ -444,333 +517,584 @@ Function Optimize-Offline } #endregion Image Preparation - #region Provisioned App Package Removal - If ($WindowsApps -and (Get-AppxProvisionedPackage -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1).Count -gt 0) - { - $Host.UI.RawUI.WindowTitle = "Remove Provisioned App Packages." - $AppxPackages = Get-AppxProvisionedPackage -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Select-Object -Property DisplayName, PackageName | Sort-Object -Property DisplayName - If ($InstallInfo.Build -eq '19041') - { - $AppxPackages = $AppxPackages | ForEach-Object -Process { - $DisplayName = $PSItem.DisplayName; $PackageName = $PSItem.PackageName - If ($DisplayName -eq 'Microsoft.549981C3F5F10') { $DisplayName = 'CortanaApp.View.App' } - [PSCustomObject]@{ DisplayName = $DisplayName; PackageName = $PackageName } + + + If ($populateLists -or $populateTemplates) { + + Try { + $Items = [System.Collections.ArrayList]@( ) + Get-AppxPackages -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -Build $InstallInfo.Build | ForEach-Object -Process { + [Void]$Items.Add([String]$PSItem.DisplayName) + } + ## Populate WindowsApps template + Log "$($OptimizeData.Populating) $($OptimizeOffline.Lists.WindowsApps.Template)" + [ordered]@{ + DisplayName = $Items + } | ConvertTo-Json | Out-File -FilePath $OptimizeOffline.Lists.WindowsApps.Template -Encoding UTF8 -Force -ErrorAction Ignore + Start-Sleep 1 + If ($populateLists -and $WindowsApps -in @('Whitelist', 'Blacklist')) { + ## Populate WindowsApps selected type of list + Log "$($OptimizeData.Populating) $($OptimizeOffline.Lists.WindowsApps[$WindowsApps])" + Start-Sleep 1 + $Items = $Items | Out-GridView -Title "Select windows apps to save to the $($WindowsApps)" -PassThru + If($Items -isnot [array]) { + $Items = @($Items) + } + [ordered]@{ + DisplayName = $Items + } | ConvertTo-Json | Out-File -FilePath $OptimizeOffline.Lists.WindowsApps[$WindowsApps] -Encoding UTF8 -Force -ErrorAction Ignore + } + + $Items = [System.Collections.ArrayList]@( ) + Get-SystemPackages | ForEach-Object -Process { + [Void]$Items.Add([String]$PSItem.DisplayName) + } + ## Populate SystemApps template + Log "$($OptimizeData.Populating) $($OptimizeOffline.Lists.SystemApps.Template)" + [ordered]@{ + DisplayName = $Items + } | ConvertTo-Json | Out-File -FilePath $OptimizeOffline.Lists.SystemApps.Template -Encoding UTF8 -Force -ErrorAction Ignore + Start-Sleep 1 + If ($populateLists -and $SystemApps -in @('Whitelist', 'Blacklist')) { + ## Populate SystemApps selected type of list + Log "$($OptimizeData.Populating) $($OptimizeOffline.Lists.SystemApps[$SystemApps])" + Start-Sleep 1 + $Items = $Items | Out-GridView -Title "Select system apps to save to the $($SystemApps)" -PassThru + If($Items -isnot [array]) { + $Items = @($Items) + } + [ordered]@{ + DisplayName = $Items + } | ConvertTo-Json | Out-File -FilePath $OptimizeOffline.Lists.SystemApps[$SystemApps] -Encoding UTF8 -Force -ErrorAction Ignore } + + $Items = [System.Collections.ArrayList]@( ) + Get-CapabilityPackages -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog | ForEach-Object -Process { + [Void]$Items.Add([String]$PSItem.Name) + } + ## Populate capabilities template + Log "$($OptimizeData.Populating) $($OptimizeOffline.Lists.Capabilities.Template)" + [ordered]@{ + Name = $Items + } | ConvertTo-Json | Out-File -FilePath $OptimizeOffline.Lists.Capabilities.Template -Encoding UTF8 -Force -ErrorAction Ignore + Start-Sleep 1 + If ($populateLists -and $Capabilities -in @('Whitelist', 'Blacklist')) { + ## Populate Capabilities selected type of list + Log "$($OptimizeData.Populating) $($OptimizeOffline.Lists.Capabilities[$Capabilities])" + Start-Sleep 1 + $Items = $Items | Out-GridView -Title "Select capabilities to save to the $($Capabilities)" -PassThru + If($Items -isnot [array]) { + $Items = @($Items) + } + [ordered]@{ + Name = $Items + } | ConvertTo-Json | Out-File -FilePath $OptimizeOffline.Lists.Capabilities[$Capabilities] -Encoding UTF8 -Force -ErrorAction Ignore + } + + $Items = [System.Collections.ArrayList]@( ) + Get-OtherWindowsPackages -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog | ForEach-Object -Process { + [Void]$Items.Add([String]$PSItem.PackageName) + } + # Populate Packages template + Log "$($OptimizeData.Populating) $($OptimizeOffline.Lists.Packages.Template)" + [ordered]@{ + PackageName = $Items + } | ConvertTo-Json | Out-File -FilePath $OptimizeOffline.Lists.Packages.Template -Encoding UTF8 -Force -ErrorAction Ignore + Start-Sleep 1 + If ($populateLists -and $Packages -in @('Whitelist', 'Blacklist')) { + ## Populate Packages selected type of list + Log "$($OptimizeData.Populating) $($OptimizeOffline.Lists.Packages[$Packages])" + Start-Sleep 1 + $Items = $Items | Out-GridView -Title "Select packages to save to the $($Packages)" -PassThru + If($Items -isnot [array]) { + $Items = @($Items) + } + [ordered]@{ + PackageName = $Items + } | ConvertTo-Json | Out-File -FilePath $OptimizeOffline.Lists.Packages[$Packages] -Encoding UTF8 -Force -ErrorAction Ignore + } + + $Items = [System.Collections.ArrayList]@( ) + Get-OptionalEnabledFeatures -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog | ForEach-Object -Process { + [Void]$Items.Add([String]$PSItem.FeatureName) + } + ## Populate FeaturesToDisable template + Log "$($OptimizeData.Populating) $($OptimizeOffline.Lists.FeaturesToDisable.Template)" + [ordered]@{ + FeatureName = $Items + } | ConvertTo-Json | Out-File -FilePath $OptimizeOffline.Lists.FeaturesToDisable.Template -Encoding UTF8 -Force -ErrorAction Ignore + Start-Sleep 1 + If ($populateLists -and $FeaturesToDisable -eq 'List') { + ## Populate FeaturesToDisable list + Log "$($OptimizeData.Populating) $($OptimizeOffline.Lists.FeaturesToDisable.List)" + Start-Sleep 1 + $Items = $Items | Out-GridView -Title "Select features to disable for saving to the FeaturesToDisable list" -PassThru + If($Items -isnot [array]) { + $Items = @($Items) + } + [ordered]@{ + FeatureName = $Items + } | ConvertTo-Json | Out-File -FilePath $OptimizeOffline.Lists.FeaturesToDisable.List -Encoding UTF8 -Force -ErrorAction Ignore + } + + $Items = [System.Collections.ArrayList]@( ) + Get-OptionalDisabledFeatures -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog | ForEach-Object -Process { + [Void]$Items.Add([String]$PSItem.FeatureName) + } + ## Populate FeaturesToEnable template + Log "$($OptimizeData.Populating) $($OptimizeOffline.Lists.FeaturesToEnable.Template)" + [ordered]@{ + FeatureName = $Items + } | ConvertTo-Json | Out-File -FilePath $OptimizeOffline.Lists.FeaturesToEnable.Template -Encoding UTF8 -Force -ErrorAction Ignore + Start-Sleep 1 + If ($populateLists -and $FeaturesToEnable -eq 'List') { + ## Populate FeaturesToEnable list + Log "$($OptimizeData.Populating) $($OptimizeOffline.Lists.FeaturesToEnable.List)" + Start-Sleep 1 + $Items = $Items | Out-GridView -Title "Select features to disable for saving to the FeaturesToEnable list" -PassThru + If($Items -isnot [array]) { + $Items = @($Items) + } + [ordered]@{ + FeatureName = $Items + } | ConvertTo-Json | Out-File -FilePath $OptimizeOffline.Lists.FeaturesToEnable.List -Encoding UTF8 -Force -ErrorAction Ignore + } + + RegHives -Load + $Items = [System.Collections.ArrayList]@( ) + Get-ChildItem -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services" | Where-Object{$_.ValueCount -gt 0} | ForEach-Object -Process { + $serviceDetails = Get-Service -Name $PSItem.PSChildName -ErrorAction Ignore + $folderKeys = Get-ItemProperty -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem.PSChildName)" + If($null -ne $folderKeys.Start -and $null -eq $folderKeys.Owners -and $folderKeys.Start -gt 1){ + [Void]$Items.Add((New-Object PSObject -Property @{ + name = [String]$PSItem.PSChildName + description = $(If ($null -ne $serviceDetails -and $null -ne $serviceDetails.DisplayName) {$serviceDetails.DisplayName} Else {""}) + start = $folderKeys.Start + })) + } + } + $JsonInfo = @( + "start key values", + "0 = Boot", + "1 = System", + "2 = Automatic", + "3 = Manual", + "4 = Disabled" + ) + ## Populate Services template + Log "$($OptimizeData.Populating) $($OptimizeOffline.Lists.Services.Template)" + [ordered]@{ + __Info = $JsonInfo + Services = $Items + } | ConvertTo-Json | Out-File -FilePath $OptimizeOffline.Lists.Services.Template -Encoding UTF8 -Force -ErrorAction Ignore + If ($populateLists -and $Services -in @('List', 'Advanced')) { + Log "$($OptimizeData.Populating) $($OptimizeOffline.Lists.Services[$Services])" + Start-Sleep 1 + $Items = $Items | Out-GridView -Title "Select services save to the list" -PassThru + If($Items -isnot [array]) { + $Items = @($Items) + } + $JsonData = [ordered]@{ + __Info = $JsonInfo + Services = $Items + } + if($Services -eq 'List'){ + $JsonData.Services = [System.Collections.ArrayList]@() + foreach ($Item in $Items) { + [Void]$JsonData.Services.Add($Item.name) + } + } + $JsonData | ConvertTo-Json | Out-File -FilePath $OptimizeOffline.Lists.Services[$Services] -Encoding UTF8 -Force -ErrorAction Ignore + } + RegHives -Unload + + } Catch { + Log $Error[0] + } Finally { + Dismount-Images + @($TempDirectory, $DISMLog, $(GetPath -Path $Env:SystemRoot -Child 'Logs\DISM\dism.log')) | Purge -ErrorAction Ignore } - $RemovedAppxPackages = [Collections.Hashtable]::New() - Switch ($PSBoundParameters.WindowsApps) + Return + } + + + #region Provisioned App Package Removal + $RemovedPackages = [Collections.Hashtable]::New(); + $NoApps = $false + If ($WindowsApps -in $AllowedRemovalOptions) + { + Try { - 'Select' + $Host.UI.RawUI.WindowTitle = "Remove Provisioned App Packages." + + $AppxPackages = Get-AppxPackages -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -Build $InstallInfo.Build + + $NoApps = ($AppxPackages.Count -eq 0) + + $appsToRemove = [System.Collections.ArrayList]@() + + $RemovedAppxPackages = [Collections.Hashtable]::New() + Switch ($PSBoundParameters.WindowsApps) { - Try + 'Select' { - $AppxPackages | Out-GridView -Title "Select the Provisioned App Packages to Remove." -PassThru | ForEach-Object -Process { - $RemoveAppxParams = @{ - Path = $InstallMount - PackageName = $PSItem.PackageName - ScratchDirectory = $ScratchFolder - LogPath = $DISMLog - LogLevel = 1 - ErrorAction = 'Stop' - } - Log ($OptimizeData.RemovingWindowsApp -f $PSItem.DisplayName) - [Void](Remove-AppxProvisionedPackage @RemoveAppxParams) - $RemovedAppxPackages.Add($PSItem.DisplayName, $PSItem.PackageName) - } - $DynamicParams.WindowsApps = $true + $appsToRemove = $AppxPackages | Out-GridView -Title "Select the Provisioned App Packages to Remove." -PassThru + Break } - Catch + 'Whitelist' { - Log $OptimizeData.FailedRemovingWindowsApps -Type Error -ErrorRecord $Error[0] - Stop-Optimize - } - Break - } - 'Whitelist' - { - If (Test-Path -Path $OptimizeOffline.AppxWhitelist) - { - Try + If (Test-Path -Path $OptimizeOffline.Lists.WindowsApps.Whitelist) { - If ($InstallInfo.Build -eq '19041') - { - $WhitelistJSON = Get-Content -Path $OptimizeOffline.AppxWhitelist -Raw -ErrorAction Stop - If ($WhitelistJSON.Contains('Microsoft.549981C3F5F10')) { $WhitelistJSON = $WhitelistJSON.Replace('Microsoft.549981C3F5F10', 'CortanaApp.View.App') } - $WhitelistJSON = $WhitelistJSON | ConvertFrom-Json -ErrorAction Stop - } - Else - { - $WhitelistJSON = Get-Content -Path $OptimizeOffline.AppxWhitelist -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop - } + $JSON = Get-Content -Path $OptimizeOffline.Lists.WindowsApps.Whitelist -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop + $AppxPackages | ForEach-Object -Process { - If ($PSItem.DisplayName -notin $WhitelistJSON.DisplayName) + If ($PSItem.DisplayName -notin $JSON.DisplayName) { - $RemoveAppxParams = @{ - Path = $InstallMount - PackageName = $PSItem.PackageName - ScratchDirectory = $ScratchFolder - LogPath = $DISMLog - LogLevel = 1 - ErrorAction = 'Stop' - } - Log ($OptimizeData.RemovingWindowsApp -f $PSItem.DisplayName) - [Void](Remove-AppxProvisionedPackage @RemoveAppxParams) - $RemovedAppxPackages.Add($PSItem.DisplayName, $PSItem.PackageName) + [void]$appsToRemove.Add($PSItem) } } - $DynamicParams.WindowsApps = $true - } - Catch - { - Log $OptimizeData.FailedRemovingWindowsApps -Type Error -ErrorRecord $Error[0] - Stop-Optimize } + Break } - Break - } - 'All' - { - Try + 'Blacklist' { - $AppxPackages | ForEach-Object -Process { - $RemoveAppxParams = @{ - Path = $InstallMount - PackageName = $PSItem.PackageName - ScratchDirectory = $ScratchFolder - LogPath = $DISMLog - LogLevel = 1 - ErrorAction = 'Stop' + If (Test-Path -Path $OptimizeOffline.Lists.WindowsApps.Blacklist) + { + $JSON = Get-Content -Path $OptimizeOffline.Lists.WindowsApps.Blacklist -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop + + $AppxPackages | ForEach-Object -Process { + If ($PSItem.DisplayName -in $JSON.DisplayName) + { + [void]$appsToRemove.Add($PSItem) + } } - Log ($OptimizeData.RemovingWindowsApp -f $PSItem.DisplayName) - [Void](Remove-AppxProvisionedPackage @RemoveAppxParams) - $RemovedAppxPackages.Add($PSItem.DisplayName, $PSItem.PackageName) } - $DynamicParams.WindowsApps = $true + Break } - Catch + 'All' { - Log $OptimizeData.FailedRemovingWindowsApps -Type Error -ErrorRecord $Error[0] - Stop-Optimize + $appsToRemove = $AppxPackages + Break } - Break } + $appsToRemove | ForEach-Object -Process { + $RemoveAppxParams = @{ + Path = $InstallMount + PackageName = $PSItem.PackageName + ScratchDirectory = $ScratchFolder + LogPath = $DISMLog + LogLevel = 1 + ErrorAction = 'Stop' + } + Log ($OptimizeData.RemovingWindowsApp -f $PSItem.DisplayName) + If ($PSItem.DisplayName -notin @("Microsoft.SecHealthUI") -or [System.Environment]::OSVersion.Version.Build -lt '22000'){ + [Void](Remove-AppxProvisionedPackage @RemoveAppxParams) + } + $RemovedAppxPackages.Add($PSItem.DisplayName, $PSItem.PackageName) + $RemovedPackages.Add($PSItem.DisplayName, $PSItem.PackageName) + } + $DynamicParams.WindowsApps = $($appsToRemove.Count -gt 0) + } + Catch + { + Log $OptimizeData.FailedRemovingWindowsApps -Type Error -ErrorRecord $Error[0] + Stop-Optimize } $Host.UI.RawUI.WindowTitle = $null; Clear-Host } #endregion Provisioned App Package Removal #region System App Removal - If ($SystemApps.IsPresent) + If ($SystemApps -in $AllowedRemovalOptions) { Clear-Host $Host.UI.RawUI.WindowTitle = "Remove System Apps." - $PSCmdlet.WriteWarning($OptimizeData.SystemAppsWarning) + Start-Sleep 5 + $InboxAppsKey = "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\InboxApplications" + + $InboxAppsPackages = Get-SystemPackages + RegHives -Load - $InboxAppsPackages = Get-ChildItem -Path $InboxAppsKey -Name | ForEach-Object -Process { - $DisplayName = $PSItem.Split('_')[0]; $PackageName = $PSItem - If ($DisplayName -like '1527c705-839a-4832-9118-54d4Bd6a0c89') { $DisplayName = 'Microsoft.Windows.FilePicker' } - If ($DisplayName -like 'c5e2524a-ea46-4f67-841f-6a9465d9d515') { $DisplayName = 'Microsoft.Windows.FileExplorer' } - If ($DisplayName -like 'E2A4F912-2574-4A75-9BB0-0D023378592B') { $DisplayName = 'Microsoft.Windows.AppResolverUX' } - If ($DisplayName -like 'F46D4000-FD22-4DB4-AC8E-4E1DDDE828FE') { $DisplayName = 'Microsoft.Windows.AddSuggestedFoldersToLibarayDialog' } - [PSCustomObject]@{ DisplayName = $DisplayName; PackageName = $PackageName } - } | Sort-Object -Property DisplayName | Out-GridView -Title "Remove System Apps." -PassThru + If ($InboxAppsPackages) { - Clear-Host $RemovedSystemApps = [Collections.Hashtable]::New() - Try - { - $InboxAppsPackages | ForEach-Object -Process { + + $packagesToRemove = [System.Collections.ArrayList]@() + + Try { + + Switch ($PSBoundParameters.SystemApps) + { + 'Select' + { + + $PSCmdlet.WriteWarning($OptimizeData.SystemAppsWarning) + + $packagesToRemove = $InboxAppsPackages | Out-GridView -Title "Remove System Apps." -PassThru + + Break + } + 'Whitelist' + { + If (Test-Path -Path $OptimizeOffline.Lists.SystemApps.Whitelist) + { + $JSON = Get-Content -Path $OptimizeOffline.Lists.SystemApps.Whitelist -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop + + $InboxAppsPackages | ForEach-Object -Process { + If ($PSItem.DisplayName -notin $JSON.DisplayName) + { + [void]$packagesToRemove.Add($PSItem) + } + } + } + Break + } + 'Blacklist' + { + If (Test-Path -Path $OptimizeOffline.Lists.SystemApps.Blacklist) + { + $JSON = Get-Content -Path $OptimizeOffline.Lists.SystemApps.Blacklist -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop + + $InboxAppsPackages | ForEach-Object -Process { + If ($PSItem.DisplayName -in $JSON.DisplayName) + { + [void]$packagesToRemove.Add($PSItem) + } + } + } + Break + } + 'All' + { + $packagesToRemove = $InboxAppsPackages + } + } + + $packagesToRemove | ForEach-Object -Process { $PackageKey = (GetPath -Path $InboxAppsKey -Child $PSItem.PackageName) -replace 'HKLM:', 'HKLM' Log ($OptimizeData.RemovingSystemApp -f $PSItem.DisplayName) $RET = StartExe $REG -Arguments ('DELETE "{0}" /F' -f $PackageKey) -ErrorAction Stop If ($RET -eq 1) { Log ($OptimizeData.FailedRemovingSystemApp -f $PSItem.DisplayName) -Type Error; Continue } $RemovedSystemApps.Add($PSItem.DisplayName, $PSItem.PackageName) + $RemovedPackages.Add($PSItem.DisplayName, $PSItem.PackageName) Start-Sleep 2 } - $DynamicParams.SystemApps = $true - } - Catch - { + + $DynamicParams.SystemApps = $($packagesToRemove.Count -gt 0) + } Catch { Log $OptimizeData.FailedRemovingSystemApps -Type Error -ErrorRecord $Error[0] Stop-Optimize } - Finally - { - RegHives -Unload - } } + RegHives -Unload $Host.UI.RawUI.WindowTitle = $null; Clear-Host } #endregion System App Removal + $DynamicParams.RemovedPackages = $RemovedPackages; + #region Removed Package Clean-up If ($DynamicParams.WindowsApps -or $DynamicParams.SystemApps) { Log $OptimizeData.RemovedPackageCleanup - If ($DynamicParams.WindowsApps) + } + If ($DynamicParams.WindowsApps) + { + If ($InstallInfo.Build -lt '19041') { - If ($InstallInfo.Build -lt '19041') - { - If ((Get-AppxProvisionedPackage -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1).Count -eq 0) { Get-ChildItem -Path (GetPath -Path $InstallMount -Child 'Program Files\WindowsApps') -Force | Purge -Force } - Else { Get-ChildItem -Path (GetPath -Path $InstallMount -Child 'Program Files\WindowsApps') -Force | Where-Object -Property Name -In $RemovedAppxPackages.Values | Purge -Force } - } - Else - { - If ((Get-AppxProvisionedPackage -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1).Count -eq 0) { Get-ChildItem -Path (GetPath -Path $InstallMount -Child 'Program Files\WindowsApps') -Force | Purge -Force } - } + If ((Get-AppxProvisionedPackage -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1).Count -eq 0) { Get-ChildItem -Path (GetPath -Path $InstallMount -Child 'Program Files\WindowsApps') -Force | Purge -Force } + Else { Get-ChildItem -Path (GetPath -Path $InstallMount -Child 'Program Files\WindowsApps') -Force | Where-Object -Property Name -In $RemovedAppxPackages.Values | Purge -Force } } - RegHives -Load - $Visibility = [Text.StringBuilder]::New('hide:') - If ($RemovedAppxPackages.'Microsoft.WindowsMaps') - { - RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\Maps" -Name "AutoUpdateEnabled" -Value 0 -Type DWord - If (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\MapsBroker") { RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\MapsBroker" -Name "Start" -Value 4 -Type DWord } - [Void]$Visibility.Append('maps;maps-downloadmaps;') - } - If ($RemovedAppxPackages.'Microsoft.Wallet' -and (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\WalletService")) { RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\WalletService" -Name "Start" -Value 4 -Type DWord } - If ($RemovedAppxPackages.'Microsoft.XboxIdentityProvider' -and ($RemovedAppxPackages.Keys -like "*Xbox*").Count -gt 1 -or $RemovedSystemApps.'Microsoft.XboxGameCallableUI') - { - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\GameDVR" -Name "AllowGameDVR" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AppCaptureEnabled" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AudioCaptureEnabled" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR" -Name "CursorCaptureEnabled" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\GameBar" -Name "AutoGameModeEnabled" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\GameBar" -Name "AllowAutoGameMode" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\GameBar" -Name "UseNexusForGameBarEnabled" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\GameBar" -Name "ShowStartupPanel" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\System\GameConfigStore" -Name "GameDVR_Enabled" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\System\GameConfigStore" -Name "GameDVR_FSEBehavior" -Value 2 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\System\GameConfigStore" -Name "GameDVR_FSEBehaviorMode" -Value 2 -Type DWord - @("xbgm", "XblAuthManager", "XblGameSave", "xboxgip", "XboxGipSvc", "XboxNetApiSvc") | ForEach-Object -Process { If (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem)") { RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem)" -Name "Start" -Value 4 -Type DWord } } - [Void]$Visibility.Append('gaming-gamebar;gaming-gamedvr;gaming-broadcasting;gaming-gamemode;gaming-xboxnetworking;quietmomentsgame;') - If ($InstallInfo.Build -lt '17763') { [Void]$Visibility.Append('gaming-trueplay;') } - } - If ($RemovedAppxPackages.'Microsoft.YourPhone' -or $RemovedSystemApps.'Microsoft.Windows.CallingShellApp') - { - [Void]$Visibility.Append('mobile-devices;mobile-devices-addphone;mobile-devices-addphone-direct;') - If (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\PhoneSvc") { RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\PhoneSvc" -Name "Start" -Value 4 -Type DWord } - } - If ($RemovedSystemApps.'Microsoft.MicrosoftEdge' -and !$MicrosoftEdge.IsPresent) { RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\EdgeUpdate" -Name "DoNotUpdateToEdgeWithChromium" -Value 1 -Type DWord } - If ($RemovedSystemApps.'Microsoft.BioEnrollment') - { - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Biometrics" -Name "Enabled" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Biometrics\Credential Provider" -Name "Enabled" -Value 0 -Type DWord - If (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\WbioSrvc") { RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\WbioSrvc" -Name "Start" -Value 4 -Type DWord } - $DynamicParams.BioEnrollment = $true - } - If ($RemovedSystemApps.'Microsoft.Windows.SecureAssessmentBrowser') - { - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\SecureAssessment" -Name "AllowScreenMonitoring" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\SecureAssessment" -Name "AllowTextSuggestions" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\SecureAssessment" -Name "RequirePrinting" -Value 0 -Type DWord - } - If ($RemovedSystemApps.'Microsoft.Windows.ContentDeliveryManager') - { - @("ContentDeliveryAllowed", "FeatureManagementEnabled", "OemPreInstalledAppsEnabled", "PreInstalledAppsEnabled", "PreInstalledAppsEverEnabled", "RotatingLockScreenEnabled", - "RotatingLockScreenOverlayEnabled", "SilentInstalledAppsEnabled", "SoftLandingEnabled", "SystemPaneSuggestionsEnabled", "SubscribedContentEnabled", - "SubscribedContent-202913Enabled", "SubscribedContent-202914Enabled", "SubscribedContent-280797Enabled", "SubscribedContent-280811Enabled", "SubscribedContent-280812Enabled", - "SubscribedContent-280813Enabled", "SubscribedContent-280814Enabled", "SubscribedContent-280815Enabled", "SubscribedContent-280810Enabled", "SubscribedContent-280817Enabled", - "SubscribedContent-310091Enabled", "SubscribedContent-310092Enabled", "SubscribedContent-310093Enabled", "SubscribedContent-310094Enabled", "SubscribedContent-314558Enabled", - "SubscribedContent-314559Enabled", "SubscribedContent-314562Enabled", "SubscribedContent-314563Enabled", "SubscribedContent-314566Enabled", "SubscribedContent-314567Enabled", - "SubscribedContent-338380Enabled", "SubscribedContent-338387Enabled", "SubscribedContent-338381Enabled", "SubscribedContent-338388Enabled", "SubscribedContent-338382Enabled", - "SubscribedContent-338389Enabled", "SubscribedContent-338386Enabled", "SubscribedContent-338393Enabled", "SubscribedContent-346480Enabled", "SubscribedContent-346481Enabled", - "SubscribedContent-353694Enabled", "SubscribedContent-353695Enabled", "SubscribedContent-353696Enabled", "SubscribedContent-353697Enabled", "SubscribedContent-353698Enabled", - "SubscribedContent-353699Enabled", "SubscribedContent-88000044Enabled", "SubscribedContent-88000045Enabled", "SubscribedContent-88000105Enabled", "SubscribedContent-88000106Enabled", - "SubscribedContent-88000161Enabled", "SubscribedContent-88000162Enabled", "SubscribedContent-88000163Enabled", "SubscribedContent-88000164Enabled", "SubscribedContent-88000165Enabled", - "SubscribedContent-88000166Enabled") | ForEach-Object -Process { RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name $PSItem -Value 0 -Type DWord } - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "NoCloudApplicationNotification" -Value 1 -Type DWord - } - If ($RemovedSystemApps.'Microsoft.Windows.SecHealthUI') - { - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender" -Name "DisableAntiSpyware" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" -Name "SpyNetReporting" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" -Name "SubmitSamplesConsent" -Value 2 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine" -Name "MpEnablePus" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" -Name "DisableEnhancedNotifications" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableBehaviorMonitoring" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableRealtimeMonitoring" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableOnAccessProtection" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableScanOnRealtimeEnable" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableIOAVProtection" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Policy Manager" -Name "AllowBehaviorMonitoring" -Value 2 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Policy Manager" -Name "AllowCloudProtection" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Policy Manager" -Name "AllowRealtimeMonitoring" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Policy Manager" -Name "SubmitSamplesConsent" -Value 2 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\UX Configuration" -Name "Notification_Suppress" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\MRT" -Name "DontOfferThroughWUAU" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\MRT" -Name "DontReportInfectionInformation" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Systray" -Name "HideSystray" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows Defender\Features" -Name "TamperProtection" -Value 0 -Type DWord -Force - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows Security Health\State" -Name "AccountProtection_MicrosoftAccount_Disconnected" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows Security Health\State" -Name "AppAndBrowser_EdgeSmartScreenOff" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\AppHost" -Name "SmartScreenEnabled" -Value "Off" -Type String - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Value "Off" -Type String - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Value "Off" -Type String - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableSmartScreen" -Value 0 -Type DWord - @("SecurityHealthService", "WinDefend", "WdNisSvc", "WdNisDrv", "WdBoot", "WdFilter", "Sense") | ForEach-Object -Process { If (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem)") { RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem)" -Name "Start" -Value 4 -Type DWord } } - @("HKLM:\WIM_HKLM_SOFTWARE\Classes\*\shellex\ContextMenuHandlers\EPP", "HKLM:\WIM_HKLM_SOFTWARE\Classes\Directory\shellex\ContextMenuHandlers\EPP", "HKLM:\WIM_HKLM_SOFTWARE\Classes\Drive\shellex\ContextMenuHandlers\EPP", - "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Control\WMI\AutoLogger\DefenderApiLogger", "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Control\WMI\AutoLogger\DefenderAuditLogger") | Purge - Remove-KeyProperty -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "SecurityHealth" - If (!$DynamicParams.LTSC -or $MicrosoftEdge.IsPresent) - { - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter" -Name "EnabledV9" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Policies\Microsoft\MicrosoftEdge\PhishingFilter" -Name "EnabledV9" -Value 0 -Type DWord - } - If ($InstallInfo.Build -ge '17763') - { - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen" -Name "ConfigureAppInstallControlEnabled" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen" -Name "ConfigureAppInstallControl" -Value "Anywhere" -Type String - } - [Void]$Visibility.Append('windowsdefender;') - $DynamicParams.SecHealthUI = $true + Else + { + If ((Get-AppxProvisionedPackage -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1).Count -eq 0) { Get-ChildItem -Path (GetPath -Path $InstallMount -Child 'Program Files\WindowsApps') -Force | Purge -Force } } - If ($Visibility.Length -gt 5) + } + RegHives -Load + $Visibility = [Text.StringBuilder]::New('hide:') + If ($RemovedPackages.'Microsoft.WindowsMaps' -or $NoApps) + { + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\Maps" -Name "AutoUpdateEnabled" -Value 0 -Type DWord + If (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\MapsBroker") { RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\MapsBroker" -Name "Start" -Value 4 -Type DWord } + [Void]$Visibility.Append('maps;maps-downloadmaps;') + } + If (($RemovedPackages.'Microsoft.Wallet' -or $NoApps) -and (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\WalletService")) { RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\WalletService" -Name "Start" -Value 4 -Type DWord } + If (($RemovedPackages.'Microsoft.XboxIdentityProvider' -and ($RemovedPackages.Keys -like "*Xbox*").Count -gt 1 -or $RemovedPackages.'Microsoft.XboxGameCallableUI') -or $NoApps) + { + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\GameDVR" -Name "AllowGameDVR" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AppCaptureEnabled" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR" -Name "AudioCaptureEnabled" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR" -Name "CursorCaptureEnabled" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\GameBar" -Name "AutoGameModeEnabled" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\GameBar" -Name "AllowAutoGameMode" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\GameBar" -Name "UseNexusForGameBarEnabled" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\GameBar" -Name "ShowStartupPanel" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\System\GameConfigStore" -Name "GameDVR_Enabled" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\System\GameConfigStore" -Name "GameDVR_FSEBehavior" -Value 2 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\System\GameConfigStore" -Name "GameDVR_FSEBehaviorMode" -Value 2 -Type DWord + @("xbgm", "XblAuthManager", "XblGameSave", "xboxgip", "XboxGipSvc", "XboxNetApiSvc") | ForEach-Object -Process { If (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem)") { RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem)" -Name "Start" -Value 4 -Type DWord } } + [Void]$Visibility.Append('gaming-gamebar;gaming-gamedvr;gaming-broadcasting;gaming-gamemode;gaming-xboxnetworking;quietmomentsgame;') + If ($InstallInfo.Build -lt '17763') { [Void]$Visibility.Append('gaming-trueplay;') } + } + If ($RemovedPackages.'Microsoft.YourPhone' -or $RemovedPackages.'Microsoft.Windows.CallingShellApp' -or $NoApps) + { + [Void]$Visibility.Append('mobile-devices;mobile-devices-addphone;mobile-devices-addphone-direct;') + If (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\PhoneSvc") { RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\PhoneSvc" -Name "Start" -Value 4 -Type DWord } + } + If ($RemovedPackages.'Microsoft.MicrosoftEdge' -and !$MicrosoftEdge.IsPresent) { RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\EdgeUpdate" -Name "DoNotUpdateToEdgeWithChromium" -Value 1 -Type DWord } + If ($RemovedPackages.'Microsoft.BioEnrollment') + { + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Biometrics" -Name "Enabled" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Biometrics\Credential Provider" -Name "Enabled" -Value 0 -Type DWord + If (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\WbioSrvc") { RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\WbioSrvc" -Name "Start" -Value 4 -Type DWord } + $DynamicParams.BioEnrollment = $true + } + If ($RemovedPackages.'Microsoft.Windows.SecureAssessmentBrowser') + { + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\SecureAssessment" -Name "AllowScreenMonitoring" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\SecureAssessment" -Name "AllowTextSuggestions" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\SecureAssessment" -Name "RequirePrinting" -Value 0 -Type DWord + } + If ($RemovedPackages.'Microsoft.Windows.ContentDeliveryManager') + { + @("ContentDeliveryAllowed", "FeatureManagementEnabled", "OemPreInstalledAppsEnabled", "PreInstalledAppsEnabled", "PreInstalledAppsEverEnabled", "RotatingLockScreenEnabled", + "RotatingLockScreenOverlayEnabled", "SilentInstalledAppsEnabled", "SoftLandingEnabled", "SystemPaneSuggestionsEnabled", "SubscribedContentEnabled", + "SubscribedContent-202913Enabled", "SubscribedContent-202914Enabled", "SubscribedContent-280797Enabled", "SubscribedContent-280811Enabled", "SubscribedContent-280812Enabled", + "SubscribedContent-280813Enabled", "SubscribedContent-280814Enabled", "SubscribedContent-280815Enabled", "SubscribedContent-280810Enabled", "SubscribedContent-280817Enabled", + "SubscribedContent-310091Enabled", "SubscribedContent-310092Enabled", "SubscribedContent-310093Enabled", "SubscribedContent-310094Enabled", "SubscribedContent-314558Enabled", + "SubscribedContent-314559Enabled", "SubscribedContent-314562Enabled", "SubscribedContent-314563Enabled", "SubscribedContent-314566Enabled", "SubscribedContent-314567Enabled", + "SubscribedContent-338380Enabled", "SubscribedContent-338387Enabled", "SubscribedContent-338381Enabled", "SubscribedContent-338388Enabled", "SubscribedContent-338382Enabled", + "SubscribedContent-338389Enabled", "SubscribedContent-338386Enabled", "SubscribedContent-338393Enabled", "SubscribedContent-346480Enabled", "SubscribedContent-346481Enabled", + "SubscribedContent-353694Enabled", "SubscribedContent-353695Enabled", "SubscribedContent-353696Enabled", "SubscribedContent-353697Enabled", "SubscribedContent-353698Enabled", + "SubscribedContent-353699Enabled", "SubscribedContent-88000044Enabled", "SubscribedContent-88000045Enabled", "SubscribedContent-88000105Enabled", "SubscribedContent-88000106Enabled", + "SubscribedContent-88000161Enabled", "SubscribedContent-88000162Enabled", "SubscribedContent-88000163Enabled", "SubscribedContent-88000164Enabled", "SubscribedContent-88000165Enabled", + "SubscribedContent-88000166Enabled") | ForEach-Object -Process { RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name $PSItem -Value 0 -Type DWord } + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "NoCloudApplicationNotification" -Value 1 -Type DWord + } + If ($DormantDefender.IsPresent -or $RemovedPackages.'Microsoft.Windows.SecHealthUI' -or $RemovedPackages.'Microsoft.SecHealthUI' -or ($NoApps -and $InstallInfo.Build -ge 22000)) + { + Write-Host "Disabling Defender and Feature Packages" -ForegroundColor Cyan + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender" -Name "DisableAntiSpyware" -Value 1 -Type DWord + + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender" -Name "PUAProtection" -Value 1 -Type DWord + + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" -Name "SpyNetReporting" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" -Name "SubmitSamplesConsent" -Value 2 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\MpEngine" -Name "MpEnablePus" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" -Name "DisableEnhancedNotifications" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableBehaviorMonitoring" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableRealtimeMonitoring" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableOnAccessProtection" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableScanOnRealtimeEnable" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" -Name "DisableIOAVProtection" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Policy Manager" -Name "AllowBehaviorMonitoring" -Value 2 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Policy Manager" -Name "AllowCloudProtection" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Policy Manager" -Name "AllowRealtimeMonitoring" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\Policy Manager" -Name "SubmitSamplesConsent" -Value 2 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\UX Configuration" -Name "Notification_Suppress" -Value 1 -Type DWord + + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\UX Configuration" -Name "UILockdown" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Notifications" -Name "DisableNotifications" -Value 1 -Type DWord + + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\MRT" -Name "DontOfferThroughWUAU" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\MRT" -Name "DontReportInfectionInformation" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Systray" -Name "HideSystray" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows Defender\Features" -Name "TamperProtection" -Value 0 -Type DWord -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows Security Health\State" -Name "AccountProtection_MicrosoftAccount_Disconnected" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows Security Health\State" -Name "AppAndBrowser_EdgeSmartScreenOff" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\AppHost" -Name "SmartScreenEnabled" -Value "Off" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Value "Off" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Value "Off" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" -Name "PreventOverride" -Value 0 -Type DWord -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\AppHost" -Name "PreventOverride" -Value 0 -Type DWord -Force + + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Edge\SmartScreenEnabled" -Name "(default)" -Value 0 -Type DWord -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Edge\SmartScreenEnabled" -Name "(default)" -Value 0 -Type DWord -Force + + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Edge\SmartScreenPuaEnabled" -Name "(default)" -Value 0 -Type DWord -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Edge\SmartScreenPuaEnabled" -Name "(default)" -Value 0 -Type DWord -Force + + + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableSmartScreen" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\System" -Name "ShellSmartScreenLevel" -Value 0 -Type DWord -Force + @("SecurityHealthService", "WinDefend", "WdNisSvc", "WdNisDrv", "WdBoot", "WdFilter", "Sense", "webthreatdefsvc", "webthreatdefusersvc") | ForEach-Object -Process { If (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem)") { RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem)" -Name "Start" -Value 4 -Type DWord } } + @("HKLM:\WIM_HKLM_SOFTWARE\Classes\*\shellex\ContextMenuHandlers\EPP", "HKLM:\WIM_HKLM_SOFTWARE\Classes\Directory\shellex\ContextMenuHandlers\EPP", "HKLM:\WIM_HKLM_SOFTWARE\Classes\Drive\shellex\ContextMenuHandlers\EPP", + "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Control\WMI\AutoLogger\DefenderApiLogger", "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Control\WMI\AutoLogger\DefenderAuditLogger") | Purge + Remove-KeyProperty -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "SecurityHealth" + If (!$DynamicParams.LTSC -or $MicrosoftEdge.IsPresent) { - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "SettingsPageVisibility" -Value $Visibility.ToString().TrimEnd(';') -Type String - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "SettingsPageVisibility" -Value $Visibility.ToString().TrimEnd(';') -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter" -Name "EnabledV9" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Policies\Microsoft\MicrosoftEdge\PhishingFilter" -Name "EnabledV9" -Value 0 -Type DWord } - RegHives -Unload - If ($DynamicParams.BioEnrollment -and (Get-WindowsCapability -Path $InstallMount -Name *Hello* -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object -Property State -EQ Installed)) + If ($InstallInfo.Build -ge '17763') { - Try - { - Log $OptimizeData.RemovingBiometricCapability - [Void](Get-WindowsCapability -Path $InstallMount -Name *Hello* -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object -Property State -EQ Installed | Remove-WindowsCapability -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 -ErrorAction Stop) - } - Catch - { - Log $OptimizeData.FailedRemovingBiometricCapability -Type Error -ErrorRecord $Error[0] - Start-Sleep 3 - } + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen" -Name "ConfigureAppInstallControlEnabled" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows Defender\SmartScreen" -Name "ConfigureAppInstallControl" -Value "Anywhere" -Type String } - If ($DynamicParams.SecHealthUI -and (Get-WindowsOptionalFeature -Path $InstallMount -FeatureName Windows-Defender-Default-Definitions -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object -Property State -EQ Enabled)) + [Void]$Visibility.Append('windowsdefender;') + $DynamicParams.SecHealthUI = $true + Log $OptimizeData.DisableDefender + Clear-Host + } + If ($Visibility.Length -gt 5) + { + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "SettingsPageVisibility" -Value $Visibility.ToString().TrimEnd(';') -Type String + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "SettingsPageVisibility" -Value $Visibility.ToString().TrimEnd(';') -Type String + } + If($RemovedPackages."Microsoft.Windows.Search") { + $DynamicParams.RemovedWindowsSearchPackage = $true + } + RegHives -Unload + If ($DynamicParams.BioEnrollment -and (Get-WindowsCapability -Path $InstallMount -Name *Hello* -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object -Property State -EQ Installed)) + { + Try { - Try - { - $DisableDefenderOptionalFeature = @{ + Get-WindowsCapability -Path $InstallMount -Name *Hello* -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object -Property State -EQ Installed | ForEach-Object -Process { + $RemoveBiometricCapability = @{ Path = $InstallMount - FeatureName = 'Windows-Defender-Default-Definitions' - Remove = $true - NoRestart = $true + Name = $PSItem.Name ScratchDirectory = $ScratchFolder LogPath = $DISMLog LogLevel = 1 ErrorAction = 'Stop' } - Log $OptimizeData.DisablingDefenderOptionalFeature - [Void](Disable-WindowsOptionalFeature @DisableDefenderOptionalFeature) + Log ($OptimizeData.RemovingBiometricCapability -f $PSItem.Name) + [Void](Remove-WindowsCapability @RemoveBiometricCapability) } - Catch - { - Log $OptimizeData.FailedDisablingDefenderOptionalFeature -Type Error -ErrorRecord $Error[0] - Start-Sleep 3 + } + Catch + { + Log $OptimizeData.FailedRemovingBiometricCapability -Type Error -ErrorRecord $Error[0] + Start-Sleep 3 + } + } + If ($DynamicParams.SecHealthUI -and (Get-WindowsOptionalFeature -Path $InstallMount -FeatureName Windows-Defender-Default-Definitions -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object -Property State -EQ Enabled)) + { + Try + { + $DisableDefenderOptionalFeature = @{ + Path = $InstallMount + FeatureName = 'Windows-Defender-Default-Definitions' + Remove = $true + NoRestart = $true + ScratchDirectory = $ScratchFolder + LogPath = $DISMLog + LogLevel = 1 + ErrorAction = 'Stop' } + Log $OptimizeData.DisablingDefenderOptionalFeature + [Void](Disable-WindowsOptionalFeature @DisableDefenderOptionalFeature) + } + Catch + { + Log $OptimizeData.FailedDisablingDefenderOptionalFeature -Type Error -ErrorRecord $Error[0] + Start-Sleep 3 } } #endregion Removed Package Clean-up @@ -785,16 +1109,72 @@ Function Optimize-Offline #endregion Import Custom App Associations #region Windows Capability and Cabinet File Package Removal - If ($Capabilities.IsPresent) + If ($Capabilities -in $AllowedRemovalOptions) { Clear-Host $Host.UI.RawUI.WindowTitle = "Remove Windows Capabilities." - $WindowsCapabilities = Get-WindowsCapability -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object { $PSItem.Name -notlike "*Language.Basic*" -and $PSItem.Name -notlike "*TextToSpeech*" -and $PSItem.State -eq 'Installed' } | Select-Object -Property Name, State | Sort-Object -Property Name | Out-GridView -Title "Remove Windows Capabilities." -PassThru + $WindowsCapabilities = Get-CapabilityPackages -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog + If ($WindowsCapabilities) { Try { - $WindowsCapabilities | ForEach-Object -Process { + + $capabilitiesToRemove = [System.Collections.ArrayList]@() + + Switch ($PSBoundParameters.Capabilities) + { + 'Select' + { + $capabilitiesToRemove = $WindowsCapabilities | Out-GridView -Title "Remove Windows Capabilities." -PassThru + + Break + } + 'Whitelist' + { + If (Test-Path -Path $OptimizeOffline.Lists.Capabilities.Whitelist) + { + $Names = Get-Content -Path $OptimizeOffline.Lists.Capabilities.Whitelist -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop | Select-Object -ExpandProperty Name + + $WindowsCapabilities | ForEach-Object -Process { + $ToRemove = $true + Foreach($Name in $Names){ + If ($PSItem.Name -eq $Name -or ($Name -match "\*" -and $PSItem.Name -like $Name)){ + $ToRemove = $false + Break + } + } + If($ToRemove){ + [void]$capabilitiesToRemove.Add($PSItem) + } + } + } + Break + } + 'Blacklist' + { + If (Test-Path -Path $OptimizeOffline.Lists.Capabilities.Blacklist) + { + $Names = Get-Content -Path $OptimizeOffline.Lists.Capabilities.Blacklist -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop | Select-Object -ExpandProperty Name + + $WindowsCapabilities | ForEach-Object -Process { + Foreach($Name in $Names){ + If ($PSItem.Name -eq $Name -or ($Name -match "\*" -and $PSItem.Name -like $Name)){ + [void]$capabilitiesToRemove.Add($PSItem) + Break + } + } + } + } + Break + } + 'All' + { + $capabilitiesToRemove = $WindowsCapabilities + } + } + + $capabilitiesToRemove | ForEach-Object -Process { $RemoveCapabilityParams = @{ Path = $InstallMount Name = $PSItem.Name @@ -803,10 +1183,11 @@ Function Optimize-Offline LogLevel = 1 ErrorAction = 'Stop' } - Log ($OptimizeData.RemovingWindowsCapability -f $PSItem.Name.Split('~')[0]) + Log ($OptimizeData.RemovingWindowsCapability -f $PSItem.Name) [Void](Remove-WindowsCapability @RemoveCapabilityParams) } - $DynamicParams.Capabilities = $true + + $DynamicParams.Capabilities = $($capabilitiesToRemove.Count -gt 0) } Catch { @@ -817,16 +1198,74 @@ Function Optimize-Offline } } - If ($Packages.IsPresent) + If ($Packages -in $AllowedRemovalOptions) { Clear-Host $Host.UI.RawUI.WindowTitle = "Remove Windows Packages." - $WindowsPackages = Get-WindowsPackage -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object { $PSItem.ReleaseType -eq 'OnDemandPack' -or $PSItem.ReleaseType -eq 'LanguagePack' -or $PSItem.ReleaseType -eq 'FeaturePack' -and $PSItem.PackageName -notlike "*20H2Enablement*" -and $PSItem.PackageName -notlike "*LanguageFeatures-Basic*" -and $PSItem.PackageName -notlike "*LanguageFeatures-TextToSpeech*" -and $PSItem.PackageState -eq 'Installed' } | Select-Object -Property PackageName, ReleaseType | Sort-Object -Property PackageName | Out-GridView -Title "Remove Windows Packages." -PassThru + + $WindowsPackages = Get-OtherWindowsPackages -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog + If ($WindowsPackages) { + $packagesToRemove = [System.Collections.ArrayList]@() Try { - $WindowsPackages | ForEach-Object -Process { + + Switch ($PSBoundParameters.Packages) { + 'Select' + { + $packagesToRemove = $WindowsPackages | Out-GridView -Title "Remove Windows Packages." -PassThru + Break + } + 'Whitelist' + { + + If (Test-Path -Path $OptimizeOffline.Lists.Packages.Whitelist) + { + $PackageNames = Get-Content -Path $OptimizeOffline.Lists.Packages.Whitelist -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop | Select-Object -ExpandProperty PackageName + + $WindowsPackages | ForEach-Object -Process { + $ToRemove = $true + Foreach($PackageName in $PackageNames){ + If ($PSItem.PackageName -eq $PackageName -or ($PackageName -Match "\*" -and $PSItem.PackageName -like $PackageName)) + { + $ToRemove = $false + Break + } + } + If($ToRemove){ + [void]$packagesToRemove.Add($PSItem) + } + } + } + Break + } + 'Blacklist' + { + + If (Test-Path -Path $OptimizeOffline.Lists.Packages.Blacklist) + { + $PackageNames = Get-Content -Path $OptimizeOffline.Lists.Packages.Blacklist -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop | Select-Object -ExpandProperty PackageName + + $WindowsPackages | ForEach-Object -Process { + Foreach($PackageName in $PackageNames){ + If ($PSItem.PackageName -eq $PackageName -or ($PackageName -Match "\*" -and $PSItem.PackageName -like $PackageName)) + { + [void]$packagesToRemove.Add($PSItem) + Break + } + } + } + } + Break + } + 'All' + { + $packagesToRemove = $WindowsPackages + } + } + + $packagesToRemove | ForEach-Object -Process { $RemovePackageParams = @{ Path = $InstallMount PackageName = $PSItem.PackageName @@ -836,10 +1275,10 @@ Function Optimize-Offline LogLevel = 1 ErrorAction = 'Stop' } - Log ($OptimizeData.RemovingWindowsPackage -f $PSItem.PackageName.Replace('Package', $null).Split('~')[0].TrimEnd('-')) + Log ($OptimizeData.RemovingWindowsPackage -f $PSItem.PackageName) [Void](Remove-WindowsPackage @RemovePackageParams) } - $DynamicParams.Packages = $true + $DynamicParams.Packages = $($packagesToRemove.Count -gt 0) } Catch { @@ -852,9 +1291,6 @@ Function Optimize-Offline #endregion Windows Capability and Cabinet File Package Removal #region Disable Unsafe Optional Features - <# - @('SMB1Protocol', 'MicrosoftWindowsPowerShellV2Root') | ForEach-Object -Process { Get-WindowsOptionalFeature -Path $InstallMount -FeatureName $PSItem -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object -Property State -EQ Disabled | Disable-WindowsOptionalFeature -Path $InstallMount -Remove -NoRestart -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 } - #> ForEach ($Feature In @('SMB1Protocol', 'MicrosoftWindowsPowerShellV2Root')) { If (Get-WindowsOptionalFeature -Path $InstallMount -FeatureName $Feature -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object -Property State -EQ Enabled) @@ -884,16 +1320,46 @@ Function Optimize-Offline #endregion Disable Unsafe Optional Features #region Disable/Enable Optional Features - If ($Features.IsPresent) + If ($FeaturesToDisable -in $AllowedRemovalOptions) { Clear-Host $Host.UI.RawUI.WindowTitle = "Disable Optional Features." - $DisableFeatures = Get-WindowsOptionalFeature -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object -Property State -EQ Enabled | Select-Object -Property FeatureName, State | Sort-Object -Property FeatureName | Out-GridView -Title "Disable Optional Features." -PassThru - If ($DisableFeatures) - { + + $EnabledFeatures = Get-OptionalEnabledFeatures -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog + + If ($EnabledFeatures) + { + $FeaturesToDisableList = [System.Collections.ArrayList]@() + Switch ($PSBoundParameters.FeaturesToDisable) { + 'Select' + { + $FeaturesToDisableList = $EnabledFeatures | Out-GridView -Title "Disable Optional Features." -PassThru + Break + } + "List" + { + If (Test-Path -Path $OptimizeOffline.Lists.FeaturesToDisable.List) + { + $JSON = Get-Content -Path $OptimizeOffline.Lists.FeaturesToDisable.List -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop + + $EnabledFeatures | ForEach-Object -Process { + If ($PSItem.FeatureName -in $JSON.FeatureName) + { + [void]$FeaturesToDisableList.Add($PSItem) + } + } + } + + Break + } + 'All' + { + $FeaturesToDisableList = $EnabledFeatures + } + } Try { - $DisableFeatures | ForEach-Object -Process { + $FeaturesToDisableList | ForEach-Object -Process { $DisableFeatureParams = @{ Path = $InstallMount FeatureName = $PSItem.FeatureName @@ -907,7 +1373,7 @@ Function Optimize-Offline Log ($OptimizeData.DisablingOptionalFeature -f $PSItem.FeatureName) [Void](Disable-WindowsOptionalFeature @DisableFeatureParams) } - $DynamicParams.DisabledOptionalFeatures = $true + $DynamicParams.DisabledOptionalFeatures = $($FeaturesToDisableList.Count -gt 0) } Catch { @@ -916,14 +1382,50 @@ Function Optimize-Offline } $Host.UI.RawUI.WindowTitle = $null; Clear-Host } + } + if ($FeaturesToEnable -in $AllowedRemovalOptions){ Clear-Host $Host.UI.RawUI.WindowTitle = "Enable Optional Features." - $EnableFeatures = Get-WindowsOptionalFeature -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object { $PSItem.FeatureName -notlike "SMB1Protocol*" -and $PSItem.FeatureName -ne "Windows-Defender-Default-Definitions" -and $PSItem.FeatureName -notlike "MicrosoftWindowsPowerShellV2*" -and $PSItem.State -eq "Disabled" } | Select-Object -Property FeatureName, State | Sort-Object -Property FeatureName | Out-GridView -Title "Enable Optional Features." -PassThru - If ($EnableFeatures) + + $DisabledFeatures = Get-OptionalDisabledFeatures -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog + + If ($DisabledFeatures) { + + $FeaturesToEnableList = [System.Collections.ArrayList]@() + + Switch ($PSBoundParameters.FeaturesToEnable) { + 'Select' + { + $FeaturesToEnableList = $DisabledFeatures | Out-GridView -Title "Enable Optional Features." -PassThru + + Break + } + "List" + { + If (Test-Path -Path $OptimizeOffline.Lists.FeaturesToEnable.List) + { + $JSON = Get-Content -Path $OptimizeOffline.Lists.FeaturesToEnable.List -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop + + $DisabledFeatures | ForEach-Object -Process { + If ($PSItem.FeatureName -in $JSON.FeatureName) + { + [void]$FeaturesToEnableList.Add($PSItem) + } + } + } + + Break + } + "All" + { + $FeaturesToEnableList = $DisabledFeatures + } + } + Try { - $EnableFeatures | ForEach-Object -Process { + $FeaturesToEnableList | ForEach-Object -Process { $EnableFeatureParams = @{ Path = $InstallMount FeatureName = $PSItem.FeatureName @@ -938,7 +1440,7 @@ Function Optimize-Offline Log ($OptimizeData.EnablingOptionalFeature -f $PSItem.FeatureName) [Void](Enable-WindowsOptionalFeature @EnableFeatureParams) } - $DynamicParams.EnabledOptionalFeatures = $true + $DynamicParams.EnabledOptionalFeatures = $($FeaturesToEnableList.Count -gt 0) } Catch { @@ -950,6 +1452,114 @@ Function Optimize-Offline } #endregion Disable/Enable Optional Features + #region disable windows services + if ($PSBoundParameters.Services -in $AllowedRemovalOptions){ + $ServicesToRemove = [System.Collections.ArrayList]@() + $ServicesToRemoveNames = @{} + $StartValues = @(0,1,2,3,4) + + Clear-Host + $Host.UI.RawUI.WindowTitle = $OptimizeData.ServicesModifying + + Try{ + RegHives -Load + + Switch($PSBoundParameters.Services){ + "List" + { + $JSON = Get-Content -Path $OptimizeOffline.Lists.Services.List -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop + + $JSON.Services | ForEach-Object -Process { + If (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem)") + { + $FolderKeys = Get-ItemProperty -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem)" + + If($null -ne $FolderKeys.Start){ + [void]$ServicesToRemove.Add(@{ + name = $PSItem + start = 4 + }) + } + + } + } + } + "Advanced" + { + $JSON = Get-Content -Path $OptimizeOffline.Lists.Services.Advanced -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop + + $JSON.Services | ForEach-Object -Process { + If (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem.name)") + { + $FolderKeys = Get-ItemProperty -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem.name)" + + If($null -eq $PSItem.start) { + $PSItem.start = 4 + } + + If($null -ne $FolderKeys.Start -and [int]$PSItem.start -in $StartValues){ + [void]$ServicesToRemove.Add($PSItem) + } + + } + } + } + "Select" + { + $ServicesSelection = [System.Collections.ArrayList]@(); + Get-ChildItem -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services" | Where-Object{$_.ValueCount -gt 0} | ForEach-Object -Process { + + $ServiceDetails = Get-Service -Name $PSItem.PSChildName -ErrorAction Ignore + + $FolderKeys = Get-ItemProperty -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem.PSChildName)" + + If($null -ne $FolderKeys.Start -and $null -eq $FolderKeys.Owners -and $FolderKeys.Start -ne 4 -and $FolderKeys.Start -gt 1){ + $O = New-Object PSObject -Property @{ + name = [String]$PSItem.PSChildName + description = $(If ($null -ne $ServiceDetails -and $null -ne $ServiceDetails.DisplayName) {$ServiceDetails.DisplayName} Else {""}) + start = $FolderKeys.Start + } + [void]$ServicesSelection.Add($O) + } + } + + $ServicesToRemove = $ServicesSelection | Out-GridView -PassThru -Title $OptimizeData.ChooseServicesTitle + } + } + + $StartLabels = @{ + 0 = $OptimizeData.ServiceStartBoot + 1 = $OptimizeData.ServiceStartSystem + 2 = $OptimizeData.ServiceStartAutomatic + 3 = $OptimizeData.ServiceStartManual + 4 = $OptimizeData.ServiceStartDisabled + } + + $ServicesToRemove | ForEach-Object -Process { + $Start = If ($PSBoundParameters.Services -eq "Select") {4} Else {[Int]$PSItem.start} + Log "$($OptimizeData.ServiceModifying): $($PSItem.name), Start: $($StartLabels[$Start])" + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\$($PSItem.name)" -Name "Start" -Type DWord -Value $Start + $ServicesToRemoveNames[$PSItem.name] = $Start + Start-Sleep 1 + } + $DynamicParams.DisabledWindowsServices = $($ServicesToRemove.Count -gt 0) + + # If the Delivery Optimization service has a SetState value of 'Disabled' in the Services.json file, set the delivery optimization download mode to bypass. + If ($null -ne $ServicesToRemoveNames['DoSvc'] -and $ServicesToRemoveNames['DoSvc'] -eq 4){ + Log $OptimizeData.DeliveryOptimizationBypass + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -Type DWord -Value 100 + Start-Sleep 1 + } + RegHives -Unload + } Catch { + Log $OptimizeData.ServicesRemovalFailed -Type Error -ErrorRecord $Error[0] + Stop-Optimize + } + + $Host.UI.RawUI.WindowTitle = $null; Clear-Host + } + #endregion disable windows services + #region DeveloperMode Integration If ($DeveloperMode.IsPresent -and (Test-Path -Path $OptimizeOffline.DevMode -Filter *DeveloperMode-Desktop-Package*.cab) -and !(Get-WindowsPackage -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object -Property PackageName -Like *DeveloperMode*)) { @@ -978,21 +1588,26 @@ Function Optimize-Offline #endregion DeveloperMode Integration #region Windows Store Integration - If ($WindowsStore.IsPresent -and (Test-Path -Path $OptimizeOffline.WindowsStore -Filter Microsoft.WindowsStore*.appxbundle) -and !(Get-AppxProvisionedPackage -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object -Property DisplayName -EQ Microsoft.WindowsStore)) + $DynamicParams.WindowsStore = (Get-AppxProvisionedPackage -Path $InstallMount -ScratchDirectory $ScratchFolder -LogPath $DISMLog -LogLevel 1 | Where-Object -Property DisplayName -EQ Microsoft.WindowsStore) + If ($WindowsStore.IsPresent -and (Test-Path -Path $OptimizeOffline.WindowsStore -Filter Microsoft.WindowsStore*.*xbundle) -and !$DynamicParams.WindowsStore) { Log $OptimizeData.IntegratingWindowsStore - $StoreBundle = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.WindowsStore*.appxbundle -File | Select-Object -ExpandProperty FullName - $PurchaseBundle = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.StorePurchaseApp*.appxbundle -File | Select-Object -ExpandProperty FullName - $XboxBundle = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.XboxIdentityProvider*.appxbundle -File | Select-Object -ExpandProperty FullName - $InstallerBundle = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.DesktopAppInstaller*.appxbundle -File | Select-Object -ExpandProperty FullName + $StoreBundle = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.WindowsStore*.*xbundle -File | Select-Object -ExpandProperty FullName + $PurchaseBundle = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.StorePurchaseApp*.*xbundle -File | Select-Object -ExpandProperty FullName + $XboxBundle = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.XboxIdentityProvider*.*xbundle -File | Select-Object -ExpandProperty FullName + $InstallerBundle = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.DesktopAppInstaller*.*xbundle -File | Select-Object -ExpandProperty FullName $StoreLicense = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.WindowsStore*.xml -File | Select-Object -ExpandProperty FullName $PurchaseLicense = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.StorePurchaseApp*.xml -File | Select-Object -ExpandProperty FullName $XboxLicense = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.XboxIdentityProvider*.xml -File | Select-Object -ExpandProperty FullName $InstallerLicense = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.DesktopAppInstaller*.xml -File | Select-Object -ExpandProperty FullName - $DependencyPackages = [Collections.Generic.List[String]]::New() - $DependencyPackages = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.VCLibs*.appx -File | Select-Object -ExpandProperty FullName - $DependencyPackages += Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter *Native.Framework*.appx -File | Select-Object -ExpandProperty FullName - $DependencyPackages += Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter *Native.Runtime*.appx -File | Select-Object -ExpandProperty FullName + + $DependencyVCLibs = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.VCLibs.140.00_*.appx -File | Select-Object -ExpandProperty FullName + $DependencyVCLibsUWPDesktop = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.VCLibs.140.00.UWPDesktop_*.appx -File | Select-Object -ExpandProperty FullName + $DependencyXAML26 = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.UI.Xaml.2.6_*.appx -File | Select-Object -ExpandProperty FullName + $DependencyXAML27 = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.UI.Xaml.2.7_*.appx -File | Select-Object -ExpandProperty FullName + $DependencyNativeFramework = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.NET.Native.Framework*.appx -File | Select-Object -ExpandProperty FullName + $DependencyNativeRuntime = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter Microsoft.NET.Native.Runtime*.appx -File | Select-Object -ExpandProperty FullName + If (!$DynamicParams.DeveloperMode) { RegHives -Load @@ -1001,6 +1616,11 @@ Function Optimize-Offline } Try { + $DependencyPackages = [Collections.Generic.List[String]]::New() + $DependencyPackages += $DependencyNativeFramework + $DependencyPackages += $DependencyNativeRuntime + $DependencyPackages += $DependencyVCLibs + $DependencyPackages += $DependencyXAML27 $StorePackage = @{ Path = $InstallMount PackagePath = $StoreBundle @@ -1012,41 +1632,60 @@ Function Optimize-Offline ErrorAction = 'Stop' } [Void](Add-AppxProvisionedPackage @StorePackage) - $PurchasePackage = @{ - Path = $InstallMount - PackagePath = $PurchaseBundle - DependencyPackagePath = $DependencyPackages - LicensePath = $PurchaseLicense - ScratchDirectory = $ScratchFolder - LogPath = $DISMLog - LogLevel = 1 - ErrorAction = 'Stop' + + If ($PurchaseBundle -and $PurchaseLicense) { + $DependencyPackages = [Collections.Generic.List[String]]::New() + $DependencyPackages += $DependencyNativeFramework + $DependencyPackages += $DependencyNativeRuntime + $DependencyPackages += $DependencyVCLibs + $PurchasePackage = @{ + Path = $InstallMount + PackagePath = $PurchaseBundle + DependencyPackagePath = $DependencyPackages + LicensePath = $PurchaseLicense + ScratchDirectory = $ScratchFolder + LogPath = $DISMLog + LogLevel = 1 + ErrorAction = 'Stop' + } + [Void](Add-AppxProvisionedPackage @PurchasePackage) } - [Void](Add-AppxProvisionedPackage @PurchasePackage) - $XboxPackage = @{ - Path = $InstallMount - PackagePath = $XboxBundle - DependencyPackagePath = $DependencyPackages - LicensePath = $XboxLicense - ScratchDirectory = $ScratchFolder - LogPath = $DISMLog - LogLevel = 1 - ErrorAction = 'Stop' + + If ($XboxBundle -and $XboxLicense) { + $DependencyPackages = [Collections.Generic.List[String]]::New() + $DependencyPackages += $DependencyNativeFramework + $DependencyPackages += $DependencyNativeRuntime + $DependencyPackages += $DependencyVCLibs + $XboxPackage = @{ + Path = $InstallMount + PackagePath = $XboxBundle + DependencyPackagePath = $DependencyPackages + LicensePath = $XboxLicense + ScratchDirectory = $ScratchFolder + LogPath = $DISMLog + LogLevel = 1 + ErrorAction = 'Stop' + } + [Void](Add-AppxProvisionedPackage @XboxPackage) } - [Void](Add-AppxProvisionedPackage @XboxPackage) - $DependencyPackages.Clear() - $DependencyPackages = Get-ChildItem -Path $OptimizeOffline.WindowsStore -Filter *Native.Runtime*.appx -File | Select-Object -ExpandProperty FullName - $InstallerPackage = @{ - Path = $InstallMount - PackagePath = $InstallerBundle - DependencyPackagePath = $DependencyPackages - LicensePath = $InstallerLicense - ScratchDirectory = $ScratchFolder - LogPath = $DISMLog - LogLevel = 1 - ErrorAction = 'Stop' + + + If ($InstallerBundle -and $InstallerLicense -and $DependencyVCLibsUWPDesktop -and $DependencyXAML26) { + $DependencyPackages = [Collections.Generic.List[String]]::New() + $DependencyPackages += $DependencyVCLibsUWPDesktop + $DependencyPackages += $DependencyXAML26 + $InstallerPackage = @{ + Path = $InstallMount + PackagePath = $InstallerBundle + DependencyPackagePath = $DependencyPackages + LicensePath = $InstallerLicense + ScratchDirectory = $ScratchFolder + LogPath = $DISMLog + LogLevel = 1 + ErrorAction = 'Stop' + } + [Void](Add-AppxProvisionedPackage @InstallerPackage) } - [Void](Add-AppxProvisionedPackage @InstallerPackage) $DynamicParams.WindowsStore = $true } Catch @@ -1164,7 +1803,7 @@ Function Optimize-Offline [IO.File]::WriteAllText((GetPath -Path $EdgeAppPath.FullName -Child master_preferences), (@' {"distribution":{"system_level":true,"do_not_create_desktop_shortcut":true,"do_not_create_quick_launch_shortcut":true,"do_not_create_taskbar_shortcut":true}} '@).Trim(), [Text.UTF8Encoding]::New($true)) - $Base64String = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes( { Get-ChildItem -Path @("HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components", "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Active Setup\Installed Components") -Recurse | Get-ItemProperty | Select-Object -Property PSPath, StubPath | Where-Object -Property StubPath -Match configure-user-settings | ForEach-Object -Process { Remove-Item -Path $PSItem.PSPath -Force }; Get-ChildItem -Path "$Env:SystemDrive\Users\*\Desktop" -Filter *lnk -Recurse | Where-Object -Property Name -Like *Edge* | Remove-Item -Force })) + $Base64String = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes({ Get-ChildItem -Path @("HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components", "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Active Setup\Installed Components") -Recurse | Get-ItemProperty | Select-Object -Property PSPath, StubPath | Where-Object -Property StubPath -Match configure-user-settings | ForEach-Object -Process { Remove-Item -Path $PSItem.PSPath -Force }; Get-ChildItem -Path "$Env:SystemDrive\Users\*\Desktop" -Filter *lnk -Recurse | Where-Object -Property Name -Like *Edge* | Remove-Item -Force })) RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" -Name "EdgeCleanup" -Value "%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -NoProfile -EncodedCommand $Base64String" -Type ExpandString RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\EdgeUpdate" -Name "CreateDesktopShortcutDefault" -Value 0 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Policies\Microsoft\EdgeUpdate" -Name "CreateDesktopShortcutDefault" -Value 0 -Type DWord @@ -1172,6 +1811,7 @@ Function Optimize-Offline RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Policies\Microsoft\Edge" -Name "HideFirstRunExperience" -Value 1 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Edge" -Name "BackgroundModeEnabled" -Value 0 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Policies\Microsoft\Edge" -Name "BackgroundModeEnabled" -Value 0 -Type DWord + If (($InstallInfo.Build -eq '19041' -and (Get-ItemPropertyValue -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name UBR -ErrorAction Ignore) -ge 1023) -or $InstallInfo.Build -gt '19041') { RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" -Name "EnableFeeds" -Value 0 -Type DWord } } RegHives -Unload } @@ -1298,6 +1938,7 @@ Function Optimize-Offline 17763 { 'RS5'; Break } 18362 { '19H2'; Break } 19041 { '20H1'; Break } + default { 'Insider'; Break } } If ($DaRT.Contains('Setup') -and $DynamicParams.BootImage) { @@ -1443,7 +2084,7 @@ Function Optimize-Offline } If ($Additional.RegistryTemplates -and (Test-Path -Path (GetPath -Path $OptimizeOffline.RegistryTemplates -Child *.reg))) { - Import-RegistryTemplates + Import-Registry -Path $OptimizeOffline.RegistryTemplates Start-Sleep 3 } If ($Additional.LayoutModification -and (Test-Path -Path (GetPath -Path $OptimizeOffline.LayoutModification -Child *.xml))) @@ -1489,7 +2130,9 @@ Function Optimize-Offline } If ($Additional.Drivers) { - Get-ChildItem -Path $OptimizeOffline.Drivers -Recurse -Force | ForEach-Object -Process { $PSItem.Attributes = 0x80 } + Get-ChildItem -Path $OptimizeOffline.Drivers -Recurse -Force | ForEach-Object -Process { + Set-ItemProperty -Path $PSItem.FullName -Name IsReadOnly -Value $false -ErrorAction Ignore + } If (Get-ChildItem -Path $OptimizeOffline.InstallDrivers -Include *.inf -Recurse -Force) { Try @@ -1591,22 +2234,26 @@ Function Optimize-Offline } } #endregion Additional Content Integration - + #region selective registry + Get-ChildItem -Path $OptimizeOffline.SelectiveRegistry -Filter *.ps1 -Recurse | ForEach-Object -Process { + & $_.FullName + } + #endregion selective registry #region Component Store Clean-up If ($ComponentCleanup.IsPresent) { If (!(Test-Path -Path (GetPath -Path $InstallMount -Child 'Windows\WinSxS\pending.xml'))) { Log ($OptimizeData.ComponentStoreCleanup -f $InstallInfo.Name) - If ($InstallInfo.Build -ge '18362') { $RegClean = 3 } - Else { $RegClean = 0 } + If ($InstallInfo.Build -ge '18362') { $RegClean = 3 } Else { $RegClean = 0 } RegHives -Load RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Configuration" -Name "DisableResetbase" -Value 1 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Configuration" -Name "SupersededActions" -Value $RegClean -Type DWord RegHives -Unload + $CleanupLog = (GetPath -Path $LogFolder -Child ComponentCleanup.log) Try { - $RET = StartExe $DISM -Arguments ('/Image:"{0}" /Cleanup-Image /StartComponentCleanup /ScratchDir:"{1}" /LogPath:"{2}" /LogLevel:1' -f $InstallMount, $ScratchFolder, $DISMLog) -ErrorAction Stop + $RET = StartExe $DISM -Arguments ('/Image:"{0}" /Cleanup-Image /StartComponentCleanup /ScratchDir:"{1}" /LogPath:"{2}" /LogLevel:1' -f $InstallMount, $ScratchFolder, $CleanupLog) -ErrorAction Stop If ($RET -eq 0) { $DynamicParams.ComponentCleanup = $true } Else { Throw } } @@ -1614,6 +2261,10 @@ Function Optimize-Offline { Log ($OptimizeData.FailedComponentStoreCleanup -f $InstallInfo.Name) -Type Error } + Finally + { + $CleanupLog | Purge -ErrorAction Ignore + } } Else { @@ -1623,7 +2274,7 @@ Function Optimize-Offline #endregion Component Store Clean-up #region Start Menu Clean-up - If (!$DynamicParams.LayoutModification) + If (!$DynamicParams.LayoutModification -and $InstallInfo.Build -le '19044') { $LayoutTemplate = @" 9NBLGGH4NNS1microsoft.desktopappinstaller_8wekyb3d8bbwee1a39502-1ffc-44f0-8c28-0034168e09ff2c3f1d47-426d-c7d7-face-ef1add208818False2016-04-14T15:58:20.6111541Z2016-04-14T15:58:20.4032196Z2016-04-14T15:58:20.4032196ZFAAAAMAAAADJAAAACgAAAAMAAQAdvg9XAgDLAAAAEAAAAK/8fFGLE5YXLOpiiSIEJQrOAAAAWAAAAG0AaQBjAHIAbwBzAG8AZgB0AC4AZABlAHMAawB0AG8AcABhAHAAcABpAG4AcwB0AGEAbABsAGUAcgBfADgAdwBlAGsAeQBiADMAZAA4AGIAYgB3AGUAAADNAAAAIgAAAAEAPHRzkyJyTeprvahJYVs0C0HSgOyvT4hrOkNjQkRP3ZkgAAAABAAAABy+D1fMAAAARAAAAAEAAgBIa5/IGWUu4VPS25nTkLR8ppTVf6vcPSq/gcYDNJ9lN2zTLbFu6TvvW9vRaJ+VeOW+RRkKhoksVH7Pt7QD1r6bgFx+w8DBVQVIbEe2VcpuymyNmZ2W4wEaZRbCfq2+g9k=eLMrCQLsZziDD7p7OTk+r0/1PlW/QvNCd1tuouOIatqECfL1vw0ssHqzwztfAKlLvpaQ1NnB6MlW4wBdOziLQs6TNUNIseASPZWl9s/0qUb85+BpOoFPt+A2t0C0+1Y33UqlpBsXOLndXgySGorBjbRBEDrpX4HFrOfuyGkUSbMVFgSr0H6xXRbLJmYTId0Oy2bPCpRfTqDwqS1x71+IDSBel8I8fs6UHYdYhGvFVqiOtg2+eeuD5pd6I5wiYLIXkfzu6/66QDT7kR1LJ+zgEJCFfauUft1vUIYjTj4evPLZUXRrK7ff8ktfaoppD3o7ToN4C3XSik9HzcsEfhLeUg==oVSJXItDsaAIfwyR9bhh/ZSppCAO+in9POLWdC2/TQodgeHZzbdBvxJvKhpbrq6ZP0FsSElLwRoLAmv7zIuVw3Vb7tfQt5bjCDHRAG9fesNlYKV3ybyNrHyzglfZPRB5UJZw32yi03zQa+LLa05fjs6joEmlHc5BrGQrGrbNMBahz4cmuxKC4/dhEb7JZFUkc0MRhs/M3Ve511HQfKuG+92g1OffJdRsAPzWRdskPoN35knnqno7F85OBmGV/LNBgdtDWUH6di1eUCQFeKGfMp+Q/LFUX9jawTTEPn72tYbpYASug05Skcg6KTHlcLGzevxGw7BYsOsqfDka5n0YGw==AAEAAQ== \ No newline at end of file diff --git a/Packages/WindowsStore/Microsoft.NET.Native.Framework.2.2_2.2.27912.0_x64__8wekyb3d8bbwe.Appx b/Packages/WindowsStore/Microsoft.NET.Native.Framework.2.2_2.2.27912.0_x64__8wekyb3d8bbwe.Appx deleted file mode 100644 index 072ccf4..0000000 Binary files a/Packages/WindowsStore/Microsoft.NET.Native.Framework.2.2_2.2.27912.0_x64__8wekyb3d8bbwe.Appx and /dev/null differ diff --git a/Packages/WindowsStore/Microsoft.NET.Native.Framework.2.2_2.2.27912.0_x86__8wekyb3d8bbwe.Appx b/Packages/WindowsStore/Microsoft.NET.Native.Framework.2.2_2.2.27912.0_x86__8wekyb3d8bbwe.Appx deleted file mode 100644 index 2f3e382..0000000 Binary files a/Packages/WindowsStore/Microsoft.NET.Native.Framework.2.2_2.2.27912.0_x86__8wekyb3d8bbwe.Appx and /dev/null differ diff --git a/Packages/WindowsStore/Microsoft.NET.Native.Runtime.2.2_2.2.28604.0_x64__8wekyb3d8bbwe.Appx b/Packages/WindowsStore/Microsoft.NET.Native.Runtime.2.2_2.2.28604.0_x64__8wekyb3d8bbwe.Appx deleted file mode 100644 index e70937b..0000000 Binary files a/Packages/WindowsStore/Microsoft.NET.Native.Runtime.2.2_2.2.28604.0_x64__8wekyb3d8bbwe.Appx and /dev/null differ diff --git a/Packages/WindowsStore/Microsoft.NET.Native.Runtime.2.2_2.2.28604.0_x86__8wekyb3d8bbwe.Appx b/Packages/WindowsStore/Microsoft.NET.Native.Runtime.2.2_2.2.28604.0_x86__8wekyb3d8bbwe.Appx deleted file mode 100644 index abf125b..0000000 Binary files a/Packages/WindowsStore/Microsoft.NET.Native.Runtime.2.2_2.2.28604.0_x86__8wekyb3d8bbwe.Appx and /dev/null differ diff --git a/Packages/WindowsStore/Microsoft.StorePurchaseApp_12011.1000.2013.0_neutral_~_8wekyb3d8bbwe.appxbundle b/Packages/WindowsStore/Microsoft.StorePurchaseApp_12011.1000.2013.0_neutral_~_8wekyb3d8bbwe.appxbundle deleted file mode 100644 index 76ead39..0000000 Binary files a/Packages/WindowsStore/Microsoft.StorePurchaseApp_12011.1000.2013.0_neutral_~_8wekyb3d8bbwe.appxbundle and /dev/null differ diff --git a/Packages/WindowsStore/Microsoft.StorePurchaseApp_8wekyb3d8bbwe.xml b/Packages/WindowsStore/Microsoft.StorePurchaseApp_8wekyb3d8bbwe.xml deleted file mode 100644 index 8133602..0000000 --- a/Packages/WindowsStore/Microsoft.StorePurchaseApp_8wekyb3d8bbwe.xml +++ /dev/null @@ -1 +0,0 @@ -9NBLGGH4LS1Fmicrosoft.storepurchaseapp_8wekyb3d8bbwea8301a7a-06f7-425e-8fb5-ebfb702440df2c3f1d47-426d-c7d7-face-ef1add208818False2016-04-01T22:02:43.4444915Z2016-04-01T22:02:43.0608594Z2016-04-01T22:02:43.0608594ZFAAAALoAAADJAAAACgAAAAMAAQAD8P5WAgDLAAAAEAAAAAYtUCgpnRSFHl1kRHEW15jOAAAAUgAAAG0AaQBjAHIAbwBzAG8AZgB0AC4AcwB0AG8AcgBlAHAAdQByAGMAaABhAHMAZQBhAHAAcABfADgAdwBlAGsAeQBiADMAZAA4AGIAYgB3AGUAAADNAAAAIgAAAAEAMPDiheq+DxYSDJaaOq7obPBL5IlMNiWK7M2dpI865e8gAAAABAAAAAPw/lbMAAAARAAAAAEAAgCVOMM09off+6NXUn50Ct6Pw0Nc1vQYj/q1lncPdmHi2L06skc87Z+WxfZQmqdsuERDP/S/l3I1ThyK+o9S+73WwnqdrNUltStkbVpNc1Fq5IKTPRvEU6bTBjRLvJ064AE=S0Gc1y9ck1pyaQn0jbLG2eI6Jkw/AjTu9Rpyc1u9qedNB1C5e9jKBLf0B3GTnALSnt87G0dqLZru6kqBLLjXoLUChtxgf4NA8J9MMeQeEWfuFtv1j5rucmvfEsRlU/dKs1q46z7GKzIX0Yl3dAEkbEKAEdUqvdBijjuRDwLckOVz0rBvFZy4qwQ+W2hP0UfgDoHiPdS9vi5VE8odzB0SO/MUxpAT/DuixrWVghqqyU9x+uVMYE9C328mNDTK3bkRiCR/bzl4EsoShTVNxdQrRFnnlB3vaOIUEg5Ge6OkGrYp69M4f82k92rH3OzlQr+qdm2UkKNAMkpI5mrwo2zuGA==oVSJXItDsaAIfwyR9bhh/ZSppCAO+in9POLWdC2/TQodgeHZzbdBvxJvKhpbrq6ZP0FsSElLwRoLAmv7zIuVw3Vb7tfQt5bjCDHRAG9fesNlYKV3ybyNrHyzglfZPRB5UJZw32yi03zQa+LLa05fjs6joEmlHc5BrGQrGrbNMBahz4cmuxKC4/dhEb7JZFUkc0MRhs/M3Ve511HQfKuG+92g1OffJdRsAPzWRdskPoN35knnqno7F85OBmGV/LNBgdtDWUH6di1eUCQFeKGfMp+Q/LFUX9jawTTEPn72tYbpYASug05Skcg6KTHlcLGzevxGw7BYsOsqfDka5n0YGw==AAEAAQ== \ No newline at end of file diff --git a/Packages/WindowsStore/Microsoft.VCLibs.140.00_14.0.27810.0_x64__8wekyb3d8bbwe.Appx b/Packages/WindowsStore/Microsoft.VCLibs.140.00_14.0.27810.0_x64__8wekyb3d8bbwe.Appx deleted file mode 100644 index 7f03af3..0000000 Binary files a/Packages/WindowsStore/Microsoft.VCLibs.140.00_14.0.27810.0_x64__8wekyb3d8bbwe.Appx and /dev/null differ diff --git a/Packages/WindowsStore/Microsoft.VCLibs.140.00_14.0.27810.0_x86__8wekyb3d8bbwe.Appx b/Packages/WindowsStore/Microsoft.VCLibs.140.00_14.0.27810.0_x86__8wekyb3d8bbwe.Appx deleted file mode 100644 index 7e4bddd..0000000 Binary files a/Packages/WindowsStore/Microsoft.VCLibs.140.00_14.0.27810.0_x86__8wekyb3d8bbwe.Appx and /dev/null differ diff --git a/Packages/WindowsStore/Microsoft.WindowsStore_12010.1001.213.0_neutral_~_8wekyb3d8bbwe.appxbundle b/Packages/WindowsStore/Microsoft.WindowsStore_12010.1001.213.0_neutral_~_8wekyb3d8bbwe.appxbundle deleted file mode 100644 index 6c67162..0000000 Binary files a/Packages/WindowsStore/Microsoft.WindowsStore_12010.1001.213.0_neutral_~_8wekyb3d8bbwe.appxbundle and /dev/null differ diff --git a/Packages/WindowsStore/Microsoft.WindowsStore_8wekyb3d8bbwe.xml b/Packages/WindowsStore/Microsoft.WindowsStore_8wekyb3d8bbwe.xml deleted file mode 100644 index 2353283..0000000 --- a/Packages/WindowsStore/Microsoft.WindowsStore_8wekyb3d8bbwe.xml +++ /dev/null @@ -1 +0,0 @@ -9WZDNCRFJBMPmicrosoft.windowsstore_8wekyb3d8bbwe20ae9d1d-4b7d-4c35-b7d6-65e31396efd32c3f1d47-426d-c7d7-face-ef1add208818False2015-06-01T18:28:54.3098854Z2015-06-01T18:28:54.3574657Z2015-06-01T18:28:54.3574657ZFAAAALIAAADJAAAACgAAAAMAAQBmpGxVAgDLAAAAEAAAAPH+T+ZG4jK2WVtWB2o/p3bOAAAASgAAAG0AaQBjAHIAbwBzAG8AZgB0AC4AdwBpAG4AZABvAHcAcwBzAHQAbwByAGUAXwA4AHcAZQBrAHkAYgAzAGQAOABiAGIAdwBlAAAAzQAAACIAAAABAAaf7l9Jp21JeRrJKBhcbP6ODp40LTKLpK3I9WgJHJhOIAAAAAQAAABmpGxVzAAAAEQAAAABAAIAHJNoXjtSbcT3K6z4K6PvH4xijDdLWKmaFiS9nm3Qze7YKZpMaHEm1aiE13HD0bKHyHyl5tAXOn8UgIHHFZ8i6g==RRM/4J8WsRpcxBMBpyvG7aUsW0jEomzv7f++SIVEVDc=ZoYDzCjHhwPTGGBopKxKsXIuvKveOvKlLVFi3inlQUSG/4yJELe1Eu/3e02s2ImCRq/Zxkue+bWXcQG/YdD8MtAQ1Q1BcqqhW3/xQt7cRBX/dwE+SVxvyFr+l7kNkzg8r7UtMMTPHmVsdH5rGR6Ej0kEW8eqUvq9Tbs6MpXFOzwIYrqbwu+LEeWfmL1UZ0DgcGBEGRupgEBzxS362H6R//oReEN0OgSWUhMZcGBuI0rJIOICntxhU/dtsksxGwwoVPheAeCAdDvjZlShWERm0T9aQnOdDqhVY96sH0DTB90GVwXZsvzksXSzdSk4rbjHRinXBS/2HHXu49iy3dXBjg==oVSJXItDsaAIfwyR9bhh/ZSppCAO+in9POLWdC2/TQodgeHZzbdBvxJvKhpbrq6ZP0FsSElLwRoLAmv7zIuVw3Vb7tfQt5bjCDHRAG9fesNlYKV3ybyNrHyzglfZPRB5UJZw32yi03zQa+LLa05fjs6joEmlHc5BrGQrGrbNMBahz4cmuxKC4/dhEb7JZFUkc0MRhs/M3Ve511HQfKuG+92g1OffJdRsAPzWRdskPoN35knnqno7F85OBmGV/LNBgdtDWUH6di1eUCQFeKGfMp+Q/LFUX9jawTTEPn72tYbpYASug05Skcg6KTHlcLGzevxGw7BYsOsqfDka5n0YGw==AAEAAQ== \ No newline at end of file diff --git a/Packages/WindowsStore/Microsoft.XboxIdentityProvider_12.67.21001.0_neutral_~_8wekyb3d8bbwe.appxbundle b/Packages/WindowsStore/Microsoft.XboxIdentityProvider_12.67.21001.0_neutral_~_8wekyb3d8bbwe.appxbundle deleted file mode 100644 index 22383e0..0000000 Binary files a/Packages/WindowsStore/Microsoft.XboxIdentityProvider_12.67.21001.0_neutral_~_8wekyb3d8bbwe.appxbundle and /dev/null differ diff --git a/Packages/WindowsStore/Microsoft.XboxIdentityProvider_8wekyb3d8bbwe.xml b/Packages/WindowsStore/Microsoft.XboxIdentityProvider_8wekyb3d8bbwe.xml deleted file mode 100644 index e4010ac..0000000 --- a/Packages/WindowsStore/Microsoft.XboxIdentityProvider_8wekyb3d8bbwe.xml +++ /dev/null @@ -1 +0,0 @@ -9WZDNCRD1HKWmicrosoft.xboxidentityprovider_8wekyb3d8bbwe15a58266-bcff-4ee0-91f9-315ff813936a2c3f1d47-426d-c7d7-face-ef1add208818False2016-02-20T19:07:41.1189892Z2016-02-20T19:07:40.9422576Z2016-02-20T19:07:40.9422576ZFAAAAMIAAADJAAAACgAAAAMAAQB9uchWAgDLAAAAEAAAABoq1MM/L6mkagTMGyNEhfvOAAAAWgAAAG0AaQBjAHIAbwBzAG8AZgB0AC4AeABiAG8AeABpAGQAZQBuAHQAaQB0AHkAcAByAG8AdgBpAGQAZQByAF8AOAB3AGUAawB5AGIAMwBkADgAYgBiAHcAZQAAAM0AAAAiAAAAAQDwzmDCtA2xOY++tCB7M16iflwLDnYpa1uHDY1XwsgdRyAAAAAEAAAAfbnIVswAAABEAAAAAQACAA1ST4slzJ4Gp3ms6V/TBuTK+mmQyhsquAlbksVmHOGGXfd2JnVaoKWScx8Dn6o88wWwQPqnWF/6QMISZLDXBgE=uvKEEs3RJfIFW/HdJ1h6CAkLr2PLsJGl07/6ndV0mLY=oA1IZpnzE4ocdvFwp3Obf57L9dSe/p/jYINwjGMINETHP2vohVdKsyBHfn9vKWao7nWuI5BYZJR1pfSlCtVQuJxavzaE+cCKtokJG+UYcRz/cJ8BBzi9sG2z62QrAbXGdFArvvaVM77s7DAjXgeGP4HWjSSM64k1aHGfKzfwexSgAyKetEto7nTrLleKtKWKxfx3CKLLRpbVBU+D//m+dXFuxIe+OCIMepFBr4udAYeAJYyFxgPKqHeqGrM8IAWoXHtZmoiKLFndDTpUsBNlvZLbyouw9W7rGYzkSE3htXIhExJilbTXXe+L5v4YD5w+1AalGAIJR42M9RZyYOGWLw==oVSJXItDsaAIfwyR9bhh/ZSppCAO+in9POLWdC2/TQodgeHZzbdBvxJvKhpbrq6ZP0FsSElLwRoLAmv7zIuVw3Vb7tfQt5bjCDHRAG9fesNlYKV3ybyNrHyzglfZPRB5UJZw32yi03zQa+LLa05fjs6joEmlHc5BrGQrGrbNMBahz4cmuxKC4/dhEb7JZFUkc0MRhs/M3Ve511HQfKuG+92g1OffJdRsAPzWRdskPoN35knnqno7F85OBmGV/LNBgdtDWUH6di1eUCQFeKGfMp+Q/LFUX9jawTTEPn72tYbpYASug05Skcg6KTHlcLGzevxGw7BYsOsqfDka5n0YGw==AAEAAQ== \ No newline at end of file diff --git a/Packages/WindowsStore/placeholder.txt b/Packages/WindowsStore/placeholder.txt new file mode 100644 index 0000000..67c3297 --- /dev/null +++ b/Packages/WindowsStore/placeholder.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/README.md b/README.md index 70ce7fe..1dadf3b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Optimize-Offline # -Optimize-Offline is a Windows Image (WIM/ESD) optimization module designed for Windows 10 versions 1803-to-2004 64-bit architectures. +Optimize-Offline is a Windows Image (WIM/ESD) optimization module designed for Windows 10 versions 1803-to-2009 64-bit architectures. ## About Optimize-Offline ## @@ -104,7 +104,12 @@ Content can be in the form of files, folders or directories, unless a specific f #### Registry Template Integration #### -Any custom registry template (.reg) file to be imported into the offline image's registry hives can be placed in the '\Content\Additional\RegistryTemplates' folder. No editing of these template files is required and Optimize-Offline will copy and edit them accordingly to apply them to the appropriate hives. +Custom registry template (.reg) files placed in the '\Content\Additional\RegistryTemplates' folder are imported by Optimize-Offline into the offline image's appropriate registry hive. + +***Note:*** +To qualify for Optimize-Offline hive import, all custom registry template additions are constrained to having unrestricted permissions. If any key change included in a custom registry template addition requires restricted access, the entire Optimize-Offline script fails without notice and without any descriptive warning. The solution is to remove any registry key change that requires access to protected registry keys. + +>Registry templates that users can add to be automatically imported into the offline registry hives are not granted the token privileges required for access to protected registry keys. Only certain values applied by the script itself are granted these privileges. [GitHub-DrEmpiricism](https://github.com/DrEmpiricism/Optimize-Offline/issues/136#issuecomment-554158335) #### Adding Drivers #### @@ -134,6 +139,33 @@ It is also recommended to be well versed and aware of all recovery tools Microso Starting in Windows 8.1, Microsoft introduced a Metro-style calculator to replace its traditional Calculator. In Windows 10 non-LTSB/LTSC/Server editions, the traditional Calculator was entirely removed and replaced with a UWP (Universal Windows Platform) App version. This new UWP Calculator introduced a fairly bloated UI many users were simply not fond of and much preferred the simplicity of the traditional Calculator (now labeled Win32Calc.exe). Unfortunately, Microsoft never added the ability to revert back to the traditional Calculator nor released a downloadable package to install the traditional Calculator. +### About Microsoft Defender ### + +>Microsoft Defender is the built-in antimalware and antivirus protection component of Microsoft Windows. [Microsoft Document](https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/microsoft-defender-antivirus-windows?view=o365-worldwide). Natively, unless replaced by another antivirus, the Defender application always starts with Windows. Optimize-Offline provides methods to regain control over the initial activation and ongoing operation of Microsoft Defender. + +***Optimize-Offline supplies two methods to control Microsoft Defender*** + +- The first method is to remove the SecHealthUI package which totally and permanently disables Defender. +- The second method is to apply the Dormant Defender parameter which provides greater flexibility in controlling Microsoft Defender. + +***Option #1 - remove the SecHealthUI package and permanently disable Defender*** + +- For Windows 10: Remove SecHealthUI from System Applications. See [GitHub-DrEmpiricism](https://github.com/DrEmpiricism/Optimize-Offline#about-system-applications) +- For Windows 11: SecHealthUI removal is handled by your chosen WindowsApps list. See [GitHub-gdeliana](https://github.com/gdeliana/Optimize-Offline/blob/master/README.md#using-component-removal-lists) + +***Option #2 - Apply the Dormant Defender parameter to gain full control of Defender*** + +For all Windows builds. The Dormant Defender parameter applies entries and values to the image registry hives forcing Microsoft Defender into an inactive state. +Dormant Defender fully disables Microsoft Defender, but by leaving the application and folder structure intact, retains the possibility to restore it to full functionality. + +To re-enable Defender apply the "Microsoft Defender Enable" script [GitHub-TairikuOokami](https://github.com/TairikuOokami/Windows/blob/main/Microsoft%20Defender%20Enable.bat). + +After Microsoft Defender is restored, retain full control by applying the "ToggleDefender" script [GitHub-AveYo](https://github.com/AveYo/LeanAndMean#toggledefender---lean-and-mean-snippet-by-aveyo-2020-2021). + +***Note:*** + +If you apply both methods to control Microsoft Defender e.g. remove the SecHealthUI package and apply the Dormant Defender parameter, then the former removal method takes precedence. Meaning that the outcome of applying both methods is the same as if you only removed the SecHealthUI package. + ### About Data Deduplication ### > Data Deduplication, often called Dedup for short, is a feature of Windows Server 2016 that can help reduce the impact of redundant data on storage costs. When enabled, Data Deduplication optimizes free space on a volume by examining the data on the volume by looking for duplicated portions on the volume. Duplicated portions of the volume's dataset are stored once and are (optionally) compressed for additional savings. Data Deduplication optimizes redundancies without compromising data fidelity or integrity. [Microsoft Document](https://docs.microsoft.com/en-us/windows-server/storage/data-deduplication/overview) @@ -178,6 +210,8 @@ The ISO parameter allows for two values to be passed to it: 'Prompt' and 'No-Pro Optimize-Offline calls the COM IMAPI2 interface for file system image building and also opens a binary stream that writes a bootfile sector code to the ISO. This allows for bootable Windows Installation Media ISO creation without the need for 3rd party tools like oscdimg. +Also it's possible to pre-define the Compression level with a json key located in Configuration.json file named: CompressionType, it's values can be one of the following: 'Select', 'None', 'Fast', 'Maximum', 'Solid'. Select will show the selection window of the compression type on runtime. + ### About Defaultuser0 ### Any time an OEM Windows Image is modified offline, or the System Preparation, Reset and Provisioning Package deployment features are used, there is a chance this ghost account will surface. @@ -195,3 +229,98 @@ Once you have edited the Configuration.json to your specific optimization requir ```PowerShell .\Start-Optimize.ps1 ``` + +## Using Optimize-Offline as TrustedInstaller ## + +Running Optimize-Offline as Trusted Installer enhances every operation it performs including properly unloading the image. This enhanced capability is provided by the "Start-Optimize-BAU-TI.ps1" script. The script is a the custom-made version of the generic "RunAsTI" script [GitHub-AveYo](https://github.com/AveYo/LeanAndMean/blob/main/RunAsTI.bat) and includes a unique solution for providing the power of Trusted Installer, but still correctly loading the HKCU USER hive as opposed to Window's natively loading the TI SYSTEM hive. + +Open the custom configuration JSON file (Configuration.json) in any text editing program and edit any values for your specific optimization requirements. While editing the Configuration.json file, do not change the template structure and make sure its formatting is retained when adding or changing values. + +Once you have edited the Configuration.json to your specific optimization requirements, open an elevated PowerShell console in the root directory of the Optimize-Offline project and execute the Start-Optimize-BAU-TI call script: + +```PowerShell +.\Start-Optimize-BAU-TI.ps1 +``` + +## Using component removal lists + +Removal lists can be found in ./Content/Lists. There are 6 basic categories spread out through each of the subfolders. In each subcategory you will find a Whitelist, Blacklist and a template. The template contains all the possible packages to be inserted either in the blacklist or in the whitelist. The features contain only a list json and a template. + +- WindowsApps - WindowsAppsWhitelist.json, WindowsAppsBlacklist.json, WindowsAppsTemplate.json +- SystemApps - SystemAppsWhitelist.json, SystemAppsBlacklist.json, SystemAppsTemplate.json +- Capabilities - CapabilitiesWhitelist.json, CapabilitiesBlacklist.json, CapabilitiesTemplate.json +- Packages - PackagesWhitelist.json, PackagesBlacklist.json, PackagesTemplate.json +- FeaturesToEnable - FeaturesToEnableList.json, FeaturesToEnableTemplate.json +- FeaturesToDisable - FeaturesToDisableList.json, FeaturesToDisableTemplate.json + +The template files can be filled by launching the script with the populateTemplates parameter + +```PowerShell +.\Start-Optimize.ps1 -populateTemplates +``` + +In configuration.json the list parameters are the following: +- WindowsApps - (All, None, Select, Whitelist, Blacklist), lists are in ./Content/Lists/WindowsApps +- SystemApps - (All, None, Select, Whitelist, Blacklist), lists are in ./Content/Lists/SystemApps +- Capabilities - (All, None, Select, Whitelist, Blacklist), lists are in ./Content/Lists/Capabilities +- Packages - (All, None, Select, Whitelist, Blacklist), lists are in ./Content/Lists/Packages +- FeaturesToEnable - (All, None, Select, List), lists are in ./Content/Lists/FeaturesToEnable +- FeaturesToDisable - (All, None, Select, List), lists are in ./Content/Lists/FeaturesToDisable +- Services - (None, Select, List, Advanced), lists are in ./Content/Lists/ServicesList.json, and in ./Content/Lists/ServicesAdvanced.json when advanced parameter is set in configuration.json + +## Generating template component removal lists + +The component removal lists mentioned above contain package names that are found in the windows system. Each version of windows may change the names and entries of it's components. For updating the lists or even helping you in generating custom ones according to the windows build you have, use the command: + +`.\Start-Optimize -populateTemplates` + +This command will find all the available windows apps, system apps and capabilities and will fill the corresponding json located in ./Content/Lists . Afterwards feel free to cherry pick the package names and insert them according to your needs in the removal lists in subfolder ./Content/Lists. + +To populate the lists interactively by clicking item in grid guis and as well populating the templates (for later making manual changes to the lists by copying and pasting), use this command: +Code: + +`.\Start-Optimize.ps1 -populateLists` + +Please note that the interactive filling of lists, will fill the list chosen in configuration.json. So first set up configuration.json with the proper list method!! If no list methods are specified in configuration.json the populateLists will just populate the templates, as it doesn't have info about which lists to fill, so it will be basically the same behaviour like populateTemplates. + + +## Windows services removal + +***==Services Template==*** +Use populateTemplates feature to assign your images available services to ServicesTemplate.json + Some filtering out of non-service related entries is complete in the provided ServicesTemplate.json, but each OS requires more filtering. + +***==List==*** +Set the Services parameter in configuration.json: List +Assigns the start behavior of the services listed in ServicesList.json to "Disabled" + For Services you want to disable, copy the service object "name" . . . + . . . from /Content/Lists/Services/ServicesTemplate.json -> /Content/Lists/Services/ServicesList.json + Alternatively, if you already have a list of services you know you want to disable, add their names following the pattern seen in the provided example ServicesList.json + +***==Advanced==*** +Set the Services parameter in configuration.json: Advanced +Useful for specifying any type of start behavior (including "4" "Disabled") to the services listed in ServicesAdvanced.json + Specify the start behavior of each service by copying the object . . . + Code: + { + name: [SERVICE_DISPLAYNAME], + start: [0,1,2,3,4], + description?: [optional, not used in the code, but just for you to know more about the services you're including] + } + . . . from /Content/Lists/Services/ServicesTemplate.json -> /Content/Lists/Services/ServicesAdvanced.json + +## Selective registry tweaks + +- DisableWindowsUpgrade - Tweak will prevent windows update from receiving cummulative updates and feature updates +- DisableWindowsUpdateMicrosoft - Applies the official developers solution to prevents Windows Update from connecting to Microsoft update services. This includes connecting to the MS Store to download apps. [Microsoft Document] (https://docs.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#bkmk-wu) Easy to turn on an off using a toggle script [GitHub Gist] (https://gist.github.com/espanafly/3041ce74cd2493d349e58c31630f98e5) +- DisableDriverUpdate - Will disable windows update from updating hw drivers +- DormantOneDrive - Disables the startup installation of Onedrive, but allows you to manually install by using the dormant physical setup file +- Disable3rdPartyApps - Will remove the 3rd party apps installed with windows +- W11ClassicContextMenu - Will make the context menu look like in W10 (builds >= 22000) +- ExplorerUIRibbon - Enables the classic explorer UI ribbon (not available on builds >= 22500) +- ClassicSearchExplorer - Tweak is needed in case you uninstall Search app or when applying the /Content/Additional/Setup/Set-Additional.ps1 on an online image. Works only on builds higher than 18363. +- RemoveTaskbarPinnedIcons - Tries to remove based on system version the automatically pinned taskbar icons +- DisableTeamsApp - Will remove Microsoft Teams from installing at the first logon +- DisableVirtualizationSecurity - Disables Core integrity and Virtualization based security (builds >= 22000) +- RunAsTiContextMenu - Adds Powershell as trusted installer context menu entry +- AmoledBlackTheme - Enables pitch black AMOLED theme on W10 and W11 all builds diff --git a/SelectiveRegistry.ps1 b/SelectiveRegistry.ps1 new file mode 100644 index 0000000..766f360 --- /dev/null +++ b/SelectiveRegistry.ps1 @@ -0,0 +1,173 @@ +RegHives -Load +If($SelectiveRegistry.DisableWindowsUpgrade) { + + $TargetReleaseVersionInfo = $null + + Switch ($Global:InstallInfo.Build) { + "17134" { $TargetReleaseVersionInfo = "1803" } + "17763" { $TargetReleaseVersionInfo = "1809" } + "18362" { $TargetReleaseVersionInfo = "1903" } + "18363" { $TargetReleaseVersionInfo = "1909" } + "19041" { $TargetReleaseVersionInfo = "2004" } + "19042" { $TargetReleaseVersionInfo = "2009" } + "19043" { $TargetReleaseVersionInfo = "21H1" } + } + + If ($Global:InstallInfo.Build -ge "19044") { + $TargetReleaseVersionInfo = "21H2" + } + + If ($Global:InstallInfo.Build -ge "22500") { + $TargetReleaseVersionInfo = "22H2" + } + + If ($TargetReleaseVersionInfo){ + + Log $OptimizeData.SelectiveRegistryWindowsUpgrade + + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -Type DWord -Value "2" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoUpdate" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "DeferUpdatePeriod" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "DeferUpgrade" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "DeferUpgradePeriod" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "TargetReleaseVersion" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "TargetReleaseVersionInfo" -Type String -Value $TargetReleaseVersionInfo + + If ($Global:InstallInfo.Build -ge "17134" -and $Global:InstallInfo.Build -le "20348") { RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "ProductVersion" -Type String -Value "Windows 10" } + + If ($Global:InstallInfo.Build -ge "22000") { RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "ProductVersion" -Type String -Value "Windows 11" } + + } + Start-Sleep 1 +} +If($SelectiveRegistry.DisableWindowsUpdateMicrosoft) { + Log $OptimizeData.SelectiveRegistryWindowsUpdateMS + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "DoNotConnectToWindowsUpdateInternetLocations" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "DisableWindowsUpdateAccess" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "WUServer" -Type String -Value " " + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "WUStatusServer" -Type String -Value " " + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "UpdateServiceUrlAlternate" -Type String -Value " " + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "UseWUServer" -Type DWord -Value "1" + Start-Sleep 1 +} + +If($SelectiveRegistry.DisableDriverUpdate) { + Log $OptimizeData.SelectiveRegistryDriverUpdate + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Device Metadata" -Name "PreventDeviceMetadataFromNetwork" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "DontPromptForWindowsUpdate" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "DontSearchWindowsUpdate" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "DriverUpdateWizardWuSearchEnabled" -Type DWord -Value "0" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DriverSearching" -Name "SearchOrderConfig" -Type DWord -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "ExcludeWUDriversInQualityUpdate" -Type DWord -Value "1" + Start-Sleep 1 +} + +If($SelectiveRegistry.DormantOneDrive) { + Log $OptimizeData.SelectiveRegistryDormantOneDrive + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "OneDriveSetup" -Type DWord -Value "0" + Start-Sleep 1 +} + +If ($SelectiveRegistry.Disable3rdPartyApps) { + + Log $OptimizeData.SelectiveRegistryDisable3rdPartyApps + + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "OemPreInstalledAppsEnabled" -Type Dword -Value "0" + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "PreInstalledAppsEnabled" -Type Dword -Value "0" + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SilentInstalledAppsEnabled" -Type Dword -Value "0" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Type Dword -Value "1" + + If ($Global:InstallInfo.Build -ge "22000") { + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\PolicyManager\current\device\Start" -Name "ConfigureStartPins" -Type String -Value '{"pinnedList": [{}]}' + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\PolicyManager\current\device\Start" -Name "ConfigureStartPins_ProviderSet" -Type Dword -Value "0" + } + Start-Sleep 1 +} + +# classic search in explorer +If($SelectiveRegistry.ClassicSearchExplorer -and $Global:InstallInfo.Build -ge '18363') { + + Log $OptimizeData.SelectiveRegistryClassicSearchExplorer + + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{1d64637d-31e9-4b06-9124-e83fb178ac6e}\TreatAs" -Name "(default)" -Value "{64bc32b5-4eec-4de7-972d-bd8bd0324537}" -Type String -Force + + Start-Sleep 1 +} + +If($SelectiveRegistry.RemoveTaskbarPinnedIcons){ + + Log $OptimizeData.SelectiveRegistryRemoveTaskbarPinnedIcons + + ## Disable taskbar taskview button + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" -Type Dword -Value "0" -Force + + If($Global:InstallInfo.Build -ge '18362') { + #Hide MeetNow icon in taskbar + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "HideSCAMeetNow" -Type dword -Value "1" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "HideSCAMeetNow" -Type dword -Value "1" + } + + if($Global:InstallInfo.Build -le '19044'){ + RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\Windows\Explorer" -Name "NoPinningStoreToTaskbar" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins" -Name "MailPin" -Value 2 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" -Name "PeopleBand" -Value 0 -Type DWord + } + + # Disable News & Interests icon + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Feeds" -Name "ShellFeedsTaskbarViewMode" -Type dword -Value "2" + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" -Name "EnableFeeds" -Type dword -Value "0" + + If($Global:InstallInfo.Build -ge '22000') { + #Remove Chat icon in taskbar + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Chat" -Name "ChatIcon" -Type dword -Value "3" + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarMn" -Type dword -Value "0" + + ## Disable widgets button + RegKey -Path "HKLM:\WIM_HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarDa" -Type Dword -Value "0" -Force + } + + Start-Sleep 1 + +} + +If($SelectiveRegistry.W11ClassicContextMenu -and $Global:InstallInfo.Build -ge '22000') { + Log $OptimizeData.SelectiveRegistryW11ClassicContextMenu + # Classic context menus + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" -Name "(default)" -Value "" -Type String -Force + Start-Sleep 1 +} + +if($SelectiveRegistry.DisableTeamsApp -and $Global:InstallInfo.Build -ge '10240') { + Log $OptimizeData.SelectiveRegistryDisableTeamsApp + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Communications" -Name "ConfigureChatAutoInstall" -Value "0" -Type DWord -Force + Start-Sleep 1 +} + +if($SelectiveRegistry.DisableVirtualizationSecurity -and $Global:InstallInfo.Build -ge '22000') { + Log $OptimizeData.SelectiveRegistryDisableVirtualizationSecurity + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Control\DeviceGuard\Scenarios" -Name "HypervisorEnforcedCodeIntegrity" -Value "0" -Type DWord -Force + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Control\DeviceGuard" -Name "EnableVirtualizationBasedSecurity" -Value "0" -Type DWord -Force + Start-Sleep 1 +} + +if($SelectiveRegistry.RunAsTiContextMenu){ + Log $OptimizeData.SelectiveRegistryRunAsTiContextMenu + Import-Registry -Path (Get-ChildItem -Path $OptimizeOffline.SelectiveRegistry -Filter RunAsTi.reg).FullName + Start-Sleep 1 +} + +if($SelectiveRegistry.AmoledBlackTheme -and $Global:InstallInfo.Build -ge '10240') { + Log $OptimizeData.SelectiveRegistryAmoledBlackTheme + Import-Registry -Path (Get-ChildItem -Path $OptimizeOffline.SelectiveRegistry -Filter AMOLED_black_theme.reg).FullName + Start-Sleep 1 +} + +if($SelectiveRegistry.ClassicFileExplorer -and $Global:InstallInfo.Build -eq '22000') { + Log $OptimizeData.SelectiveRegistryClassicFileExplorer + Import-Registry -Path (Get-ChildItem -Path $OptimizeOffline.SelectiveRegistry -Filter ClassicFileExplorer.reg).FullName + Start-Sleep 1 +} + +RegHives -Unload + +Clear-Host diff --git a/Set-RegistryProperties.ps1 b/Set-RegistryProperties.ps1 new file mode 100644 index 0000000..0ad09a5 --- /dev/null +++ b/Set-RegistryProperties.ps1 @@ -0,0 +1,352 @@ +Function Set-RegistryProperties +{ + [CmdletBinding()] + Param () + + Try { Import-LocalizedData -BindingVariable RegistryData -FileName Set-RegistryProperties.strings.psd1 -ErrorAction Stop } + Catch { Log ($OptimizeData.FailedImportingRegistryLocalizedData -f (GetPath -Path (GetPath -Path $OptimizeOffline.Resources -Child "Public\$($OptimizeOffline.Culture)\Set-RegistryProperties.strings.psd1") -Split Leaf)) -Type Error -ErrorRecord $Error[0]; Return } + + Try + { + Log $OptimizeData.ApplyingRegistrySettings + $InstallInfo = Import-DataFile Install -ErrorAction Stop + RegHives -Load + + $RegistryData.DisableCortana | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + If ($InstallInfo.Build -ge '18362') { RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowCortanaButton" -Value 0 -Type DWord } + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Search" -Name "CortanaConsent" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Search" -Name "CortanaInAmbientMode" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Search" -Name "HistoryViewEnabled" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Search" -Name "HasAboveLockTips" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Search" -Name "AllowSearchToUseLocation" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\SearchSettings" -Name "SafeSearchMode" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\Windows\Explorer" -Name "DisableSearchBoxSuggestions" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCortana" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "ConnectedSearchUseWeb" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "ConnectedSearchUseWebOverMeteredConnections" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCloudSearch" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "DisableSearchBoxSuggestions" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\InputPersonalization\TrainedDataStore" -Name "AcceptedPrivacyPolicy" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Personalization\Settings" -Name "AcceptedPrivacyPolicy" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Speech_OneCore\Preferences" -Name "VoiceActivationDefaultOn" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Speech_OneCore\Preferences" -Name "VoiceActivationEnableAboveLockscreen" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Speech_OneCore\Preferences" -Name "ModelDownloadAllowed" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" -Name "DisableVoice" -Value 1 -Type DWord + If (!$DynamicParams.LTSC -and !$DynamicParams.MicrosoftEdge -and !$DynamicParams.MicrosoftEdgeChromium) { RegKey -Path "HKLM:\WIM_HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\ServiceUI" -Name "EnableCortana" -Value 0 -Type DWord } + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" -Name "Block Cortana ActionUriServer.exe" -Value "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\ActionUriServer.exe|Name=Block Cortana ActionUriServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" -Name "Block Cortana PlacesServer.exe" -Value "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\PlacesServer.exe|Name=Block Cortana PlacesServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" -Name "Block Cortana RemindersServer.exe" -Value "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\RemindersServer.exe|Name=Block Cortana RemindersServer.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" -Name "Block Cortana RemindersShareTargetApp.exe" -Value "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\RemindersShareTargetApp.exe|Name=Block Cortana RemindersShareTargetApp.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" -Name "Block Cortana SearchUI.exe" -Value "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|App=C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\SearchUI.exe|Name=Block Cortana SearchUI.exe|Desc=Block Cortana Outbound UDP/TCP Traffic|" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" -Name "Block Cortana Package" -Value "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|Name=Block Cortana Package|Desc=Block Cortana Outbound UDP/TCP Traffic|AppPkgId=S-1-15-2-1861897761-1695161497-2927542615-642690995-327840285-2659745135-2630312742|Platform=2:6:2|Platform2=GTEQ|" -Type String + + $RegistryData.DisableTelemetry | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + If ($DynamicParams.LTSC -or $InstallInfo.Name -like "*Enterprise*" -or $InstallInfo.Name -like "*Education*") { $TelemetryLevel = 0 } Else { $TelemetryLevel = 0 } + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Value $TelemetryLevel -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Value $TelemetryLevel -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "DoNotShowFeedbackNotifications" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\Windows\CloudContent" -Name "DisableTailoredExperiencesWithDiagnosticData" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\AppCompat" -Name "AITEnable" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\AppCompat" -Name "DisableInventory" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\AppCompat" -Name "DisablePCA" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\AppCompat" -Name "DisableUAR" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Messaging" -Name "AllowMessageSync" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Messenger\Client" -Name "CEIP" -Value 2 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\Messenger\Client" -Name "CEIP" -Value 2 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\AppV\CEIP" -Name "CEIPEnable" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\SQMClient\Windows" -Name "CEIPEnable" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Internet Explorer\SQM" -Name "DisableCustomerImprovementProgram" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\TabletPC" -Name "PreventHandwritingDataSharing" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\Software Protection Platform" -Name "NoGenTicket" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\TextInput" -Name "AllowLinguisticDataCollection" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Privacy" -Name "TailoredExperiencesWithDiagnosticDataEnabled" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\PolicyManager\default\System\AllowExperimentation" -Name "value" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Control Panel\International\User Profile" -Name "HttpAcceptLanguageOptOut" -Value 1 -Type DWord + If(!$DynamicParams.WindowsStore -and $DynamicParams.RemovedPackages."Microsoft.DesktopAppInstaller"){ + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" -Name "DODownloadMode" -Value 100 -Type DWord + } + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\WindowsInkWorkspace" -Name "AllowWindowsInkWorkspace" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\WindowsInkWorkspace" -Name "AllowSuggestedAppsInWindowsInkWorkspace" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Input\TIPC" -Name "Enabled" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\Windows\AdvertisingInfo" -Name "DisabledByGroupPolicy" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\Windows Error Reporting" -Name "Disabled" -Value 1 -Type DWord + + If (!$DynamicParams.LTSC -and !$DynamicParams.MicrosoftEdge -and !$DynamicParams.MicrosoftEdgeChromium -and $InstallInfo.Build -le '19044') + { + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\MicrosoftEdge\BooksLibrary" -Name "EnableExtendedBooksTelemetry" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Policies\Microsoft\MicrosoftEdge\BooksLibrary" -Name "EnableExtendedBooksTelemetry" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\FlipAhead" -Name "FPEnabled" -Value 0 -Type DWord + } + + $RegistryData.DisableTracking | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\Assistance\Client\1.0" -Name "NoExplicitFeedback" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Start_TrackDocs" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableActivityFeed" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\System" -Name "PublishUserActivities" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\System" -Name "UploadUserActivities" -Value 0 -Type DWord + + If (!$DynamicParams.LTSC -and !$DynamicParams.MicrosoftEdge -and !$DynamicParams.MicrosoftEdgeChromium -and $InstallInfo.Build -le '19044') + { + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\MicrosoftEdge\Main" -Name "DoNotTrack" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Policies\Microsoft\MicrosoftEdge\Main" -Name "DoNotTrack" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\MicrosoftEdge\Addons" -Name "FlashPlayerEnabled" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Policies\Microsoft\MicrosoftEdge\Addons" -Name "FlashPlayerEnabled" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Main" -Name "DoNotTrack" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Main" -Name "ShowSearchSuggestionsGlobal" -Value 0 -Type DWord + } + + $RegistryData.DisableLocation | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" -Name "DisableLocation" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" -Name "DisableLocationScripting" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" -Name "DisableSensors" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" -Name "Value" -Value "Deny" -Type String + If (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\lfsvc") { RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\lfsvc" -Name "Start" -Value 4 -Type DWord } + If (Test-Path -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\lfsvc\Service\Configuration") { RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\lfsvc\Service\Configuration" -Name "Status" -Value 0 -Type DWord } + + If (!$DynamicParams.LTSC -and !$DynamicParams.MicrosoftEdge -and !$DynamicParams.MicrosoftEdgeChromium) + { + $RegistryData.DisableDefaultBrowserPrompt | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\microsoft.microsoftedge_8wekyb3d8bbwe\MicrosoftEdge\Main" -Name "DisallowDefaultBrowserPrompt" -Value 1 -Type DWord + } + + $RegistryData.DisablePassReveal | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\CredUI" -Name "DisablePasswordReveal" -Value 1 -Type DWord + + $RegistryData.DisableSharedExperiences | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\CDP" -Name "CdpSessionUserAuthzPolicy" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\CDP" -Name "RomeSdkChannelUserAuthzPolicy" -Value 0 -Type DWord + + $RegistryData.DisableWiFiSense | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "value" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "value" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config" -Name "AutoConnectAllowedOEM" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config" -Name "WiFISenseAllowed" -Value 0 -Type DWord + + $RegistryData.DisableNotifications | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "NoToastApplicationNotification" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" -Name "NoToastApplicationNotificationOnLockScreen" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings" -Name "NOC_GLOBAL_SETTING_ALLOW_TOASTS_ABOVE_LOCK" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings" -Name "NOC_GLOBAL_SETTING_ALLOW_CRITICAL_TOASTS_ABOVE_LOCK" -Value 0 -Type DWord + + $RegistryData.DisableAutoplayAutorun | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" -Name "DisableAutoplay" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutoRun" -Value 255 -Type DWord + + $RegistryData.DisableFileBlocking | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments" -Name "SaveZoneInformation" -Value 1 -Type DWord + + $RegistryData.DisableModernUISwapFile | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Control\Session Manager\Memory Management" -Name "SwapfileControl" -Value 0 -Type DWord + + If ($InstallInfo.Build -ge '18362') + { + $RegistryData.DisableReservedStorage | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager" -Name "PassedPolicy" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager" -Name "ShippedWithReserves" -Value 0 -Type DWord + } + + $RegistryData.DisableAutoCleanup | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersionStorageSense\Parameters\StoragePolicy" -Name "512" -Value 0 -Type DWord + + $RegistryData.DisableLogonAnimation | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableFirstLogonAnimation" -Value 0 -Type DWord + + $RegistryData.DisableStartupSound | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\BootAnimation" -Name "DisableStartupSound" -Value 1 -Type DWord + + If ($InstallInfo.Build -ge '18362') + { + $RegistryData.DisableGetMoreNotification | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement" -Name "ScoobeSystemSettingEnabled" -Value 0 -Type DWord + } + + If ($InstallInfo.Build -le '19044'){ + $RegistryData.EnableSearchIcon | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Value $(If ($DynamicParams.RemovedWindowsSearchPackage) {0} Else {1}) -Type DWord + } + + $RegistryData.EnableDriveLetterBeforeDriveName | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowDriveLettersFirst" -Value 4 -Type DWord + + If ($InstallInfo.Build -le '19044'){ + $RegistryData.EnableOLEDTaskbar | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "UseOLEDTaskbarTransparency" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\Dwm" -Name "ForceEffectMode" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name "EnableTransparency" -Value 1 -Type DWord + } + + $RegistryData.EnableLaunchToThisPC | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowSyncProviderNotifications" -Value 0 -Type DWord + If ($InstallInfo.Build -ge '22500'){ + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowCloudFilesInQuickAccess" -Value 0 -Type DWord + } + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowRecent" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowFrequent" -Value 0 -Type DWord + + $RegistryData.DisableJPEGQualityReduction | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Control Panel\Desktop" -Name "JPEGImportQuality" -Value 90 -Type DWord + + If ($InstallInfo.Build -ge '18362' -and $InstallInfo.Build -le '19044') + { + $RegistryData.DisableAcrylicBlur | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\System" -Name "DisableAcrylicBackgroundOnLogon" -Value 1 -Type DWord + } + + $RegistryData.DisableShortcutText | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "link" -Value (0, 0, 0, 0) -Type Binary + + $RegistryData.EnableCMDWinXMenu | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "DontUsePowerShellOnWinX" -Value 1 -Type DWord + + If (!$DynamicParams.LTSC -and !$DynamicParams.MicrosoftEdge -and !$DynamicParams.MicrosoftEdgeChromium -and $InstallInfo.Build -le '19044') + { + $RegistryData.DisableEdgeShortcutPrelaunch | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "DisableEdgeDesktopShortcutCreation" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\MicrosoftEdge\Main" -Name "AllowPrelaunch" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\MicrosoftEdge\Main" -Name "AllowPrelaunch" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Policies\Microsoft\MicrosoftEdge\Main" -Name "AllowPrelaunch" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\MicrosoftEdge\TabPreloader" -Name "PreventTabPreloading" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\MicrosoftEdge\TabPreloader" -Name "PreventTabPreloading" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Policies\Microsoft\MicrosoftEdge\TabPreloader" -Name "PreventTabPreloading" -Value 1 -Type DWord + } + + If ((($InstallInfo.Build -eq '19041' -and (Get-ItemPropertyValue -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name UBR -ErrorAction Ignore) -ge 1023) -or $InstallInfo.Build -gt '19041') -and !$DynamicParams.MicrosoftEdgeChromium) + { + + $RegistryData.EnableCombineSmallIcons | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarGlomLevel" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarSmallIcons" -Value 1 -Type DWord + + $RegistryData.EnableClassicPersonalizationPanel | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "(default)" -Value "Personalization (Classic)" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "InfoTip" -Value '@%SystemRoot%\\System32\\themecpl.dll,-2#immutable1' -Type ExpandString + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "System.ApplicationName" -Value "Microsoft.Personalization" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "System.ControlPanel.Category" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "System.Software.TasksFileUrl" -Value "Internal" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}\DefaultIcon" -Name "(default)" -Value "%SystemRoot%\\System32\\themecpl.dll,-1" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}\shell\Open\Command" -Name "(default)" -Value "explorer.exe shell:::{ED834ED6-4B5A-4bfe-8F11-A626DCB6A921}" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "(default)" -Value "Personalization" -Type String + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" -Name "StartupPage" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" -Name "AllItemsIconView" -Value 1 -Type DWord + } + + $RegistryData.ReduceStartMenuDelay | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Control Panel\Desktop" -Name "MenuShowDelay" -Value 50 -Type String + + + $RegistryData.DisableOpenFilePrompt | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "NoUseStoreOpenWith" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "NoNewAppAlert" -Value 1 -Type DWord + + + If ($InstallInfo.Build -ge '17763' -and $InstallInfo.Build -lt '19041') + { + $RegistryData.EnableFloatingImmersiveControlPanel | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Search" -Name "ImmersiveSearch" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Search\Flighting\Override" -Name "CenterScreenRoundedCornerRadius" -Value 9 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Search\Flighting\Override" -Name "ImmersiveSearchFull" -Value 1 -Type DWord + } + + If ($InstallInfo.Build -eq '19041' -and (Get-ItemPropertyValue -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name UBR -ErrorAction Ignore) -ge 423) + { + $RegistryData.EnableNewStartMenu | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\0\2093230218" -Name EnabledState -Value 2 -Type DWord -Force + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Control\FeatureManagement\Overrides\0\2093230218" -Name EnabledStateOptions -Value 0 -Type DWord -Force + } + + $RegistryData.EnableThisPCDesktop | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -Value 0 -Type DWord + + $RegistryData.RemoveEditPaintPrintContextMenu | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + @('.3mf', '.bmp', '.fbx', '.gif', '.jfif', '.jpe', '.jpeg', '.jpg', '.png', '.tif', '.tiff') | ForEach-Object -Process { Purge -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\SystemFileAssociations\$($PSItem)\shell\3D Edit" } + @('.3ds', '.3mf', '.dae', '.dxf', '.obj', '.ply', '.stl', '.wrl') | ForEach-Object -Process { Purge -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\SystemFileAssociations\$($PSItem)\shell\3D Print" } + + $RegistryData.RestoreWindowsPhotoViewer | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + @('.Bmp', '.Cr2', '.Dib', '.Gif', '.JFIF', '.Jpe', '.Jpeg', '.Jpg', '.Jxr', '.Png', '.Tif', '.Tiff', '.Wdp') | ForEach-Object -Process { + If ($PSItem -in @('.JFIF', '.Jpeg', '.Gif', '.Png', '.Wdp')) + { + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\PhotoViewer.FileAssoc$($PSItem)" -Name "EditFlags" -Value 65536 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\PhotoViewer.FileAssoc$($PSItem)" -Name "ImageOptionFlags" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\PhotoViewer.FileAssoc$($PSItem)" -Name "FriendlyTypeName" -Value '@%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll,-3055' -Type ExpandString + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\PhotoViewer.FileAssoc$($PSItem)\DefaultIcon" -Name "(default)" -Value "%SystemRoot%\System32\imageres.dll,-72" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\PhotoViewer.FileAssoc$($PSItem)\shell\open" -Name "MuiVerb" -Value '@%ProgramFiles%\Windows Photo Viewer\photoviewer.dll,-3043' -Type ExpandString + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\PhotoViewer.FileAssoc$($PSItem)\shell\open\command" -Name "(default)" -Value '%SystemRoot%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1' -Type ExpandString + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\PhotoViewer.FileAssoc$($PSItem)\shell\open\DropTarget" -Name "Clsid" -Value "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" -Type String + } + If ($PSItem -in @('.Cr2', '.Tif')) { RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" -Name $PSItem.ToLower() -Value "PhotoViewer.FileAssoc.Tiff" -Type String } + ElseIf ($PSItem -in @('.Dib', '.Bmp')) { RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" -Name $PSItem.ToLower() -Value "PhotoViewer.FileAssoc.Bitmap" -Type String } + ElseIf ($PSItem -in @('.Jpg', '.Jpe', '.Jpeg')) { RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" -Name $PSItem.ToLower() -Value "PhotoViewer.FileAssoc.Jpeg" -Type String } + Else { RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" -Name $PSItem.ToLower() -Value "PhotoViewer.FileAssoc$($PSItem)" -Type String } + } + + $RegistryData.RemoveUserFoldersExplorer | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + @("HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}", "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}", + "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}", "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}", + "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}", "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{D3162B92-9365-467A-956B-92703ACA08AF}", + "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}", "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{D3162B92-9365-467A-956B-92703ACA08AF}", + "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}", "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088E3905-0323-4B02-9826-5D99428E115F}", + "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}", "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088E3905-0323-4B02-9826-5D99428E115F}", + "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}", "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3DFDF296-DBEC-4FB4-81D1-6A3438BCF4DE}", + "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}", "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3DFDF296-DBEC-4FB4-81D1-6A3438BCF4DE}", + "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}", "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24AD3AD4-A569-4530-98E1-AB02F9417AA8}", + "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}", "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24AD3AD4-A569-4530-98E1-AB02F9417AA8}", + "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}", "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{F86FA3AB-70D2-4FC7-9C99-FCBF05467F3A}", + "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}", "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{F86FA3AB-70D2-4FC7-9C99-FCBF05467F3A}") | Purge + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Name "ThisPCPolicy" -Value "Hide" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Name "ThisPCPolicy" -Value "Hide" -Type String + + $RegistryData.IncreaseIconCache | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "Max Cached Icons" -Value 8192 -Type String + + $RegistryData.DisableStickyKeysPrompt | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Control Panel\Accessibility\StickyKeys" -Name "Flags" -Value 506 -Type String + + $RegistryData.DisableEnhancedPointerPrecision | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Control Panel\Mouse" -Name "MouseSpeed" -Value 0 -Type String + RegKey -Path "HKLM:\WIM_HKCU\Control Panel\Mouse" -Name "MouseThreshold1" -Value 0 -Type String + RegKey -Path "HKLM:\WIM_HKCU\Control Panel\Mouse" -Name "MouseThreshold2" -Value 0 -Type String + + $RegistryData.RemoveAccessShareCastContextMenu | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + @("HKLM:\WIM_HKLM_SOFTWARE\Classes\*\shellex\ContextMenuHandlers\Sharing", "HKLM:\WIM_HKLM_SOFTWARE\Classes\Directory\Background\shellex\ContextMenuHandlers\Sharing", + "HKLM:\WIM_HKLM_SOFTWARE\Classes\Directory\shellex\ContextMenuHandlers\Sharing", "HKLM:\WIM_HKLM_SOFTWARE\Classes\Directory\shellex\CopyHookHandlers\Sharing", + "HKLM:\WIM_HKLM_SOFTWARE\Classes\Directory\shellex\PropertySheetHandlers\Sharing", "HKLM:\WIM_HKLM_SOFTWARE\Classes\Drive\shellex\ContextMenuHandlers\Sharing", + "HKLM:\WIM_HKLM_SOFTWARE\Classes\Drive\shellex\PropertySheetHandlers\Sharing", "HKLM:\WIM_HKLM_SOFTWARE\Classes\LibraryFolder\background\shellex\ContextMenuHandlers\Sharing", + "HKLM:\WIM_HKLM_SOFTWARE\Classes\UserLibraryFolder\shellex\ContextMenuHandlers\Sharing", "HKLM:\WIM_HKLM_SOFTWARE\Classes\*\shellex\ContextMenuHandlers\ModernSharing") | Purge + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{7AD84985-87B4-4a16-BE58-8B72A5B390F7}" -Value "Play to Menu" -Type String + + $RegistryData.RemoveRestorePreviousVersions | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + @("HKLM:\WIM_HKLM_SOFTWARE\Classes\AllFilesystemObjects\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}", "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}", + "HKLM:\WIM_HKLM_SOFTWARE\Classes\Directory\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}", "HKLM:\WIM_HKLM_SOFTWARE\Classes\Drive\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}", + "HKLM:\WIM_HKLM_SOFTWARE\Classes\AllFilesystemObjects\shellex\PropertySheetHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}", "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shellex\PropertySheetHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}", + "HKLM:\WIM_HKLM_SOFTWARE\Classes\Directory\shellex\PropertySheetHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}", "HKLM:\WIM_HKLM_SOFTWARE\Classes\Drive\shellex\PropertySheetHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}") | Purge + + <# $RegistryData.EnableRebootRecoveryMyPC | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Reboot to Recovery" -Name "Icon" -Value "%SystemRoot%\System32\imageres.dll,-110" -Type String -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Reboot to Recovery\command" -Name "(default)" -Value "shutdown.exe /r /o /f /t 00" -Type String -Force #> + + $RegistryData.EnableLongFilePaths | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -Type DWord + + $RegistryData.EnableStrongCrypto | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\.NETFramework\v4.0.30319" -Name "SchUseStrongCrypto" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319" -Name "SchUseStrongCrypto" -Value 1 -Type DWord + + } + Catch + { + Log $OptimizeData.FailedApplyingRegistrySettings -Type Error -ErrorRecord $Error[0] + } + Finally + { + RegHives -Unload + } +} \ No newline at end of file diff --git a/Src/Offline-Resources.psm1 b/Src/Offline-Resources.psm1 index 3cee6c8..3d56a7d 100644 --- a/Src/Offline-Resources.psm1 +++ b/Src/Offline-Resources.psm1 @@ -3,11 +3,11 @@ #Requires -Version 5.1 <# =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2021 v5.8.191 + Created with: SAPIEN Technologies, Inc., PowerShell Studio 2021 v5.8.192 Created on: 11/20/2019 11:53 AM Created by: BenTheGreat Filename: Offline-Resources.psm1 - Last updated: 06/22/2021 + Last updated: 08/04/2021 ------------------------------------------------------------------------- Module Name: Offline-Resources =========================================================================== @@ -49,7 +49,6 @@ $OptimizeOffline.Packages = (Resolve-FullPath -Path $OptimizeOffline.Directory - $OptimizeOffline.LocalizedDataStrings = (Resolve-FullPath -Path $OptimizeOffline.LocalizedData -Child Optimize-Offline.strings.psd1) $OptimizeOffline.ConfigurationJSON = (Resolve-FullPath -Path $OptimizeOffline.Directory -Child Configuration.json) $OptimizeOffline.ManifestDataFile = (Resolve-FullPath -Path $OptimizeOffline.Directory -Child Optimize-Offline.psd1) -$OptimizeOffline.AppxWhitelist = (Resolve-FullPath -Path $OptimizeOffline.Content -Child AppxWhitelist.json) $OptimizeOffline.CustomAppAssociations = (Resolve-FullPath -Path $OptimizeOffline.Content -Child CustomAppAssociations.xml) $OptimizeOffline.DevMode = (Resolve-FullPath -Path $OptimizeOffline.Packages -Child DeveloperMode) $OptimizeOffline.WindowsStore = (Resolve-FullPath -Path $OptimizeOffline.Packages -Child WindowsStore) @@ -68,8 +67,55 @@ $OptimizeOffline.Drivers = (Resolve-FullPath -Path $OptimizeOffline.Additional - $OptimizeOffline.InstallDrivers = (Resolve-FullPath -Path $OptimizeOffline.Drivers -Child Install) $OptimizeOffline.BootDrivers = (Resolve-FullPath -Path $OptimizeOffline.Drivers -Child Boot) $OptimizeOffline.RecoveryDrivers = (Resolve-FullPath -Path $OptimizeOffline.Drivers -Child Recovery) +$OptimizeOffline.SelectiveRegistry = (Resolve-FullPath -Path $OptimizeOffline.Additional -Child SelectiveRegistry) #endregion Module Path Declarations + +#region List paths +$OptimizeOffline.Lists = @{} +$OptimizeOffline.Lists.Path = (Resolve-FullPath -Path $OptimizeOffline.Content -Child Lists) + +$OptimizeOffline.Lists.WindowsApps = @{} +$OptimizeOffline.Lists.WindowsApps.Path = (Resolve-FullPath -Path $OptimizeOffline.Lists.Path -Child WindowsApps) +$OptimizeOffline.Lists.WindowsApps.Whitelist = (Resolve-FullPath -Path $OptimizeOffline.Lists.WindowsApps.Path -Child WindowsAppsWhitelist.json) +$OptimizeOffline.Lists.WindowsApps.Blacklist = (Resolve-FullPath -Path $OptimizeOffline.Lists.WindowsApps.Path -Child WindowsAppsBlacklist.json) +$OptimizeOffline.Lists.WindowsApps.Template = (Resolve-FullPath -Path $OptimizeOffline.Lists.WindowsApps.Path -Child WindowsAppsTemplate.json) + +$OptimizeOffline.Lists.SystemApps = @{} +$OptimizeOffline.Lists.SystemApps.Path = (Resolve-FullPath -Path $OptimizeOffline.Lists.Path -Child SystemApps) +$OptimizeOffline.Lists.SystemApps.Whitelist = (Resolve-FullPath -Path $OptimizeOffline.Lists.SystemApps.Path -Child SystemAppsWhitelist.json) +$OptimizeOffline.Lists.SystemApps.Blacklist = (Resolve-FullPath -Path $OptimizeOffline.Lists.SystemApps.Path -Child SystemAppsBlacklist.json) +$OptimizeOffline.Lists.SystemApps.Template = (Resolve-FullPath -Path $OptimizeOffline.Lists.SystemApps.Path -Child SystemAppsTemplate.json) + +$OptimizeOffline.Lists.Capabilities = @{} +$OptimizeOffline.Lists.Capabilities.Path = (Resolve-FullPath -Path $OptimizeOffline.Lists.Path -Child Capabilities) +$OptimizeOffline.Lists.Capabilities.Whitelist = (Resolve-FullPath -Path $OptimizeOffline.Lists.Capabilities.Path -Child CapabilitiesWhitelist.json) +$OptimizeOffline.Lists.Capabilities.Blacklist = (Resolve-FullPath -Path $OptimizeOffline.Lists.Capabilities.Path -Child CapabilitiesBlacklist.json) +$OptimizeOffline.Lists.Capabilities.Template = (Resolve-FullPath -Path $OptimizeOffline.Lists.Capabilities.Path -Child CapabilitiesTemplate.json) + +$OptimizeOffline.Lists.Packages = @{} +$OptimizeOffline.Lists.Packages.Path = (Resolve-FullPath -Path $OptimizeOffline.Lists.Path -Child Packages) +$OptimizeOffline.Lists.Packages.Whitelist = (Resolve-FullPath -Path $OptimizeOffline.Lists.Packages.Path -Child PackagesWhitelist.json) +$OptimizeOffline.Lists.Packages.Blacklist = (Resolve-FullPath -Path $OptimizeOffline.Lists.Packages.Path -Child PackagesBlacklist.json) +$OptimizeOffline.Lists.Packages.Template = (Resolve-FullPath -Path $OptimizeOffline.Lists.Packages.Path -Child PackagesTemplate.json) + +$OptimizeOffline.Lists.FeaturesToEnable = @{} +$OptimizeOffline.Lists.FeaturesToEnable.Path = (Resolve-FullPath -Path $OptimizeOffline.Lists.Path -Child FeaturesToEnable) +$OptimizeOffline.Lists.FeaturesToEnable.List = (Resolve-FullPath -Path $OptimizeOffline.Lists.FeaturesToEnable.Path -Child FeaturesToEnableList.json) +$OptimizeOffline.Lists.FeaturesToEnable.Template = (Resolve-FullPath -Path $OptimizeOffline.Lists.FeaturesToEnable.Path -Child FeaturesToEnableTemplate.json) + +$OptimizeOffline.Lists.FeaturesToDisable = @{} +$OptimizeOffline.Lists.FeaturesToDisable.Path = (Resolve-FullPath -Path $OptimizeOffline.Lists.Path -Child FeaturesToDisable) +$OptimizeOffline.Lists.FeaturesToDisable.List = (Resolve-FullPath -Path $OptimizeOffline.Lists.FeaturesToDisable.Path -Child FeaturesToDisableList.json) +$OptimizeOffline.Lists.FeaturesToDisable.Template = (Resolve-FullPath -Path $OptimizeOffline.Lists.FeaturesToDisable.Path -Child FeaturesToDisableTemplate.json) + +$OptimizeOffline.Lists.Services = @{} +$OptimizeOffline.Lists.Services.Path = (Resolve-FullPath -Path $OptimizeOffline.Lists.Path -Child Services) +$OptimizeOffline.Lists.Services.List = (Resolve-FullPath -Path $OptimizeOffline.Lists.Services.Path -Child ServicesList.json) +$OptimizeOffline.Lists.Services.Advanced = (Resolve-FullPath -Path $OptimizeOffline.Lists.Services.Path -Child ServicesAdvanced.json) +$OptimizeOffline.Lists.Services.Template = (Resolve-FullPath -Path $OptimizeOffline.Lists.Services.Path -Child ServicesTemplate.json) +#endregion List paths + #region Data Declarations Try { $ManifestData = Import-PowerShellDataFile -Path $OptimizeOffline.ManifestDataFile -ErrorAction Stop } Catch { Write-Warning ('Failed to import the manifest data file: "{0}"' -f (Resolve-FullPath -Path $OptimizeOffline.ManifestDataFile -Split Leaf)); Break } @@ -78,6 +124,16 @@ Try { Import-LocalizedData -BaseDirectory $OptimizeOffline.Directory -FileName O Catch { Write-Warning ('Failed to import the localized data file: "{0}"' -f (Resolve-FullPath -Path $OptimizeOffline.LocalizedDataStrings -Split Leaf)); Break } #endregion Data Declarations +#region translations +$OptimizeOffline.ServicesStartLabels = @{ + 0 = $OptimizeData.ServiceStartBoot + 1 = $OptimizeData.ServiceStartSystem + 2 = $OptimizeData.ServiceStartAutomatic + 3 = $OptimizeData.ServiceStartManual + 4 = $OptimizeData.ServiceStartDisabled +} +#endregion translations + #region Variable Declarations $LocalScope = [PSCustomObject]::New() $OptimizeOfflineParams = [PSCustomObject]::New() @@ -97,10 +153,17 @@ $ErrorLog = (Resolve-FullPath -Path $LogFolder -Child OptimizeErrors.log) $RegistryLog = (Resolve-FullPath -Path $LogFolder -Child RegistrySettings.log) $DISMLog = (Resolve-FullPath -Path $LogFolder -Child DISM.log) $DISM = If (Get-DeploymentTool) { Resolve-FullPath -Path $(Get-DeploymentTool) -Child dism.exe } Else { Resolve-FullPath -Path $Env:SystemRoot -Child 'System32\dism.exe' } -$OSCDIMG = If (Get-DeploymentTool -OSCDIMG) { Resolve-FullPath -Path $(Get-DeploymentTool -OSCDIMG) -Child oscdimg.exe } Else { $null } +$OSCDIMG = If (Get-DeploymentTool -OSCDIMG) { + Resolve-FullPath -Path $(Get-DeploymentTool -OSCDIMG) -Child oscdimg.exe +} Elseif (Test-Path -Path $(Resolve-FullPath -Path $OptimizeOffline.Directory -Child oscdimg.exe)) { + Resolve-FullPath -Path $OptimizeOffline.Directory -Child oscdimg.exe +} Else { + $null +} $REG = (Resolve-FullPath -Path $Env:SystemRoot -Child 'System32\reg.exe') $REGEDIT = (Resolve-FullPath -Path $Env:SystemRoot -Child regedit.exe) $EXPAND = (Resolve-FullPath -Path $Env:SystemRoot -Child 'System32\expand.exe') +$AllowedRemovalOptions = @('All', 'Select', 'List', 'Whitelist', 'BlackList', 'Advanced') #endregion Variable Declarations #region Resource Alias Creation @@ -115,7 +178,7 @@ New-Alias -Name GetPath -Value Resolve-FullPath $ExportResourceParams = @{ Function = $PublicFunctions.Basename - Variable = 'OptimizeOffline', 'ManifestData', 'OptimizeData', 'LocalScope', 'OptimizeParams', 'DynamicParams', 'ConfigParams', 'OptimizeErrors', 'TempDirectory', 'LogFolder', 'WorkFolder', 'ScratchFolder', 'ImageFolder', 'InstallMount', 'BootMount', 'RecoveryMount', 'ModuleLog', 'ErrorLog', 'RegistryLog', 'DISMLog', 'DISM', 'OSCDIMG', 'REG', 'REGEDIT', 'EXPAND' + Variable = 'OptimizeOffline', 'ManifestData', 'OptimizeData', 'LocalScope', 'OptimizeParams', 'DynamicParams', 'ConfigParams', 'OptimizeErrors', 'TempDirectory', 'LogFolder', 'WorkFolder', 'ScratchFolder', 'ImageFolder', 'InstallMount', 'BootMount', 'RecoveryMount', 'ModuleLog', 'ErrorLog', 'RegistryLog', 'DISMLog', 'DISM', 'OSCDIMG', 'REG', 'REGEDIT', 'EXPAND', 'AllowedRemovalOptions' Alias = '*' } Export-ModuleMember @ExportResourceParams diff --git a/Src/Public/DIR2ISO.ps1 b/Src/Public/DIR2ISO.ps1 new file mode 100644 index 0000000..226f33c --- /dev/null +++ b/Src/Public/DIR2ISO.ps1 @@ -0,0 +1,55 @@ +function :DIR2ISO ($dir, $iso, $prompt = $true, $VolumeName = 'DVD_ROM') { + if (!(test-path -Path $dir -pathtype Container)) { + return $false + } + $dir2iso = @" +using System; using System.IO; using System.Runtime.Interop`Services; using System.Runtime.Interop`Services.ComTypes; +public class dir2iso {public int AveYo=2021; [Dll`Import("shlwapi",CharSet=CharSet.Unicode,PreserveSig=false)] +internal static extern void SHCreateStreamOnFileEx(string f,uint m,uint d,bool b,IStream r,out IStream s); +public static void Create(string file, ref object obj, int bs, int tb) { IStream dir=(IStream)obj, iso; +try {SHCreateStreamOnFileEx(file,0x1001,0x80,true,null,out iso);} catch(Exception e) {Console.WriteLine(e.Message); return;} +int d=tb>1024 ? 1024 : 1, pad=tb%d, block=bs*d, total=(tb-pad)/d, c=total>100 ? total/100 : total, i=1, MB=(bs/1024)*tb/1024; +Console.Write("{0,3}% {1}MB {2} :DIR2ISO",0,MB,file); if (pad > 0) dir.CopyTo(iso, pad * block, Int`Ptr.Zero, Int`Ptr.Zero); +while (total-- > 0) {dir.CopyTo(iso, block, Int`Ptr.Zero, Int`Ptr.Zero); if (total % c == 0) {Console.Write("\r{0,3}%",i++);}} +iso.Commit(0); Console.WriteLine("\r{0,3}% {1}MB {2} :DIR2ISO", 100, MB, file); } } +"@; & { + $cs = new-object CodeDom.Compiler.CompilerParameters + $cs.GenerateInMemory = 1 #,# no`warnings + $compile = (new-object Microsoft.CSharp.CSharpCodeProvider).CompileAssemblyFromSource($cs, $dir2iso) + $BOOT = @() + $bootable = 0 + $mbr_efi = @(0, 0xEF) + $images = @('boot\etfsboot.com', "efi\microsoft\boot\efisys$(If (-not $prompt) {"_noprompt"}).bin") + + 0, 1 | % { + $bootimage = join-path $dir -child $images[$_] + if (test-path -Path $bootimage -pathtype Leaf) { + $bin = new-object -ComObject ADODB.Stream + $bin.Open() + $bin.Type = 1 + $bin.LoadFromFile($bootimage) + $opt = new-object -ComObject IMAPI2FS.BootOptions + $opt.AssignBootImage($bin.psobject.BaseObject) + $opt.Manufacturer = 'Microsoft' + $opt.PlatformId = $mbr_efi[$_] + $opt.Emulation = 0 + $bootable = 1 + $BOOT += $opt.psobject.BaseObject + } + } + + $fsi = new-object -ComObject IMAPI2FS.MsftFileSystemImage + $fsi.FileSystemsToCreate = 4 + $fsi.FreeMediaBlocks = 0 + if ($bootable) { + $fsi.BootImageOptionsArray = $BOOT + } + $CONTENT = $fsi.Root + $CONTENT.AddTree($dir, $false) + $fsi.VolumeName = $VolumeName + $obj = $fsi.CreateResultImage() + [dir2iso]::Create($iso, [ref]$obj.ImageStream, $obj.BlockSize, $obj.TotalBlocks) + } + [GC]::Collect() + return $true +} $:DIR2ISO: #,# export directory as (bootable) udf iso - lean and mean snippet by AveYo, 2021 \ No newline at end of file diff --git a/Src/Public/Get-AppxPackages.ps1 b/Src/Public/Get-AppxPackages.ps1 new file mode 100644 index 0000000..ae57230 --- /dev/null +++ b/Src/Public/Get-AppxPackages.ps1 @@ -0,0 +1,38 @@ +Function Get-AppxPackages { + + [CmdletBinding()] + + Param ( + [Parameter(Mandatory = $true, + HelpMessage = 'full path to the root directory of the offline Windows image that you will service.')] + [String]$Path, + [Parameter(Mandatory = $false, + HelpMessage = 'Specifies a temporary directory that will be used when extracting files for use during servicing. The directory must exist locally. If not specified, the \Windows\%Temp% directory will be used')] + [String]$ScratchDirectory, + [Parameter(Mandatory = $false, + HelpMessage = 'the full path and file name to log to. If not set, the default is %WINDIR%\Logs\Dism\dism.log')] + [String]$LogPath, + [Parameter( + Mandatory = $true, + HelpMessage = 'Windows offline image build number' + )] + [Int]$Build + ) + + If($Global:InstallInfo.InstallationType.ToLower().Contains('server core')) { + return @{} + } + + $AppxPackages = Get-AppxProvisionedPackage -Path $Path -ScratchDirectory $ScratchDirectory -LogPath $LogPath -LogLevel 1 | Select-Object -Property DisplayName, PackageName | Sort-Object -Property DisplayName + + If ($Build -ge '19041') + { + $AppxPackages = $AppxPackages | ForEach-Object -Process { + $DisplayName = $PSItem.DisplayName; $PackageName = $PSItem.PackageName + If ($DisplayName -eq 'Microsoft.549981C3F5F10') { $DisplayName = 'CortanaApp.View.App' } + [PSCustomObject]@{ DisplayName = $DisplayName; PackageName = $PackageName } + } + } + + return $AppxPackages +} \ No newline at end of file diff --git a/Src/Public/Get-CapabilityPackages.ps1 b/Src/Public/Get-CapabilityPackages.ps1 new file mode 100644 index 0000000..df240af --- /dev/null +++ b/Src/Public/Get-CapabilityPackages.ps1 @@ -0,0 +1,21 @@ +Function Get-CapabilityPackages { + + [CmdletBinding()] + + Param ( + [Parameter(Mandatory = $true, + HelpMessage = 'full path to the root directory of the offline Windows image that you will service.')] + [String]$Path, + [Parameter(Mandatory = $false, + HelpMessage = 'Specifies a temporary directory that will be used when extracting files for use during servicing. The directory must exist locally. If not specified, the \Windows\%Temp% directory will be used')] + [String]$ScratchDirectory, + [Parameter(Mandatory = $false, + HelpMessage = 'the full path and file name to log to. If not set, the default is %WINDIR%\Logs\Dism\dism.log')] + [String]$LogPath + ) + + $WindowsCapabilities = Get-WindowsCapability -Path $Path -ScratchDirectory $ScratchDirectory -LogPath $LogPath -LogLevel 1 | Where-Object { $PSItem.Name -notlike "*Language.Basic*" -and $PSItem.Name -notlike "*TextToSpeech*" -and $PSItem.State -eq 'Installed' } | Select-Object -Property Name, State | Sort-Object -Property Name + + return $WindowsCapabilities + +} \ No newline at end of file diff --git a/Src/Public/Get-ImageData.ps1 b/Src/Public/Get-ImageData.ps1 index 2dbf5bc..04cb63c 100644 --- a/Src/Public/Get-ImageData.ps1 +++ b/Src/Public/Get-ImageData.ps1 @@ -69,6 +69,12 @@ Function Get-ImageData $ImageData.Build = $CurrentVersion.CurrentBuildNumber If ($CurrentVersion.DisplayVersion -eq '21H1') { $ImageData.CodeName = $CurrentVersion.DisplayVersion } } + ElseIf ($ImageData.Build -eq '19041' -and $CurrentVersion.CurrentBuildNumber -eq '19044') + { + $ImageData.Version = $ImageData.Version.Replace($ImageData.Build, $CurrentVersion.CurrentBuildNumber) + $ImageData.Build = $CurrentVersion.CurrentBuildNumber + If ($CurrentVersion.DisplayVersion -eq '21H2') { $ImageData.CodeName = $CurrentVersion.DisplayVersion } + } Else { If ($ImageData.Build -eq '19041') { $ImageData.CodeName = '20H1' } diff --git a/Src/Public/Get-OfflineHives.ps1 b/Src/Public/Get-OfflineHives.ps1 index 04ccca9..4c90dfe 100644 --- a/Src/Public/Get-OfflineHives.ps1 +++ b/Src/Public/Get-OfflineHives.ps1 @@ -13,6 +13,10 @@ Function Get-OfflineHives { $Hive = [Ordered]@{ SOFTWARE = (GetPath -Path $InstallMount -Child 'Windows\System32\Config\SOFTWARE'); SYSTEM = (GetPath -Path $InstallMount -Child 'Windows\System32\Config\SYSTEM'); DEFAULT = (GetPath -Path $InstallMount -Child 'Windows\System32\Config\DEFAULT'); NTUSER = (GetPath -Path $InstallMount -Child 'Users\Default\NTUSER.DAT') } $HiveMountPoint = [Ordered]@{ SOFTWARE = 'WIM_HKLM_SOFTWARE'; SYSTEM = 'WIM_HKLM_SYSTEM'; DEFAULT = 'WIM_HKU_DEFAULT'; NTUSER = 'WIM_HKCU' } + if(Test-Path -Path $BootMount) { + $Hive.SYSTEM_BOOT = (GetPath -Path $BootMount -Child 'Windows\System32\Config\SYSTEM') + $HiveMountPoint.SYSTEM_BOOT = 'BOOT_HKLM_SYSTEM' + } $HKLM = 0x80000002 'SeBackupPrivilege', 'SeRestorePrivilege' | Grant-Privilege } @@ -30,6 +34,9 @@ Function Get-OfflineHives [Void]$RegLoad::RegLoadKey($HKLM, $HiveMountPoint.SYSTEM, $Hive.SYSTEM) [Void]$RegLoad::RegLoadKey($HKLM, $HiveMountPoint.DEFAULT, $Hive.DEFAULT) [Void]$RegLoad::RegLoadKey($HKLM, $HiveMountPoint.NTUSER, $Hive.NTUSER) + if($Hive.SYSTEM_BOOT -and $HiveMountPoint.SYSTEM_BOOT){ + [Void]$RegLoad::RegLoadKey($HKLM, $HiveMountPoint.SYSTEM_BOOT, $Hive.SYSTEM_BOOT) + } } Break } diff --git a/Src/Public/Get-OptionalDisabledFeatures.ps1 b/Src/Public/Get-OptionalDisabledFeatures.ps1 new file mode 100644 index 0000000..19faf96 --- /dev/null +++ b/Src/Public/Get-OptionalDisabledFeatures.ps1 @@ -0,0 +1,18 @@ +Function Get-OptionalDisabledFeatures { + + [CmdletBinding()] + + Param ( + [Parameter(Mandatory = $true, + HelpMessage = 'full path to the root directory of the offline Windows image that you will service.')] + [String]$Path, + [Parameter(Mandatory = $false, + HelpMessage = 'Specifies a temporary directory that will be used when extracting files for use during servicing. The directory must exist locally. If not specified, the \Windows\%Temp% directory will be used')] + [String]$ScratchDirectory, + [Parameter(Mandatory = $false, + HelpMessage = 'the full path and file name to log to. If not set, the default is %WINDIR%\Logs\Dism\dism.log')] + [String]$LogPath + ) + + return Get-WindowsOptionalFeature -Path $Path -ScratchDirectory $ScratchDirectory -LogPath $LogPath -LogLevel 1 | Select-Object -Property FeatureName, State | Sort-Object -Property FeatureName | Where-Object { $PSItem.FeatureName -notlike "SMB1Protocol*" -and $PSItem.FeatureName -ne "Windows-Defender-Default-Definitions" -and $PSItem.FeatureName -notlike "MicrosoftWindowsPowerShellV2*" -and $PSItem.State -eq "Disabled" } +} \ No newline at end of file diff --git a/Src/Public/Get-OptionalEnabledFeatures.ps1 b/Src/Public/Get-OptionalEnabledFeatures.ps1 new file mode 100644 index 0000000..aa8f675 --- /dev/null +++ b/Src/Public/Get-OptionalEnabledFeatures.ps1 @@ -0,0 +1,18 @@ +Function Get-OptionalEnabledFeatures { + + [CmdletBinding()] + + Param ( + [Parameter(Mandatory = $true, + HelpMessage = 'full path to the root directory of the offline Windows image that you will service.')] + [String]$Path, + [Parameter(Mandatory = $false, + HelpMessage = 'Specifies a temporary directory that will be used when extracting files for use during servicing. The directory must exist locally. If not specified, the \Windows\%Temp% directory will be used')] + [String]$ScratchDirectory, + [Parameter(Mandatory = $false, + HelpMessage = 'the full path and file name to log to. If not set, the default is %WINDIR%\Logs\Dism\dism.log')] + [String]$LogPath + ) + + return Get-WindowsOptionalFeature -Path $Path -ScratchDirectory $ScratchDirectory -LogPath $LogPath -LogLevel 1 | Select-Object -Property FeatureName, State | Sort-Object -Property FeatureName | Where-Object -Property State -EQ Enabled +} \ No newline at end of file diff --git a/Src/Public/Get-OtherWindowsPackages.ps1 b/Src/Public/Get-OtherWindowsPackages.ps1 new file mode 100644 index 0000000..18076e7 --- /dev/null +++ b/Src/Public/Get-OtherWindowsPackages.ps1 @@ -0,0 +1,19 @@ +Function Get-OtherWindowsPackages { + + [CmdletBinding()] + + Param ( + [Parameter(Mandatory = $true, + HelpMessage = 'full path to the root directory of the offline Windows image that you will service.')] + [String]$Path, + [Parameter(Mandatory = $false, + HelpMessage = 'Specifies a temporary directory that will be used when extracting files for use during servicing. The directory must exist locally. If not specified, the \Windows\%Temp% directory will be used')] + [String]$ScratchDirectory, + [Parameter(Mandatory = $false, + HelpMessage = 'the full path and file name to log to. If not set, the default is %WINDIR%\Logs\Dism\dism.log')] + [String]$LogPath + ) + + + return Get-WindowsPackage -Path $Path -ScratchDirectory $ScratchDirectory -LogPath $LogPath -LogLevel 1 | Where-Object { $PSItem.ReleaseType -eq 'OnDemandPack' -or $PSItem.ReleaseType -eq 'LanguagePack' -or $PSItem.ReleaseType -eq 'FeaturePack' -and $PSItem.PackageName -notlike "*20H2Enablement*" -and $PSItem.PackageName -notlike "*LanguageFeatures-Basic*" -and $PSItem.PackageName -notlike "*LanguageFeatures-TextToSpeech*" -and $PSItem.PackageState -eq 'Installed' } | Select-Object -Property PackageName, ReleaseType | Sort-Object -Property PackageName +} \ No newline at end of file diff --git a/Src/Public/Get-SystemPackages.ps1 b/Src/Public/Get-SystemPackages.ps1 new file mode 100644 index 0000000..788c571 --- /dev/null +++ b/Src/Public/Get-SystemPackages.ps1 @@ -0,0 +1,32 @@ +Function Get-SystemPackages { + + [CmdletBinding()] + + Param ( + [Parameter(Mandatory = $false)] + [String]$RegKeyPath + ) + + If(-Not $RegKeyPath){ + $RegKeyPath = "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\InboxApplications" + } + + RegHives -Load + + If (!(Test-Path -Path $RegKeyPath)) { + return @() + } + + $InboxAppsPackages = Get-ChildItem -Path $RegKeyPath -Name | ForEach-Object -Process { + $DisplayName = $PSItem.Split('_')[0]; $PackageName = $PSItem + If ($DisplayName -like '1527c705-839a-4832-9118-54d4Bd6a0c89') { $DisplayName = 'Microsoft.Windows.FilePicker' } + If ($DisplayName -like 'c5e2524a-ea46-4f67-841f-6a9465d9d515') { $DisplayName = 'Microsoft.Windows.FileExplorer' } + If ($DisplayName -like 'E2A4F912-2574-4A75-9BB0-0D023378592B') { $DisplayName = 'Microsoft.Windows.AppResolverUX' } + If ($DisplayName -like 'F46D4000-FD22-4DB4-AC8E-4E1DDDE828FE') { $DisplayName = 'Microsoft.Windows.AddSuggestedFoldersToLibarayDialog' } + [PSCustomObject]@{ DisplayName = $DisplayName; PackageName = $PackageName } + } | Sort-Object -Property DisplayName + + RegHives -Unload + + return $InboxAppsPackages +} \ No newline at end of file diff --git a/Src/Public/Import-Registry.ps1 b/Src/Public/Import-Registry.ps1 new file mode 100644 index 0000000..d73a781 --- /dev/null +++ b/Src/Public/Import-Registry.ps1 @@ -0,0 +1,67 @@ +Function Import-Registry +{ + [CmdletBinding()] + Param ( + [String]$Path + ) + + If ((Get-Item $Path) -is [System.IO.DirectoryInfo]){ + Get-ChildItem -Path $Path -Filter *.Offline | Purge + Get-ChildItem -Path $Path -Filter *.reg | ForEach-Object -Process { + $REGContent = Get-Content -Path $PSItem.FullName + $REGContent = $REGContent -replace 'HKEY_CLASSES_ROOT', 'HKEY_LOCAL_MACHINE\WIM_HKLM_SOFTWARE\Classes' + $REGContent = $REGContent -replace 'HKEY_LOCAL_MACHINE\\SOFTWARE', 'HKEY_LOCAL_MACHINE\WIM_HKLM_SOFTWARE' + $REGContent = $REGContent -replace 'HKEY_LOCAL_MACHINE\\SYSTEM', 'HKEY_LOCAL_MACHINE\WIM_HKLM_SYSTEM' + $REGContent = $REGContent -replace 'HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE\WIM_HKCU' + $REGContent = $REGContent -replace 'HKEY_USERS\\.DEFAULT', 'HKEY_LOCAL_MACHINE\WIM_HKU_DEFAULT' + $REGContent = $REGContent -replace 'HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet', 'HKEY_LOCAL_MACHINE\WIM_HKLM_SYSTEM\ControlSet001' + $REGContent | Set-Content -Path $PSItem.FullName.Replace($PSItem.Extension, '.Offline') -Encoding Unicode -Force + } + If (Get-ChildItem -Path $Path -Filter *.Offline) + { + RegHives -Load + Get-ChildItem -Path $Path -Filter *.Offline | ForEach-Object -Process { + Try + { + Log ($OptimizeData.ImportingRegistryTemplate -f $PSItem.Name.Replace($PSItem.Extension, '.reg')) + $RET = StartExe $REGEDIT -Arguments ('/S "{0}"' -f $PSItem.FullName) + If ($RET -ne 0) { Throw } + } + Catch + { + Log ($OptimizeData.FailedImportingRegistryTemplate -f $PSItem.Name.Replace($PSItem.Extension, '.reg')) -Type Error + } + Finally + { + RegHives -Unload; Purge $PSItem.FullName; Start-Sleep 2 + } + } + } + } Else { + $RegFile = Get-Item $Path + $REGContent = Get-Content -Path $RegFile.FullName + $REGContent = $REGContent -replace 'HKEY_CLASSES_ROOT', 'HKEY_LOCAL_MACHINE\WIM_HKLM_SOFTWARE\Classes' + $REGContent = $REGContent -replace 'HKEY_LOCAL_MACHINE\\SOFTWARE', 'HKEY_LOCAL_MACHINE\WIM_HKLM_SOFTWARE' + $REGContent = $REGContent -replace 'HKEY_LOCAL_MACHINE\\SYSTEM', 'HKEY_LOCAL_MACHINE\WIM_HKLM_SYSTEM' + $REGContent = $REGContent -replace 'HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE\WIM_HKCU' + $REGContent = $REGContent -replace 'HKEY_USERS\\.DEFAULT', 'HKEY_LOCAL_MACHINE\WIM_HKU_DEFAULT' + $REGContent = $REGContent -replace 'HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet', 'HKEY_LOCAL_MACHINE\WIM_HKLM_SYSTEM\ControlSet001' + $REGContent | Set-Content -Path $RegFile.FullName.Replace($RegFile.Extension, '.Offline') -Encoding Unicode -Force + RegHives -Load + $ProcessedItem = Get-Item $RegFile.FullName.Replace($RegFile.Extension, '.Offline') + Try + { + Log ($OptimizeData.ImportingRegistryTemplate -f $ProcessedItem.Name.Replace($ProcessedItem.Extension, '.reg')) + $RET = StartExe $REGEDIT -Arguments ('/S "{0}"' -f $ProcessedItem.FullName) + If ($RET -ne 0) { Throw } + } + Catch + { + Log ($OptimizeData.FailedImportingRegistryTemplate -f $ProcessedItem.Name.Replace($ProcessedItem.Extension, '.reg')) -Type Error + } + Finally + { + RegHives -Unload; Purge $ProcessedItem.FullName; Start-Sleep 2 + } + } +} \ No newline at end of file diff --git a/Src/Public/Import-RegistryTemplates.ps1 b/Src/Public/Import-RegistryTemplates.ps1 deleted file mode 100644 index 118f03b..0000000 --- a/Src/Public/Import-RegistryTemplates.ps1 +++ /dev/null @@ -1,37 +0,0 @@ -Function Import-RegistryTemplates -{ - [CmdletBinding()] - Param () - - Get-ChildItem -Path $OptimizeOffline.RegistryTemplates -Filter *.Offline | Purge - Get-ChildItem -Path $OptimizeOffline.RegistryTemplates -Filter *.reg | ForEach-Object -Process { - $REGContent = Get-Content -Path $PSItem.FullName - $REGContent = $REGContent -replace 'HKEY_CLASSES_ROOT', 'HKEY_LOCAL_MACHINE\WIM_HKLM_SOFTWARE\Classes' - $REGContent = $REGContent -replace 'HKEY_LOCAL_MACHINE\\SOFTWARE', 'HKEY_LOCAL_MACHINE\WIM_HKLM_SOFTWARE' - $REGContent = $REGContent -replace 'HKEY_LOCAL_MACHINE\\SYSTEM', 'HKEY_LOCAL_MACHINE\WIM_HKLM_SYSTEM' - $REGContent = $REGContent -replace 'HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE\WIM_HKCU' - $REGContent = $REGContent -replace 'HKEY_USERS\\.DEFAULT', 'HKEY_LOCAL_MACHINE\WIM_HKU_DEFAULT' - $REGContent = $REGContent -replace 'HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet', 'HKEY_LOCAL_MACHINE\WIM_HKLM_SYSTEM\ControlSet001' - $REGContent | Set-Content -Path $PSItem.FullName.Replace($PSItem.Extension, '.Offline') -Encoding Unicode -Force - } - If (Get-ChildItem -Path $OptimizeOffline.RegistryTemplates -Filter *.Offline) - { - RegHives -Load - Get-ChildItem -Path $OptimizeOffline.RegistryTemplates -Filter *.Offline | ForEach-Object -Process { - Try - { - Log ($OptimizeData.ImportingRegistryTemplate -f $PSItem.Name.Replace($PSItem.Extension, '.reg')) - $RET = StartExe $REGEDIT -Arguments ('/S "{0}"' -f $PSItem.FullName) - If ($RET -ne 0) { Throw } - } - Catch - { - Log ($OptimizeData.FailedImportingRegistryTemplate -f $PSItem.Name.Replace($PSItem.Extension, '.reg')) -Type Error - } - Finally - { - RegHives -Unload; Purge $PSItem.FullName; Start-Sleep 2 - } - } - } -} \ No newline at end of file diff --git a/Src/Public/New-ISOMedia.ps1 b/Src/Public/New-ISOMedia.ps1 index e486efe..0476930 100644 --- a/Src/Public/New-ISOMedia.ps1 +++ b/Src/Public/New-ISOMedia.ps1 @@ -7,11 +7,11 @@ Function New-ISOMedia [ValidateSet('Prompt', 'No-Prompt')] [String]$BootType ) - - Begin - { + Begin { $ISOMedia = Import-DataFile -ISOMedia -ErrorAction:$ErrorActionPreference $InstallInfo = Import-DataFile Install -ErrorAction:$ErrorActionPreference + $ISOFile = GetPath -Path $WorkFolder -Child ($($InstallInfo.Edition).Replace(' ', '') + "_$($InstallInfo.Build).iso") + $BootFile = Switch ($BootType) { 'Prompt' { 'efisys.bin'; Break } @@ -19,88 +19,82 @@ Function New-ISOMedia } If ($PSVersionTable.PSVersion.Major -gt 5 -and !(Test-Path -Path (GetPath -Path $ISOMedia.FullName -Child 'boot\etfsboot.com'))) { Log "Missing the required etfsboot.com bootfile for ISO creation." -Type Error; Start-Sleep 3; Break } If (!(Test-Path -Path (GetPath -Path $ISOMedia.FullName -Child "efi\Microsoft\boot\$($BootFile)"))) { Log ('Missing the required {0} bootfile for ISO creation.' -f $BootFile) -Type Error; Start-Sleep 3; Break } - If ($PSVersionTable.PSVersion.Major -lt 6) + If (!('ISOWriter' -as [Type])) { - $CompilerParams = New-Object -TypeName CodeDom.Compiler.CompilerParameters -Property @{ CompilerOptions = '/unsafe'; WarningLevel = 4; TreatWarningsAsErrors = $true } -ErrorAction:$ErrorActionPreference - If (!('ISOWriter' -as [Type])) - { - Add-Type @' + Add-Type -TypeDefinition @' using System; using System.IO; +using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; public class ISOWriter { - public unsafe static void Create(string Path, object Stream, int BlockSize, int TotalBlocks) + [DllImport ("shlwapi.dll", CharSet = CharSet.Unicode, ExactSpelling = true, PreserveSig = false, EntryPoint = "SHCreateStreamOnFileEx")] + internal static extern void SHCreateStreamOnFileEx (String FileName, UInt32 Mode, UInt32 Attributes, Boolean Create, IStream StreamNull, out IStream Stream); + + public static void Create (String FilePath, ref Object ImageStream, Int32 BlockSize, Int32 TotalBlocks) { - int BytesRead = 0; - byte[] Buffer = new byte[BlockSize]; - int* Pointer = &BytesRead; - var OpenFile = System.IO.File.OpenWrite(Path); - var IStream = Stream as System.Runtime.InteropServices.ComTypes.IStream; - if (OpenFile != null) + IStream ResultStream = (IStream) ImageStream, ImageFile; + SHCreateStreamOnFileEx (FilePath, 0x1001, 0x80, true, null, out ImageFile); + Int32 Data = TotalBlocks > 1024 ? 1024 : 1; + Int32 Pointer = TotalBlocks % Data; + Int32 SizeBytes = BlockSize * Data; + Int32 Buffer = (TotalBlocks - Pointer) / Data; + if (Pointer > 0) + ResultStream.CopyTo (ImageFile, Pointer * SizeBytes, IntPtr.Zero, IntPtr.Zero); + while (Buffer-- > 0) { - while (TotalBlocks-- > 0) - { - IStream.Read(Buffer, BlockSize, (IntPtr)Pointer); - OpenFile.Write(Buffer, 0, BytesRead); - } - OpenFile.Flush(); - OpenFile.Close(); + ResultStream.CopyTo (ImageFile, SizeBytes, IntPtr.Zero, IntPtr.Zero); } + ImageFile.Commit (0); } } -'@ -CompilerParameters $CompilerParams +'@ + } + $BootOptionsDetail = @( + @{ + File = (Get-ChildItem -Path "$($ISOMedia.FullName)\boot\etfsboot.com" | Select-Object -ExpandProperty FullName) + PlatformId = 0 + }, + @{ + File = (Get-ChildItem -Path "$($ISOMedia.FullName)\efi\Microsoft\boot" -Filter $BootFile | Select-Object -ExpandProperty FullName) + PlatformId = 0xEF } - $FileSystem = @{ UDF = 4 }; $PlatformId = @{ EFI = 0xEF } + ) + $BootOptions = @() + Foreach($BootOptionDetail in $BootOptionsDetail) + { ($BootStream = New-Object -ComObject ADODB.Stream -Property @{ Type = 1 } -ErrorAction:$ErrorActionPreference).Open() - $BootStream.LoadFromFile((Get-ChildItem -Path "$($ISOMedia.FullName)\efi\Microsoft\boot" -Filter $BootFile | Select-Object -ExpandProperty FullName)) - ($BootOptions = New-Object -ComObject IMAPI2FS.BootOptions -Property @{ PlatformId = $PlatformId.EFI } -ErrorAction:$ErrorActionPreference).AssignBootImage($BootStream) - ($FSImage = New-Object -ComObject IMAPI2FS.MsftFileSystemImage -Property @{ FileSystemsToCreate = $FileSystem.UDF; VolumeName = $InstallInfo.Name; WorkingDirectory = $WorkFolder } -ErrorAction:$ErrorActionPreference).ChooseImageDefaultsForMediaType(13) + $BootStream.LoadFromFile($BootOptionDetail.File) + $BootOption = New-Object -ComObject IMAPI2FS.BootOptions -Property @{ PlatformId = $BootOptionDetail.PlatformId; Manufacturer = 'Microsoft'; Emulation = 0 } -ErrorAction:$ErrorActionPreference + $BootOption.AssignBootImage($BootStream.psobject.BaseObject) + $BootOptions += $BootOption.psobject.BaseObject } + $FileSystem = @{ UDF = 4 }; + $FSImage = New-Object -ComObject IMAPI2FS.MsftFileSystemImage -Property @{ FileSystemsToCreate = $FileSystem.UDF; UDFRevision = 0x102; FreeMediaBlocks = 0; VolumeName = $InstallInfo.Name; WorkingDirectory = $WorkFolder } -ErrorAction:$ErrorActionPreference } Process { - If ($PSVersionTable.PSVersion.Major -lt 6) - { - ForEach ($Item In Get-ChildItem -Path $ISOMedia.FullName -Force) - { - If ($Item -isnot [IO.FileInfo] -and $Item -isnot [IO.DirectoryInfo]) { $Item = Get-Item -Path $Item -ErrorAction:$ErrorActionPreference } - If ($Item) { $FSImage.Root.AddTree($Item.FullName, $true) } - } - } + $FSImage.Root.AddTree($ISOMedia.FullName, $false) } End { - If ($PSVersionTable.PSVersion.Major -lt 6) + $FSImage.BootImageOptionsArray = $BootOptions + $WriteISO = $FSImage.CreateResultImage() + $ISOFile = New-Item -Path $WorkFolder -Name ($($InstallInfo.Edition).Replace(' ', '') + "_$($InstallInfo.Build).iso") -ItemType File -Force -ErrorAction:$ErrorActionPreference + If ($ISOFile.Exists) { - $FSImage.BootImageOptions = $BootOptions - $WriteISO = $FSImage.CreateResultImage() - $ISOFile = New-Item -Path $WorkFolder -Name ($($InstallInfo.Edition).Replace(' ', '') + "_$($InstallInfo.Build).iso") -ItemType File -Force -ErrorAction:$ErrorActionPreference - If ($ISOFile.Exists) - { - [ISOWriter]::Create($ISOFile.FullName, $WriteISO.ImageStream, $WriteISO.BlockSize, $WriteISO.TotalBlocks) - $ISOFile.Refresh() - If (($WriteISO.BlockSize * $WriteISO.TotalBlocks) -eq $ISOFile.Length) { $ISOFile.FullName } - } - While ([Runtime.Interopservices.Marshal]::ReleaseComObject($BootStream) -gt 0) { } - While ([Runtime.Interopservices.Marshal]::ReleaseComObject($BootOptions) -gt 0) { } - While ([Runtime.Interopservices.Marshal]::ReleaseComObject($FSImage) -gt 0) { } - While ([Runtime.Interopservices.Marshal]::ReleaseComObject($WriteISO) -gt 0) { } - [GC]::Collect() - [GC]::WaitForPendingFinalizers() + [ISOWriter]::Create($ISOFile.FullName, [ref]$WriteISO.ImageStream, $WriteISO.BlockSize, $WriteISO.TotalBlocks) + $ISOFile.Refresh() + If (($WriteISO.BlockSize * $WriteISO.TotalBlocks) -eq $ISOFile.Length) { $ISOFile.FullName } } - Else - { - If ($OSCDIMG -and (Test-Path -Path $OSCDIMG)) - { - If (!(Test-Path -Path (GetPath -Path $ISOMedia.FullName -Child 'boot\etfsboot.com'))) { Log "Missing the required etfsboot.com bootfile for ISO creation." -Type Error } - $ISOFile = GetPath -Path $WorkFolder -Child ($($InstallInfo.Edition).Replace(' ', '') + "_$($InstallInfo.Build).iso") - $BootData = ('2#p0,e,b"{0}"#pEF,e,b"{1}"' -f (Get-ChildItem -Path "$($ISOMedia.FullName)\boot" -Filter etfsboot.com | Select-Object -ExpandProperty FullName), (Get-ChildItem -Path "$($ISOMedia.FullName)\efi\Microsoft\boot" -Filter $BootFile | Select-Object -ExpandProperty FullName)) - $OSCDIMGArgs = @('-bootdata:{0}', '-u2', '-udfver102', '-l"{1}"', '"{2}"', '"{3}"' -f $BootData, $InstallInfo.Name, $ISOMedia.FullName, $ISOFile) - $RET = StartExe $OSCDIMG -Arguments $OSCDIMGArgs - If ($RET -eq 0) { $ISOFile } - } + While ([Runtime.Interopservices.Marshal]::ReleaseComObject($BootStream) -gt 0) { } + Foreach($BootOption in $BootOptions){ + While ([Runtime.Interopservices.Marshal]::ReleaseComObject($BootOption) -gt 0) { } } + While ([Runtime.Interopservices.Marshal]::ReleaseComObject($FSImage) -gt 0) { } + While ([Runtime.Interopservices.Marshal]::ReleaseComObject($WriteISO) -gt 0) { } + [GC]::Collect() + [GC]::WaitForPendingFinalizers() } -} \ No newline at end of file +} diff --git a/Src/Public/Set-RegistryProperties.ps1 b/Src/Public/Set-RegistryProperties.ps1 index d3ecdd6..0ad09a5 100644 --- a/Src/Public/Set-RegistryProperties.ps1 +++ b/Src/Public/Set-RegistryProperties.ps1 @@ -46,7 +46,7 @@ Function Set-RegistryProperties RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules" -Name "Block Cortana Package" -Value "v2.26|Action=Block|Active=TRUE|Dir=Out|RA42=IntErnet|RA62=IntErnet|Name=Block Cortana Package|Desc=Block Cortana Outbound UDP/TCP Traffic|AppPkgId=S-1-15-2-1861897761-1695161497-2927542615-642690995-327840285-2659745135-2630312742|Platform=2:6:2|Platform2=GTEQ|" -Type String $RegistryData.DisableTelemetry | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force - If ($DynamicParams.LTSC -or $InstallInfo.Name -like "*Enterprise*" -or $InstallInfo.Name -like "*Education*") { $TelemetryLevel = 0 } Else { $TelemetryLevel = 1 } + If ($DynamicParams.LTSC -or $InstallInfo.Name -like "*Enterprise*" -or $InstallInfo.Name -like "*Education*") { $TelemetryLevel = 0 } Else { $TelemetryLevel = 0 } RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" -Name "AllowTelemetry" -Value $TelemetryLevel -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Value $TelemetryLevel -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "DoNotShowFeedbackNotifications" -Value 1 -Type DWord @@ -60,14 +60,16 @@ Function Set-RegistryProperties RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\Messenger\Client" -Name "CEIP" -Value 2 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\AppV\CEIP" -Name "CEIPEnable" -Value 0 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\SQMClient\Windows" -Name "CEIPEnable" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Internet Explorer\SQM" -Name "DisableCustomerImprovementProgram" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Internet Explorer\SQM" -Name "DisableCustomerImprovementProgram" -Value 1 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\TabletPC" -Name "PreventHandwritingDataSharing" -Value 1 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\Software Protection Platform" -Name "NoGenTicket" -Value 1 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\TextInput" -Name "AllowLinguisticDataCollection" -Value 0 -Type DWord RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Privacy" -Name "TailoredExperiencesWithDiagnosticDataEnabled" -Value 0 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\PolicyManager\default\System\AllowExperimentation" -Name "value" -Value 0 -Type DWord RegKey -Path "HKLM:\WIM_HKCU\Control Panel\International\User Profile" -Name "HttpAcceptLanguageOptOut" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" -Name "DODownloadMode" -Value 100 -Type DWord + If(!$DynamicParams.WindowsStore -and $DynamicParams.RemovedPackages."Microsoft.DesktopAppInstaller"){ + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" -Name "DODownloadMode" -Value 100 -Type DWord + } RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\WindowsInkWorkspace" -Name "AllowWindowsInkWorkspace" -Value 0 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\WindowsInkWorkspace" -Name "AllowSuggestedAppsInWindowsInkWorkspace" -Value 0 -Type DWord RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Input\TIPC" -Name "Enabled" -Value 0 -Type DWord @@ -75,7 +77,7 @@ Function Set-RegistryProperties RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -Value 0 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\Windows Error Reporting" -Name "Disabled" -Value 1 -Type DWord - If (!$DynamicParams.LTSC -and !$DynamicParams.MicrosoftEdge -and !$DynamicParams.MicrosoftEdgeChromium) + If (!$DynamicParams.LTSC -and !$DynamicParams.MicrosoftEdge -and !$DynamicParams.MicrosoftEdgeChromium -and $InstallInfo.Build -le '19044') { RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\MicrosoftEdge\BooksLibrary" -Name "EnableExtendedBooksTelemetry" -Value 0 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Policies\Microsoft\MicrosoftEdge\BooksLibrary" -Name "EnableExtendedBooksTelemetry" -Value 0 -Type DWord @@ -90,7 +92,7 @@ Function Set-RegistryProperties RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\System" -Name "PublishUserActivities" -Value 0 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\System" -Name "UploadUserActivities" -Value 0 -Type DWord - If (!$DynamicParams.LTSC -and !$DynamicParams.MicrosoftEdge -and !$DynamicParams.MicrosoftEdgeChromium) + If (!$DynamicParams.LTSC -and !$DynamicParams.MicrosoftEdge -and !$DynamicParams.MicrosoftEdgeChromium -and $InstallInfo.Build -le '19044') { RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\MicrosoftEdge\Main" -Name "DoNotTrack" -Value 1 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Policies\Microsoft\MicrosoftEdge\Main" -Name "DoNotTrack" -Value 1 -Type DWord @@ -165,26 +167,34 @@ Function Set-RegistryProperties RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement" -Name "ScoobeSystemSettingEnabled" -Value 0 -Type DWord } - $RegistryData.EnableSearchIcon | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Value 1 -Type DWord + If ($InstallInfo.Build -le '19044'){ + $RegistryData.EnableSearchIcon | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Value $(If ($DynamicParams.RemovedWindowsSearchPackage) {0} Else {1}) -Type DWord + } $RegistryData.EnableDriveLetterBeforeDriveName | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowDriveLettersFirst" -Value 4 -Type DWord - $RegistryData.EnableOLEDTaskbar | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "UseOLEDTaskbarTransparency" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\Dwm" -Name "ForceEffectMode" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name "EnableTransparency" -Value 1 -Type DWord + If ($InstallInfo.Build -le '19044'){ + $RegistryData.EnableOLEDTaskbar | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "UseOLEDTaskbarTransparency" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\Dwm" -Name "ForceEffectMode" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name "EnableTransparency" -Value 1 -Type DWord + } $RegistryData.EnableLaunchToThisPC | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowSyncProviderNotifications" -Value 0 -Type DWord + If ($InstallInfo.Build -ge '22500'){ + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowCloudFilesInQuickAccess" -Value 0 -Type DWord + } RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowRecent" -Value 0 -Type DWord RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowFrequent" -Value 0 -Type DWord $RegistryData.DisableJPEGQualityReduction | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force - RegKey -Path "HKLM:\WIM_HKCU\Control Panel\Desktop" -Name "JPEGImportQuality" -Value 100 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Control Panel\Desktop" -Name "JPEGImportQuality" -Value 90 -Type DWord - If ($InstallInfo.Build -ge '18362') + If ($InstallInfo.Build -ge '18362' -and $InstallInfo.Build -le '19044') { $RegistryData.DisableAcrylicBlur | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\System" -Name "DisableAcrylicBackgroundOnLogon" -Value 1 -Type DWord @@ -196,7 +206,7 @@ Function Set-RegistryProperties $RegistryData.EnableCMDWinXMenu | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "DontUsePowerShellOnWinX" -Value 1 -Type DWord - If (!$DynamicParams.LTSC -and !$DynamicParams.MicrosoftEdge -and !$DynamicParams.MicrosoftEdgeChromium) + If (!$DynamicParams.LTSC -and !$DynamicParams.MicrosoftEdge -and !$DynamicParams.MicrosoftEdgeChromium -and $InstallInfo.Build -le '19044') { $RegistryData.DisableEdgeShortcutPrelaunch | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" -Name "DisableEdgeDesktopShortcutCreation" -Value 1 -Type DWord @@ -207,34 +217,35 @@ Function Set-RegistryProperties RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\MicrosoftEdge\TabPreloader" -Name "PreventTabPreloading" -Value 1 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Policies\Microsoft\MicrosoftEdge\TabPreloader" -Name "PreventTabPreloading" -Value 1 -Type DWord } + + If ((($InstallInfo.Build -eq '19041' -and (Get-ItemPropertyValue -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name UBR -ErrorAction Ignore) -ge 1023) -or $InstallInfo.Build -gt '19041') -and !$DynamicParams.MicrosoftEdgeChromium) + { - $RegistryData.DisablePinnedIcons | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force - RegKey -Path "HKLM:\WIM_HKCU\Software\Policies\Microsoft\Windows\Explorer" -Name "NoPinningStoreToTaskbar" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband\AuxilliaryPins" -Name "MailPin" -Value 2 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" -Name "PeopleBand" -Value 0 -Type DWord + $RegistryData.EnableCombineSmallIcons | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarGlomLevel" -Value 0 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarSmallIcons" -Value 1 -Type DWord + + $RegistryData.EnableClassicPersonalizationPanel | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "(default)" -Value "Personalization (Classic)" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "InfoTip" -Value '@%SystemRoot%\\System32\\themecpl.dll,-2#immutable1' -Type ExpandString + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "System.ApplicationName" -Value "Microsoft.Personalization" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "System.ControlPanel.Category" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "System.Software.TasksFileUrl" -Value "Internal" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}\DefaultIcon" -Name "(default)" -Value "%SystemRoot%\\System32\\themecpl.dll,-1" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}\shell\Open\Command" -Name "(default)" -Value "explorer.exe shell:::{ED834ED6-4B5A-4bfe-8F11-A626DCB6A921}" -Type String + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "(default)" -Value "Personalization" -Type String + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" -Name "StartupPage" -Value 1 -Type DWord + RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" -Name "AllItemsIconView" -Value 1 -Type DWord + } $RegistryData.ReduceStartMenuDelay | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force RegKey -Path "HKLM:\WIM_HKCU\Control Panel\Desktop" -Name "MenuShowDelay" -Value 50 -Type String - $RegistryData.EnableCombineSmallIcons | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarGlomLevel" -Value 0 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarSmallIcons" -Value 1 -Type DWord $RegistryData.DisableOpenFilePrompt | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "NoUseStoreOpenWith" -Value 1 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Policies\Microsoft\Windows\Explorer" -Name "NoNewAppAlert" -Value 1 -Type DWord - $RegistryData.EnableClassicPersonalizationPanel | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "(default)" -Value "Personalization (Classic)" -Type String - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "InfoTip" -Value '@%SystemRoot%\\System32\\themecpl.dll,-2#immutable1' -Type ExpandString - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "System.ApplicationName" -Value "Microsoft.Personalization" -Type String - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "System.ControlPanel.Category" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "System.Software.TasksFileUrl" -Value "Internal" -Type String - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}\DefaultIcon" -Name "(default)" -Value "%SystemRoot%\\System32\\themecpl.dll,-1" -Type String - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}\shell\Open\Command" -Name "(default)" -Value "explorer.exe shell:::{ED834ED6-4B5A-4bfe-8F11-A626DCB6A921}" -Type String - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace\{580722FF-16A7-44C1-BF74-7E1ACD00F4F9}" -Name "(default)" -Value "Personalization" -Type String - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" -Name "StartupPage" -Value 1 -Type DWord - RegKey -Path "HKLM:\WIM_HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" -Name "AllItemsIconView" -Value 1 -Type DWord If ($InstallInfo.Build -ge '17763' -and $InstallInfo.Build -lt '19041') { @@ -318,9 +329,9 @@ Function Set-RegistryProperties "HKLM:\WIM_HKLM_SOFTWARE\Classes\AllFilesystemObjects\shellex\PropertySheetHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}", "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shellex\PropertySheetHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}", "HKLM:\WIM_HKLM_SOFTWARE\Classes\Directory\shellex\PropertySheetHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}", "HKLM:\WIM_HKLM_SOFTWARE\Classes\Drive\shellex\PropertySheetHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}") | Purge - $RegistryData.EnableRebootRecoveryMyPC | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force + <# $RegistryData.EnableRebootRecoveryMyPC | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Reboot to Recovery" -Name "Icon" -Value "%SystemRoot%\System32\imageres.dll,-110" -Type String -Force - RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Reboot to Recovery\command" -Name "(default)" -Value "shutdown.exe /r /o /f /t 00" -Type String -Force + RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Reboot to Recovery\command" -Name "(default)" -Value "shutdown.exe /r /o /f /t 00" -Type String -Force #> $RegistryData.EnableLongFilePaths | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force RegKey -Path "HKLM:\WIM_HKLM_SYSTEM\ControlSet001\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -Type DWord @@ -328,6 +339,7 @@ Function Set-RegistryProperties $RegistryData.EnableStrongCrypto | Out-File -FilePath $RegistryLog -Encoding UTF8 -Append -Force RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\Microsoft\.NETFramework\v4.0.30319" -Name "SchUseStrongCrypto" -Value 1 -Type DWord RegKey -Path "HKLM:\WIM_HKLM_SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319" -Name "SchUseStrongCrypto" -Value 1 -Type DWord + } Catch { diff --git a/Src/Public/Test-Requirements.ps1 b/Src/Public/Test-Requirements.ps1 index b43bbb4..eacc550 100644 --- a/Src/Public/Test-Requirements.ps1 +++ b/Src/Public/Test-Requirements.ps1 @@ -2,9 +2,9 @@ Function Test-Requirements { If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Warning ('Elevation is required to process optimizations. Please relaunch {0} as an administrator.' -f $OptimizeOffline.BaseName); Break } If ($PSVersionTable.PSVersion.Major -lt 5) { Write-Warning ('{0} does not support PowerShell version {1}' -f $OptimizeOffline.BaseName, $PSVersionTable.PSVersion.ToString()); Break } - $OSCaption = (Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Caption) - $HostEnvironment = @('Microsoft Windows 10', 'Microsoft Windows Server 2016', 'Microsoft Windows Server 2019') - If ($OSCaption -notlike "$($HostEnvironment[0])*" -and $OSCaption -notlike "$($HostEnvironment[1])*" -and $OSCaption -notlike "$($HostEnvironment[2])*") { Write-Warning ('{0} requires one of the following host environments: {1}.' -f $OptimizeOffline.BaseName, ($HostEnvironment -join ', ')); Break } + #$OSCaption = (Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Caption) + #$HostEnvironment = @('Microsoft Windows 10', 'Microsoft Windows Server 2016', 'Microsoft Windows Server 2019') + #If ($OSCaption -notlike "$($HostEnvironment[0])*" -and $OSCaption -notlike "$($HostEnvironment[1])*" -and $OSCaption -notlike "$($HostEnvironment[2])*") { Write-Warning ('{0} requires one of the following host environments: {1}.' -f $OptimizeOffline.BaseName, ($HostEnvironment -join ', ')); Break } If ($Env:PROCESSOR_ARCHITECTURE -ne $ManifestData.ProcessorArchitecture) { Write-Warning ('{0} requires an "{1}" processor architecture.' -f $OptimizeOffline.BaseName, $ManifestData.ProcessorArchitecture); Break } If (Test-Path -Path HKLM:\SYSTEM\CurrentControlSet\Control\MiniNT) { Write-Warning ('{0} cannot be run in a Preinstallation environment.' -f $OptimizeOffline.BaseName); Break } If ((Get-UICulture).Name -ne $OptimizeOffline.Culture) { Write-Warning ('{0} is designed for the "{1}" regional culture. Not all optimizations will be available for the "{2}" regional culture.' -f $OptimizeOffline.BaseName, $OptimizeOffline.Culture, (Get-UICulture).Name); Start-Sleep 5 } diff --git a/Src/Public/en-US/Set-RegistryProperties.strings.psd1 b/Src/Public/en-US/Set-RegistryProperties.strings.psd1 index e42e28e..93fd760 100644 --- a/Src/Public/en-US/Set-RegistryProperties.strings.psd1 +++ b/Src/Public/en-US/Set-RegistryProperties.strings.psd1 @@ -25,6 +25,7 @@ DisableAcrylicBlur = Disabling the Sign-in Screen Acrylic Blur. DisableShortcutText = Disabling the Trailing Text for Shortcuts. EnableCMDWinXMenu = Enabling Command Prompt on the Win+X Quick Link Menu. DisableEdgeShortcutPrelaunch = Disabling Microsoft Edge Desktop Shortcut Creation and Pre-Launching. +DisableTaskbarInterestsNews = Disabling Interests and News on Taskbar. DisablePinnedIcons = Disabling Pinned Windows Store, Windows Mail and People Icons. ReduceStartMenuDelay = Reducing Start Menu Delay. EnableCombineSmallIcons = Enabling TaskBar Icon Combining with Small Icons. diff --git a/Start-Optimize-BAU-TI.ps1 b/Start-Optimize-BAU-TI.ps1 new file mode 100644 index 0000000..754ea32 --- /dev/null +++ b/Start-Optimize-BAU-TI.ps1 @@ -0,0 +1,130 @@ +<# + .SYNOPSIS + Start-Optimize is a configuration call script for the Optimize-Offline module. + + .DESCRIPTION + Start-Optimize automatically imports the configuration JSON file into the Optimize-Offline module. + + .EXAMPLE + .\Start-Optimize.ps1 + + This command will import all values set in the configuration JSON file into the Optimize-Offline module and begin the optimization process. + + .NOTES + Start-Optimize requires that the configuration JSON file is present in the root path of the Optimize-Offline module. +#> +[CmdletBinding()] +Param ( + [Parameter(Mandatory = $false)] [switch]$populateLists, + [Parameter(Mandatory = $false)] [switch]$populateTemplates +) + +$Global:Error.Clear() + +# Ensure we are running with full administrative permissions via RunAsTI function. +function RunAsTI ($cmd) { $id='RunAsTI'; $sid=((whoami /user)-split' ')[-1]; $code=@' +$ti=(whoami /groups)-like"*1-16-16384*"; $DM=[AppDomain]::CurrentDomain."DefineDynamicAss`embly"(1,1)."DefineDynamicMod`ule"(1) +$D=@(); 0..5|% {$D+=$DM."DefineT`ype"("M$_",1179913,[ValueType])}; $I=[int32];$P=$I.module.gettype("System.Int`Ptr"); $U=[uintptr] +$D+=$U; 4..6|% {$D+=$D[$_]."MakeB`yRefType"()};$M=$I.module.gettype("System.Runtime.Interop`Services.Mar`shal");$Z=[uintptr]::size +$S=[string]; $F="kernel","advapi","advapi",($S,$S,$I,$I,$I,$I,$I,$S,$D[7],$D[8]),($U,$S,$I,$I,$D[9]),($U,$S,$I,$I,[byte[]],$I) +0..2|% {$9=$D[0]."DefinePInvokeMeth`od"(("CreateProcess","RegOpenKeyEx","RegSetValueEx")[$_],$F[$_]+'32',8214,1,$S,$F[$_+3],1,4)} +$DF=0,($P,$I,$P),($I,$I,$I,$I,$P,$D[1]),($I,$S,$S,$S,$I,$I,$I,$I,$I,$I,$I,$I,[int16],[int16],$P,$P,$P,$P),($D[3],$P),($P,$P,$I,$I) +1..5|% {$k=$_;$n=1;$AveYo=1; $DF[$_]|% {$9=$D[$k]."DefineFie`ld"('f'+$n++,$_,6)}}; $T=@(); 0..5|% {$T+=$D[$_]."CreateT`ype"()} +0..5|% {nv "A$_" ([Activator]::CreateInstance($T[$_])) -force}; function F ($1,$2) {$T[0]."GetMeth`od"($1).invoke(0,$2)}; +if (!$ti) { $g=0; "TrustedInstaller","lsass"|% {if (!$g) {net1 start $_ 2>&1 >$null; $g=@(get-process -name $_ -ea 0|% {$_})[0]}} + function M($1,$2,$3){$M."GetMeth`od"($1,[type[]]$2).invoke(0,$3)}; $H=@(); $Z,(4*$Z+16)|% {$H+=M "AllocHG`lobal" $I $_}; + M "WriteInt`Ptr" ($P,$P) ($H[0],$g.Handle); $A1.f1=131072;$A1.f2=$Z;$A1.f3=$H[0];$A2.f1=1;$A2.f2=1;$A2.f3=1;$A2.f4=1;$A2.f6=$A1 + $A3.f1=10*$Z+32;$A4.f1=$A3;$A4.f2=$H[1]; M "StructureTo`Ptr" ($D[2],$P,[boolean]) (($A2 -as $D[2]),$A4.f2,$false); $w=0x0E080600 + $out=@($null,"powershell -win 1 -nop -c iex `$env:A",0,0,0,$w,0,$null,($A4 -as $T[4]),($A5 -as $T[5])); F "CreateProcess" $out +} else { $env:A=''; $PRIV=[uri].module.gettype("System.Diagnostics.Process")."GetMeth`ods"(42) |? {$_.Name -eq "SetPrivilege"} + "SeSecurityPrivilege","SeTakeOwnershipPrivilege","SeBackupPrivilege","SeRestorePrivilege" |% {$PRIV.Invoke(0, @("$_",2))} + $HKU=[uintptr][uint32]2147483651; $LNK=$HKU; $reg=@($HKU,"S-1-5-18",8,2,($LNK -as $D[9])); F "RegOpenKeyEx" $reg; $LNK=$reg[4] + function SYM($1,$2){$b=[Text.Encoding]::Unicode.GetBytes("\Registry\User\$1");@($2,"SymbolicLinkValue",0,6,[byte[]]$b,$b.Length)} + if (!$cmd) {$cmd='cmd'}; $r="start `"$id`" /high /w"; F "RegSetValueEx" (SYM $(($key-split'\\')[1]) $LNK) + start cmd -args ("/q/x/d/r title $id && $r",$cmd) -wait -win 1; F "RegSetValueEx" (SYM ".Default" $LNK) +} # lean and mean snippet by AveYo, 2018-2021 +'@; $key="Registry::HKEY_USERS\$sid\Volatile Environment"; $a1="`$id='$id';`$key='$key';";$a2="`$cmd='$($cmd-replace"'","''")';`n" +sp $key $id $($a1,$a2,$code) -type 7 -force; $arg="$a1 `$env:A=(gi `$key).getvalue(`$id)-join'';rp `$key `$id -force; iex `$env:A" +start powershell -args "-win 1 -nop -c $arg" -verb runas } + +$arguments = @() +foreach ($param in $PSBoundParameters.GetEnumerator()) { + $arguments += "-"+[string]$param.Key+$(If ($param.Value -notin @("True", "False")) {"="+$param.Value} Else {""}) +} +if ((whoami)-ne"nt authority\system") {RunAsTI "powershell -c . ""$($MyInvocation.MyCommand.Path)"" $arguments; pause"; return} + +# Ensure the configuration JSON file exists. +If (!(Test-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath Configuration.json))) { + Write-Warning ('The required configuration JSON file does not exist: "{0}"' -f (Join-Path -Path $PSScriptRoot -ChildPath Configuration.json)) + Start-Sleep 3 + Exit +} + +# If the configuration JSON or ordered collection list variables still exists from a previous session, remove them. +If ((Test-Path -Path Variable:\ContentJSON) -or (Test-Path -Path Variable:\ConfigParams)) { + Remove-Variable -Name ContentJSON, ConfigParams -ErrorAction Ignore +} + +# Use a Try/Catch/Finally block in case the configuration JSON file URL formatting is invalid so we can catch it, correct its formatting and continue. +Try { + $ContentJSON = Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath Configuration.json) -Raw | ConvertFrom-Json +} +Catch [ArgumentException] { + $ContentJSON = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath Configuration.json) -Raw).Replace('\', '\\') | Set-Content -Path (Join-Path -Path $Env:TEMP -ChildPath Configuration.json) -Encoding UTF8 -Force -PassThru + $ContentJSON = $ContentJSON | ConvertFrom-Json + Move-Item -Path (Join-Path -Path $Env:TEMP -ChildPath Configuration.json) -Destination $PSScriptRoot -Force + $Global:Error.Remove($Error[-1]) +} +Finally { + $ContentJSON.PSObject.Properties.Remove('_Info') +} + +# Convert the JSON object into a nested ordered collection list. We use the PSObject.Properties method to retain the JSON object order. +$ConfigParams = [Ordered]@{ + populateLists = $populateLists + populateTemplates = $populateTemplates +} +ForEach ($Name In $ContentJSON.PSObject.Properties.Name) { + $Value = $ContentJSON.PSObject.Properties.Item($Name).Value + If ($Value -is [PSCustomObject]) { + $ConfigParams.$Name = [Ordered]@{ } + ForEach ($Property in $Value.PSObject.Properties) { + $ConfigParams.$Name[$Property.Name] = $Property.Value + } + } + Else { + $ConfigParams.$Name = $Value + } +} + +# Import the Optimize-Offline module and call it by passing the JSON configuration. +If ($PSVersionTable.PSVersion.Major -gt 5) { + Try { + Import-Module Dism -SkipEditionCheck -Force -WarningAction Ignore -ErrorAction Stop + } + Catch { + Write-Warning 'Failed to import the required Dism module.' + Start-Sleep 3 + Exit + } + Try { + Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Optimize-Offline.psm1) -SkipEditionCheck -Force -WarningAction Ignore -ErrorAction Stop + } + Catch { + Write-Warning ('Failed to import the Optimize-Offline module: "{0}"' -f (Join-Path -Path $PSScriptRoot -ChildPath Optimize-Offline.psm1)) + Start-Sleep 3 + Exit + } +} +Else { + Try { + Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Optimize-Offline.psm1) -Force -WarningAction Ignore -ErrorAction Stop + } + Catch { + Write-Warning ('Failed to import the Optimize-Offline module: "{0}"' -f (Join-Path -Path $PSScriptRoot -ChildPath Optimize-Offline.psm1)) + Start-Sleep 3 + Exit + } +} + +Optimize-Offline @ConfigParams diff --git a/Start-Optimize.bat b/Start-Optimize.bat new file mode 100644 index 0000000..5d99678 --- /dev/null +++ b/Start-Optimize.bat @@ -0,0 +1 @@ +powershell "%~dp0Start-Optimize" \ No newline at end of file diff --git a/Start-Optimize.ps1 b/Start-Optimize.ps1 index f3d84e8..2b9b942 100644 --- a/Start-Optimize.ps1 +++ b/Start-Optimize.ps1 @@ -1,5 +1,4 @@ -#Requires -RunAsAdministrator -<# +<# .SYNOPSIS Start-Optimize is a configuration call script for the Optimize-Offline module. @@ -15,100 +14,98 @@ Start-Optimize requires that the configuration JSON file is present in the root path of the Optimize-Offline module. #> [CmdletBinding()] -Param () +Param ( + [Parameter(Mandatory = $false)] [switch]$populateLists, + [Parameter(Mandatory = $false)] [switch]$populateTemplates +) $Global:Error.Clear() # Ensure we are running with administrative permissions. -If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) -{ - Write-Warning "Elevation is required to process optimizations. Please relaunch Start-Optimize as an administrator." - Start-Sleep 3 - Exit +If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { + $arguments = @(" & '" + $MyInvocation.MyCommand.Definition + "'") + foreach ($param in $PSBoundParameters.GetEnumerator()) { + $arguments += "-"+[string]$param.Key+$(If ($param.Value -notin @("True", "False")) {"="+$param.Value} Else {""}) + } + $arguments += " ; pause" + Start-Process powershell -Verb RunAs -ArgumentList $arguments + Stop-Process -Id $PID +} + +$configration_selected = "Configuration.json" + +If (Test-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath "Configuration_custom.json")) { + $configration_selected = "Configuration_custom.json" } # Ensure the configuration JSON file exists. -If (!(Test-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath Configuration.json))) -{ - Write-Warning ('The required configuration JSON file does not exist: "{0}"' -f (Join-Path -Path $PSScriptRoot -ChildPath Configuration.json)) +If (!(Test-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath $configration_selected))) { + Write-Warning ('The required configuration JSON file does not exist: "{0}"' -f (Join-Path -Path $PSScriptRoot -ChildPath $configration_selected)) Start-Sleep 3 Exit } # If the configuration JSON or ordered collection list variables still exists from a previous session, remove them. -If ((Test-Path -Path Variable:\ContentJSON) -or (Test-Path -Path Variable:\ConfigParams)) -{ +If ((Test-Path -Path Variable:\ContentJSON) -or (Test-Path -Path Variable:\ConfigParams)) { Remove-Variable -Name ContentJSON, ConfigParams -ErrorAction Ignore } # Use a Try/Catch/Finally block in case the configuration JSON file URL formatting is invalid so we can catch it, correct its formatting and continue. -Try -{ - $ContentJSON = Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath Configuration.json) -Raw | ConvertFrom-Json +Try { + $ContentJSON = Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath $configration_selected) -Raw | ConvertFrom-Json } -Catch [ArgumentException] -{ - $ContentJSON = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath Configuration.json) -Raw).Replace('\', '\\') | Set-Content -Path (Join-Path -Path $Env:TEMP -ChildPath Configuration.json) -Encoding UTF8 -Force -PassThru +Catch [ArgumentException] { + $ContentJSON = (Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath $configration_selected) -Raw).Replace('\', '\\') | Set-Content -Path (Join-Path -Path $Env:TEMP -ChildPath $configration_selected) -Encoding UTF8 -Force -PassThru $ContentJSON = $ContentJSON | ConvertFrom-Json - Move-Item -Path (Join-Path -Path $Env:TEMP -ChildPath Configuration.json) -Destination $PSScriptRoot -Force + Move-Item -Path (Join-Path -Path $Env:TEMP -ChildPath $configration_selected) -Destination $PSScriptRoot -Force $Global:Error.Remove($Error[-1]) } -Finally -{ +Finally { $ContentJSON.PSObject.Properties.Remove('_Info') } # Convert the JSON object into a nested ordered collection list. We use the PSObject.Properties method to retain the JSON object order. -$ConfigParams = [Ordered]@{ } -ForEach ($Name In $ContentJSON.PSObject.Properties.Name) -{ +$ConfigParams = [Ordered]@{ + populateLists = $populateLists + populateTemplates = $populateTemplates +} +ForEach ($Name In $ContentJSON.PSObject.Properties.Name) { $Value = $ContentJSON.PSObject.Properties.Item($Name).Value - If ($Value -is [PSCustomObject]) - { + If ($Value -is [PSCustomObject]) { $ConfigParams.$Name = [Ordered]@{ } - ForEach ($Property in $Value.PSObject.Properties) - { + ForEach ($Property in $Value.PSObject.Properties) { $ConfigParams.$Name[$Property.Name] = $Property.Value } } - Else - { + Else { $ConfigParams.$Name = $Value } } # Import the Optimize-Offline module and call it by passing the JSON configuration. -If ($PSVersionTable.PSVersion.Major -gt 5) -{ - Try - { +If ($PSVersionTable.PSVersion.Major -gt 5) { + Try { Import-Module Dism -SkipEditionCheck -Force -WarningAction Ignore -ErrorAction Stop } - Catch - { + Catch { Write-Warning 'Failed to import the required Dism module.' Start-Sleep 3 Exit } - Try - { + Try { Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Optimize-Offline.psm1) -SkipEditionCheck -Force -WarningAction Ignore -ErrorAction Stop } - Catch - { + Catch { Write-Warning ('Failed to import the Optimize-Offline module: "{0}"' -f (Join-Path -Path $PSScriptRoot -ChildPath Optimize-Offline.psm1)) Start-Sleep 3 Exit } } -Else -{ - Try - { +Else { + Try { Import-Module (Join-Path -Path $PSScriptRoot -ChildPath Optimize-Offline.psm1) -Force -WarningAction Ignore -ErrorAction Stop } - Catch - { + Catch { Write-Warning ('Failed to import the Optimize-Offline module: "{0}"' -f (Join-Path -Path $PSScriptRoot -ChildPath Optimize-Offline.psm1)) Start-Sleep 3 Exit diff --git a/docs/Optimize-Offline-help.md b/docs/Optimize-Offline-help.md index d55e2fd..0871ac0 100644 --- a/docs/Optimize-Offline-help.md +++ b/docs/Optimize-Offline-help.md @@ -14,7 +14,7 @@ Offline optimization framework for Windows 10 image versions 1803-to-2004 with 6 ``` Optimize-Offline [-SourcePath] [[-WindowsApps] ] [-SystemApps] [-Capabilities] [-Packages] - [-Features] [-DeveloperMode] [-WindowsStore] [-MicrosoftEdge] [-Win32Calc] [-Dedup] [[-DaRT] ] + [-Features] [-DeveloperMode] [-WindowsStore] [-MicrosoftEdge] [-Win32Calc] [-DormantDefender] [-Dedup] [[-DaRT] ] [-Registry] [[-Additional] ] [-ComponentCleanup] [[-ISO] ] [] ``` @@ -38,7 +38,7 @@ This command automatically starts optimizing an image by importing the configura ### EXAMPLE 2 ``` -Optimize-Offline -SourcePath "D:\Images\Windows 10 1903\18362.1.190318-1202.19H1_RELEASE_CLIENTMULTI_X64FRE_EN-US.iso" -WindowsApps "Select" -SystemApps -Capabilities -Packages -Features -Win32Calc -Dedup -DaRT "Setup" -Registry -Additional @{ Setup = $true; RegistryTemplates = $true; LayoutModification = $true; Drivers = $true } -ISO "No-Prompt" +Optimize-Offline -SourcePath "D:\Images\Windows 10 1903\18362.1.190318-1202.19H1_RELEASE_CLIENTMULTI_X64FRE_EN-US.iso" -WindowsApps "Select" -SystemApps -Capabilities -Packages -Features -Win32Calc -DormantDefender -Dedup -DaRT "Setup" -Registry -Additional @{ Setup = $true; RegistryTemplates = $true; LayoutModification = $true; Drivers = $true } -ISO "No-Prompt" ``` This command starts optimizing an image by manually passing parameters to the module. @@ -202,6 +202,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -DormantDefender +Disable Windows defender while retaining the option to reactivate it. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Dedup Integrates the Windows Server Data Deduplication Feature into the image. diff --git a/en-US/Optimize-Offline-help.xml b/en-US/Optimize-Offline-help.xml index a59d38a..87abace 100644 --- a/en-US/Optimize-Offline-help.xml +++ b/en-US/Optimize-Offline-help.xml @@ -168,6 +168,17 @@ False + + DormantDefender + + Disable Windows defender while retaining the option to reactivate it. + + + SwitchParameter + + + False + Dedup @@ -326,6 +337,18 @@ False + + DormantDefender + + Disable Windows defender while retaining the option to reactivate it. + + SwitchParameter + + SwitchParameter + + + False + Dedup @@ -453,7 +476,7 @@ -------------------------- EXAMPLE 2 -------------------------- - Optimize-Offline -SourcePath "D:\Images\Windows 10 1903\18362.1.190318-1202.19H1_RELEASE_CLIENTMULTI_X64FRE_EN-US.iso" -WindowsApps "Select" -SystemApps -Capabilities -Packages -Features -Win32Calc -Dedup -DaRT "Setup" -Registry -Additional @{ Setup = $true; RegistryTemplates = $true; Drivers = $true } -ISO "No-Prompt" + Optimize-Offline -SourcePath "D:\Images\Windows 10 1903\18362.1.190318-1202.19H1_RELEASE_CLIENTMULTI_X64FRE_EN-US.iso" -WindowsApps "Select" -SystemApps -Capabilities -Packages -Features -Win32Calc -DormantDefender -Dedup -DaRT "Setup" -Registry -Additional @{ Setup = $true; RegistryTemplates = $true; Drivers = $true } -ISO "No-Prompt" This command starts optimizing an image by manually passing parameters to the cmdlet. @@ -474,4 +497,4 @@ - \ No newline at end of file + diff --git a/en-US/Optimize-Offline.strings.psd1 b/en-US/Optimize-Offline.strings.psd1 index 498ba2e..10807d2 100644 --- a/en-US/Optimize-Offline.strings.psd1 +++ b/en-US/Optimize-Offline.strings.psd1 @@ -5,7 +5,7 @@ InvalidWindowsInstallMedia = "{0}" does not contain valid Windows I ExportingMedia = Exporting media from "{0}" CopyingImage = Copying {0} from "{1}" FailedToReturnInstallImage = Failed to return the Install Image from "{0}" -SelectWindowsEdition = Select the Windows 10 Edition to Optimize. +SelectWindowsEdition = Select the Windows Edition to Optimize. FailedToRetrieveImageMetadata = Failed to retrieve the necessary image metadata from the {0} UnsupportedImageVersion = Unsupported Image Version: [{0}] UnsupportedImageArch = Unsupported Image Architecture: [{0}] @@ -25,8 +25,9 @@ RemovingSystemApp = Removing System App: {0} FailedRemovingSystemApp = Failed to Remove System App: {0} FailedRemovingSystemApps = Failed to Remove System Apps. RemovedPackageCleanup = Disabling Services, Drivers and Integration Content for Removed Apps. -RemovingBiometricCapability = Removing Windows Biometric Capability Packages. -FailedRemovingBiometricCapability = Failed to Remove Windows Biometric Capability Packages. +DisableDefender = Disabling Defender Start-up and Feature Packages. +RemovingBiometricCapability = Removing Windows Biometric Capability: {0} +FailedRemovingBiometricCapability = Failed to Remove Windows Biometric Capabilities. DisablingDefenderOptionalFeature = Disabling Optional Feature: Windows-Defender-Default-Definitions FailedDisablingDefenderOptionalFeature = Failed to Disable Optional Feature: Windows-Defender-Default-Definitions ImportingCustomAppAssociations = Importing Custom App Associations. @@ -79,7 +80,7 @@ InjectingDriverPackages = Injecting Driver Packages into {0} FailedInjectingDriverPackages = Failed to Inject Driver Packages into {0} EnablingNetFx3 = Enabling Optional Feature: NetFx3 FailedEnablingNetFx3 = Failed to Enable Optional Feature: NetFx3 -ComponentStoreCleanup = Performing a Clean-up of the {0} Component Store. +ComponentStoreCleanup = Performing a Clean-up of the {0} Component Store. This may take some time to complete. FailedComponentStoreCleanup = Failed to perform a Clean-up of the {0} Component Store. ComponentStorePendingInstallations = Cannot perform a clean-up of the Component Store while there are pending installations. CleanupStartMenu = Cleaning-up the Start Menu Layout. @@ -101,4 +102,28 @@ FailedCreatingISO = Failed to Create a {0} Bootable Window FinalizingOptimizations = Finalizing Optimizations. OptimizationsCompleted = {0} completed in [{1}] minutes with [{2}] errors. TerminatingOptimizations = Discarding any Images and Terminating Optimizations. -'@ \ No newline at end of file +Populating = populating +SelectiveRegistryWindowsUpgrade = Disabling Windows Upgrade +SelectiveRegistryWindowsUpdateMS = Disabling Windows Update using Microsoft's Method +SelectiveRegistryDriverUpdate = Disabling automatic driver update +SelectiveRegistryDormantOneDrive = Enabling dormant OneDrive fix +SelectiveRegistryDisable3rdPartyApps = Disabling 3rd party apps +SelectiveRegistryW11ClassicContextMenu = Setting W11 classic context menu +SelectiveRegistryExplorerUIRibbon = Enabling explorer classic UI ribbon +SelectiveRegistryRemoveTaskbarPinnedIcons = Removing taskbar pinned icons +SelectiveRegistryDisableVirtualizationSecurity = Disabling virtualization security +SelectiveRegistryAmoledBlackTheme = Adding AMOLED pitch-black theme +SelectiveRegistryClassicSearchExplorer = Setting classic search explorer +SelectiveRegistryDisableTeamsApp = Disabling Microsoft Teams autostart entry +SelectiveRegistryRunAsTiContextMenu = Adding Powershell as trusted installer context menu entry +ServiceStartBoot = Boot +ServiceStartSystem = System +ServiceStartAutomatic = Automatic +ServiceStartManual = Manual +ServiceStartDisabled = Disabled +ServiceModifying = Modifying windows service +ServicesModifying = Modifying windows services +DeliveryOptimizationBypass = Setting delivery optimization to bypass mode +ServicesRemovalFailed = Failed removing windows services +ChooseServicesTitle = Choose services to remove +'@ diff --git a/populateLists.bat b/populateLists.bat new file mode 100644 index 0000000..07d3ed4 --- /dev/null +++ b/populateLists.bat @@ -0,0 +1 @@ +powershell "%~dp0Start-Optimize -populateLists" \ No newline at end of file diff --git a/populateTemplates.bat b/populateTemplates.bat new file mode 100644 index 0000000..fc87b1d --- /dev/null +++ b/populateTemplates.bat @@ -0,0 +1 @@ +powershell "%~dp0Start-Optimize -populateTemplates" \ No newline at end of file