Batch file to speed up Windows 10

This batch file will walk through the steps to clean up Windows 10.

Feel free to modify this for your own needs.

Use at your own risk, I am not responsible for use of this software.

@Echo off
CLS


::Check_Permissions
net session >nul 2>&1
if %errorLevel% == 0 (
    Echo.
    Echo Success: Administrative permissions confirmed.
) else (
    Echo.
    Color 4F
    Echo Failure: Current permissions inadequate.
    Echo.
    Echo You need Administrative permissions for this to work properly.
    Echo.
    Pause
    Color 7 
    )


:: Start Date and Time
Set Year=%date:~10,4%
Set Month=%date:~4,2%
Set Day=%date:~7,2%
Set StartTime=%Time:~0,5%
Echo.
Echo Starting: %Day%-%Month%-%Year%  %StartTime%
Echo.


:Q1
SET /P QQ01= Delete Temp Files?  Y N or X?
If %QQ01%==y goto Q1Y
if %QQ01%==Y goto Q1Y
if %QQ01%==n goto Q2
if %QQ01%==N goto Q2
if %QQ01%==x goto End
if %QQ01%==X goto End
goto Q1
::
::
:Q1Y
Color 71
::
::
:Q1a
CLS
Echo.
SET /P ZZa= Do you want to EDIT or DELETE or SKIP %userprofile%\Recent\ ?   E D S ?
If %ZZa%==e goto Q1aL
If %ZZa%==E goto Q1aL
If %ZZa%==d goto Q1aY
If %ZZa%==D goto Q1aY
If %ZZa%==s goto Q1b
If %ZZa%==S goto Q1b
Goto Q1a
:Q1aL
Explorer "%userprofile%\Recent"
Goto Q1b
:Q1aY
del /s /f /q %userprofile%\Recent\*.*
::
::
:Q1b
CLS
Echo.
SET /P ZZb= Do you want to EDIT or DELETE or SKIP C:\Windows\Prefetch\ ?   E D S ?
If %ZZb%==e goto Q1bL
If %ZZb%==E goto Q1bL
If %ZZb%==d goto Q1bY
If %ZZb%==D goto Q1bY
If %ZZb%==s goto Q1c
If %ZZb%==S goto Q1c
Goto Q1b
:Q1bL
explorer "C:\Windows\Prefetch"
Goto Q1c
:Q1bY
del /s /f /q C:\Windows\Prefetch\*.*
::
::
:Q1c
CLS
Echo.
SET /P ZZc= Do you want to EDIT or DELETE or SKIP C:\Windows\Temp ?   E D S ?
If %ZZc%==e goto Q1cL
If %ZZc%==E goto Q1cL
If %ZZc%==d goto Q1cY
If %ZZc%==D goto Q1cY
If %ZZc%==s goto Q1d
If %ZZc%==S goto Q1d
Goto Q1c
:Q1cL
explorer "C:\Windows\Temp"
Goto Q1d
:Q1cY
del /s /f /q C:\Windows\Temp\*.*
::
::
:Q1d
CLS
Echo.
SET /P ZZd= Do you want to EDIT or DELETE or SKIP %USERPROFILE%\appdata\local\temp ?   E D S ?
If %ZZd%==e goto Q1dL
If %ZZd%==E goto Q1dL
If %ZZd%==d goto Q1dY
If %ZZd%==D goto Q1dY
If %ZZd%==s goto Q1e
If %ZZd%==S goto Q1e
Goto Q1d
:Q1dL
explorer "%USERPROFILE%\appdata\local\temp"
Goto Q1e
:Q1dY
del /s /f /q %USERPROFILE%\appdata\local\temp\*.*
::
::
:Q1e
CLS
Echo.
SET /P ZZe= Do you want to EDIT or DELETE or SKIP %USERPROFILE%\appdata\local\Microsoft\Windows\INetCache ?   E D S ?
If %ZZe%==e goto Q1eL
If %ZZe%==E goto Q1eL
If %ZZe%==d goto Q1eY
If %ZZe%==D goto Q1eY
If %ZZe%==s goto Q1f
If %ZZe%==S goto Q1f
Goto Q1e
:Q1eL
explorer "%USERPROFILE%\appdata\local\Microsoft\Windows\INetCache"
Goto Q1f
:Q1eY
del /s /f /q %USERPROFILE%\appdata\local\Microsoft\Windows\INetCache\*.*
::
::
:Q1f
CLS
Echo.
SET /P ZZf= Do you want to EDIT or DELETE or SKIP C:\Windows\Logs\CBS ?   E D S ?
If %ZZf%==e goto Q1fL
If %ZZf%==E goto Q1fL
If %ZZf%==d goto Q1fY
If %ZZf%==D goto Q1fY
If %ZZf%==s goto Q1g
If %ZZf%==S goto Q1g
Goto Q1f
:Q1fL
explorer "C:\Windows\Logs\CBS"
Goto Q1g
:Q1fY
del /s /f /q C:\Windows\Logs\CBS\*.*
::
::
:Q1g
Color 07
Cls
Echo.


:Q2
Echo.
SET /P QQ02= Start System Maintenance? Y N or X?
If %QQ02%==y goto Q2Y
if %QQ02%==Y goto Q2Y
if %QQ02%==n goto Q3
if %QQ02%==N goto Q3
if %QQ02%==x goto End
if %QQ02%==X goto End
goto Q2
:Q2Y
MSchedExe.exe Start


:Q3
Echo.
SET /P QQ03= Check Start Up Programs?  Y N or X?
If %QQ03%==y goto Q3Y
if %QQ03%==Y goto Q3Y
if %QQ03%==n goto Q4
if %QQ03%==N goto Q4
if %QQ03%==x goto End
if %QQ03%==X goto End
goto Q3
:Q3Y
Color 71
Cls
Echo
Echo Pay close attention to the 'Startup Impact' values for each program e.g. 'High'
Echo.
Echo 2 other file explorer windows are open with programs that auto start.
Echo.
taskmgr /7 /startup
explorer "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
explorer "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp"
Pause
Color 07


:Q4
Echo.
SET /P QQ04= Disable Indexing? Y N or X?
If %QQ04%==y goto Q4Y
if %QQ04%==Y goto Q4Y
if %QQ04%==n goto Q5
if %QQ04%==N goto Q5
if %QQ04%==x goto End
if %QQ04%==X goto End
goto Q4
:Q4Y
sc config WSearch start= disabled


:Q5
Echo.
SET /P QQ05= Disable Visual Effects? and Recovery Protection?  Y N or X?
If %QQ05%==y goto Q5Y
if %QQ05%==Y goto Q5Y
if %QQ05%==n goto Q6
if %QQ05%==N goto Q6
if %QQ05%==x goto End
if %QQ05%==X goto End
goto Q5
:Q5Y
Cls
Color 71
Echo.
Echo.
Echo.
Echo Select "Advanced"
Echo Preformance "Settings"
Echo "Adjust for best performance"
Echo "OK"
Echo.
Echo Startup and Recovery "Settings"
Echo Check "Time to display list of operating systems" 20 seconds
Echo "OK"
Echo.
:: Echo Select "System Protection"
:: Echo Click  "Windows C:"
:: Echo Select "Configure"
:: Echo Turn ON system protection
:: Echo Set "Disk Sapce Usage" to 20 GB
:: Echo "OK"
Echo "OK"
Echo.
Sysdm.cpl
Pause
Color 07


:Q6
Echo.
SET /P QQ06= Disable Transparncy?  Y N or X?
If %QQ06%==y goto Q6Y
if %QQ06%==Y goto Q6Y
if %QQ06%==n goto Q7
if %QQ06%==N goto Q7
if %QQ06%==x goto End
if %QQ06%==X goto End
goto Q6
:Q6Y
REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /V "EnableTransparency /T REG_DWORD /D 0 /F


:Q7
Echo.
SET /P QQ07= Flush DNS?  Y N or X?
If %QQ07%==y goto Q7Y
if %QQ07%==Y goto Q7Y
if %QQ07%==n goto Q8
if %QQ07%==N goto Q8
if %QQ07%==x goto End
if %QQ07%==X goto End
goto Q7
:Q7Y
ipconfig /flushdns


:Q8
Echo.
::Click the Windows menu and type 'Disk Cleanup' in the search bar to get started. The utility will offer you a choice of files to remove. Simply mark the check box next to each option. Click 'Clean up system Files' to begin. Disk Cleanup will calculate the amount of space you will save.
SET /P QQ08= Run Disk Cleanup?  Y N or X?
If %QQ08%==y goto Q8Y
if %QQ08%==Y goto Q8Y
if %QQ08%==n goto Q9
if %QQ08%==N goto Q9
if %QQ08%==x goto End
if %QQ08%==X goto End
goto Q8
:Q8Y
c:\windows\SYSTEM32\cleanmgr /d C /lowdisk


