forked from voruti/Win10-Initial-Setup-Script
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
4,766 additions
and
4,736 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
ccsetup.zip | ||
KeePass.zip | ||
*.zip |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
@powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0Win10.ps1" -include "%~dp0Win10.psm1" -preset "%~dpn0.preset" | ||
@powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0Win10.ps1" -include "%~dp0Win10.psm1" -preset "%~dpn0.preset" |
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
MIT License | ||
Copyright (c) 2017 Disassembler <[email protected]> | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
MIT License | ||
|
||
Copyright (c) 2017 Disassembler <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,59 @@ | ||
########## | ||
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Main execution loop | ||
# Author: Disassembler <[email protected]> | ||
# Version: v3.10, 2020-07-15 | ||
# 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 = @() | ||
|
||
Function AddOrRemoveTweak($tweak) { | ||
If ($tweak[0] -eq "!") { | ||
# If the name starts with exclamation mark (!), exclude the tweak from selection | ||
$script:tweaks = $script:tweaks | Where-Object { $_ -ne $tweak.Substring(1) } | ||
} ElseIf ($tweak -ne "") { | ||
# Otherwise add the tweak | ||
$script:tweaks += $tweak | ||
} | ||
} | ||
|
||
# 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] -ErrorAction Stop | ||
$PSCommandArgs += "-include `"$include`"" | ||
# Import the included file as a module | ||
Import-Module -Name $include -ErrorAction Stop | ||
} ElseIf ($args[$i].ToLower() -eq "-preset") { | ||
# Resolve full path to the preset file | ||
$preset = Resolve-Path $args[++$i] -ErrorAction Stop | ||
$PSCommandArgs += "-preset `"$preset`"" | ||
# Load tweak names from the preset file | ||
Get-Content $preset -ErrorAction Stop | ForEach-Object { AddOrRemoveTweak($_.Split("#")[0].Trim()) } | ||
} ElseIf ($args[$i].ToLower() -eq "-log") { | ||
# Resolve full path to the output file | ||
$log = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($args[++$i]) | ||
$PSCommandArgs += "-log `"$log`"" | ||
# Record session to the output file | ||
Start-Transcript $log | ||
} Else { | ||
$PSCommandArgs += $args[$i] | ||
# Load tweak names from command line | ||
AddOrRemoveTweak($args[$i]) | ||
} | ||
$i++ | ||
} | ||
|
||
# Call the desired tweak functions | ||
$tweaks | ForEach-Object { Invoke-Expression $_ } | ||
########## | ||
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Main execution loop | ||
# Author: Disassembler <[email protected]> | ||
# Version: v3.10, 2020-07-15 | ||
# 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 = @() | ||
|
||
Function AddOrRemoveTweak($tweak) { | ||
If ($tweak[0] -eq "!") { | ||
# If the name starts with exclamation mark (!), exclude the tweak from selection | ||
$script:tweaks = $script:tweaks | Where-Object { $_ -ne $tweak.Substring(1) } | ||
} ElseIf ($tweak -ne "") { | ||
# Otherwise add the tweak | ||
$script:tweaks += $tweak | ||
} | ||
} | ||
|
||
# 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] -ErrorAction Stop | ||
$PSCommandArgs += "-include `"$include`"" | ||
# Import the included file as a module | ||
Import-Module -Name $include -ErrorAction Stop | ||
} ElseIf ($args[$i].ToLower() -eq "-preset") { | ||
# Resolve full path to the preset file | ||
$preset = Resolve-Path $args[++$i] -ErrorAction Stop | ||
$PSCommandArgs += "-preset `"$preset`"" | ||
# Load tweak names from the preset file | ||
Get-Content $preset -ErrorAction Stop | ForEach-Object { AddOrRemoveTweak($_.Split("#")[0].Trim()) } | ||
} ElseIf ($args[$i].ToLower() -eq "-log") { | ||
# Resolve full path to the output file | ||
$log = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($args[++$i]) | ||
$PSCommandArgs += "-log `"$log`"" | ||
# Record session to the output file | ||
Start-Transcript $log | ||
} Else { | ||
$PSCommandArgs += $args[$i] | ||
# Load tweak names from command line | ||
AddOrRemoveTweak($args[$i]) | ||
} | ||
$i++ | ||
} | ||
|
||
# Call the desired tweak functions | ||
$tweaks | ForEach-Object { Invoke-Expression $_ } |
Oops, something went wrong.