Skip to content

Commit dcb2c27

Browse files
authored
tiny11 builder v04-29-24
Added telemetry disabling features.
1 parent 77c74f5 commit dcb2c27

File tree

1 file changed

+125
-4
lines changed

1 file changed

+125
-4
lines changed

tiny11maker.ps1

Lines changed: 125 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ else
2424
[System.Diagnostics.Process]::Start($newProcess);
2525
exit
2626
}
27-
Write-Host "Welcome to the tiny11 image creator!"
27+
Write-Host "Welcome to the tiny11 image creator! Release: 04-29-2024"
2828
Start-Sleep -Seconds 3
2929
Clear-Host
3030
$mainOSDrive = $env:SystemDrive
@@ -84,7 +84,6 @@ if (-not $architecture) {
8484
Write-Host "Architecture information not found."
8585
}
8686

87-
8887
Write-Host "Mounting complete! Performing removal of applications..."
8988

9089
$packages = & 'dism' '/English' "/image:$($env:SystemDrive)\scratchdir" '/Get-ProvisionedAppxPackages' |
@@ -104,6 +103,7 @@ foreach ($package in $packagesToRemove) {
104103
}
105104

106105

106+
107107
Write-Host "Removing Edge:"
108108
Remove-Item -Path "$mainOSDrive\scratchdir\Program Files (x86)\Microsoft\Edge" -Recurse -Force
109109
Remove-Item -Path "$mainOSDrive\scratchdir\Program Files (x86)\Microsoft\EdgeUpdate" -Recurse -Force
@@ -184,8 +184,8 @@ Write-Host "Disabling Sponsored Apps:"
184184
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SubscribedContent-353696Enabled' '/t' 'REG_DWORD' '/d' '0' '/f'
185185
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SubscribedContentEnabled' '/t' 'REG_DWORD' '/d' '0' '/f'
186186
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager' '/v' 'SystemPaneSuggestionsEnabled' '/t' 'REG_DWORD' '/d' '0' '/f'
187-
& 'reg' 'add' 'HKLM\zSoftware\Policies\Microsoft\PushToInstall' '/v' 'DisablePushToInstall' '/t' 'REG_DWORD' '/d' '1' '/f'
188-
& 'reg' 'add' 'HKLM\zSoftware\Policies\Microsoft\MRT' '/v' 'DontOfferThroughWUAU' '/t' 'REG_DWORD' '/d' '1' '/f'
187+
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\PushToInstall' '/v' 'DisablePushToInstall' '/t' 'REG_DWORD' '/d' '1' '/f'
188+
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\MRT' '/v' 'DontOfferThroughWUAU' '/t' 'REG_DWORD' '/d' '1' '/f'
189189
& 'reg' 'delete' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\Subscriptions' '/f'
190190
& 'reg' 'delete' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager\SuggestedApps' '/f'
191191
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\CloudContent' '/v' 'DisableConsumerAccountStateContent' '/t' 'REG_DWORD' '/d' '1' '/f'
@@ -198,8 +198,127 @@ Write-Host "Disabling Reserved Storage:"
198198
Write-Host "Disabling Chat icon:"
199199
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\Windows Chat' '/v' 'ChatIcon' '/t' 'REG_DWORD' '/d' '3' '/f'
200200
& 'reg' 'add' 'HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' '/v' 'TaskbarMn' '/t' 'REG_DWORD' '/d' '0' '/f'
201+
Write-Host "Disabling Telemetry:"
202+
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo' '/v' 'Enabled' '/t' 'REG_DWORD' '/d' '0' '/f'
203+
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Windows\CurrentVersion\Privacy' '/v' 'TailoredExperiencesWithDiagnosticDataEnabled' '/t' 'REG_DWORD' '/d' '0' '/f'
204+
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy' '/v' 'HasAccepted' '/t' 'REG_DWORD' '/d' '0' '/f'
205+
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Input\TIPC' '/v' 'Enabled' '/t' 'REG_DWORD' '/d' '0' '/f'
206+
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization' '/v' 'RestrictImplicitInkCollection' '/t' 'REG_DWORD' '/d' '1' '/f'
207+
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization' '/v' 'RestrictImplicitTextCollection' '/t' 'REG_DWORD' '/d' '1' '/f'
208+
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\InputPersonalization\TrainedDataStore' '/v' 'HarvestContacts' '/t' 'REG_DWORD' '/d' '0' '/f'
209+
& 'reg' 'add' 'HKLM\zNTUSER\Software\Microsoft\Personalization\Settings' '/v' 'AcceptedPrivacyPolicy' '/t' 'REG_DWORD' '/d' '0' '/f'
210+
& 'reg' 'add' 'HKLM\zSOFTWARE\Policies\Microsoft\Windows\DataCollection' '/v' 'AllowTelemetry' '/t' 'REG_DWORD' '/d' '0' '/f'
211+
& 'reg' 'add' 'HKLM\zSYSTEM\ControlSet001\Services\dmwappushservice' '/v' 'Start' '/t' 'REG_DWORD' '/d' '4' '/f'
212+
## this function allows PowerShell to take ownership of the Scheduled Tasks registry key from TrustedInstaller. Based on Jose Espitia's script.
213+
function Enable-Privilege {
214+
param(
215+
[ValidateSet(
216+
"SeAssignPrimaryTokenPrivilege", "SeAuditPrivilege", "SeBackupPrivilege",
217+
"SeChangeNotifyPrivilege", "SeCreateGlobalPrivilege", "SeCreatePagefilePrivilege",
218+
"SeCreatePermanentPrivilege", "SeCreateSymbolicLinkPrivilege", "SeCreateTokenPrivilege",
219+
"SeDebugPrivilege", "SeEnableDelegationPrivilege", "SeImpersonatePrivilege", "SeIncreaseBasePriorityPrivilege",
220+
"SeIncreaseQuotaPrivilege", "SeIncreaseWorkingSetPrivilege", "SeLoadDriverPrivilege",
221+
"SeLockMemoryPrivilege", "SeMachineAccountPrivilege", "SeManageVolumePrivilege",
222+
"SeProfileSingleProcessPrivilege", "SeRelabelPrivilege", "SeRemoteShutdownPrivilege",
223+
"SeRestorePrivilege", "SeSecurityPrivilege", "SeShutdownPrivilege", "SeSyncAgentPrivilege",
224+
"SeSystemEnvironmentPrivilege", "SeSystemProfilePrivilege", "SeSystemtimePrivilege",
225+
"SeTakeOwnershipPrivilege", "SeTcbPrivilege", "SeTimeZonePrivilege", "SeTrustedCredManAccessPrivilege",
226+
"SeUndockPrivilege", "SeUnsolicitedInputPrivilege")]
227+
$Privilege,
228+
## The process on which to adjust the privilege. Defaults to the current process.
229+
$ProcessId = $pid,
230+
## Switch to disable the privilege, rather than enable it.
231+
[Switch] $Disable
232+
)
233+
$definition = @'
234+
using System;
235+
using System.Runtime.InteropServices;
236+
237+
public class AdjPriv
238+
{
239+
[DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]
240+
internal static extern bool AdjustTokenPrivileges(IntPtr htok, bool disall,
241+
ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen);
242+
243+
[DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]
244+
internal static extern bool OpenProcessToken(IntPtr h, int acc, ref IntPtr phtok);
245+
[DllImport("advapi32.dll", SetLastError = true)]
246+
internal static extern bool LookupPrivilegeValue(string host, string name, ref long pluid);
247+
[StructLayout(LayoutKind.Sequential, Pack = 1)]
248+
internal struct TokPriv1Luid
249+
{
250+
public int Count;
251+
public long Luid;
252+
public int Attr;
253+
}
254+
255+
internal const int SE_PRIVILEGE_ENABLED = 0x00000002;
256+
internal const int SE_PRIVILEGE_DISABLED = 0x00000000;
257+
internal const int TOKEN_QUERY = 0x00000008;
258+
internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020;
259+
public static bool EnablePrivilege(long processHandle, string privilege, bool disable)
260+
{
261+
bool retVal;
262+
TokPriv1Luid tp;
263+
IntPtr hproc = new IntPtr(processHandle);
264+
IntPtr htok = IntPtr.Zero;
265+
retVal = OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref htok);
266+
tp.Count = 1;
267+
tp.Luid = 0;
268+
if(disable)
269+
{
270+
tp.Attr = SE_PRIVILEGE_DISABLED;
271+
}
272+
else
273+
{
274+
tp.Attr = SE_PRIVILEGE_ENABLED;
275+
}
276+
retVal = LookupPrivilegeValue(null, privilege, ref tp.Luid);
277+
retVal = AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero);
278+
return retVal;
279+
}
280+
}
281+
'@
282+
283+
$processHandle = (Get-Process -id $ProcessId).Handle
284+
$type = Add-Type $definition -PassThru
285+
$type[0]::EnablePrivilege($processHandle, $Privilege, $Disable)
286+
}
287+
288+
Enable-Privilege SeTakeOwnershipPrivilege
289+
290+
$regKey = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("zSOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks",[Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree,[System.Security.AccessControl.RegistryRights]::TakeOwnership)
291+
$regACL = $regKey.GetAccessControl()
292+
$regACL.SetOwner([System.Security.Principal.NTAccount]"Administrators")
293+
$regKey.SetAccessControl($regACL)
294+
$regKey.Close()
295+
Write-Host "Owner changed to Administrators."
296+
297+
$regKey = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("zSOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks",[Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree,[System.Security.AccessControl.RegistryRights]::ChangePermissions)
298+
$regACL = $regKey.GetAccessControl()
299+
$regRule = New-Object System.Security.AccessControl.RegistryAccessRule ("Administrators","FullControl","ContainerInherit","None","Allow")
300+
$regACL.SetAccessRule($regRule)
301+
$regKey.SetAccessControl($regACL)
302+
Write-Host "Permissions modified for Administrators group."
303+
Write-Host "Registry key permissions successfully updated."
304+
$regKey.Close()
305+
306+
Write-Host 'Deleting Application Compatibility Appraiser'
307+
reg delete "HKEY_LOCAL_MACHINE\zSOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{0600DD45-FAF2-4131-A006-0B17509B9F78}" /f
308+
Write-Host 'Deleting Customer Experience Improvement Program'
309+
reg delete "HKEY_LOCAL_MACHINE\zSOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{4738DE7A-BCC1-4E2D-B1B0-CADB044BFA81}" /f
310+
reg delete "HKEY_LOCAL_MACHINE\zSOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{6FAC31FA-4A85-4E64-BFD5-2154FF4594B3}" /f
311+
reg delete "HKEY_LOCAL_MACHINE\zSOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{FC931F16-B50A-472E-B061-B6F79A71EF59}" /f
312+
Write-Host 'Deleting Program Data Updater'
313+
reg delete "HKEY_LOCAL_MACHINE\zSOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{0671EB05-7D95-4153-A32B-1426B9FE61DB}" /f
314+
Write-Host 'Deleting autochk proxy'
315+
reg delete "HKEY_LOCAL_MACHINE\zSOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{87BF85F4-2CE1-4160-96EA-52F554AA28A2}" /f
316+
reg delete "HKEY_LOCAL_MACHINE\zSOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{8A9C643C-3D74-4099-B6BD-9C6D170898B1}" /f
317+
Write-Host 'Deleting QueueReporting'
318+
reg delete "HKEY_LOCAL_MACHINE\zSOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{E3176A65-4E44-4ED3-AA73-3283660ACB9C}" /f
201319
Write-Host "Tweaking complete!"
202320
Write-Host "Unmounting Registry..."
321+
$regKey.Close()
203322
reg unload HKLM\zCOMPONENTS
204323
reg unload HKLM\zDRIVERS
205324
reg unload HKLM\zDEFAULT
@@ -244,11 +363,13 @@ Write-Host "Bypassing system requirements(on the setup image):"
244363
& 'reg' 'add' 'HKLM\zSYSTEM\Setup\MoSetup' '/v' 'AllowUpgradesWithUnsupportedTPMOrCPU' '/t' 'REG_DWORD' '/d' '1' '/f'
245364
Write-Host "Tweaking complete!"
246365
Write-Host "Unmounting Registry..."
366+
$regKey.Close()
247367
reg unload HKLM\zCOMPONENTS
248368
reg unload HKLM\zDRIVERS
249369
reg unload HKLM\zDEFAULT
250370
reg unload HKLM\zNTUSER
251371
reg unload HKLM\zSCHEMA
372+
$regKey.Close()
252373
reg unload HKLM\zSOFTWARE
253374
reg unload HKLM\zSYSTEM
254375
Write-Host "Unmounting image..."

0 commit comments

Comments
 (0)