:Q9
Echo.
SET /P QQ09= Uninstall Bloatware?  Y N or X?
If %QQ09%==y goto Q9Y
if %QQ09%==Y goto Q9Y
if %QQ09%==n goto Q10
if %QQ09%==N goto Q10
if %QQ09%==x goto End
if %QQ09%==X goto End
goto Q9
:Q9Y
control appwiz.cpl


:Q10
Echo.
SET /P QQ10= Monitor=60min Sleep=Never Standby=Never Hibernate=Never?  Y N or X?
If %QQ10%==y goto Q10Y
if %QQ10%==Y goto Q10Y
if %QQ10%==n goto Q11
if %QQ10%==N goto Q11
if %QQ10%==x goto End
if %QQ10%==X goto End
goto Q10
:Q10Y
powercfg.exe -x -monitor-timeout-ac 60
powercfg.exe -x -monitor-timeout-dc 60
powercfg.exe -x -disk-timeout-ac 0
powercfg.exe -x -disk-timeout-dc 0
powercfg.exe -x -standby-timeout-ac 0
powercfg.exe -x -standby-timeout-dc 0
powercfg.exe -x -hibernate-timeout-ac 0
powercfg.exe -x -hibernate-timeout-dc 0
powercfg /SETDCVALUEINDEX SCHEME_CURRENT 2a737441-1930-4402-8d77-b2bebba308a3 48e6b7a6-50f5-4782-a5d4-53bb8f07e226 0


:Q11
Echo.
SET /P QQ11= Sync time to the Internet?  Y N or X?
If %QQ11%==y goto Q11Y
if %QQ11%==Y goto Q11Y
if %QQ11%==n goto Q12
if %QQ11%==N goto Q12
if %QQ11%==x goto End
if %QQ11%==X goto End
goto Q11
:Q11Y
net stop w32time
w32tm /unregister
w32tm /register
net start w32time
w32tm /resync


:Q12
Echo.
SET /P QQ12= Do you want Remove News and Interests Y N or X?
If %QQ12%==y goto Q12Y
if %QQ12%==Y goto Q12Y
if %QQ12%==n goto Q13
if %QQ12%==N goto Q13
if %QQ12%==x goto End
if %QQ12%==X goto End
goto Q12
:Q12Y
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Feeds" /V ShellFeedsTaskbarViewMode /T REG_DWORD /D 2 /F
REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" /V EnableFeeds /T REG_DWORD /D 0 /F


:Q13
Echo.
SET /P QQ13= Disabl Telemetry Y N or X?
If %QQ13%==y goto Q13Y
if %QQ13%==Y goto Q13Y
if %QQ13%==n goto Q14
if %QQ13%==N goto Q14
if %QQ13%==x goto End
if %QQ13%==X goto End
goto Q13
:Q13Y
REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /V AllowTelemetry /T REG_DWORD /D 0 /F


:Q14
Echo.
SET /P QQ14= Disabling Location Tracking Y N or X?
If %QQ14%==y goto Q14Y
if %QQ14%==Y goto Q14Y
if %QQ14%==n goto Q15
if %QQ14%==N goto Q15
if %QQ14%==x goto End
if %QQ14%==X goto End
goto Q14
:Q14Y
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" /V SensorPermissionState /T REG_DWORD /D 0 /F
REG ADD "HKLM\System\CurrentControlSet\Services\lfsvc\Service\Configuration" /V Status /T REG_DWORD /D 0 /F


:Q15
Echo.
SET /P QQ15= Disable IPV6 on Ethernet? Y N or X?
If %QQ15%==y goto Q15Y
if %QQ15%==Y goto Q15Y
if %QQ15%==n goto Q16
if %QQ15%==N goto Q16
if %QQ15%==x goto End
if %QQ15%==X goto End
goto Q15
:Q15Y
Echo Disable-NetAdapterBinding -Name Ethernet -ComponentID ms_tcpip6 >DisIP6.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& './DisIP6.ps1'"
ping -n 1 127.0.0.1 >nul: 2>nul:
Del DisIP6.ps1

:Q16
Echo.
SET /P QQ16= Disabl Wi-Fi Sense Y N or X?
If %QQ16%==y goto Q16Y
if %QQ16%==Y goto Q16Y
if %QQ16%==n goto Q17
if %QQ16%==N goto Q17
if %QQ16%==x goto End
if %QQ16%==X goto End
goto Q16
:Q16Y
REG ADD "HKLM\Software\Microsoft\PolicyManager\default\WiFi" /V AllowWiFiHotSpotReporting /T REG_DWORD /D 0 /F
REG ADD "HKLM\Software\Microsoft\PolicyManager\default\WiFi" /V AllowAutoConnectToWiFiSenseHotspots /T REG_DWORD /D 0 /F


:Q17
Echo.
SET /P QQ17= Restrict Windows Update P2P only to local network Y N or X?
If %QQ17%==y goto Q17Y
if %QQ17%==Y goto Q17Y
if %QQ17%==n goto Q18
if %QQ17%==N goto Q18
if %QQ17%==x goto End
if %QQ17%==X goto End
goto Q17
:Q17Y
REG ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" /V DODownloadMode /T REG_DWORD /D 1 /F
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization" /V SystemSettingsDownloadMode /T REG_DWORD /D 3 /F


