mirror of
https://github.com/Disassembler0/Win10-Initial-Setup-Script.git
synced 2026-01-11 23:18:19 -05:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91a6afba1f | ||
|
|
b6caea6a56 | ||
|
|
a73dc396f7 | ||
|
|
94d9046fd4 | ||
|
|
f61ef1a899 | ||
|
|
965d033fd7 | ||
|
|
a74666786c | ||
|
|
e75bfe9842 | ||
|
|
58881c87f4 | ||
|
|
3f09ce7b9e | ||
|
|
bf69210346 | ||
|
|
7e52af6d42 | ||
|
|
004dd6d752 | ||
|
|
30382f9b30 | ||
|
|
d8f790e6f3 | ||
|
|
81b660974c | ||
|
|
1f9e9c48ff | ||
|
|
fb04190dfd | ||
|
|
8dbe0c49fc | ||
|
|
6d1b6b725d | ||
|
|
f489347b17 | ||
|
|
26d5762d97 | ||
|
|
3472bde78c | ||
|
|
b67cde21cc | ||
|
|
a79832ca0d |
@@ -1,7 +1,7 @@
|
||||
##########
|
||||
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Default preset
|
||||
# Author: Disassembler <disassembler@dasm.cz>
|
||||
# Version: v3.7, 2019-05-31
|
||||
# Version: v3.8, 2019-09-11
|
||||
# Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
|
||||
##########
|
||||
|
||||
@@ -12,7 +12,7 @@ RequireAdmin
|
||||
DisableTelemetry # EnableTelemetry
|
||||
DisableWiFiSense # EnableWiFiSense
|
||||
# DisableSmartScreen # EnableSmartScreen
|
||||
DisableWebSearch # EnableWebSearch
|
||||
# DisableWebSearch # EnableWebSearch
|
||||
DisableAppSuggestions # EnableAppSuggestions
|
||||
DisableActivityHistory # EnableActivityHistory
|
||||
DisableBackgroundApps # EnableBackgroundApps
|
||||
@@ -26,6 +26,7 @@ DisableWebLangList # EnableWebLangList
|
||||
DisableCortana # EnableCortana
|
||||
# DisableBiometrics # EnableBiometrics
|
||||
# DisableCamera # EnableCamera
|
||||
# DisableMicrophone # EnableMicrophone
|
||||
DisableErrorReporting # EnableErrorReporting
|
||||
# SetP2PUpdateLocal # SetP2PUpdateInternet # SetP2PUpdateDisable
|
||||
DisableDiagTrack # EnableDiagTrack
|
||||
@@ -37,15 +38,6 @@ DisableWAPPush # EnableWAPPush
|
||||
# SetUACLow # SetUACHigh
|
||||
# EnableSharingMappedDrives # DisableSharingMappedDrives
|
||||
DisableAdminShares # EnableAdminShares
|
||||
# DisableSMB1 # EnableSMB1
|
||||
# DisableSMBServer # EnableSMBServer
|
||||
# DisableNetBIOS # EnableNetBIOS
|
||||
# DisableLLMNR # EnableLLMNR
|
||||
# DisableNCSIProbe # EnableNCSIProbe
|
||||
SetCurrentNetworkPrivate # SetCurrentNetworkPublic
|
||||
# SetUnknownNetworksPrivate # SetUnknownNetworksPublic
|
||||
# DisableConnectionSharing # EnableConnectionSharing
|
||||
# DisableNetDevicesAutoInst # EnableNetDevicesAutoInst
|
||||
# DisableFirewall # EnableFirewall
|
||||
# HideDefenderTrayIcon # ShowDefenderTrayIcon
|
||||
# DisableDefender # EnableDefender
|
||||
@@ -63,16 +55,35 @@ EnableF8BootMenu # DisableF8BootMenu
|
||||
# DisableRecoveryAndReset # EnableRecoveryAndReset
|
||||
SetDEPOptOut # SetDEPOptIn
|
||||
|
||||
### Network Tweaks ###
|
||||
SetCurrentNetworkPrivate # SetCurrentNetworkPublic
|
||||
# SetUnknownNetworksPrivate # SetUnknownNetworksPublic
|
||||
# DisableNetDevicesAutoInst # EnableNetDevicesAutoInst
|
||||
# DisableHomeGroups # EnableHomeGroups
|
||||
# DisableSMB1 # EnableSMB1
|
||||
# DisableSMBServer # EnableSMBServer
|
||||
# DisableNetBIOS # EnableNetBIOS
|
||||
# DisableLLMNR # EnableLLMNR
|
||||
# DisableLLDP # EnableLLDP
|
||||
# DisableLLTD # EnableLLTD
|
||||
# DisableMSNetClient # EnableMSNetClient
|
||||
# DisableQoS # EnableQoS
|
||||
# DisableIPv4 # EnableIPv4
|
||||
# DisableIPv6 # EnableIPv6
|
||||
# DisableNCSIProbe # EnableNCSIProbe
|
||||
# DisableConnectionSharing # EnableConnectionSharing
|
||||
DisableRemoteAssistance # EnableRemoteAssistance
|
||||
# EnableRemoteDesktop # DisableRemoteDesktop
|
||||
|
||||
### Service Tweaks ###
|
||||
# DisableUpdateMSRT # EnableUpdateMSRT
|
||||
# DisableUpdateDriver # EnableUpdateDriver
|
||||
EnableUpdateMSProducts # DisableUpdateMSProducts
|
||||
# DisableUpdateAutoDownload # EnableUpdateAutoDownload
|
||||
DisableUpdateRestart # EnableUpdateRestart
|
||||
DisableMaintenanceWakeUp # EnableMaintenanceWakeUp
|
||||
# DisableHomeGroups # EnableHomeGroups
|
||||
DisableSharedExperiences # EnableSharedExperiences
|
||||
# EnableClipboardHistory # DisableClipboardHistory
|
||||
DisableRemoteAssistance # EnableRemoteAssistance
|
||||
EnableRemoteDesktop # DisableRemoteDesktop
|
||||
DisableAutoplay # EnableAutoplay
|
||||
DisableAutorun # EnableAutorun
|
||||
# DisableRestorePoints # EnableRestorePoints
|
||||
@@ -81,6 +92,7 @@ DisableAutorun # EnableAutorun
|
||||
# DisableSuperfetch # EnableSuperfetch
|
||||
# DisableIndexing # EnableIndexing
|
||||
# DisableSwapFile # EnableSwapFile
|
||||
# DisableRecycleBin # EnableRecycleBin
|
||||
EnableNTFSLongPaths # DisableNTFSLongPaths
|
||||
# DisableNTFSLastAccess # EnableNTFSLastAccess
|
||||
# SetBIOSTimeUTC # SetBIOSTimeLocal
|
||||
@@ -108,6 +120,7 @@ ShowSmallTaskbarIcons # ShowLargeTaskbarIcons
|
||||
SetTaskbarCombineWhenFull # SetTaskbarCombineNever # SetTaskbarCombineAlways
|
||||
HideTaskbarPeopleIcon # ShowTaskbarPeopleIcon
|
||||
ShowTrayIcons # HideTrayIcons
|
||||
# ShowSecondsInTaskbar # HideSecondsFromTaskbar
|
||||
DisableSearchAppInStore # EnableSearchAppInStore
|
||||
DisableNewAppPrompt # EnableNewAppPrompt
|
||||
# HideRecentlyAddedApps # ShowRecentlyAddedApps
|
||||
@@ -150,6 +163,7 @@ ShowThisPCOnDesktop # HideThisPCFromDesktop
|
||||
# ShowUserFolderOnDesktop # HideUserFolderFromDesktop
|
||||
# ShowControlPanelOnDesktop # HideControlPanelFromDesktop
|
||||
# ShowNetworkOnDesktop # HideNetworkFromDesktop
|
||||
# ShowBuildNumberOnDesktop # HideBuildNumberFromDesktop
|
||||
HideDesktopFromThisPC # ShowDesktopInThisPC
|
||||
# HideDesktopFromExplorer # ShowDesktopInExplorer
|
||||
HideDocumentsFromThisPC # ShowDocumentsInThisPC
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
##########
|
||||
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Main execution loop
|
||||
# Author: Disassembler <disassembler@dasm.cz>
|
||||
# Version: v3.7, 2019-05-31
|
||||
# Version: v3.8, 2019-09-11
|
||||
# Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
|
||||
##########
|
||||
|
||||
@@ -31,13 +31,13 @@ $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]
|
||||
$include = Resolve-Path $args[++$i] -ErrorAction Stop
|
||||
$PSCommandArgs += "-include `"$include`""
|
||||
# Import the included file as a module
|
||||
Import-Module -Name $include
|
||||
Import-Module -Name $include -ErrorAction Stop
|
||||
} ElseIf ($args[$i].ToLower() -eq "-preset") {
|
||||
# Resolve full path to the preset file
|
||||
$preset = Resolve-Path $args[++$i]
|
||||
$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()) }
|
||||
|
||||
543
Win10.psm1
543
Win10.psm1
@@ -1,7 +1,7 @@
|
||||
##########
|
||||
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Tweak library
|
||||
# Author: Disassembler <disassembler@dasm.cz>
|
||||
# Version: v3.7, 2019-05-31
|
||||
# Version: v3.8, 2019-09-11
|
||||
# Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
|
||||
##########
|
||||
|
||||
@@ -169,6 +169,10 @@ Function DisableAppSuggestions {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Type DWord -Value 1
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsInkWorkspace")) {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsInkWorkspace" -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsInkWorkspace" -Name "AllowSuggestedAppsInWindowsInkWorkspace" -Type DWord -Value 0
|
||||
# Empty placeholder tile collection in registry cache and restart Start Menu process to reload the cache
|
||||
If ([System.Environment]::OSVersion.Version.Build -ge 17134) {
|
||||
$key = Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\*windows.data.placeholdertilecollection\Current"
|
||||
@@ -196,6 +200,7 @@ Function EnableAppSuggestions {
|
||||
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338393Enabled" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-353698Enabled" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsInkWorkspace" -Name "AllowSuggestedAppsInWindowsInkWorkspace" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable Activity History feed in Task View - Note: The checkbox "Let Windows collect my activities from this PC" remains checked even when the function is disabled
|
||||
@@ -391,21 +396,36 @@ Function EnableBiometrics {
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Biometrics" -Name "Enabled" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable use of camera devices
|
||||
# Disable access to camera from ModernUI applications
|
||||
Function DisableCamera {
|
||||
Write-Output "Disabling camera devices..."
|
||||
Write-Output "Disabling access to camera from ModernUI applications..."
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Camera")) {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Camera" -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Camera" -Name "AllowCamera" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Enable use of camera devices
|
||||
# Enable access to camera in ModernUI applications
|
||||
Function EnableCamera {
|
||||
Write-Output "Enabling camera devices..."
|
||||
Write-Output "Enabling access to camera from ModernUI applications..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Camera" -Name "AllowCamera" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable access to microphone in ModernUI applications
|
||||
Function DisableMicrophone {
|
||||
Write-Output "Disabling access to microphone in ModernUI applications..."
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy")) {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" -Name "LetAppsAccessMicrophone" -Type DWord -Value 2
|
||||
}
|
||||
|
||||
# Enable access to microphone in ModernUI applications
|
||||
Function EnableMicrophone {
|
||||
Write-Output "Enabling access to microphone from ModernUI applications..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" -Name "LetAppsAccessMicrophone" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable Error reporting
|
||||
Function DisableErrorReporting {
|
||||
Write-Output "Disabling Error reporting..."
|
||||
@@ -589,127 +609,6 @@ Function EnableAdminShares {
|
||||
Remove-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" -Name "AutoShareWks" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable obsolete SMB 1.0 protocol - Disabled by default since 1709
|
||||
Function DisableSMB1 {
|
||||
Write-Output "Disabling SMB 1.0 protocol..."
|
||||
Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force
|
||||
}
|
||||
|
||||
# Enable obsolete SMB 1.0 protocol - Disabled by default since 1709
|
||||
Function EnableSMB1 {
|
||||
Write-Output "Enabling SMB 1.0 protocol..."
|
||||
Set-SmbServerConfiguration -EnableSMB1Protocol $true -Force
|
||||
}
|
||||
|
||||
# Disable SMB Server - Completely disables file and printer sharing, but leaves the system able to connect to another SMB server as a client
|
||||
# Note: Do not run this if you plan to use Docker and Shared Drives (as it uses SMB internally), see https://github.com/Disassembler0/Win10-Initial-Setup-Script/issues/216
|
||||
Function DisableSMBServer {
|
||||
Write-Output "Disabling SMB Server..."
|
||||
Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force
|
||||
Set-SmbServerConfiguration -EnableSMB2Protocol $false -Force
|
||||
}
|
||||
|
||||
# Enable SMB Server
|
||||
Function EnableSMBServer {
|
||||
Write-Output "Enabling SMB Server..."
|
||||
Set-SmbServerConfiguration -EnableSMB2Protocol $true -Force
|
||||
}
|
||||
|
||||
# Disable NetBIOS over TCP/IP on all currently installed network interfaces
|
||||
Function DisableNetBIOS {
|
||||
Write-Output "Disabling NetBIOS over TCP/IP..."
|
||||
Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces\Tcpip*" -Name "NetbiosOptions" -Type DWord -Value 2
|
||||
}
|
||||
|
||||
# Enable NetBIOS over TCP/IP on all currently installed network interfaces
|
||||
Function EnableNetBIOS {
|
||||
Write-Output "Enabling NetBIOS over TCP/IP..."
|
||||
Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces\Tcpip*" -Name "NetbiosOptions" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Disable Link-Local Multicast Name Resolution (LLMNR) protocol
|
||||
Function DisableLLMNR {
|
||||
Write-Output "Disabling LLMNR..."
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient")) {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient" -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient" -Name "EnableMulticast" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Enable Link-Local Multicast Name Resolution (LLMNR) protocol
|
||||
Function EnableLLMNR {
|
||||
Write-Output "Enabling LLMNR..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient" -Name "EnableMulticast" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable Network Connectivity Status Indicator active test
|
||||
# Note: This may reduce the ability of OS and other components to determine internet access, however protects against a specific type of zero-click attack.
|
||||
# See https://github.com/Disassembler0/Win10-Initial-Setup-Script/pull/111 for details
|
||||
Function DisableNCSIProbe {
|
||||
Write-Output "Disabling NCSI active test..."
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\NetworkConnectivityStatusIndicator" -Name "NoActiveProbe" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Enable Network Connectivity Status Indicator active test
|
||||
Function EnableNCSIProbe {
|
||||
Write-Output "Enabling NCSI active test..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\NetworkConnectivityStatusIndicator" -Name "NoActiveProbe" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Set current network profile to private (allow file sharing, device discovery, etc.)
|
||||
Function SetCurrentNetworkPrivate {
|
||||
Write-Output "Setting current network profile to private..."
|
||||
Set-NetConnectionProfile -NetworkCategory Private
|
||||
}
|
||||
|
||||
# Set current network profile to public (deny file sharing, device discovery, etc.)
|
||||
Function SetCurrentNetworkPublic {
|
||||
Write-Output "Setting current network profile to public..."
|
||||
Set-NetConnectionProfile -NetworkCategory Public
|
||||
}
|
||||
|
||||
# Set unknown networks profile to private (allow file sharing, device discovery, etc.)
|
||||
Function SetUnknownNetworksPrivate {
|
||||
Write-Output "Setting unknown networks profile to private..."
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\010103000F0000F0010000000F0000F0C967A3643C3AD745950DA7859209176EF5B87C875FA20DF21951640E807D7C24")) {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\010103000F0000F0010000000F0000F0C967A3643C3AD745950DA7859209176EF5B87C875FA20DF21951640E807D7C24" -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\010103000F0000F0010000000F0000F0C967A3643C3AD745950DA7859209176EF5B87C875FA20DF21951640E807D7C24" -Name "Category" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Set unknown networks profile to public (deny file sharing, device discovery, etc.)
|
||||
Function SetUnknownNetworksPublic {
|
||||
Write-Output "Setting unknown networks profile to public..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\010103000F0000F0010000000F0000F0C967A3643C3AD745950DA7859209176EF5B87C875FA20DF21951640E807D7C24" -Name "Category" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable Internet Connection Sharing (e.g. mobile hotspot)
|
||||
Function DisableConnectionSharing {
|
||||
Write-Output "Disabling Internet Connection Sharing..."
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Network Connections" -Name "NC_ShowSharedAccessUI" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Enable Internet Connection Sharing (e.g. mobile hotspot)
|
||||
Function EnableConnectionSharing {
|
||||
Write-Output "Enabling Internet Connection Sharing..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Network Connections" -Name "NC_ShowSharedAccessUI" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable automatic installation of network devices
|
||||
Function DisableNetDevicesAutoInst {
|
||||
Write-Output "Disabling automatic installation of network devices..."
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NcdAutoSetup\Private")) {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NcdAutoSetup\Private" -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NcdAutoSetup\Private" -Name "AutoSetup" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Enable automatic installation of network devices
|
||||
Function EnableNetDevicesAutoInst {
|
||||
Write-Output "Enabling automatic installation of network devices..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NcdAutoSetup\Private" -Name "AutoSetup" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable Firewall
|
||||
Function DisableFirewall {
|
||||
Write-Output "Disabling Firewall..."
|
||||
@@ -970,6 +869,260 @@ Function SetDEPOptIn {
|
||||
|
||||
|
||||
|
||||
##########
|
||||
#region Network Tweaks
|
||||
##########
|
||||
|
||||
# Set current network profile to private (allow file sharing, device discovery, etc.)
|
||||
Function SetCurrentNetworkPrivate {
|
||||
Write-Output "Setting current network profile to private..."
|
||||
Set-NetConnectionProfile -NetworkCategory Private
|
||||
}
|
||||
|
||||
# Set current network profile to public (deny file sharing, device discovery, etc.)
|
||||
Function SetCurrentNetworkPublic {
|
||||
Write-Output "Setting current network profile to public..."
|
||||
Set-NetConnectionProfile -NetworkCategory Public
|
||||
}
|
||||
|
||||
# Set unknown networks profile to private (allow file sharing, device discovery, etc.)
|
||||
Function SetUnknownNetworksPrivate {
|
||||
Write-Output "Setting unknown networks profile to private..."
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\010103000F0000F0010000000F0000F0C967A3643C3AD745950DA7859209176EF5B87C875FA20DF21951640E807D7C24")) {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\010103000F0000F0010000000F0000F0C967A3643C3AD745950DA7859209176EF5B87C875FA20DF21951640E807D7C24" -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\010103000F0000F0010000000F0000F0C967A3643C3AD745950DA7859209176EF5B87C875FA20DF21951640E807D7C24" -Name "Category" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Set unknown networks profile to public (deny file sharing, device discovery, etc.)
|
||||
Function SetUnknownNetworksPublic {
|
||||
Write-Output "Setting unknown networks profile to public..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\010103000F0000F0010000000F0000F0C967A3643C3AD745950DA7859209176EF5B87C875FA20DF21951640E807D7C24" -Name "Category" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable automatic installation of network devices
|
||||
Function DisableNetDevicesAutoInst {
|
||||
Write-Output "Disabling automatic installation of network devices..."
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NcdAutoSetup\Private")) {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NcdAutoSetup\Private" -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NcdAutoSetup\Private" -Name "AutoSetup" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Enable automatic installation of network devices
|
||||
Function EnableNetDevicesAutoInst {
|
||||
Write-Output "Enabling automatic installation of network devices..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NcdAutoSetup\Private" -Name "AutoSetup" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Stop and disable Home Groups services - Not applicable since 1803. Not applicable to Server
|
||||
Function DisableHomeGroups {
|
||||
Write-Output "Stopping and disabling Home Groups services..."
|
||||
If (Get-Service "HomeGroupListener" -ErrorAction SilentlyContinue) {
|
||||
Stop-Service "HomeGroupListener" -WarningAction SilentlyContinue
|
||||
Set-Service "HomeGroupListener" -StartupType Disabled
|
||||
}
|
||||
If (Get-Service "HomeGroupProvider" -ErrorAction SilentlyContinue) {
|
||||
Stop-Service "HomeGroupProvider" -WarningAction SilentlyContinue
|
||||
Set-Service "HomeGroupProvider" -StartupType Disabled
|
||||
}
|
||||
}
|
||||
|
||||
# Enable and start Home Groups services - Not applicable since 1803. Not applicable to Server
|
||||
Function EnableHomeGroups {
|
||||
Write-Output "Starting and enabling Home Groups services..."
|
||||
Set-Service "HomeGroupListener" -StartupType Manual
|
||||
Set-Service "HomeGroupProvider" -StartupType Manual
|
||||
Start-Service "HomeGroupProvider" -WarningAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable obsolete SMB 1.0 protocol - Disabled by default since 1709
|
||||
Function DisableSMB1 {
|
||||
Write-Output "Disabling SMB 1.0 protocol..."
|
||||
Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force
|
||||
}
|
||||
|
||||
# Enable obsolete SMB 1.0 protocol - Disabled by default since 1709
|
||||
Function EnableSMB1 {
|
||||
Write-Output "Enabling SMB 1.0 protocol..."
|
||||
Set-SmbServerConfiguration -EnableSMB1Protocol $true -Force
|
||||
}
|
||||
|
||||
# Disable SMB Server - Completely disables file and printer sharing, but leaves the system able to connect to another SMB server as a client
|
||||
# Note: Do not run this if you plan to use Docker and Shared Drives (as it uses SMB internally), see https://github.com/Disassembler0/Win10-Initial-Setup-Script/issues/216
|
||||
Function DisableSMBServer {
|
||||
Write-Output "Disabling SMB Server..."
|
||||
Set-SmbServerConfiguration -EnableSMB1Protocol $false -Force
|
||||
Set-SmbServerConfiguration -EnableSMB2Protocol $false -Force
|
||||
Disable-NetAdapterBinding -Name "*" -ComponentID "ms_server"
|
||||
}
|
||||
|
||||
# Enable SMB Server
|
||||
Function EnableSMBServer {
|
||||
Write-Output "Enabling SMB Server..."
|
||||
Set-SmbServerConfiguration -EnableSMB2Protocol $true -Force
|
||||
Enable-NetAdapterBinding -Name "*" -ComponentID "ms_server"
|
||||
}
|
||||
|
||||
# Disable NetBIOS over TCP/IP on all currently installed network interfaces
|
||||
Function DisableNetBIOS {
|
||||
Write-Output "Disabling NetBIOS over TCP/IP..."
|
||||
Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces\Tcpip*" -Name "NetbiosOptions" -Type DWord -Value 2
|
||||
}
|
||||
|
||||
# Enable NetBIOS over TCP/IP on all currently installed network interfaces
|
||||
Function EnableNetBIOS {
|
||||
Write-Output "Enabling NetBIOS over TCP/IP..."
|
||||
Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces\Tcpip*" -Name "NetbiosOptions" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Disable Link-Local Multicast Name Resolution (LLMNR) protocol
|
||||
Function DisableLLMNR {
|
||||
Write-Output "Disabling Link-Local Multicast Name Resolution (LLMNR)..."
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient")) {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient" -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient" -Name "EnableMulticast" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Enable Link-Local Multicast Name Resolution (LLMNR) protocol
|
||||
Function EnableLLMNR {
|
||||
Write-Output "Enabling Link-Local Multicast Name Resolution (LLMNR)..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient" -Name "EnableMulticast" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable Local-Link Discovery Protocol (LLDP) for all installed network interfaces
|
||||
Function DisableLLDP {
|
||||
Write-Output "Disabling Local-Link Discovery Protocol (LLDP)..."
|
||||
Disable-NetAdapterBinding -Name "*" -ComponentID "ms_lldp"
|
||||
}
|
||||
|
||||
# Enable Local-Link Discovery Protocol (LLDP) for all installed network interfaces
|
||||
Function EnableLLDP {
|
||||
Write-Output "Enabling Local-Link Discovery Protocol (LLDP)..."
|
||||
Enable-NetAdapterBinding -Name "*" -ComponentID "ms_lldp"
|
||||
}
|
||||
|
||||
# Disable Local-Link Topology Discovery (LLTD) for all installed network interfaces
|
||||
Function DisableLLTD {
|
||||
Write-Output "Disabling Local-Link Topology Discovery (LLTD)..."
|
||||
Disable-NetAdapterBinding -Name "*" -ComponentID "ms_lltdio"
|
||||
Disable-NetAdapterBinding -Name "*" -ComponentID "ms_rspndr"
|
||||
}
|
||||
|
||||
# Enable Local-Link Topology Discovery (LLTD) for all installed network interfaces
|
||||
Function EnableLLTD {
|
||||
Write-Output "Enabling Local-Link Topology Discovery (LLTD)..."
|
||||
Enable-NetAdapterBinding -Name "*" -ComponentID "ms_lltdio"
|
||||
Enable-NetAdapterBinding -Name "*" -ComponentID "ms_rspndr"
|
||||
}
|
||||
|
||||
# Disable Client for Microsoft Networks for all installed network interfaces
|
||||
Function DisableMSNetClient {
|
||||
Write-Output "Disabling Client for Microsoft Networks..."
|
||||
Disable-NetAdapterBinding -Name "*" -ComponentID "ms_msclient"
|
||||
}
|
||||
|
||||
# Enable Client for Microsoft Networks for all installed network interfaces
|
||||
Function EnableMSNetClient {
|
||||
Write-Output "Enabling Client for Microsoft Networks..."
|
||||
Enable-NetAdapterBinding -Name "*" -ComponentID "ms_msclient"
|
||||
}
|
||||
|
||||
# Disable Quality of Service (QoS) packet scheduler for all installed network interfaces
|
||||
Function DisableQoS {
|
||||
Write-Output "Disabling Quality of Service (QoS) packet scheduler..."
|
||||
Disable-NetAdapterBinding -Name "*" -ComponentID "ms_pacer"
|
||||
}
|
||||
|
||||
# Enable Quality of Service (QoS) packet scheduler for all installed network interfaces
|
||||
Function EnableQoS {
|
||||
Write-Output "Enabling Quality of Service (QoS) packet scheduler..."
|
||||
Enable-NetAdapterBinding -Name "*" -ComponentID "ms_pacer"
|
||||
}
|
||||
|
||||
# Disable IPv4 stack for all installed network interfaces
|
||||
Function DisableIPv4 {
|
||||
Write-Output "Disabling IPv4 stack..."
|
||||
Disable-NetAdapterBinding -Name "*" -ComponentID "ms_tcpip"
|
||||
}
|
||||
|
||||
# Enable IPv4 stack for all installed network interfaces
|
||||
Function EnableIPv4 {
|
||||
Write-Output "Enabling IPv4 stack..."
|
||||
Enable-NetAdapterBinding -Name "*" -ComponentID "ms_tcpip"
|
||||
}
|
||||
|
||||
# Disable IPv6 stack for all installed network interfaces
|
||||
Function DisableIPv6 {
|
||||
Write-Output "Disabling IPv6 stack..."
|
||||
Disable-NetAdapterBinding -Name "*" -ComponentID "ms_tcpip6"
|
||||
}
|
||||
|
||||
# Enable IPv6 stack for all installed network interfaces
|
||||
Function EnableIPv6 {
|
||||
Write-Output "Enabling IPv6 stack..."
|
||||
Enable-NetAdapterBinding -Name "*" -ComponentID "ms_tcpip6"
|
||||
}
|
||||
|
||||
# Disable Network Connectivity Status Indicator active test
|
||||
# Note: This may reduce the ability of OS and other components to determine internet access, however protects against a specific type of zero-click attack.
|
||||
# See https://github.com/Disassembler0/Win10-Initial-Setup-Script/pull/111 for details
|
||||
Function DisableNCSIProbe {
|
||||
Write-Output "Disabling Network Connectivity Status Indicator (NCSI) active test..."
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\NetworkConnectivityStatusIndicator" -Name "NoActiveProbe" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Enable Network Connectivity Status Indicator active test
|
||||
Function EnableNCSIProbe {
|
||||
Write-Output "Enabling Network Connectivity Status Indicator (NCSI) active test..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\NetworkConnectivityStatusIndicator" -Name "NoActiveProbe" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable Internet Connection Sharing (e.g. mobile hotspot)
|
||||
Function DisableConnectionSharing {
|
||||
Write-Output "Disabling Internet Connection Sharing..."
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Network Connections" -Name "NC_ShowSharedAccessUI" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Enable Internet Connection Sharing (e.g. mobile hotspot)
|
||||
Function EnableConnectionSharing {
|
||||
Write-Output "Enabling Internet Connection Sharing..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Network Connections" -Name "NC_ShowSharedAccessUI" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable Remote Assistance - Not applicable to Server (unless Remote Assistance is explicitly installed)
|
||||
Function DisableRemoteAssistance {
|
||||
Write-Output "Disabling Remote Assistance..."
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Remote Assistance" -Name "fAllowToGetHelp" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Enable Remote Assistance - Not applicable to Server (unless Remote Assistance is explicitly installed)
|
||||
Function EnableRemoteAssistance {
|
||||
Write-Output "Enabling Remote Assistance..."
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Remote Assistance" -Name "fAllowToGetHelp" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Enable Remote Desktop
|
||||
Function EnableRemoteDesktop {
|
||||
Write-Output "Enabling Remote Desktop..."
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Type DWord -Value 0
|
||||
Enable-NetFirewallRule -Name "RemoteDesktop*"
|
||||
}
|
||||
|
||||
# Disable Remote Desktop
|
||||
Function DisableRemoteDesktop {
|
||||
Write-Output "Disabling Remote Desktop..."
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Type DWord -Value 1
|
||||
Disable-NetFirewallRule -Name "RemoteDesktop*"
|
||||
}
|
||||
|
||||
##########
|
||||
#endregion Network Tweaks
|
||||
##########
|
||||
|
||||
|
||||
|
||||
##########
|
||||
#region Service Tweaks
|
||||
##########
|
||||
@@ -1020,6 +1173,20 @@ Function EnableUpdateDriver {
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "ExcludeWUDriversInQualityUpdate" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Enable receiving updates for other Microsoft products via Windows Update
|
||||
Function EnableUpdateMSProducts {
|
||||
Write-Output "Enabling updates for other Microsoft products..."
|
||||
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "") | Out-Null
|
||||
}
|
||||
|
||||
# Disable receiving updates for other Microsoft products via Windows Update
|
||||
Function DisableUpdateMSProducts {
|
||||
Write-Output "Disabling updates for other Microsoft products..."
|
||||
If ((New-Object -ComObject Microsoft.Update.ServiceManager).Services | Where-Object { $_.ServiceID -eq "7971f918-a847-4430-9279-4a52d1efe18d"}) {
|
||||
(New-Object -ComObject Microsoft.Update.ServiceManager).RemoveService("7971f918-a847-4430-9279-4a52d1efe18d") | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
# Disable Windows Update automatic downloads
|
||||
Function DisableUpdateAutoDownload {
|
||||
Write-Output "Disabling Windows Update automatic downloads..."
|
||||
@@ -1035,6 +1202,23 @@ Function EnableUpdateAutoDownload {
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable automatic restart after Windows Update installation
|
||||
# The tweak is slightly experimental, as it registers a dummy debugger for MusNotification.exe
|
||||
# which blocks the restart prompt executable from running, thus never schedulling the restart
|
||||
Function DisableUpdateRestart {
|
||||
Write-Output "Disabling Windows Update automatic restart..."
|
||||
If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MusNotification.exe")) {
|
||||
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MusNotification.exe" -Force | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MusNotification.exe" -Name "Debugger" -Type String -Value "cmd.exe"
|
||||
}
|
||||
|
||||
# Enable automatic restart after Windows Update installation
|
||||
Function EnableUpdateRestart {
|
||||
Write-Output "Enabling Windows Update automatic restart..."
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MusNotification.exe" -Name "Debugger" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable nightly wake-up for Automatic Maintenance and Windows Updates
|
||||
Function DisableMaintenanceWakeUp {
|
||||
Write-Output "Disabling nightly wake-up for Automatic Maintenance..."
|
||||
@@ -1052,27 +1236,6 @@ Function EnableMaintenanceWakeUp {
|
||||
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\Maintenance" -Name "WakeUp" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Stop and disable Home Groups services - Not applicable since 1803. Not applicable to Server
|
||||
Function DisableHomeGroups {
|
||||
Write-Output "Stopping and disabling Home Groups services..."
|
||||
If (Get-Service "HomeGroupListener" -ErrorAction SilentlyContinue) {
|
||||
Stop-Service "HomeGroupListener" -WarningAction SilentlyContinue
|
||||
Set-Service "HomeGroupListener" -StartupType Disabled
|
||||
}
|
||||
If (Get-Service "HomeGroupProvider" -ErrorAction SilentlyContinue) {
|
||||
Stop-Service "HomeGroupProvider" -WarningAction SilentlyContinue
|
||||
Set-Service "HomeGroupProvider" -StartupType Disabled
|
||||
}
|
||||
}
|
||||
|
||||
# Enable and start Home Groups services - Not applicable since 1803. Not applicable to Server
|
||||
Function EnableHomeGroups {
|
||||
Write-Output "Starting and enabling Home Groups services..."
|
||||
Set-Service "HomeGroupListener" -StartupType Manual
|
||||
Set-Service "HomeGroupProvider" -StartupType Manual
|
||||
Start-Service "HomeGroupProvider" -WarningAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable Shared Experiences - Applicable since 1703. Not applicable to Server
|
||||
# This setting can be set also via GPO, however doing so causes reset of Start Menu cache. See https://github.com/Disassembler0/Win10-Initial-Setup-Script/issues/145 for details
|
||||
Function DisableSharedExperiences {
|
||||
@@ -1101,32 +1264,6 @@ Function DisableClipboardHistory {
|
||||
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Clipboard" -Name "EnableClipboardHistory" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable Remote Assistance - Not applicable to Server (unless Remote Assistance is explicitly installed)
|
||||
Function DisableRemoteAssistance {
|
||||
Write-Output "Disabling Remote Assistance..."
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Remote Assistance" -Name "fAllowToGetHelp" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Enable Remote Assistance - Not applicable to Server (unless Remote Assistance is explicitly installed)
|
||||
Function EnableRemoteAssistance {
|
||||
Write-Output "Enabling Remote Assistance..."
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Remote Assistance" -Name "fAllowToGetHelp" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Enable Remote Desktop
|
||||
Function EnableRemoteDesktop {
|
||||
Write-Output "Enabling Remote Desktop..."
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Type DWord -Value 0
|
||||
Enable-NetFirewallRule -Name "RemoteDesktop*"
|
||||
}
|
||||
|
||||
# Disable Remote Desktop
|
||||
Function DisableRemoteDesktop {
|
||||
Write-Output "Disabling Remote Desktop..."
|
||||
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Type DWord -Value 1
|
||||
Disable-NetFirewallRule -Name "RemoteDesktop*"
|
||||
}
|
||||
|
||||
# Disable Autoplay
|
||||
Function DisableAutoplay {
|
||||
Write-Output "Disabling Autoplay..."
|
||||
@@ -1240,6 +1377,21 @@ Function EnableSwapFile {
|
||||
Remove-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Name "SwapfileControl" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable Recycle Bin - Files will be permanently deleted without placing into Recycle Bin
|
||||
Function DisableRecycleBin {
|
||||
Write-Output "Disabling Recycle Bin..."
|
||||
If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer")) {
|
||||
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoRecycleFiles" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Enable Recycle Bin
|
||||
Function EnableRecycleBin {
|
||||
Write-Output "Enable Recycle Bin..."
|
||||
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoRecycleFiles" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Enable NTFS paths with length over 260 characters
|
||||
Function EnableNTFSLongPaths {
|
||||
Write-Output "Enabling NTFS paths with length over 260 characters..."
|
||||
@@ -1649,6 +1801,21 @@ Function HideTrayIcons {
|
||||
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoAutoTrayNotify" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Show seconds in taskbar
|
||||
Function ShowSecondsInTaskbar {
|
||||
Write-Output "Showing seconds in taskbar..."
|
||||
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 "ShowSecondsInSystemClock" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Hide seconds from taskbar
|
||||
Function HideSecondsFromTaskbar {
|
||||
Write-Output "Hiding seconds from taskbar..."
|
||||
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowSecondsInSystemClock" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Disable search for app in store for unknown extensions
|
||||
Function DisableSearchAppInStore {
|
||||
Write-Output "Disabling search for app in store for unknown extensions..."
|
||||
@@ -1836,7 +2003,7 @@ Function RemoveENKeyboard {
|
||||
Function EnableNumlock {
|
||||
Write-Output "Enabling NumLock after startup..."
|
||||
If (!(Test-Path "HKU:")) {
|
||||
New-PSDrive -Name HKU -PSProvider Registry -Root HKEY_USERS | Out-Null
|
||||
New-PSDrive -Name "HKU" -PSProvider "Registry" -Root "HKEY_USERS" | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKU:\.DEFAULT\Control Panel\Keyboard" -Name "InitialKeyboardIndicators" -Type DWord -Value 2147483650
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
@@ -1850,7 +2017,7 @@ Function EnableNumlock {
|
||||
Function DisableNumlock {
|
||||
Write-Output "Disabling NumLock after startup..."
|
||||
If (!(Test-Path "HKU:")) {
|
||||
New-PSDrive -Name HKU -PSProvider Registry -Root HKEY_USERS | Out-Null
|
||||
New-PSDrive -Name "HKU" -PSProvider "Registry" -Root "HKEY_USERS" | Out-Null
|
||||
}
|
||||
Set-ItemProperty -Path "HKU:\.DEFAULT\Control Panel\Keyboard" -Name "InitialKeyboardIndicators" -Type DWord -Value 2147483648
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
@@ -2306,6 +2473,18 @@ Function HideNetworkFromDesktop {
|
||||
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Show Windows build number and Windows edition (Home/Pro/Enterprise) from bottom right of desktop
|
||||
Function ShowBuildNumberOnDesktop {
|
||||
Write-Output "Showing Windows build number on desktop..."
|
||||
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "PaintDesktopVersion" -Type DWord -Value 1
|
||||
}
|
||||
|
||||
# Remove Windows build number and Windows edition (Home/Pro/Enterprise) from bottom right of desktop
|
||||
Function HideBuildNumberFromDesktop {
|
||||
Write-Output "Hiding Windows build number from desktop..."
|
||||
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "PaintDesktopVersion" -Type DWord -Value 0
|
||||
}
|
||||
|
||||
# Hide Desktop icon from This PC - The icon remains in personal folders and open/save dialogs
|
||||
Function HideDesktopFromThisPC {
|
||||
Write-Output "Hiding Desktop icon from This PC..."
|
||||
@@ -2669,12 +2848,14 @@ Function UninstallOneDrive {
|
||||
Start-Sleep -s 2
|
||||
Stop-Process -Name "explorer" -Force -ErrorAction SilentlyContinue
|
||||
Start-Sleep -s 2
|
||||
Remove-Item -Path "$env:USERPROFILE\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue
|
||||
If ((Get-ChildItem -Path "$env:USERPROFILE\OneDrive" -ErrorAction SilentlyContinue | Measure-Object).Count -eq 0) {
|
||||
Remove-Item -Path "$env:USERPROFILE\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue
|
||||
}
|
||||
Remove-Item -Path "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "$env:PROGRAMDATA\Microsoft OneDrive" -Force -Recurse -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "$env:SYSTEMDRIVE\OneDriveTemp" -Force -Recurse -ErrorAction SilentlyContinue
|
||||
If (!(Test-Path "HKCR:")) {
|
||||
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
|
||||
New-PSDrive -Name "HKCR" -PSProvider "Registry" -Root "HKEY_CLASSES_ROOT" | Out-Null
|
||||
}
|
||||
Remove-Item -Path "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Recurse -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Recurse -ErrorAction SilentlyContinue
|
||||
@@ -3207,7 +3388,7 @@ Function UninstallNET23 {
|
||||
Function SetPhotoViewerAssociation {
|
||||
Write-Output "Setting Photo Viewer association for bmp, gif, jpg, png and tif..."
|
||||
If (!(Test-Path "HKCR:")) {
|
||||
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
|
||||
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
|
||||
@@ -3221,7 +3402,7 @@ Function SetPhotoViewerAssociation {
|
||||
Function UnsetPhotoViewerAssociation {
|
||||
Write-Output "Unsetting Photo Viewer association for bmp, gif, jpg, png and tif..."
|
||||
If (!(Test-Path "HKCR:")) {
|
||||
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
|
||||
New-PSDrive -Name "HKCR" -PSProvider "Registry" -Root "HKEY_CLASSES_ROOT" | Out-Null
|
||||
}
|
||||
Remove-Item -Path "HKCR:\Paint.Picture\shell\open" -Recurse -ErrorAction SilentlyContinue
|
||||
Remove-ItemProperty -Path "HKCR:\giffile\shell\open" -Name "MuiVerb" -ErrorAction SilentlyContinue
|
||||
@@ -3236,7 +3417,7 @@ Function UnsetPhotoViewerAssociation {
|
||||
Function AddPhotoViewerOpenWith {
|
||||
Write-Output "Adding Photo Viewer to 'Open with...'"
|
||||
If (!(Test-Path "HKCR:")) {
|
||||
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
|
||||
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
|
||||
@@ -3249,7 +3430,7 @@ Function AddPhotoViewerOpenWith {
|
||||
Function RemovePhotoViewerOpenWith {
|
||||
Write-Output "Removing Photo Viewer from 'Open with...'"
|
||||
If (!(Test-Path "HKCR:")) {
|
||||
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
|
||||
New-PSDrive -Name "HKCR" -PSProvider "Registry" -Root "HKEY_CLASSES_ROOT" | Out-Null
|
||||
}
|
||||
Remove-Item -Path "HKCR:\Applications\photoviewer.dll\shell\open" -Recurse -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user