-
-
Save MDtThomas/e6153f67f5d480f140ad3cba8525837e to your computer and use it in GitHub Desktop.
[Windows Setup]Run with PowerShell - User don't have to be administrator - Restart #Script #Thomas #Windows #Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Uninstall apps | |
# Delete all apps except Store | |
Get-AppxPackage | where-object {$_.name -notlike "*store*"} | Remove-AppxPackage | |
#endregion | |
#region Registry setting | |
If (!(Test-Path "HKCU:\Software\Microsoft\GameBar")) { | |
New-Item -Path "HKCU:\Software\Microsoft\GameBar" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\GameBar" ` | |
-Name "AutoGameModeEnabled" -Type DWord -Value 0 | |
If (!(Test-Path "HKCU:\System\GameConfigStore")) { | |
New-Item -Path "HKCU:\System\GameConfigStore" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" ` | |
-Name "GameDVR_Enabled" -Type DWord -Value 0 | |
#endregion | |
#region FileExplorer | |
#region Hide folders that starts with a dot in UserProfile | |
Get-ChildItem $ENV:USERPROFILE | | |
Where-Object {$_.name -like ".*" -and $_.attributes -match 'Hidden' -eq $false} | | |
Set-ItemProperty -name Attributes -value ([System.IO.FileAttributes]::Hidden) | |
#endregion | |
#region Show full directory path in Explorer title bar | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState" -Name "FullPath" -Type DWord -Value 1 | |
#endregion | |
#region Show known file extensions | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Type DWord -Value 0 -force | |
#endregion | |
#region Hide item selection checkboxes | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "AutoCheckSelect" -Type DWord -Value 0 | |
#endregion | |
#region Hide recently and frequently items in Quick access | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowRecent" -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "ShowFrequent" -Type DWord -Value 0 | |
#endregion | |
#region Change default Explorer view to This PC | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "LaunchTo" -Type DWord -Value 1 | |
#endregion | |
#region Disable creation of Thumbs.db thumbnail cache files on network folders | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "DisableThumbsDBOnNetworkFolders" -Type DWord -Value 1 | |
#endregion | |
#region Disable Autoplay | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" -Name "DisableAutoplay" -Type DWord -Value 1 | |
#endregion | |
#region Remove OneDrive in NavPane | |
function Remove-OneDriveNavPane { | |
$null = New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | |
'HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}', | |
'HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}' | | |
ForEach-Object { | |
if (Test-Path -Path $_) { | |
Set-ItemProperty -Path $_ -Name System.IsPinnedToNameSpaceTree -Value 0 | |
} | |
} | |
Remove-PSDrive -Name HKCR | |
} | |
Remove-OneDriveNavPane | |
#endregion | |
#endregion | |
#region UserInterface | |
#region Show Task Manager details | |
$taskmgr = Start-Process -WindowStyle Hidden -FilePath taskmgr.exe -PassThru | |
$timeout = 30000 | |
$sleep = 100 | |
Do { | |
Start-Sleep -Milliseconds $sleep | |
$timeout -= $sleep | |
$preferences = Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\TaskManager" -Name "Preferences" -ErrorAction SilentlyContinue | |
} Until ($preferences -or $timeout -le 0) | |
Stop-Process $taskmgr | |
If ($preferences) { | |
$preferences.Preferences[28] = 0 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\TaskManager" -Name "Preferences" -Type Binary -Value $preferences.Preferences | |
} | |
#endregion | |
#region Show file operations details N/A | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager" -Name "EnthusiastMode" -Type DWord -Value 1 | |
#endregion | |
#region Hide Taskbar Search icon/box | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" | Out-Null | |
} | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search\SearchboxTaskbarMode")){ | |
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" -Name "SearchboxTaskbarMode" -Type DWord -Value 0 | Out-Null | |
} | |
#endregion | |
#region Remove-ExplorerUserFolders | |
if(Test-Path -Path "$Env:USERPROFILE\3D Objects") { | |
Remove-Item -path "$Env:USERPROFILE\3D Objects" -recurse -force | Out-Null | |
} | |
if(Test-Path -Path "$Env:USERPROFILE\Contacts") { | |
Remove-Item -path "$Env:USERPROFILE\Contacts" -recurse -force | Out-Null | |
} | |
if(Test-Path -Path "$Env:USERPROFILE\Favorites") { | |
Remove-Item -path "$Env:USERPROFILE\Favorites" -recurse -force | Out-Null | |
} | |
if(Test-Path -Path "$Env:USERPROFILE\Links") { | |
Remove-Item -path "$Env:USERPROFILE\Links" -recurse -force | Out-Null | |
} | |
if(Test-Path -Path "$Env:USERPROFILE\Roaming") { | |
Remove-Item -Path "$Env:USERPROFILE\Roaming" -recurse -force | Out-Null | |
} | |
if(Test-Path -Path "$Env:USERPROFILE\Saved Games") { | |
Remove-Item -Path "$Env:USERPROFILE\Saved Games" -recurse -force | Out-Null | |
} | |
if(Test-Path -Path "$Env:USERPROFILE\Searches") { | |
Remove-Item -path "$Env:USERPROFILE\Searches" -recurse -force | Out-Null | |
} | |
#endregion | |
#region Hide Task View button | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowTaskViewButton" -Type DWord -Value 0 | |
#endregion | |
#region Set taskbar to show labels and combine when full | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarGlomLevel" -Type DWord -Value 1 | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "MMTaskbarGlomLevel" -Type DWord -Value 1 | |
#endregion | |
#region Hide Taskbar People icon | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" -Name "PeopleBand" -Type DWord -Value 0 | |
#endregion | |
#region Hide tray icons as needed | |
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoAutoTrayNotify" -ErrorAction SilentlyContinue | |
#endregion | |
#region Set Control Panel view to Large icons (Classic) | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" -Name "StartupPage" -Type DWord -Value 1 | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel" -Name "AllItemsIconView" -Type DWord -Value 0 | |
#endregion | |
#region Disable adding '- shortcut' to shortcut name | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name "link" -Type Binary -Value ([byte[]](0,0,0,0)) | |
#endregion | |
#region Unpin all Taskbar icons | |
If (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband")) { | |
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Force | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Name "Favorites" -Type Binary -Value ([byte[]](255)) | |
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -Name "FavoritesResolve" -ErrorAction SilentlyContinue | |
#endregion | |
#endregion | |
#region Press any key | |
Write-Output "`nPress any key to continue..." # OK | |
[Console]::ReadKey($true) | Out-Null | |
#endregion | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment