diff --git a/windows10.ps1 b/windows10.ps1 index d34d7b0..b1ce65c 100644 --- a/windows10.ps1 +++ b/windows10.ps1 @@ -140,3 +140,67 @@ Start-Job -Name "Configuring Windows - Optimizations, Debloating, and Hardening" New-Item "C:\" -Name "temp" -ItemType "directory" -Force iex ((New-Object System.Net.WebClient).DownloadString('https://simeononsecurity.ch/scripts/windowsoptimizeandharden.ps1')) } + +Start-Job -Name "Customizations" -ScriptBlock { + #Set Screen Timeout to 15 Minutes + powercfg -change -monitor-timeout-ac 15 + + #Enable Darkmode + New-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Force | Out-Null + New-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name AppsUseLightTheme -Type "DWORD" -Value "00000000" -Force | Out-Null + New-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name SystemUsesLightTheme -Type "DWORD" -Value "00000000" -Force | Out-Null + New-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name ColorPrevalence -Type "DWORD" -Value "00000000" -Force | Out-Null + New-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name EnableTransparency -Type "DWORD" -Value "00000001" -Force | Out-Null + Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name AppsUseLightTheme -Type "DWORD" -Value "00000000" -Force | Out-Null + Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name SystemUsesLightTheme -Type "DWORD" -Value "00000000" -Force | Out-Null + Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name ColorPrevalence -Type "DWORD" -Value "00000000" -Force | Out-Null + Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name EnableTransparency -Type "DWORD" -Value "00000001" -Force | Out-Null + + #Clear Start Menu + #https://github.com/builtbybel/privatezilla/blob/master/scripts/Unpin%20Startmenu%20Tiles.ps1 + $START_MENU_LAYOUT = @" + + + + + + + + +"@ + $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 -Force -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 -Force -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 +}