:Q18
Echo.
SET /P QQ18= Disable Corana with PowerShell Y N or X?
If %QQ18%==y goto Q18Y
if %QQ18%==Y goto Q18Y
if %QQ18%==n goto Q19
if %QQ18%==N goto Q19
if %QQ18%==x goto End
if %QQ18%==X goto End
goto Q18
:Q18Y
Echo Write-Host "Disabling Cortana..." >%temp%\DisCortana.ps1
Echo If (!(Test-Path "HKCU:\Software\Microsoft\Personalization\Settings")) { >>%temp%\DisCortana.ps1
Echo New-Item -Path "HKCU:\Software\Microsoft\Personalization\Settings" -Force ^| Out-Null >>%temp%\DisCortana.ps1
Echo } >>%temp%\DisCortana.ps1
Echo Set-ItemProperty -Path "HKCU:\Software\Microsoft\Personalization\Settings" -Name "AcceptedPrivacyPolicy" -Type DWord -Value 0 >>%temp%\DisCortana.ps1
Echo If (!(Test-Path "HKCU:\Software\Microsoft\InputPersonalization")) { >>%temp%\DisCortana.ps1
Echo New-Item -Path "HKCU:\Software\Microsoft\InputPersonalization" -Force ^| Out-Null >>%temp%\DisCortana.ps1
Echo } >>%temp%\DisCortana.ps1
Echo Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Type DWord -Value 1 >>%temp%\DisCortana.ps1
Echo Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Type DWord -Value 1 >>%temp%\DisCortana.ps1
Echo If (!(Test-Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore")) { >>%temp%\DisCortana.ps1
Echo New-Item -Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore" -Force ^| Out-Null >>%temp%\DisCortana.ps1
Echo } >>%temp%\DisCortana.ps1
Echo Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts" -Type DWord -Value 0 >>%temp%\DisCortana.ps1
::
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& './%temp%\DisCortana.ps1'"
ping -n 2 127.0.0.1 >nul: 2>nul:
Del %temp%\DisCortana.ps1


:Q19
Echo.
SET /P QQ19= Uninstall Default apps with PowerShell  Y N or X?
If %QQ19%==y goto Q19Y
if %QQ19%==Y goto Q19Y
if %QQ19%==n goto Q20
if %QQ19%==N goto Q20
if %QQ19%==x goto End
if %QQ19%==X goto End
goto Q19
:Q19Y
Echo If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")) { >%temp%\UnInst.ps1
Echo Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs >>%temp%\UnInst.ps1
Echo Exit >>%temp%\UnInst.ps1
Echo } >>%temp%\UnInst.ps1
Echo Write-Output "Uninstalling default apps" >>%temp%\UnInst.ps1
Echo $apps = @( >>%temp%\UnInst.ps1
Echo     # default Windows 10 apps >>%temp%\UnInst.ps1
Echo     "Microsoft.3DBuilder" >>%temp%\UnInst.ps1
Echo     "Microsoft.Advertising.Xaml" >>%temp%\UnInst.ps1
Echo     #"Microsoft.Appconnector" >>%temp%\UnInst.ps1
Echo     "Microsoft.BingFinance" >>%temp%\UnInst.ps1
Echo     "Microsoft.BingNews" >>%temp%\UnInst.ps1
Echo     "Microsoft.BingSports" >>%temp%\UnInst.ps1
Echo     "Microsoft.BingTranslator" >>%temp%\UnInst.ps1
Echo     "Microsoft.BingWeather" >>%temp%\UnInst.ps1
Echo     #"Microsoft.FreshPaint" >>%temp%\UnInst.ps1
Echo     "Microsoft.GamingServices" >>%temp%\UnInst.ps1
Echo     "Microsoft.Microsoft3DViewer" >>%temp%\UnInst.ps1
Echo     "Microsoft.WindowsFeedbackHub" >>%temp%\UnInst.ps1
Echo     "Microsoft.MicrosoftOfficeHub" >>%temp%\UnInst.ps1
Echo     "Microsoft.MixedReality.Portal" >>%temp%\UnInst.ps1
Echo     "Microsoft.MicrosoftPowerBIForWindows" >>%temp%\UnInst.ps1
Echo     "Microsoft.MicrosoftSolitaireCollection" >>%temp%\UnInst.ps1
Echo     #"Microsoft.MicrosoftStickyNotes" >>%temp%\UnInst.ps1
Echo     "Microsoft.MinecraftUWP" >>%temp%\UnInst.ps1
Echo     "Microsoft.NetworkSpeedTest" >>%temp%\UnInst.ps1
Echo     "Microsoft.Office.OneNote" >>%temp%\UnInst.ps1
Echo     "Microsoft.People" >>%temp%\UnInst.ps1
Echo     "Microsoft.Print3D" >>%temp%\UnInst.ps1
Echo     "Microsoft.SkypeApp" >>%temp%\UnInst.ps1
Echo     "Microsoft.Wallet" >>%temp%\UnInst.ps1
Echo     # "Microsoft.Windows.Photos" >>%temp%\UnInst.ps1
Echo     # "Microsoft.WindowsAlarms" >>%temp%\UnInst.ps1
Echo     # "Microsoft.WindowsCalculator" >>%temp%\UnInst.ps1
Echo     # "Microsoft.WindowsCamera" >>%temp%\UnInst.ps1
Echo     #"microsoft.windowscommunicationsapps" >>%temp%\UnInst.ps1
Echo     "Microsoft.WindowsMaps" >>%temp%\UnInst.ps1
Echo     "Microsoft.WindowsPhone" >>%temp%\UnInst.ps1
Echo     #"Microsoft.WindowsSoundRecorder" >>%temp%\UnInst.ps1
Echo     #"Microsoft.WindowsStore"   # can't be re-installed >>%temp%\UnInst.ps1
Echo     "Microsoft.Xbox.TCUI" >>%temp%\UnInst.ps1
Echo     "Microsoft.XboxApp" >>%temp%\UnInst.ps1
Echo     "Microsoft.XboxGameOverlay" >>%temp%\UnInst.ps1
Echo     "Microsoft.XboxGamingOverlay" >>%temp%\UnInst.ps1
Echo     "Microsoft.XboxSpeechToTextOverlay" >>%temp%\UnInst.ps1
Echo     "Microsoft.YourPhone" >>%temp%\UnInst.ps1
Echo     "Microsoft.ZuneMusic" >>%temp%\UnInst.ps1
Echo     "Microsoft.ZuneVideo" >>%temp%\UnInst.ps1
Echo     "Microsoft.Windows.CloudExperienceHost" >>%temp%\UnInst.ps1
Echo     "Microsoft.Windows.ContentDeliveryManager" >>%temp%\UnInst.ps1
Echo     "Microsoft.Windows.PeopleExperienceHost" >>%temp%\UnInst.ps1
Echo     "Microsoft.XboxGameCallableUI" >>%temp%\UnInst.ps1
Echo.  >>%temp%\UnInst.ps1
Echo     # Threshold 2 apps >>%temp%\UnInst.ps1
Echo     "Microsoft.CommsPhone" >>%temp%\UnInst.ps1
Echo     #"Microsoft.ConnectivityStore" >>%temp%\UnInst.ps1
Echo     #"Microsoft.GetHelp" >>%temp%\UnInst.ps1
Echo     "Microsoft.Getstarted" >>%temp%\UnInst.ps1
Echo     "Microsoft.Messaging" >>%temp%\UnInst.ps1
Echo     "Microsoft.Office.Sway" >>%temp%\UnInst.ps1
Echo     #"Microsoft.OneConnect" >>%temp%\UnInst.ps1
Echo     "Microsoft.WindowsFeedbackHub" >>%temp%\UnInst.ps1
Echo.  >>%temp%\UnInst.ps1
Echo     # Creators Update apps >>%temp%\UnInst.ps1
Echo     "Microsoft.Microsoft3DViewer" >>%temp%\UnInst.ps1
Echo     #"Microsoft.MSPaint" >>%temp%\UnInst.ps1
Echo.  >>%temp%\UnInst.ps1
Echo     #Redstone apps >>%temp%\UnInst.ps1
Echo     "Microsoft.BingFoodAndDrink" >>%temp%\UnInst.ps1
Echo     "Microsoft.BingHealthAndFitness" >>%temp%\UnInst.ps1
Echo     "Microsoft.BingTravel" >>%temp%\UnInst.ps1
Echo     "Microsoft.WindowsReadingList" >>%temp%\UnInst.ps1
Echo.  >>%temp%\UnInst.ps1
Echo     # Redstone 5 apps >>%temp%\UnInst.ps1
Echo     "Microsoft.MixedReality.Portal" >>%temp%\UnInst.ps1
Echo     "Microsoft.ScreenSketch" >>%temp%\UnInst.ps1
Echo     "Microsoft.XboxGamingOverlay" >>%temp%\UnInst.ps1
Echo     "Microsoft.YourPhone" >>%temp%\UnInst.ps1
Echo.  >>%temp%\UnInst.ps1
Echo     # non-Microsoft >>%temp%\UnInst.ps1
Echo     #"2FE3CB00.PicsArt-PhotoStudio" >>%temp%\UnInst.ps1
Echo     #"46928bounde.EclipseManager" >>%temp%\UnInst.ps1
Echo     "4DF9E0F8.Netflix" >>%temp%\UnInst.ps1
Echo     "613EBCEA.PolarrPhotoEditorAcademicEdition" >>%temp%\UnInst.ps1
Echo     "6Wunderkinder.Wunderlist" >>%temp%\UnInst.ps1
Echo     #"7EE7776C.LinkedInforWindows" >>%temp%\UnInst.ps1
Echo     "89006A2E.AutodeskSketchBook" >>%temp%\UnInst.ps1
Echo     "9E2F88E3.Twitter" >>%temp%\UnInst.ps1
Echo     "A278AB0D.DisneyMagicKingdoms" >>%temp%\UnInst.ps1
Echo     "A278AB0D.MarchofEmpires" >>%temp%\UnInst.ps1
Echo     "ActiproSoftwareLLC.562882FEEB491" # next one is for the Code Writer from Actipro Software LLC >>%temp%\UnInst.ps1
Echo     "CAF9E577.Plex"   >>%temp%\UnInst.ps1
Echo     "ClearChannelRadioDigital.iHeartRadio" >>%temp%\UnInst.ps1
Echo     "D52A8D61.FarmVille2CountryEscape" >>%temp%\UnInst.ps1
Echo     #"D5EA27B7.Duolingo-LearnLanguagesforFree" >>%temp%\UnInst.ps1
Echo     "DB6EA5DB.CyberLinkMediaSuiteEssentials" >>%temp%\UnInst.ps1
Echo     #"DolbyLaboratories.DolbyAccess" >>%temp%\UnInst.ps1
Echo     #"DolbyLaboratories.DolbyAccess" >>%temp%\UnInst.ps1
Echo     "Drawboard.DrawboardPDF" >>%temp%\UnInst.ps1
Echo     "Facebook.Facebook" >>%temp%\UnInst.ps1
Echo     "Fitbit.FitbitCoach" >>%temp%\UnInst.ps1
Echo     "Flipboard.Flipboard" >>%temp%\UnInst.ps1
Echo     "GAMELOFTSA.Asphalt8Airborne" >>%temp%\UnInst.ps1
Echo     "KeeperSecurityInc.Keeper" >>%temp%\UnInst.ps1
Echo     "NORDCURRENT.COOKINGFEVER" >>%temp%\UnInst.ps1
Echo     "PandoraMediaInc.29680B314EFC2" >>%temp%\UnInst.ps1
Echo     "Playtika.CaesarsSlotsFreeCasino" >>%temp%\UnInst.ps1
Echo     "ShazamEntertainmentLtd.Shazam" >>%temp%\UnInst.ps1
Echo     "SlingTVLLC.SlingTV" >>%temp%\UnInst.ps1
Echo     "SpotifyAB.SpotifyMusic" >>%temp%\UnInst.ps1
Echo     "TheNewYorkTimes.NYTCrossword" >>%temp%\UnInst.ps1
Echo     "ThumbmunkeysLtd.PhototasticCollage" >>%temp%\UnInst.ps1
Echo     "TuneIn.TuneInRadio" >>%temp%\UnInst.ps1
Echo     "WinZipComputing.WinZipUniversal" >>%temp%\UnInst.ps1
Echo     "XINGAG.XING" >>%temp%\UnInst.ps1
Echo     "flaregamesGmbH.RoyalRevolt2" >>%temp%\UnInst.ps1
Echo     "king.com.*" >>%temp%\UnInst.ps1
Echo     "king.com.BubbleWitch3Saga" >>%temp%\UnInst.ps1
Echo     "king.com.CandyCrushSaga" >>%temp%\UnInst.ps1
Echo     "king.com.CandyCrushSodaSaga" >>%temp%\UnInst.ps1
Echo.  >>%temp%\UnInst.ps1
Echo     # apps which cannot be removed using Remove-AppxPackage >>%temp%\UnInst.ps1
Echo     #"Microsoft.BioEnrollment" >>%temp%\UnInst.ps1
Echo     #"Microsoft.MicrosoftEdge" >>%temp%\UnInst.ps1
Echo     #"Microsoft.Windows.Cortana" >>%temp%\UnInst.ps1
Echo     #"Microsoft.WindowsFeedback" >>%temp%\UnInst.ps1
Echo     #"Microsoft.XboxGameCallableUI" >>%temp%\UnInst.ps1
Echo     #"Microsoft.XboxIdentityProvider" >>%temp%\UnInst.ps1
Echo     #"Windows.ContactSupport" >>%temp%\UnInst.ps1
Echo.  >>%temp%\UnInst.ps1
Echo     # apps which other apps depend on >>%temp%\UnInst.ps1
Echo     "Microsoft.Advertising.Xaml" >>%temp%\UnInst.ps1
Echo ) >>%temp%\UnInst.ps1
Echo.  >>%temp%\UnInst.ps1
Echo foreach ($app in $apps) { >>%temp%\UnInst.ps1
Echo     Write-Output "Trying to remove $app" >>%temp%\UnInst.ps1
Echo.  >>%temp%\UnInst.ps1
Echo     Get-AppxPackage -Name $app -AllUsers ^| Remove-AppxPackage -AllUsers >>%temp%\UnInst.ps1
Echo.  >>%temp%\UnInst.ps1
Echo     Get-AppXProvisionedPackage -Online ^| >>%temp%\UnInst.ps1
Echo         Where-Object DisplayName -EQ $app ^| >>%temp%\UnInst.ps1
Echo         Remove-AppxProvisionedPackage -Online >>%temp%\UnInst.ps1
Echo } >>%temp%\UnInst.ps1
Echo.
::
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& './%temp%\UnInst.ps1'"
ping -n 2 127.0.0.1 >nul: 2>nul:
Del %temp%\UnInst.ps1


:Q20
:: ***********************
goto Q26
:: ***********************
Echo.
SET /P QQ20= ******Question***** Y N or X?
If %QQ20%==y goto Q20Y
if %QQ20%==Y goto Q20Y
if %QQ20%==n goto Q21
if %QQ20%==N goto Q21
if %QQ20%==x goto End
if %QQ20%==X goto End
goto Q20
:Q20Y
RUN***RUN***RUN***

:Q21
Echo.
SET /P QQ21= ******Question***** Y N or X?
If %QQ21%==y goto Q21Y
if %QQ21%==Y goto Q21Y
if %QQ21%==n goto Q22
if %QQ21%==N goto Q22
if %QQ21%==x goto End
if %QQ21%==X goto End
goto Q21
:Q21Y
RUN***RUN***RUN***

:Q22
Echo.
SET /P QQ22= ******Question***** Y N or X?
If %QQ22%==y goto Q22Y
if %QQ22%==Y goto Q22Y
if %QQ22%==n goto Q23
if %QQ22%==N goto Q23
if %QQ22%==x goto End
if %QQ22%==X goto End
goto Q22
:Q22Y
RUN***RUN***RUN***

:Q23
Echo.
SET /P QQ23= ******Question***** Y N or X?
If %QQ23%==y goto Q23Y
if %QQ23%==Y goto Q23Y
if %QQ23%==n goto Q24
if %QQ23%==N goto Q24
if %QQ23%==x goto End
if %QQ23%==X goto End
goto Q23
:Q23Y
RUN***RUN***RUN***

:Q24
Echo.
SET /P QQ24= ******Question***** Y N or X?
If %QQ24%==y goto Q24Y
if %QQ24%==Y goto Q24Y
if %QQ24%==n goto Q25
if %QQ24%==N goto Q25
if %QQ24%==x goto End
if %QQ24%==X goto End
goto Q24
:Q24Y
RUN***RUN***RUN***

:Q25
Echo.
SET /P QQ25= ******Question***** Y N or X?
If %QQ25%==y goto Q25Y
if %QQ25%==Y goto Q25Y
if %QQ25%==n goto Q26
if %QQ25%==N goto Q26
if %QQ25%==x goto End
if %QQ25%==X goto End
goto Q25
:Q25Y
RUN***RUN***RUN***

:Q26
Echo.
SET /P QQ26= Reset the TCPIP stack Y N or X?
If %QQ26%==y goto Q26Y
if %QQ26%==Y goto Q26Y
if %QQ26%==n goto Q27
if %QQ26%==N goto Q27
if %QQ26%==x goto End
if %QQ26%==X goto End
goto Q26
:Q26Y
netsh winsock reset
netsh int ip reset
ipconfig /release
ipconfig /renew
ipconfig /flushdns


:Q27
Echo.
SET /P QQ27= Install Russian Language  Y N or X?
if %QQ27%==y goto Q27Y
if %QQ27%==Y goto Q27Y
if %QQ27%==n goto Q28
if %QQ27%==N goto Q28
if %QQ27%==x goto End
if %QQ27%==X goto End
goto Q27
:Q27Y
Echo $LanguageList = Get-WinUserLanguageList >%temp%\InstRuss.ps1
Echo $LanguageList.Add("ru") >>%temp%\InstRuss.ps1
Echo Set-WinUserLanguageList $LanguageList -Confirm:$False >>%temp%\InstRuss.ps1
::
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& './%temp%\InstRuss.ps1'"
ping -n 2 127.0.0.1 >nul: 2>nul:
Del %temp%\InstRuss.ps1

:Q28
Echo.
SET /P QQ28= Enable System Restore and set to 20 GB Y N or X?
If %QQ28%==y goto Q28Y
if %QQ28%==Y goto Q28Y
if %QQ28%==n goto Q30
if %QQ28%==N goto Q30
if %QQ28%==x goto End
if %QQ28%==X goto End
goto Q28
:Q28Y
Echo Enable-ComputerRestore -Drive "C:\" >"%TEMP%\SysResto.ps1"
Echo vssadmin resize shadowstorage /On=%SystemDrive% /For=%SystemDrive% /Maxsize=20GB >>"%TEMP%\SysResto.ps1"
::
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& './%temp%\SysResto.ps1'"
ping -n 2 127.0.0.1 >nul: 2>nul:
Del "%temp%\SysResto.ps1"


:Q30
Echo.
SET /P QQ30= Do you want to scan the Windows System Files for Corruption  Y N or X?
If %QQ30%==y goto Q30Y
if %QQ30%==Y goto Q30Y
if %QQ30%==n goto End
if %QQ30%==N goto End
if %QQ30%==x goto End
if %QQ30%==X goto End
goto Q30
:Q30Y
DISM /Online /Cleanup-Image /CheckHealth
DISM /Online /Cleanup-Image /ScanHealth
DISM /Online /Cleanup-Image /RestoreHealth /Source:repairSource\install.wim
sfc /scannow


:End
Color 71
Echo.
Echo   Started: %Day%-%Month%-%Year%  %StartTime%
Set Year=%date:~10,4%
Set Month=%date:~4,2%
Set Day=%date:~7,2%
Set EndTime=%Time:~0,5%
Echo Completed: %Day%-%Month%-%Year%  %EndTime%
Echo.
Echo You should restart Windows now.
Echo.
Echo         Thank you!
Echo.
Pause

Powershell script to clean Windows 10

The following is a PowerShell script clean-up Windows 10. I wrote this for Windows 10 Pro computers in a work environment that need to get the most performance, and eliminate a lot of the build-in crap, and get as much privacy as possible.

Read the script and edit what you would like to change before you run it.

Run at your own risk, I don’t take any responsibility.

##########
# Win10 Optimize
# Author: Jeff 
# Updated: 07/12/2021
##########

# If this does not run, run the following command to allow PowerShell scripts
#Set-ExecutionPolicy Unrestricted -Force

