mirror of
https://github.com/Disassembler0/Win10-Initial-Setup-Script.git
synced 2026-01-14 00:18:21 -05:00
- Add "Disable Restore Points" - Add "Disable Automatic Boot Recovery" - Add "Disable Recovery and Factory Reset" - Add "Disable NTFS Last Acccess time stamps" (thx @r3incarnat0r) - Add "Enable Defender Application Guard" (thx @sippi90) - Add "Uninstall PowerShell 2.0" (thx @sippi90) - Add "Install .NET Framework 2.0, 3.0 and 3.5 runtimes" - Add "Enable navigation pane expanding to current folder" (thx arobasse2) - Add "Disable Aero Shake" (thx arobasse2) - Add "Disable adding '- shortcut' to shortcut name" (thx arobasse2) - Add "Disable automatic reboot on crash" (thx arobasse2) - Add "Disable blocking of downloaded files" (thx arobasse2) - Add "Hide 'Include in library' context menu item" (thx arobasse2) - Add "Hide 'Share' and 'Give access to' context menu items" (thx arobasse2) - Update SetP2PUpdate* to use GPO (thx @sippi90) - Update Enable/DisableHibernation to run powercfg (thx @r3incarnat0r) - Update ShowTaskManagerDetails to not get stuck (thx @r3incarnat0r) - Update EnableDefender for 1809 - Update UninstallMsftBloat for 1809 (thx @sippi90) - Update UnpinStartMenuTiles for 1809 - Update CtrldFolderAccess to suppress warnings when Defender is disabled - Fix copy paste error in EnableSharingWizard (thx @sippi90) - Bunch of minor comment changes, code style alignments, reorganizations, clarifications and nitpicks
44 lines
1.5 KiB
PowerShell
44 lines
1.5 KiB
PowerShell
##########
|
|
# Win10 / WinServer2016 Initial Setup Script - Main execution loop
|
|
# Author: Disassembler <disassembler@dasm.cz>
|
|
# Version: v3.1, 2018-10-04
|
|
# Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
|
|
##########
|
|
|
|
# Relaunch the script with administrator privileges
|
|
Function RequireAdmin {
|
|
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")) {
|
|
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`" $PSCommandArgs" -Verb RunAs
|
|
Exit
|
|
}
|
|
}
|
|
|
|
$tweaks = @()
|
|
$PSCommandArgs = @()
|
|
|
|
# Parse and resolve paths in passed arguments
|
|
$i = 0
|
|
While ($i -lt $args.Length) {
|
|
If ($args[$i].ToLower() -eq "-include") {
|
|
# Resolve full path to the included file
|
|
$include = Resolve-Path $args[++$i]
|
|
$PSCommandArgs += "-include `"$include`""
|
|
# Import the included file as a module
|
|
Import-Module -Name $include
|
|
} ElseIf ($args[$i].ToLower() -eq "-preset") {
|
|
# Resolve full path to the preset file
|
|
$preset = Resolve-Path $args[++$i]
|
|
$PSCommandArgs += "-preset `"$preset`""
|
|
# Load tweak names from the preset file
|
|
$tweaks += Get-Content $preset -ErrorAction Stop | ForEach-Object { $_.Split("#")[0].Trim() } | Where-Object { $_ -ne "" }
|
|
} Else {
|
|
$PSCommandArgs += $args[$i]
|
|
# Load tweak names from command line
|
|
$tweaks += $args[$i]
|
|
}
|
|
$i++
|
|
}
|
|
|
|
# Call the desired tweak functions
|
|
$tweaks | ForEach-Object { Invoke-Expression $_ }
|