26 Commits

Author SHA1 Message Date
Disassembler
91a6afba1f v3.8, 2019-09-11
- Add "Enable updates for Microsoft products via Windows Update" (thx @farag2)
 - Add "Disable Microphone"
 - Add "Disable Recycle Bin" (thx @Robot1me)
 - Add "Show Build Number On Desktop" (thx @Cubox-)
 - Add "Show seconds in taskbar functions" (thx @reloxx13)
 - Add "Disable Automatic Restart after Windows Update"
 - Add several tweaks to disable network protocols (thx @gxjit)
 - Create new group for network tweaks and move appropriate tweaks there
 - Update DisableAppSuggestions to disable Ink Workspace suggestions
 - Update UninstallOneDrive to not remove user files if OneDrive has already been used
 - Update main execution loop to return nonzero exit code when module or preset file doesn't exist or can't be loaded
2019-09-11 14:37:17 +02:00
Disassembler
b6caea6a56 Remove DisableWebSearch warning as it's fixed by KB4515384, related to #262 2019-09-11 14:20:11 +02:00
Disassembler
a73dc396f7 Fix typo and suppress 2 more error messages 2019-09-09 20:33:25 +02:00
Disassembler
94d9046fd4 Reintroduce "Disable Automatic Restart after Windows Update" 2019-09-09 13:35:18 +02:00
Disassembler
f61ef1a899 Add tweaks to disable network protocols. Reimplements #257 (thx @gxjit) 2019-09-06 07:59:01 +02:00
Disassembler
965d033fd7 Create "Network Tweaks" group and move related tweaks 2019-09-05 17:23:00 +02:00
MoritzDa
a74666786c Add quotes in New-PSDrive commands (#259) 2019-09-05 15:10:45 +02:00
reloxx13
e75bfe9842 Add "Show seconds in taskbar functions" (#256) 2019-09-05 15:05:05 +02:00
Disassembler
58881c87f4 Reorder the new tweaks 2019-09-05 15:00:39 +02:00
Disassembler
3f09ce7b9e Add "Show Build Number On Desktop", closes #255 (thx @Cubox-) 2019-09-05 14:23:28 +02:00
Disassembler
bf69210346 Add Write-Output strings 2019-09-05 14:22:45 +02:00
Disassembler
7e52af6d42 Add "Disable Recycle Bin", closes #245 2019-09-05 14:10:06 +02:00
Disassembler
004dd6d752 Rename 2019-09-05 13:55:46 +02:00
Disassembler
30382f9b30 Return nonzero exit code when module or preset file doesn't exist, resolves #258 2019-09-05 13:32:24 +02:00
Disassembler
d8f790e6f3 Add "Disable Microphone", closes #253 2019-09-05 13:07:28 +02:00
Disassembler
81b660974c Don't remove user files if OneDrive has already been used, closes #248 2019-09-05 09:52:40 +02:00
Disassembler
1f9e9c48ff Disable Windows Ink Workspace suggestions as part of DisableAppSuggestions, closes #246 2019-09-05 08:29:11 +02:00
Disassembler
fb04190dfd Comment DisableWebSearch and add a note about breakage in 18362.329. Closes #262 2019-09-04 19:48:13 +02:00
Andy Pilate
8dbe0c49fc Unset the feature on default preset
Co-Authored-By: kroimon <github@kroimon.de>
2019-08-23 15:43:53 +02:00
Andy Pilate
6d1b6b725d Merge pull request #2 from Cubox-/patch-1
Add ShowBuildNumberOnDesktop function
2019-07-20 02:08:45 +02:00
Andy Pilate
f489347b17 Merge pull request #1 from Cubox-/patch-2
Add BuildNumberOnDesktop to Default.preset
2019-07-20 02:07:16 +02:00
Andy Pilate
26d5762d97 Add BuildNumberOnDesktop to Default.preset
Enabled by default
2019-07-20 02:05:41 +02:00
Andy Pilate
3472bde78c Add ShowBuildNumberOnDesktop function 2019-07-20 02:03:59 +02:00
Disassembler
b67cde21cc Add "Enable updates for Microsoft products via WU", closes #250 (thx @farag2) 2019-06-19 17:49:36 +02:00
Robot1me
a79832ca0d Add "EnableRecycleFiles"
Option to enforce file deletion, without moving files to recycle bin.
2019-06-07 19:54:06 +02:00
Disassembler
e488251c16 v3.7, 2019-05-31
- Add -log parameter for output logging
 - Add more bloatware for removal (thx @r3incarnat0r)
 - Add "Disable Location services" (thx @r3incarnat0r)
 - Add "Disable Sensor services" (thx @r3incarnat0r)
 - Add "Disable Biometric services" (thx @r3incarnat0r)
 - Add "Disable Camera" (thx @r3incarnat0r)
 - Add "Disable Media Sharing" (thx @r3incarnat0r)
 - Add "Show verbose startup/shutdown status messages" (thx @CruzMarcio)
 - Add "Disable First Logon Animation" (thx @mrcrutch)
 - Add "Disable Windows Update automatic downloads" (thx @pablospizzamiglio)
 - Add "Disable Lock screen Blur" (thx @sippi90)
 - Add "Show full path in Explorer title" (thx @Zweikeks)
 - Add "Show protected operating system files" (thx @Zweikeks)
 - Add "Show empty drives" (thx @Zweikeks)
 - Add "Show folder merge conflicts" (thx @Zweikeks)
 - Add "Show all folders in Explorer navigation pane" (thx @Zweikeks)
 - Add "Show coloring of encrypted or compressed NTFS files" (thx @Zweikeks)
 - Add "Disable accessibility keys prompts" (thx @r3incarnat0r)
 - Add "Disable F1 Help key" (thx @Conder000)
 - Add "Disable NetBIOS" (thx @shaunography)
 - Add "Hide Recycle Bin From Desktop" (thx @mcavallo-git)
 - Add "Show Network On Desktop" (thx @mcavallo-git)
 - Add "Enable Clipboard History" (thx @Ash258)
 - Add "Enable NTFS long paths"
 - Add "Disable Internet Connection Sharing"
 - Add "Disable Fullscreen optimizations"
 - Add "Disable nightly wake-up for Automatic Maintenance"
 - Update "EnableXboxFeatures" to disable Game mode
 - Update "Enable Remote Desktop" to leave Network Level Authentication enabled
 - Update "DisableTelemetry" to set more registry keys (thx @r3incarnat0r)
 - Update "DisableCortana" to set more registry keys (thx @r3incarnat0r)
 - Remove "DisableLocationTracking" in favor of "DisableLocation"
 - Remove "DisableStickyKeys" in favor of "DisableAccessibilityKeys"
 - Remove "DisableUpdateRestart" in favor of "DisableMaintenanceWakeUp"
2019-05-31 21:29:37 +02:00
3 changed files with 394 additions and 199 deletions

View File

@@ -1,7 +1,7 @@
##########
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Default preset
# Author: Disassembler <disassembler@dasm.cz>
# Version: development
# 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

View File

@@ -1,7 +1,7 @@
##########
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Main execution loop
# Author: Disassembler <disassembler@dasm.cz>
# Version: development
# 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()) }

View File

@@ -1,7 +1,7 @@
##########
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Tweak library
# Author: Disassembler <disassembler@dasm.cz>
# Version: development
# 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
}