#This will self elevate the script so with a UAC prompt since this script needs to be run as an Administrator in order to function properly.
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) {
    Write-Host "You didn't run this script as an Administrator. This script will self elevate to run as an Administrator and continue."
    Start-Process powershell.exe -ArgumentList ("-NoProfile -ExecutionPolicy Bypass -File `"{0}`"" -f $PSCommandPath) -Verb RunAs
    Exit
}


##########
# Power
##########

# Set power to High
& powercfg.exe -x -monitor-timeout-ac 60
& powercfg.exe -x -monitor-timeout-dc 60
& powercfg.exe -x -disk-timeout-ac 0
& powercfg.exe -x -disk-timeout-dc 0
& powercfg.exe -x -standby-timeout-ac 0
& powercfg.exe -x -standby-timeout-dc 0
& powercfg.exe -x -hibernate-timeout-ac 0
& powercfg.exe -x -hibernate-timeout-dc 0
# Disable USB Selective Suspend 
& powercfg /SETDCVALUEINDEX SCHEME_CURRENT 2a737441-1930-4402-8d77-b2bebba308a3 48e6b7a6-50f5-4782-a5d4-53bb8f07e226 0
# Disable hibernation/sleep
Start-Process 'powercfg.exe' -Verb runAs -ArgumentList '/h off'
# Disable Connected Standby (CSEnabled)
Set-ItemProperty -Path "HKLM:\SYSTEM\\CurrentControlSet\Control\Power" -Name "CSEnabled" -Type DWord -Value 0

##########
# Ninite Apps
##########
# A # in front means it won't install
$niniteapps = @(
    # ".net4.7",
    "7zip",
    # "adaware",
    # "aimp",
    # "air",
    # "audacity",
    # "avast",
    # "avg",
    # "avira",
    # "cccp",
    # "cdburnerxp",
    "chrome"
    # "classicstart",
    # "cutepdf",
    # "dropbox",
    # "eclipse",
    # "emule",
    # "essentials",
    # "evernote",
    # "everything",
    # "faststone",
    # "filezilla",
    # "firefox",
    # "foobar",
    # "foxit",
    # "gimp",
    # "glary",
    # "gom",
    # "googledrive",
    # "googleearth",
    # "greenshot",
    # "handbrake",
    # "imgburn",
    # "infrarecorder",
    # "inkscape",
    # "irfanview",
    # "itunes",
    # "java8",
    # "jdk8",
    # "jdkx8",
    # "keepass2",
    # "klitecodecs",
    # "launchy",
    # "libreoffice",
    # "malwarebytes",
    # "mediamonkey",
    # "mozy",
    # "musicbee",
    # "notepadplusplus",
    # "nvda",
    # "onedrive",
    # "openoffice",
    # "operaChromium",
    # "paint.net",
    # "pdfcreator",
    # "peazip",
    # "pidgin",
    # "putty",
    # "python",
    # "qbittorrent",
    # "realvnc",
    # "revo",
    # "shockwave",
    # "silverlight",
    # "skype",
    # "spotify",
    # "spybot2",
    # "steam",
    # "sugarsync",
    # "sumatrapdf",
    # "super",
    # "teamviewer12",
    # "teracopy",
    # "thunderbird",
    # "trillian",
    # "vlc",
    # "vscode",
    # "winamp",
    # "windirstat",
    # "winmerge",
    # "winrar",
    # "winscp",
    # "xnview"
)

# Download ninite and install the selected apps
Write-Host "Downloading Ninite ..."
    
$ofs = '-'
$niniteurl = "https://ninite.com/" + $niniteapps + "/ninite.exe"
$output = "C:\Ninite.exe"
   
Invoke-WebRequest $niniteurl -OutFile $output
& $output

Write-Host
Read-Host "Press ENTER when all applications have been installed by Ninite"

# Old Version to Install 7 Zip and Chrome from NiNite
# & $USBDrive'\\Build\\RunMe\\Ninite 7Zip Installer.exe'
# & $USBDrive'\\Build\\RunMe\\Ninite Chrome Installer.exe'

##########
# Disable Scheduled Tasks
##########

Disable-ScheduledTask -TaskName "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\Application Experience\ProgramDataUpdater"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\Application Experience\StartupAppTask"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\Customer Experience Improvement Program\Consolidator"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip"
# Disable-ScheduledTask -TaskName "\Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticResolver"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\Maps\MapsToastTask"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\Maps\MapsUpdateTask"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\Shell\FamilySafetyMonitor"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\WDI\ResolutionHost"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\Windows Media Sharing\UpdateLibrary"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\Autochk\Proxy"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\CloudExperienceHost\CreateObjectTask"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\Feedback\Siuf\DmClient"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\Feedback\Siuf\DmClientOnScenarioDownload"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\Shell\FamilySafetyRefreshTask"
Disable-ScheduledTask -TaskName "\Microsoft\Windows\Windows Error Reporting\QueueReporting"
Disable-ScheduledTask -TaskName "\Microsoft\XblGameSave\XblGameSaveTask"

##########
# Privacy Settings
##########

# Disable Sharing Wizzard
Set-ItemProperty -Path "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "SharingWizardOn" -Type DWord -Value 0

# Disable Telemetry
Write-Host "Disabling Telemetry..."
Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0

# Disable Wi-Fi Sense
Write-Host "Disabling Wi-Fi Sense..."
If (!(Test-Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting")) {
New-Item -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Force | Out-Null
}
Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" -Name "Value" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" -Name "Value" -Type DWord -Value 0

# Disable SmartScreen Filter
Write-Host "Disabling SmartScreen Filter..."
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "SmartScreenEnabled" -Type String -Value "Off"
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AppHost" -Name "EnableWebContentEvaluation" -Type DWord -Value 0

# Disable Bing Search in Start Menu
Write-Host "Disabling Bing Search in Start Menu..."
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "BingSearchEnabled" -Type DWord -Value 0

# Disable Location Tracking
Write-Host "Disabling Location Tracking..."
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" -Name "SensorPermissionState" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\lfsvc\Service\Configuration" -Name "Status" -Type DWord -Value 0

# Disable Feedback
Write-Host "Disabling Feedback..."
If (!(Test-Path "HKCU:\Software\Microsoft\Siuf\Rules")) {
New-Item -Path "HKCU:\Software\Microsoft\Siuf\Rules" -Force | Out-Null
}
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Siuf\Rules" -Name "NumberOfSIUFInPeriod" -Type DWord -Value 0

# Disable Advertising ID
Write-Host "Disabling Advertising ID..."
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo")) {
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" | Out-Null
}
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -Type DWord -Value 0

# Disable Cortana
Write-Host "Disabling Cortana..."
If (!(Test-Path "HKCU:\Software\Microsoft\Personalization\Settings")) {
New-Item -Path "HKCU:\Software\Microsoft\Personalization\Settings" -Force | Out-Null
}
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Personalization\Settings" -Name "AcceptedPrivacyPolicy" -Type DWord -Value 0
If (!(Test-Path "HKCU:\Software\Microsoft\InputPersonalization")) {
New-Item -Path "HKCU:\Software\Microsoft\InputPersonalization" -Force | Out-Null
}
Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Type DWord -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Type DWord -Value 1
If (!(Test-Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore")) {
New-Item -Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore" -Force | Out-Null
}
Set-ItemProperty -Path "HKCU:\Software\Microsoft\InputPersonalization\TrainedDataStore" -Name "HarvestContacts" -Type DWord -Value 0

# Remove AutoLogger file and restrict directory
Write-Host "Removing AutoLogger file and restricting directory..."
$autoLoggerDir = "$env:PROGRAMDATA\Microsoft\Diagnosis\ETLLogs\AutoLogger"
If (Test-Path "$autoLoggerDir\AutoLogger-Diagtrack-Listener.etl") {
Remove-Item "$autoLoggerDir\AutoLogger-Diagtrack-Listener.etl"
}
icacls $autoLoggerDir /deny SYSTEM:`(OI`)`(CI`)F | Out-Null

# Stop and disable Diagnostics Tracking Service
Write-Host "Stopping and disabling Diagnostics Tracking Service..."
Stop-Service "DiagTrack"
Set-Service "DiagTrack" -StartupType Disabled

##########
# Service Tweaks
##########

# Remove Password Age Limit (Passwords never expire) #
net accounts /maxpwage:0

# Set to Eastern time zone
Set-TimeZone "Eastern Standard Time"

# Sync time to Internet 
net stop w32time
w32tm /unregister
w32tm /register
net start w32time
w32tm /resync

# Enable Auto Maintenance
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\" -Name "Maintenance" -Type DWord -Value 0

# Enable System Restore
Enable-ComputerRestore -Drive "C:\"

# Set the Restere Storage Size
vssadmin resize shadowstorage /On=%SystemDrive% /For=%SystemDrive% /Maxsize=20GB

# Enable sharing mapped drives between users
Write-Host "Enabling sharing mapped drives between users..."
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLinkedConnections" -Type DWord -Value 1

# Restrict Windows Update P2P only to local network
Write-Host "Restricting Windows Update P2P only to local network..."
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -Type DWord -Value 1
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization")) {
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization" | Out-Null
}
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\DeliveryOptimization" -Name "SystemSettingsDownloadMode" -Type DWord -Value 3

##########
# UI Tweaks
##########

# Show all tray icons
Write-Host "Showing all tray icons..."
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "EnableAutoTray" -Type DWord -Value 0

# Show known file extensions
Write-Host "Showing known file extensions..."
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 0

# Change default Explorer view to "Computer"
Write-Host "Changing default Explorer view to `"Computer`"..."
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" -Type DWord -Value 1

# Remove Music icon from computer namespace
Write-Host "Removing Music icon from computer namespace..."
Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}" -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}" -Recurse -ErrorAction SilentlyContinue

# Add Desktop Icons
$registryPath1 = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu"
$registryPath2 = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel"
# Value of 0 = Added to Desktop : 1 = Remove from Desktop
$value = 0
#
$Names = @(
    # This PC
    "{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
    # Contol Panel
    #"{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}"
    # Network
    "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"
    # Recycle Bin
    "{645FF040-5081-101B-9F08-00AA002F954E}"
    # Users Files
    "{59031a47-3f72-44a7-89c5-5595fe6b30ee}"
)
#
foreach ($Name in $Names) {
    IF(!(Test-Path $registryPath1))   {
        New-Item -Path $registryPath1 -Force | Out-Null
        New-ItemProperty -Path $registryPath1 -Name $name -PropertyType DWORD -Value $value -Force | Out-Null
    }
    ELSE   {
        New-ItemProperty -Path $registryPath1 -Name $name -PropertyType DWORD -Value $value -Force | Out-Null
    }
    Pop-Location
    #
    IF(!(Test-Path $registryPath2))   {
        New-Item -Path $registryPath2 -Force | Out-Null
        New-ItemProperty -Path $registryPath2 -Name $name -PropertyType DWORD -Value $value -Force | Out-Null
    }
    ELSE   {
        New-ItemProperty -Path $registryPath2 -Name $name -PropertyType DWORD -Value $value -Force | Out-Null
    }
    Pop-Location
}

##########
# Remove unwanted applications
##########

# Disable OneDrive
Write-Host "Disabling OneDrive..."
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive")) {
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" | Out-Null
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Name "DisableFileSyncNGSC" -Type DWord -Value 1

# Set Photo Viewer as default for bmp, gif, jpg and png
Write-Host "Setting Photo Viewer as default for bmp, gif, jpg, png and tif..."
If (!(Test-Path "HKCR:")) {
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
}
ForEach ($type in @("Paint.Picture", "giffile", "jpegfile", "pngfile")) {
New-Item -Path $("HKCR:\$type\shell\open") -Force | Out-Null
New-Item -Path $("HKCR:\$type\shell\open\command") | Out-Null
Set-ItemProperty -Path $("HKCR:\$type\shell\open") -Name "MuiVerb" -Type ExpandString -Value "@%ProgramFiles%\Windows Photo Viewer\photoviewer.dll,-3043"
Set-ItemProperty -Path $("HKCR:\$type\shell\open\command") -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1"
}

# Show Photo Viewer in "Open with..."
Write-Host "Showing Photo Viewer in `"Open with...`""
If (!(Test-Path "HKCR:")) {
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
}
New-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open\command" -Force | Out-Null
New-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open\DropTarget" -Force | Out-Null
Set-ItemProperty -Path "HKCR:\Applications\photoviewer.dll\shell\open" -Name "MuiVerb" -Type String -Value "@photoviewer.dll,-3043"
Set-ItemProperty -Path "HKCR:\Applications\photoviewer.dll\shell\open\command" -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1"
Set-ItemProperty -Path "HKCR:\Applications\photoviewer.dll\shell\open\DropTarget" -Name "Clsid" -Type String -Value "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}"

# This script disables unwanted Windows services. If you do not want to disable
# certain services comment out the corresponding lines below.
$services = @(
    "diagnosticshub.standardcollector.service" # Microsoft (R) Diagnostics Hub Standard Collector Service
    "DiagTrack"                                # Diagnostics Tracking Service
    "dmwappushservice"                         # WAP Push Message Routing Service (see known issues)
    "lfsvc"                                    # Geolocation Service
    "MapsBroker"                               # Downloaded Maps Manager
    "NetTcpPortSharing"                        # Net.Tcp Port Sharing Service
    # "RemoteAccess"                           # Routing and Remote Access
    # "RemoteRegistry"                         # Remote Registry
    # "SharedAccess"                           # Internet Connection Sharing (ICS)
    "TrkWks"                                   # Distributed Link Tracking Client
    # "WbioSrvc"                               # Windows Biometric Service (required for Fingerprint reader / facial detection)
    #"WlanSvc"                                 # WLAN AutoConfig
    "WMPNetworkSvc"                            # Windows Media Player Network Sharing Service
    #"wscsvc"                                  # Windows Security Center Service
    #"WSearch"                                 # Windows Search
    "XblAuthManager"                           # Xbox Live Auth Manager
    "XblGameSave"                              # Xbox Live Game Save Service
    "XboxNetApiSvc"                            # Xbox Live Networking Service
    "ndu"                                      # Windows Network Data Usage Monitor
    # Services which cannot be disabled
    #"WdNisSvc"
)

foreach ($service in $services) {
    Write-Output "Trying to disable $service"
    Get-Service -Name $service | Set-Service -StartupType Disabled
}

#   Description:
# This script optimizes Windows updates by disabling automatic download and
# seeding updates to other computers.
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\New-FolderForced.psm1
Write-Output "Disable seeding of updates to other computers via Group Policies"
New-FolderForced -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization"
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" "DODownloadMode" 0


# This script removes unwanted Apps that come with Windows. If you  do not want
# to remove certain Apps comment out the corresponding lines below.
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\take-own.psm1
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\New-FolderForced.psm1

Write-Output "Elevating privileges for this process"
do {} until (Elevate-Privileges SeTakeOwnershipPrivilege)

Write-Output "Uninstalling default apps"
$apps = @(
    # default Windows 10 apps
    "Microsoft.3DBuilder"
    "Microsoft.Advertising.Xaml"
    "Microsoft.Appconnector"
    "Microsoft.BingFinance"
    "Microsoft.BingNews"
    "Microsoft.BingSports"
    "Microsoft.BingTranslator"
    "Microsoft.BingWeather"
    #"Microsoft.FreshPaint"
    "Microsoft.GamingServices"
    "Microsoft.Microsoft3DViewer"
    "Microsoft.WindowsFeedbackHub"
    "Microsoft.MicrosoftOfficeHub"
    "Microsoft.MixedReality.Portal"
    "Microsoft.MicrosoftPowerBIForWindows"
    "Microsoft.MicrosoftSolitaireCollection"
    #"Microsoft.MicrosoftStickyNotes"
    "Microsoft.MinecraftUWP"
    "Microsoft.NetworkSpeedTest"
    "Microsoft.Office.OneNote"
    "Microsoft.People"
    "Microsoft.Print3D"
    "Microsoft.SkypeApp"
    "Microsoft.Wallet"
    # "Microsoft.Windows.Photos"
    # "Microsoft.WindowsAlarms"
    # "Microsoft.WindowsCalculator"
    # "Microsoft.WindowsCamera"
    "microsoft.windowscommunicationsapps"
    "Microsoft.WindowsMaps"
    "Microsoft.WindowsPhone"
    "Microsoft.WindowsSoundRecorder"
    #"Microsoft.WindowsStore"   # can't be re-installed
    "Microsoft.Xbox.TCUI"
    "Microsoft.XboxApp"
    "Microsoft.XboxGameOverlay"
    "Microsoft.XboxGamingOverlay"
    "Microsoft.XboxSpeechToTextOverlay"
    "Microsoft.YourPhone"
    "Microsoft.ZuneMusic"
    "Microsoft.ZuneVideo"
    "Microsoft.Windows.CloudExperienceHost"
    "Microsoft.Windows.ContentDeliveryManager"
    "Microsoft.Windows.PeopleExperienceHost"
    "Microsoft.XboxGameCallableUI"

    # Threshold 2 apps
    "Microsoft.CommsPhone"
    "Microsoft.ConnectivityStore"
    "Microsoft.GetHelp"
    "Microsoft.Getstarted"
    "Microsoft.Messaging"
    "Microsoft.Office.Sway"
    "Microsoft.OneConnect"
    "Microsoft.WindowsFeedbackHub"

    # Creators Update apps
    "Microsoft.Microsoft3DViewer"
    #"Microsoft.MSPaint"

    #Redstone apps
    "Microsoft.BingFoodAndDrink"
    "Microsoft.BingHealthAndFitness"
    "Microsoft.BingTravel"
    "Microsoft.WindowsReadingList"

    # Redstone 5 apps
    "Microsoft.MixedReality.Portal"
    "Microsoft.ScreenSketch"
    "Microsoft.XboxGamingOverlay"
    "Microsoft.YourPhone"

    # non-Microsoft
    "2FE3CB00.PicsArt-PhotoStudio"
    "46928bounde.EclipseManager"
    "4DF9E0F8.Netflix"
    "613EBCEA.PolarrPhotoEditorAcademicEdition"
    "6Wunderkinder.Wunderlist"
    "7EE7776C.LinkedInforWindows"
    "89006A2E.AutodeskSketchBook"
    "9E2F88E3.Twitter"
    "A278AB0D.DisneyMagicKingdoms"
    "A278AB0D.MarchofEmpires"
    "ActiproSoftwareLLC.562882FEEB491" # next one is for the Code Writer from Actipro Software LLC
    "CAF9E577.Plex"  
    "ClearChannelRadioDigital.iHeartRadio"
    "D52A8D61.FarmVille2CountryEscape"
    "D5EA27B7.Duolingo-LearnLanguagesforFree"
    "DB6EA5DB.CyberLinkMediaSuiteEssentials"
    "DolbyLaboratories.DolbyAccess"
    "DolbyLaboratories.DolbyAccess"
    "Drawboard.DrawboardPDF"
    "Facebook.Facebook"
    "Fitbit.FitbitCoach"
    "Flipboard.Flipboard"
    "GAMELOFTSA.Asphalt8Airborne"
    "KeeperSecurityInc.Keeper"
    "NORDCURRENT.COOKINGFEVER"
    "PandoraMediaInc.29680B314EFC2"
    "Playtika.CaesarsSlotsFreeCasino"
    "ShazamEntertainmentLtd.Shazam"
    "SlingTVLLC.SlingTV"
    "SpotifyAB.SpotifyMusic"
    "TheNewYorkTimes.NYTCrossword"
    "ThumbmunkeysLtd.PhototasticCollage"
    "TuneIn.TuneInRadio"
    "WinZipComputing.WinZipUniversal"
    "XINGAG.XING"
    "flaregamesGmbH.RoyalRevolt2"
    "king.com.*"
    "king.com.BubbleWitch3Saga"
    "king.com.CandyCrushSaga"
    "king.com.CandyCrushSodaSaga"

    # apps which cannot be removed using Remove-AppxPackage
    #"Microsoft.BioEnrollment"
    #"Microsoft.MicrosoftEdge"
    #"Microsoft.Windows.Cortana"
    #"Microsoft.WindowsFeedback"
    #"Microsoft.XboxGameCallableUI"
    #"Microsoft.XboxIdentityProvider"
    #"Windows.ContactSupport"

    # apps which other apps depend on
    "Microsoft.Advertising.Xaml"
)

foreach ($app in $apps) {
    Write-Output "Trying to remove $app"

    Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage -AllUsers

    Get-AppXProvisionedPackage -Online |
        Where-Object DisplayName -EQ $app |
        Remove-AppxProvisionedPackage -Online
}

# Prevents Apps from re-installing
$cdm = @(
    "ContentDeliveryAllowed"
    "FeatureManagementEnabled"
    "OemPreInstalledAppsEnabled"
    "PreInstalledAppsEnabled"
    "PreInstalledAppsEverEnabled"
    "SilentInstalledAppsEnabled"
    "SubscribedContent-314559Enabled"
    "SubscribedContent-338387Enabled"
    "SubscribedContent-338388Enabled"
    "SubscribedContent-338389Enabled"
    "SubscribedContent-338393Enabled"
    "SubscribedContentEnabled"
    "SystemPaneSuggestionsEnabled"
)

New-FolderForced -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
foreach ($key in $cdm) {
    Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" $key 0
}

New-FolderForced -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore"
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore" "AutoDownload" 2

# Prevents "Suggested Applications" returning
New-FolderForced -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" "DisableWindowsConsumerFeatures" 1

#   Description:
# This script will remove and disable OneDrive integration.
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\New-FolderForced.psm1
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\take-own.psm1

Write-Output "Kill OneDrive process"
taskkill.exe /F /IM "OneDrive.exe"
taskkill.exe /F /IM "explorer.exe"

Write-Output "Remove OneDrive"
if (Test-Path "$env:systemroot\System32\OneDriveSetup.exe") {
    & "$env:systemroot\System32\OneDriveSetup.exe" /uninstall
}
if (Test-Path "$env:systemroot\SysWOW64\OneDriveSetup.exe") {
    & "$env:systemroot\SysWOW64\OneDriveSetup.exe" /uninstall
}

Write-Output "Removing OneDrive leftovers"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:localappdata\Microsoft\OneDrive"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:programdata\Microsoft OneDrive"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:systemdrive\OneDriveTemp"
# check if directory is empty before removing:
If ((Get-ChildItem "$env:userprofile\OneDrive" -Recurse | Measure-Object).Count -eq 0) {
    Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:userprofile\OneDrive"
}

Write-Output "Disable OneDrive via Group Policies"
New-FolderForced -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\OneDrive"
Set-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\OneDrive" "DisableFileSyncNGSC" 1

Write-Output "Remove Onedrive from explorer sidebar"
New-PSDrive -PSProvider "Registry" -Root "HKEY_CLASSES_ROOT" -Name "HKCR"
mkdir -Force "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
Set-ItemProperty -Path "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" "System.IsPinnedToNameSpaceTree" 0
mkdir -Force "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}"
Set-ItemProperty -Path "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" "System.IsPinnedToNameSpaceTree" 0
Remove-PSDrive "HKCR"

# Thank you Matthew Israelsson
Write-Output "Removing run hook for new users"
reg load "hku\Default" "C:\Users\Default\NTUSER.DAT"
reg delete "HKEY_USERS\Default\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "OneDriveSetup" /f
reg unload "hku\Default"

Write-Output "Removing startmenu entry"
Remove-Item -Force -ErrorAction SilentlyContinue "$env:userprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk"

Write-Output "Removing scheduled task"
Get-ScheduledTask -TaskPath '\' -TaskName 'OneDrive*' -ea SilentlyContinue | Unregister-ScheduledTask -Confirm:$false

Write-Output "Restarting explorer"
Start-Process "explorer.exe"

Write-Output "Waiting for explorer to complete loading"
Start-Sleep 10

Write-Output "Removing additional OneDrive leftovers"
foreach ($item in (Get-ChildItem "$env:WinDir\WinSxS\*onedrive*")) {
    Takeown-Folder $item.FullName
    Remove-Item -Recurse -Force $item.FullName
}


# This script removes all Start Menu Tiles from the .default user #
Set-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -Value '<LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '  <LayoutOptions StartTileGroupCellWidth="6" />'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '  <DefaultLayoutOverride>'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '    <StartLayoutCollection>'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '      <defaultlayout:StartLayout GroupCellWidth="6" />'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '    </StartLayoutCollection>'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '  </DefaultLayoutOverride>'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '    <CustomTaskbarLayoutCollection>'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '      <defaultlayout:TaskbarLayout>'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '        <taskbar:TaskbarPinList>'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '          <taskbar:UWA AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" />'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '          <taskbar:DesktopApp DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\File Explorer.lnk" />'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '        </taskbar:TaskbarPinList>'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '      </defaultlayout:TaskbarLayout>'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '    </CustomTaskbarLayoutCollection>'
Add-Content -Path 'C:\Users\Default\AppData\Local\Microsoft\Windows\Shell\DefaultLayouts.xml' -value '</LayoutModificationTemplate>'

$START_MENU_LAYOUT = @"
<LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" Version="1" xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
    <LayoutOptions StartTileGroupCellWidth="6" />
    <DefaultLayoutOverride>
        <StartLayoutCollection>
            <defaultlayout:StartLayout GroupCellWidth="6" />
        </StartLayoutCollection>
    </DefaultLayoutOverride>
</LayoutModificationTemplate>
"@

$layoutFile="C:\Windows\StartMenuLayout.xml"

#Delete layout file if it already exists
If(Test-Path $layoutFile)
{
    Remove-Item $layoutFile
}

#Creates the blank layout file
$START_MENU_LAYOUT | Out-File $layoutFile -Encoding ASCII

$regAliases = @("HKLM", "HKCU")

#Assign the start layout and force it to apply with "LockedStartLayout" at both the machine and user level
foreach ($regAlias in $regAliases){
    $basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
    $keyPath = $basePath + "\Explorer" 
    IF(!(Test-Path -Path $keyPath)) { 
        New-Item -Path $basePath -Name "Explorer"
    }
    Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 1
    Set-ItemProperty -Path $keyPath -Name "StartLayoutFile" -Value $layoutFile
}

#Restart Explorer, open the start menu (necessary to load the new layout), and give it a few seconds to process
Stop-Process -name explorer
Start-Sleep -s 5
$wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('^{ESCAPE}')
Start-Sleep -s 5

#Enable the ability to pin items again by disabling "LockedStartLayout"
foreach ($regAlias in $regAliases){
    $basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
    $keyPath = $basePath + "\Explorer" 
    Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 0
}

#Restart Explorer and delete the layout file
Stop-Process -name explorer

# Uncomment the next line to make clean start menu default for all new users
Import-StartLayout -LayoutPath $layoutFile -MountPath $env:SystemDrive\

Remove-Item $layoutFile

# Prevents SYSPREP from freezing at "Getting Ready" on first boot                          #
# NOTE, DMWAPPUSHSERVICE is a Keyboard and Ink telemetry service, and potential keylogger. #
# It is recommended to disable this service in new builds, but SYSPREP will freeze/fail    #
# if the service is not running. If SYSPREP will be used, add a FirstBootCommand to your   #
# build to disable the service.                                                            #

reg delete "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\dmwappushservice" /v "DelayedAutoStart" /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\dmwappushservice" /v "DelayedAutoStart" /t REG_DWORD /d "1"
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\dmwappushservice" /v "Start" /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\dmwappushservice" /v "Start" /t REG_DWORD /d "2"
# Add the line below to FirstBootCommand in answer file #
# reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "disabledmwappushservice" /t REG_SZ /d "sc config dmwappushservice start= disabled"

# Disable Privacy Settings Experience #
# Also disables all settings in Privacy Experience #
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\OOBE" /v "DisablePrivacyExperience" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\OOBE" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\OOBE" /v "DisablePrivacyExperience" /t REG_DWORD /d "1" /f
reg delete "HKEY_USERS\.DEFAULT\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy" /v "HasAccepted" /f
reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Speech_OneCore" /f
reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Speech_OneCore\Settings" /f
reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy" /v "HasAccepted" /t REG_DWORD /d "0" /f
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy" /v "HasAccepted" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Speech_OneCore" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Speech_OneCore\Settings" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy" /v "HasAccepted" /t REG_DWORD /d "0" /f
reg delete "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" /v "Value" /f
reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager" /f
reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore" /f
reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" /v "Value" /t REG_SZ /d "Deny" /f
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" /v "Value" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" /v "Value" /t REG_SZ /d "Deny" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Settings\FindMyDevice" /v "LocationSyncEnabled" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Settings\FindMyDevice" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Settings\FindMyDevice" /v "LocationSyncEnabled" /t REG_DWORD /d "0" /f
reg delete "HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack" /v "ShowedToastAtLevel" /f
reg add "HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics" /f
reg add "HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack" /f
reg add "HKEY_USERS\.DEFAULT\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack" /v "ShowedToastAtLevel" /t REG_DWORD /d "1" /f
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack" /v "ShowedToastAtLevel" /f
reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics" /f
reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack" /f
reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack" /v "ShowedToastAtLevel" /t REG_DWORD /d "1" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "AllowTelemetry" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "AllowTelemetry" /t REG_DWORD /d "1" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "MaxTelemetryAllowed" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" /v "MaxTelemetryAllowed" /t REG_DWORD /d "1" /f
reg delete "HKEY_USERS\.DEFAULT\Software\Microsoft\Input\TIPC" /v "Enabled" /f
reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Input" /f
reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Input\TIPC" /f
reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Input\TIPC" /v "Enabled" /t REG_DWORD /d "0" /f
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Input\TIPC" /v "Enabled" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Input" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Input\TIPC" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Input\TIPC" /v "Enabled" /t REG_DWORD /d "0" /f
reg delete "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Privacy" /v "TailoredExperiencesWithDiagnosticDataEnabled" /f
reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Privacy" /f
reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Privacy" /v "TailoredExperiencesWithDiagnosticDataEnabled" /t REG_DWORD /d "0" /f
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy" /v "TailoredExperiencesWithDiagnosticDataEnabled" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Privacy" /v "TailoredExperiencesWithDiagnosticDataEnabled" /t REG_DWORD /d "0" /f
reg delete "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v "Enabled" /f
reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /f
reg add "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v "Enabled" /t REG_DWORD /d "0" /f
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v "Enabled" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo" /v "Enabled" /t REG_DWORD /d "0" /f

##########
# Network
##########

# Windows Auto-Tuning
netsh int tcp set global autotuninglevel=restricted
    # Disabled           No scale factor available Set the TCP receive window at its default value.  Good for small networks
    # Highly Restricted  0x2 (scale factor of 2)   Set the TCP receive window to grow beyond its default value, but do so very conservatively.
    # Restricted         0x4 (scale factor of 4)   Set the TCP receive window to grow beyond its default value, but limit such growth in some scenarios.  Good for large networks
    # Normal (default)   0x8 (scale factor of 8)   Set the TCP receive window to grow to accommodate almost all scenarios.
    # Experimental       0xE (scale factor of 14)  Set the TCP receive window to grow to accommodate extreme scenarios.

# Disable IPV6 on Ethernet 
Disable-NetAdapterBinding -Name Ethernet -ComponentID ms_tcpip6

# Set Networks to Private
Get-NetConnectionProfile | Where-Object { $_.NetworkCategory -match "Public" } | Set-NetConnectionProfile -NetworkCategory Private

# Enbale File Sharing 
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes

# Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled True -Profile Any
Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled False -Profile Public
Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled True -Profile Private

##########
# Restart
##########

Write-Host
Write-Host "Press any key to restart your system..." -ForegroundColor Black -BackgroundColor White
$key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Write-Host "Restarting..."
Restart-Computer

Disk cleanup in Windows 10

Delete temporary files:

  1. In the search box on the taskbar, type disk cleanup, and select Disk Cleanup from the list of results.
  2. Select the drive you want to clean up, and then select OK.
  3. Under Files to delete, select the file types to get rid of. To get a description of the file type, select it.
  4. Select OK.

Copy and Paste

The basics of Copy, Cut, and Paste

Copy: After selecting one or more items using your mouse or keyboard, press Ctrl+C. The information will be copied to the clipboard.

Cut: After selecting one or more items, press Ctrl+X, and the information will be copied to the clipboard and removed from the original location.

Paste: Select a destination by clicking on an area (or by placing your cursor in the position where you want the information to go), then press Ctrl+V.

The basics of Selecting multiple items

Single item: Click on an item and it is selected.

Range of items: Click on the first item, press the Shift key+Click on the last item.  All items between the two will be selected.

Multiple items that are not continuous: Click on the first item, press Ctrl+Click on any other items.  All items clicked on will be selected, you can also re-click on an item to unselect it.

Get rid of ads in your Start menu

When you install Windows 10 with default settings, you see apps on the right side of your Start menu. Microsoft calls them “suggestions,” but they are actually ads for Windows Store apps they want you to buy. 

To get rid of the ads in your Windows 10 Start menu, go to Settings > Personalization > Start. Unselect the setting called Show suggestions occasionally in Start to the off position. 

Take a screenshot

To capture and save a picture of your entire screen, the easiest way is to hit the Windows key + Print Screen key, and that picture will be saved to the Pictures > Screenshots folder. 

To capture just one part of your screen, hit the Windows key + Shift + S to open a tool called Snip & Sketch, which allows you to click and drag to create a screenshot, which is saved to your Clipboard.

Windows God Mode

God Mode doesn’t give you secret features in Windows. It’s just a special folder you can enable that exposes most of Windows’ admin, management, settings, and Control Panel tools in a single, easy-to-scroll-through interface. The God Mode folder offers an easier way to browse through over 200 of these tools and get to know them.

To do this you must be using an account with administrative privileges. On your desktop right-click and select “New” on the context menu, and then click “Folder”.  The new folder icon will appear.

Now, rename the folder to the following:

GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}

Double-click the icon to open the newly-created God Mode. The major categories are organized alphabetically and so are the more than 200 settings you’ll find within those categories.

Free Browser plugin you should be using

Privacy Badger

Privacy Badger is a browser add-on that stops advertisers and other third-party trackers from secretly tracking where you go and what pages you look at on the web. If an advertiser seems to be tracking you across multiple websites without your permission, Privacy Badger automatically blocks that advertiser from loading any more content in your browser. To the advertiser, it’s like you suddenly disappeared.

#1 Internet Security Tip

Create an alternate ID

Avoid a lot of the worries about your ID being stolen, make an alternate ID, to use that when you are asked for your personal information.  If the website gets hacked, the thieves get your fake information.  If you are paying by credit card, use your real information for the Billing and your Shipping address, and if there is an option for the site NOT to save your credit card, select it. There is no such thing as perfect security, but this helps.

Write down the details of your alternate ID so you can be consistent. If you need help creating an alternate ID go to http:\\fakenamegenerator.com