-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathWindowsMize.mini.ps1
More file actions
1984 lines (1686 loc) · 69.6 KB
/
WindowsMize.mini.ps1
File metadata and controls
1984 lines (1686 loc) · 69.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#=================================================================================================================
# __ __ _ _ __ __ _
# \ \ / / (_) _ _ __| | ___ __ __ __ ___ | \/ | (_) ___ ___
# \ \/\/ / | | | ' \ / _` | / _ \ \ V V / (_-< | |\/| | | | |_ / / -_)
# \_/\_/ |_| |_||_| \__,_| \___/ \_/\_/ /__/ |_| |_| |_| /__| \___|
#
# PowerShell script to automate and customize the configuration of Windows
#
#=================================================================================================================
<#
This file is the equivalent of all functions within the "scripts" folder.
#>
#Requires -RunAsAdministrator
#Requires -Version 7.5
[CmdletBinding()]
param
(
[string] $User
)
$Global:ProvidedUserName = $User
Import-Module -Name "$PSScriptRoot\src\modules\helper_functions\general"
Test-PowerShellLanguageMode
Test-NewerWindowsMizeVersion
Start-Logging -FileName 'WindowsMize.mini'
#=================================================================================================================
# Modules
#=================================================================================================================
$WindowsMizeModuleNames = @(
# --- Application
'settings_app\optional_features'
'applications\management'
'applications\settings'
# --- Network & Internet
'settings_app\network_&_internet'
'network'
# --- System & Tweaks
'file_explorer'
'power_options'
'system_properties'
'scheduled_tasks'
'services'
'ramdisk'
'tweaks'
# --- Telemetry & Annoyances
'telemetry'
'settings_app\defender_security_center'
'settings_app\privacy_&_security'
# --- Win Settings App
'settings_app\system'
'settings_app\bluetooth_&_devices'
'settings_app\personnalization'
'settings_app\apps'
'settings_app\accounts'
'settings_app\time_&_language'
'settings_app\gaming'
'settings_app\accessibility'
'settings_app\windows_update'
)
Import-Module -Name $WindowsMizeModuleNames.ForEach({ "$PSScriptRoot\src\modules\$_" })
# Parameters values (if not specified):
# State: Disabled | Enabled
# GPO: Disabled | NotConfigured (default)
#=================================================================================================================
# Apps Management
#=================================================================================================================
#region Apps Management
Write-Section -Name 'Applications Management'
# Appx & provisioned packages
#=======================================
#region Debloat
Write-Section -Name 'Appx & provisioned packages' -SubSection
Remove-StartMenuPromotedApps # Win11
Set-StartMenuBingSearch -State 'Disabled' -GPO 'Disabled'
Set-Recall -GPO 'Disabled' # Disabled | Enabled | NotConfigured
Set-Widgets -GPO 'Disabled'
Set-MicrosoftStorePushToInstall -GPO 'Disabled'
Set-Copilot -GPO 'Disabled' # old
Set-Cortana -GPO 'Disabled' # old
Export-DefaultAppxPackagesNames
Remove-MSMaliciousSoftwareRemovalTool
Remove-MicrosoftEdge
Remove-OneDrive
$OneDriveConfig = @{
NewUserAutoInstall = 'Disabled'
#RunAtStartup = 'Disabled'
BackupNotifExplorer = 'Disabled'
BackupNotifToast = 'Disabled'
}
Set-OneDrive @OneDriveConfig
$PreinstalledAppsToRemove = @(
'BingSearch'
#'Calculator'
'Camera'
'Clipchamp'
'Clock'
'Compatibility'
'Cortana'
'CrossDevice'
'DevHome'
'EdgeGameAssist'
#'Extensions'
'Family'
'FeedbackHub'
'GetHelp'
'Journal'
'MailAndCalendar'
'Maps'
'MediaPlayer'
'M365Copilot'
'M365Companions'
'MicrosoftCopilot'
'MicrosoftTeams'
'MoviesAndTV'
'News'
#'Notepad'
'Outlook'
#'Paint'
'People'
'PhoneLink'
#'Photos'
'PowerAutomate'
'QuickAssist'
#'SnippingTool'
'Solitaire'
'SoundRecorder'
'StickyNotes'
#'Terminal'
'Tips'
'Todo'
'Weather'
#'Whiteboard'
'Widgets'
#'Xbox' # might be required for some games
# Win 10
'3DViewer'
'MixedReality'
'OneNote'
'Paint3D'
'Skype'
'Wallet'
)
$PreinstalledAppsToRemove | Remove-PreinstalledAppPackage
# --- Optional features
Export-InstalledWindowsCapabilitiesNames
Export-EnabledWindowsOptionalFeaturesNames
$OptionalFeatures = @(
# --- Features
'ExtendedThemeContent'
'FacialRecognitionWindowsHello'
'InternetExplorerMode'
'MathRecognizer'
'NotepadSystem'
'OneSync'
'OpenSSHClient'
'PrintManagement'
'StepsRecorder'
'WMIC'
'VBScript'
'WindowsFaxAndScan'
'WindowsMediaPlayerLegacy'
'WindowsPowerShellISE'
'WordPad'
'XpsViewer'
# --- More Windows features
'InternetPrintingClient'
'MediaFeatures'
'MicrosoftXpsDocumentWriter'
'NetFramework48TcpPortSharing'
'RemoteDesktopConnection'
'RemoteDiffCompressionApiSupport'
'SmbDirect'
'WindowsPowerShell2'
'WindowsRecall'
'WorkFoldersClient'
)
$OptionalFeatures | Remove-PreinstalledOptionalFeature
#endregion Debloat
# Installation
#=======================================
#region Install
Write-Section -Name 'Installation' -SubSection
$CustomAppsToInstall = @{
Machine = @(
'Valve.Steam'
'AppName2'
'AppName3'
)
User = @(
'AppName1'
'AppName2'
)
NoScope = @(
'AppName1'
'AppName2'
)
}
# Scope (optional): Machine | User
#$CustomAppsToInstall['Machine'] | Install-ApplicationWithWinget -Scope 'Machine'
#$CustomAppsToInstall['User'] | Install-ApplicationWithWinget -Scope 'User'
#$CustomAppsToInstall['NoScope'] | Install-ApplicationWithWinget
$AppsToInstall = @(
#'Git'
#'VSCode'
'VLC'
#'Bitwarden'
#'KeePassXC'
#'ProtonPass'
#'AcrobatReader'
#'SumatraPDF'
#'7zip'
#'Notepad++'
#'qBittorrent'
#'ProtonVPN'
#'MullvadVPN'
'Brave'
#'Firefox'
#'MullvadBrowser'
#'VCRedist2015+.ARM'
'VCRedist2015+'
#'VCRedist2013'
#'VCRedist2012'
#'VCRedist2010'
#'VCRedist2008'
#'VCRedist2005'
#'DirectX9EndUserRuntime'
#'DotNetDesktopRuntime10'
#'DotNetDesktopRuntime9'
#'DotNetDesktopRuntime8'
#'DotNetDesktopRuntime7'
#'DotNetDesktopRuntime6'
#'DotNetDesktopRuntime5'
)
$AppsToInstall | Install-Application
#Remove-AllDesktopShortcuts
#Install-WindowsSubsystemForLinux
#Install-WindowsSubsystemForLinux -Distribution 'Debian'
#endregion Install
#endregion Apps Management
#=================================================================================================================
# Apps Settings
#=================================================================================================================
#region Apps Settings
Write-Section -Name 'Applications Settings'
# Acrobat Reader
#=======================================
#region acrobat reader
Write-Section -Name 'Acrobat Reader' -SubSection
$AdobeReaderSettings = @{
# --- Preferences
## Documents
ShowToolsPane = 'Disabled'
## General
ShowCloudStorageOnFileOpen = 'Disabled'
ShowCloudStorageOnFileSave = 'Disabled'
ShowMessagesAtLaunch = 'Disabled' ; ShowMessagesAtLaunchGPO = 'Disabled' # Disabled | Enabled | NotConfigured
ShowMessagesWhenViewingPdf = 'Disabled' ; ShowMessagesWhenViewingPdfGPO = 'Disabled' # Disabled | Enabled | NotConfigured
SendCrashReports = 'Never' # Ask | Always | Never
## Email accounts
WebmailGPO = 'Disabled'
## Javascript
Javascript = 'Disabled' ; JavascriptGPO = 'NotConfigured'
JavascriptMenuItemsExecution = 'Disabled'
JavascriptGlobalObjectSecurity = 'Enabled'
## Reviewing
SharedReviewWelcomeDialog = 'Disabled'
## Security (enhanced)
ProtectedMode = 'Enabled' ; ProtectedModeGPO = 'NotConfigured' # Disabled | Enabled | NotConfigured
AppContainer = 'Enabled' ; AppContainerGPO = 'NotConfigured' # Disabled | Enabled | NotConfigured
ProtectedView = 'Disabled' ; ProtectedViewGPO = 'NotConfigured'
EnhancedSecurity = 'Enabled' ; EnhancedSecurityGPO = 'NotConfigured' # Disabled | Enabled | NotConfigured
TrustCertifiedDocuments = 'Disabled' ; TrustCertifiedDocumentsGPO = 'NotConfigured' # Disabled | Enabled | NotConfigured
TrustOSTrustedSites = 'Disabled' ; TrustOSTrustedSitesGPO = 'NotConfigured' # Disabled | Enabled | NotConfigured
AddTrustedFilesFoldersGPO = 'NotConfigured'
AddTrustedSitesGPO = 'NotConfigured'
## Trust manager
OpenFileAttachments = 'Disabled' ; OpenFileAttachmentsGPO = 'NotConfigured'
InternetAccessFromPdf = 'Custom' ; InternetAccessFromPdfGPO = 'NotConfigured' # BlockAllWebSites | AllowAllWebSites | Custom | NotConfigured
InternetAccessFromPdfUnknownUrl = 'Ask' ; InternetAccessFromPdfUnknownUrlGPO = 'NotConfigured' # Ask | Allow | Block | NotConfigured
## Units
PageUnits = 'Centimeters' # Points | Inches | Millimeters | Centimeters | Picas
# --- Miscellaneous
## Ads
UpsellGPO = 'Disabled'
UpsellMobileAppGPO = 'Disabled'
## Cloud storage
AdobeCloudStorageGPO = 'Disabled'
SharePointGPO = 'Disabled'
ThirdPartyCloudStorageGPO = 'Disabled'
## Tips
FirstLaunchExperienceGPO = 'Disabled'
OnboardingDialogsGPO = 'Disabled'
PopupTipsGPO = 'Disabled'
## Others
AcceptEulaGPO = 'Enabled' # Enabled | NotConfigured
ChromeExtensionGPO = 'Disabled' # Disabled | Enabled | NotConfigured
CrashReporterDialogGPO = 'Disabled'
HomeTopBannerGPO = 'Disabled' # Disabled | Expanded | Collapsed
OnlineServicesGPO = 'Disabled'
OutlookPluginGPO = 'Disabled'
ShareFileGPO = 'Disabled'
TelemetryGPO = 'Disabled'
SynchronizerRunAtStartup = 'Disabled'
SynchronizerTaskManagerProcess = 'Disabled'
}
Set-AdobeAcrobatReaderSetting @AdobeReaderSettings
$RemovedTools = @(
#'AddComments'
'AddRichMedia'
'AddSearchIndex'
#'AddStamp'
'ApplyPdfStandards'
'CreatePdf'
'CombineFiles'
'CompareFiles'
'CompressPdf'
'ConvertPdf'
'EditPdf'
'ExportPdf'
#'FillAndSign'
'MeasureObjects'
'OrganizePages'
'PrepareForAccessibility'
'PrepareForm'
'ProtectPdf'
'RedactPdf'
'RequestSignatures'
'ScanAndOcr'
'UseCertificate'
'UseGuidedActions'
'UsePrintProduction'
)
Set-AdobeAcrobatReaderSetting -RemoveToolFromToolsTab $RemovedTools
#Set-AdobeAcrobatReaderSetting -ResetRemovedToolsFromToolsTab
#endregion acrobat reader
# Brave, VLC, Others
#=======================================
#region Brave, VLC, Others
Write-Section -Name 'Brave, VLC, Others' -SubSection
# src\modules\applications\settings\private\New-BraveBrowserConfigData.ps1
Set-BraveBrowserSettings
# src\modules\applications\settings\config_files
$AppsToConfig = @(
#'KeePassXC'
#'qBittorrent'
'VLC'
#'VSCode'
#'Git'
)
$AppsToConfig | Set-MyAppsSetting
#endregion Brave, VLC, Others
# MS Office
#=======================================
#region MS Office
Write-Section -Name 'MS Office' -SubSection
# --- Microsoft Office
$MsOfficeSettings = @{
# Options
LinkedinFeatures = 'Disabled' ; LinkedinFeaturesGPO = 'NotConfigured'
ShowStartScreen = 'Disabled' ; ShowStartScreenGPO = 'NotConfigured'
# Miscellaneous
AcceptEULAsGPO = 'Enabled' # Enabled | NotConfigured
BlockSigninGPO = 'NotConfigured' # Enabled | NotConfigured
TeachingTips = 'Disabled'
# Privacy
AILocalTrainingGPO = 'Disabled'
CeipGPO = 'Disabled'
DiagnosticsGPO = 'Disabled' # Disabled | Enabled | NotConfigured
DiscountProgramNotifsGPO = 'Disabled' # Disabled | Enabled | NotConfigured
ErrorReportingGPO = 'Disabled'
FeedbackGPO = 'Disabled'
FirstRunAboutSigninGPO = 'Disabled'
FirstRunOptinWizardGPO = 'Disabled'
SendPersonalInfoGPO = 'Disabled'
SurveysGPO = 'Disabled'
TelemetryGPO = 'Disabled'
# Connected experiences
AllConnectedExperiencesGPO = 'NotConfigured'
ConnectedExperiencesThatAnalyzeContentGPO = 'NotConfigured'
ConnectedExperiencesThatDownloadContentGPO = 'NotConfigured'
OptionalConnectedExperiences = 'Disabled' ; OptionalConnectedExperiencesGPO = 'NotConfigured'
}
Set-MicrosoftOfficeSetting @MsOfficeSettings
#endregion MS Office
# MS Store & Edge
#=======================================
#region MS Store & Edge
Write-Section -Name 'MS Store & Edge' -SubSection
# --- MS Edge
$MicrosoftEdgePolicy = @{
Prelaunch = 'Disabled' # Disabled | Enabled | NotConfigured
StartupBoost = 'Disabled' # Disabled | Enabled | NotConfigured
BackgroundMode = 'Disabled' # Disabled | Enabled | NotConfigured
}
Set-MicrosoftEdgePolicy @MicrosoftEdgePolicy
# --- MS Store
$MsStoreSettings = @{
AutoAppUpdates = 'Enabled' ; AutoAppUpdatesGPO = 'NotConfigured' # Disabled | Enabled | NotConfigured
AppInstallNotifications = 'Enabled'
AutoCreateAppDesktopShorcut = 'Disabled'
VideoAutoplay = 'Disabled'
PersonalizedExperiences = 'Disabled'
}
Set-MicrosoftStoreSetting @MsStoreSettings
#endregion MS Store & Edge
# UWP Apps
#=======================================
#region UWP Apps
Write-Section -Name 'UWP Apps' -SubSection
# --- Windows Notepad
$NotepadSettings = @{
Theme = 'System' # System | Light | Dark
FontFamily = 'Consolas' # Arial | Calibri | Consolas | Comic Sans MS | Times New Roman | ...
FontStyle = 'Regular' # Regular | Italic | Bold | Bold Italic
FontSize = '11' # range 1-99
WordWrap = 'Enabled'
Formatting = 'Disabled'
FormattingTips = 'Disabled'
OpenFile = 'NewTab' # NewTab | NewWindow
RecentFiles = 'Enabled'
SpellCheck = 'Disabled'
AutoCorrect = 'Disabled'
WritingTools = 'Disabled'
StatusBar = 'Enabled'
ContinuePreviousSession = 'Disabled'
ContinuePreviousSessionTip = 'Disabled'
}
Set-WindowsNotepadSetting @NotepadSettings
# --- Windows Photos
$PhotosSettings = @{
Theme = 'Dark' # System | Light | Dark
ShowGalleryTilesAttributes = 'Enabled'
LocationBasedFeatures = 'Disabled'
ShowICloudPhotos = 'Disabled'
DeleteConfirmationDialog = 'Enabled'
ImageCategorization = 'Disabled'
MouseWheelBehavior = 'ZoomInOut' # ZoomInOut | NextPreviousItems
SmallMediaZoomPreference = 'ViewActualSize' # FitWindow | ViewActualSize
#RunAtStartup = 'Disabled' # old
GalleryType = 'River' # River | Square
GallerySize = 'Medium' # Small | Medium | Large
FirstRunExperience = 'Disabled'
}
Set-WindowsPhotosSetting @PhotosSettings
# --- Windows Snipping Tool
$SnippingToolSettings = @{
AutoCopyScreenshotChangesToClipboard = 'Enabled'
AutoSaveScreenshots = 'Enabled'
AskToSaveEditedScreenshots = 'Disabled'
MultipleWindows = 'Disabled'
ScreenshotBorder = 'Disabled'
HDRColorCorrector = 'Disabled'
AutoCopyRecordingChangesToClipboard = 'Enabled'
AutoSaveRecordings = 'Enabled'
AskToSaveEditedRecordings = 'Disabled'
IncludeMicrophoneInRecording = 'Disabled'
IncludeSystemAudioInRecording = 'Enabled'
Theme = 'System' # System | Light | Dark
TeachingTips = 'Disabled'
}
Set-WindowsSnippingToolSetting @SnippingToolSettings
# --- Windows Terminal
$TerminalSettings = @{
DefaultProfile = 'PowerShellCore' # WindowsPowerShell | CommandPrompt | PowerShellCore
DefaultCommandTerminalApp = 'WindowsTerminal' # LetWindowsDecide | WindowsConsoleHost | WindowsTerminal
RunAtStartup = 'Disabled'
DefaultColorScheme = 'One Half Dark' # Campbell | Campbell Powershell | Dark+ | One Half Dark | ...
DefaultHistorySize = 32767 # default: 9001 | max: 32767
}
Set-WindowsTerminalSetting @TerminalSettings
#endregion UWP Apps
#endregion Apps Settings
#=================================================================================================================
# Network & Internet
#=================================================================================================================
#region Network & Internet
Write-Section -Name 'Network & Internet'
# Network & internet
#=======================================
#region Network
Write-Section -Name 'Network & internet' -SubSection
# ResetServerAddresses
# FallbackToPlaintext (does not work for Mullvad)
# Provider: Adguard | Cloudflare | Mullvad | Quad9
# Server:
# Adguard : Default | Unfiltered | Family
# Cloudflare : Default | Security | Family
# Mullvad : Default | Adblock | Base | Extended | Family | All
# Quad9 : Default | Unfiltered
Set-DnsServer -Provider 'Cloudflare' -Server 'Default'
#Set-DnsServer -Provider 'Cloudflare' -Server 'Default' -FallbackToPlaintext
#Set-DnsServer -ResetServerAddresses
$NetworkSettings = @{
ConnectedNetworkProfile = 'Private' # Public | Private
VpnOverMeteredNetworks = 'Enabled'
VpnWhileRoaming = 'Enabled'
ProxyAutoDetectSettings = 'Disabled'
AutoSetupConnectedDevices = 'Disabled'
}
Set-NetworkSetting @NetworkSettings
$NetworkSharingSettings = @(
@{ Name = 'NetworkDiscovery' ; NetProfile = 'Private' ; State = 'Disabled' }
@{ Name = 'NetworkDiscovery' ; NetProfile = 'Public' ; State = 'Disabled' }
@{ Name = 'NetworkDiscovery' ; NetProfile = 'Domain' ; State = 'Disabled' }
@{ Name = 'FileAndPrinterSharing' ; NetProfile = 'Private' ; State = 'Disabled' }
@{ Name = 'FileAndPrinterSharing' ; NetProfile = 'Public' ; State = 'Disabled' }
@{ Name = 'FileAndPrinterSharing' ; NetProfile = 'Domain' ; State = 'Disabled' }
) | ForEach-Object { [PSCustomObject]$_ }
$NetworkSharingSettings | Set-NetworkSharingSetting
#endregion Network
# Firewall
#=======================================
#region Firewall
Write-Section -Name 'Firewall' -SubSection
$FirewallRules = @(
'AllJoynRouter'
'CastToDevice'
'ConnectedDevicesPlatform'
'DeliveryOptimization'
'DIALProtocol'
'MicrosoftMediaFoundation'
'ProximitySharing'
'WifiDirectDiscovery'
'WirelessDisplay'
'WiFiDirectCoordinationProtocol'
'WiFiDirectKernelModeDriver'
)
Set-DefenderFirewallRule -Name $FirewallRules -State 'Disabled'
$FirewallInboundRules = @(
'CDP'
'DCOM_RPC'
'NetBiosTcpIP'
'SMB'
'MiscProgSrv' # lsass.exe, wininit.exe, Schedule, EventLog, services.exe
)
Block-DefenderFirewallInboundRule -Name $FirewallInboundRules
#Block-DefenderFirewallInboundRule -Name $FirewallInboundRules -Reset
#endregion Firewall
# Protocol
#=======================================
#region Protocol
Write-Section -Name 'Protocol' -SubSection
# --- IPv6 transition technologies
$IPv6TransitionTech = @(
'6to4'
'Teredo'
'IP-HTTPS'
'ISATAP'
)
Set-NetIPv6Transition -Name $IPv6TransitionTech -State 'Disabled' -GPO 'Disabled'
# --- Network adapter protocol
Export-DefaultNetAdapterProtocolsState
$AdapterProtocolsToDisable = @(
'LltdIo'
'LltdResponder'
#'IPv4'
#'IPv6'
#'FileSharingClient' # needed by NetworkDiscovery (File Explorer > Network)
#'FileSharingServer' # needed by NetworkDiscovery (File Explorer > Network)
'BridgeDriver' # old ?
'QosPacketScheduler'
'HyperVExtensibleVirtualSwitch'
'Lldp'
'MicrosoftMultiplexor'
)
Set-NetAdapterProtocol -Name $AdapterProtocolsToDisable -State 'Disabled'
# --- System Drivers (Services)
$SystemDriversToConfig = @(
'BridgeDriver' # old ?
'NetBiosDriver' # needed by old pc/hardware: File and Printer Sharing
'NetBiosOverTcpIpDriver' # legacy/old | needed by old pc/hardware: File and Printer Sharing
'LldpDriver'
'LltdIoDriver'
'LltdResponderDriver'
'MicrosoftMultiplexorDriver'
'QosPacketSchedulerDriver'
)
# Disable the above selected drivers.
#$SystemDriversToConfig | Set-ServiceStartupTypeGroup
#$SystemDriversToConfig | Set-ServiceStartupTypeGroup -RestoreDefault
# --- Miscellaneous
Set-NetBiosOverTcpIP -State 'Disabled' # Disabled | Enabled | Default
Set-NetIcmpRedirects -State 'Disabled'
Set-NetIPSourceRouting -State 'Disabled'
#Set-NetLlmnr -GPO 'NotConfigured' # needed by NetworkDiscovery (File Explorer > Network)
Set-NetLmhosts -State 'Disabled'
#Set-NetMulicastDns -State 'Disabled' # needed by NetworkDiscovery (File Explorer > Network)
Set-NetSmhnr -GPO 'Disabled'
#Set-NetProxyAutoDetect -State 'Disabled'
#endregion Protocol
#endregion Network & Internet
#=================================================================================================================
# System & Tweaks
#=================================================================================================================
#region System & Tweaks
Write-Section -Name 'System & Tweaks'
# File Explorer
#=======================================
#region file Explorer
Write-Section -Name 'File Explorer' -SubSection
$FileExplorerSettings = @{
# --- General
LaunchTo = 'Home' # ThisPC | Home | Downloads | OneDrive
#OpenFolder = 'SameWindow' # SameWindow | NewWindow
#OpenFolderInNewTab = 'Enabled'
#OpenItem = 'DoubleClick' # SingleClick | DoubleClick
ShowRecentFiles = 'Enabled'
ShowFrequentFolders = 'Disabled'
ShowCloudFiles = 'Disabled'
ShowRecommendedSection = 'Disabled'
# --- View
#ShowIconsOnly = 'Disabled'
CompactView = 'Enabled'
#ShowFileIconOnThumbnails = 'Enabled'
#ShowFileSizeInFolderTips = 'Enabled'
#ShowFullPathInTitleBar = 'Disabled'
#Prelaunch = 'Enabled'
ShowHiddenItems = 'Enabled'
#HideEmptyDrives = 'Enabled'
HideFileExtensions = 'Disabled'
#HideFolderMergeConflicts = 'Enabled'
#HideProtectedSystemFiles = 'Enabled'
#LaunchFolderInSeparateProcess = 'Disabled'
#RestorePreviousFoldersAtLogon = 'Disabled'
#ShowDriveLetters = 'AfterDriveName' # Disabled | AfterDriveName | BeforeDriveName
#ColorEncryptedAndCompressedFiles = 'Disabled'
#ShowItemsInfoPopup = 'Enabled'
#ShowPreviewHandlers = 'Enabled'
#ShowStatusBar = 'Enabled'
ShowSyncProviderNotifications = 'Disabled'
ItemsCheckBoxes = 'Enabled'
SharingWizard = 'Disabled'
#TypingIntoListViewBehavior = 'SelectItemInView' # SelectItemInView | AutoTypeInSearchBox
ShowCloudStatesOnNavPane = 'Disabled'
#ExpandToCurrentFolder = 'Disabled'
#ShowAllFolders = 'Disabled'
#ShowLibraries = 'Disabled'
#ShowNetwork = 'Enabled'
#ShowThisPC = 'Enabled'
# --- Search
DontUseSearchIndex = 'Enabled'
#IncludeSystemFolders = 'Enabled'
#IncludeCompressedFiles = 'Disabled'
#SearchFileNamesAndContents = 'Disabled'
# --- Miscellaneous
ShowHome = 'Enabled'
ShowGallery = 'Disabled'
ShowRemovableDrivesOnlyInThisPC = 'Enabled'
MaxIconCacheSize = 4096 # KB
AutoFolderTypeDetection = 'Disabled'
#UndoRedo = 'Disabled'
#RecycleBin = 'Enabled' ; RecycleBinGPO = 'NotConfigured'
#ConfirmFileDelete = 'Disabled' ; ConfirmFileDeleteGPO = 'NotConfigured'
}
Set-FileExplorerSetting @FileExplorerSettings
#endregion file Explorer
# Power & battery
#=======================================
#region power & battery
Write-Section -Name 'Power & battery' -SubSection
# --- Control Panel
Set-FastStartup -State 'Disabled'
Set-Hibernate -State 'Disabled'
Set-HardDiskTimeout -PowerSource 'OnBattery' -Timeout 20 # min
Set-HardDiskTimeout -PowerSource 'PluggedIn' -Timeout 60 # min
Set-ModernStandbyNetworkConnectivity -PowerSource 'OnBattery' -State 'Disabled' # Disabled | Enabled | ManagedByWindows
Set-ModernStandbyNetworkConnectivity -PowerSource 'PluggedIn' -State 'Disabled' # Disabled | Enabled | ManagedByWindows
# Level: value in percent (range: 5-100)
# Action: DoNothing | Sleep | Hibernate | ShutDown
Set-AdvancedBatterySetting -Battery 'Low' -Level 19 -Action 'DoNothing'
Set-AdvancedBatterySetting -Battery 'Reserve' -Level 12
Set-AdvancedBatterySetting -Battery 'Critical' -Level 9 -Action 'Sleep'
# --- Win settings app
# PowerMode: BestPowerEfficiency | Balanced | BestPerformance
# PowerSource (optional): PluggedIn | OnBattery
Set-PowerSetting -PowerMode 'Balanced'
#Set-PowerSetting -PowerSource 'PluggedIn' -PowerMode 'Balanced'
#Set-PowerSetting -PowerSource 'OnBattery' -PowerMode 'BestPowerEfficiency'
Set-PowerSetting -BatteryPercentage 'Disabled'
# Timeout: value in minutes | never: 0
$DeviceTimeouts = @(
@{ PowerSource = 'PluggedIn' ; PowerState = 'Screen' ; Timeout = 3 }
@{ PowerSource = 'PluggedIn' ; PowerState = 'Sleep' ; Timeout = 10 }
@{ PowerSource = 'PluggedIn' ; PowerState = 'Hibernate' ; Timeout = 60 }
@{ PowerSource = 'OnBattery' ; PowerState = 'Screen' ; Timeout = 3 }
@{ PowerSource = 'OnBattery' ; PowerState = 'Sleep' ; Timeout = 5 }
@{ PowerSource = 'OnBattery' ; PowerState = 'Hibernate' ; Timeout = 30 }
) | ForEach-Object { [PSCustomObject]$_ }
$DeviceTimeouts | Set-PowerSetting
$EnergySaverSettings = @{
AlwaysOn = 'Disabled'
TurnOnAtBatteryLevel = 30 # range: 0-100 / never: 0 | always: 100
LowerBrightness = 70 # range: 0-99 / Disabled: 100
}
Set-EnergySaverSetting @EnergySaverSettings
# Action: DoNothing | Sleep | Hibernate | ShutDown | DisplayOff
$ButtonControlsSettings = @(
@{ PowerSource = 'PluggedIn' ; ButtonControls = 'PowerButton' ; Action = 'Sleep' }
@{ PowerSource = 'PluggedIn' ; ButtonControls = 'SleepButton' ; Action = 'Sleep' }
@{ PowerSource = 'PluggedIn' ; ButtonControls = 'LidClose' ; Action = 'Sleep' }
@{ PowerSource = 'OnBattery' ; ButtonControls = 'PowerButton' ; Action = 'Sleep' }
@{ PowerSource = 'OnBattery' ; ButtonControls = 'SleepButton' ; Action = 'Sleep' }
@{ PowerSource = 'OnBattery' ; ButtonControls = 'LidClose' ; Action = 'Sleep' }
) | ForEach-Object { [PSCustomObject]$_ }
$ButtonControlsSettings | Set-PowerSetting
#endregion power & battery
# System properties
#=======================================
#region system properties
Write-Section -Name 'System properties' -SubSection
# --- Miscellaneous
Set-ManufacturerAppsAutoDownload -State 'Enabled' -GPO 'NotConfigured'
# CustomSize | SystemManaged | NoPagingFile
Set-PagingFileSize -Drive $env:SystemDrive -State 'CustomSize' -InitialSize 4096 -MaximumSize 4096 # MB
#Set-PagingFileSize -AllDrivesAutoManaged 'Enabled'
#Set-PagingFileSize -Drive 'X:', 'Y:' -State 'SystemManaged'
Set-DataExecutionPrevention -State 'OptIn' # OptIn | OptOut
Set-SystemRestore -AllDrivesDisabled -GPO 'NotConfigured'
#Set-SystemRestore -Drive $env:SystemDrive -State 'Enabled'
Set-RemoteAssistance -State 'Disabled' -GPO 'NotConfigured' # Disabled | FullControl | ViewOnly | NotConfigured
$RemoteAssistanceProperties = @{
State = 'ViewOnly'
GPO = 'NotConfigured'
InvitationMaxTime = 6 # range: 1-99
InvitationMaxTimeUnit = 'Hours' # Minutes | Hours | Days
EncryptedOnly = 'Enabled'
EncryptedOnlyGPO = 'NotConfigured' # Disabled | Enabled | NotConfigured
InvitationMethodGPO = 'SimpleMAPI' # SimpleMAPI | Mailto
}
#Set-RemoteAssistance @RemoteAssistanceProperties
# --- Visual Effects
$VisualEffectsCustomSettings = @{
'Animate controls and elements inside windows' = 'Enabled'
'Animate windows when minimizing and maximizing' = 'Enabled'
'Animations in the taskbar' = 'Enabled'
'Enable Peek' = 'Enabled'
'Fade or slide menus into view' = 'Enabled'
'Fade or slide ToolTips into view' = 'Enabled'
'Fade out menu items after clicking' = 'Enabled'
'Save taskbar thumbnail previews' = 'Disabled'
'Show shadows under mouse pointer' = 'Enabled'
'Show shadows under windows' = 'Enabled'
'Show thumbnails instead of icons' = 'Enabled'
'Show translucent selection rectangle' = 'Enabled'
'Show window contents while dragging' = 'Enabled'
'Slide open combo boxes' = 'Enabled'
'Smooth edges of screen fonts' = 'Enabled'
'Smooth-scroll list boxes' = 'Enabled'
'Use drop shadows for icon labels on the desktop' = 'Enabled'
}
# ManagedByWindows | BestAppearance | BestPerformance | Custom
Set-VisualEffects -Value 'Custom' -Setting $VisualEffectsCustomSettings
#Set-VisualEffects -Value 'ManagedByWindows'
# --- System Failure
$SystemFailureSettings = @{
WriteEventToSystemLog = 'Enabled'
AutoRestart = 'Disabled'
WriteDebugInfo = 'None' # None | Complete | Kernel | Small | Automatic | Active
OverwriteExistingDebugFile = 'Enabled'
AlwaysKeepMemoryDumpOnLowDiskSpace = 'Disabled'
}
Set-SystemFailureSetting @SystemFailureSettings
#endregion system properties
# Services & Scheduled Tasks
#=======================================
#region services & tasks
Write-Section -Name 'Services & Scheduled Tasks' -SubSection
# --- Services
Export-DefaultServicesStartupType
Export-DefaultSystemDriversStartupType
# Minimum recommended:
# 'Deprecated'
# 'RemoteDesktop'
# 'Telemetry'
# src\modules\services\private
$ServicesToConfig = @(
# --- SystemDriver
'UserChoiceProtectionDriver'
#'OfflineFilesDriver'
#'NetworkDataUsageDriver'
# --- Windows
'Features' # adjust to your needs: Features.ps1 (e.g. SysMain (disabled)).
'Miscellaneous' # adjust to your needs: Miscellaneous.ps1.
#'Autoplay'
#'Bluetooth'
#'BluetoothAndCast'
#'BluetoothAudio'
'DefenderPhishingProtection' # do not disable if you use Edge with 'Phishing Protection' enabled.
'Deprecated'
'DiagnosticAndUsage'
#'FileAndPrinterSharing' # needed by NetworkDiscovery (File Explorer > Network).
'HyperV'
#'MicrosoftOffice'
'MicrosoftStore' # only 'PushToInstall service' is disabled. all others are left to default state 'Manual'.
'Network'
#'NetworkDiscovery' # needed by printer and FileAndPrinterSharing.
'Printer'
'RemoteDesktop'
#'Sensor' # screen auto-rotation, adaptive brightness, location, Windows Hello (face/fingerprint sign-in).
'SmartCard'
'Telemetry'
'VirtualReality'
'Vpn' # only needed if using the built-in Windows VPN feature (i.e. not needed if using 3rd party VPN client).
#'Webcam' # only needed by MS Store apps. e.g. Microsoft Teams, Skype, or Camera app.
'WindowsBackupAndSystemRestore' # also used by new PITR feature.
'WindowsSearch'
#'WindowsSubsystemForLinux'
'Xbox'
# --- ThirdParty
#'AdobeAcrobat'
'Intel'
#'Nvidia'
)
$ServicesToConfig | Set-ServiceStartupTypeGroup
# The script must have been executed at least once.
#Restore-ServiceStartupTypeFromBackup
#Restore-ServiceStartupTypeFromBackup -FilePath 'X:\Backup\windows_services_default.json'
# --- Scheduled Tasks
Export-DefaultScheduledTasksState
# Everything should be ok/harmless.
# src\modules\scheduled_tasks\private
$TasksToConfig = @(
#'AdobeAcrobat'
'Diagnostic'
'Features'
#'MicrosoftOffice'
#'MicrosoftOneDrive'
'Miscellaneous'
'Telemetry'
'UserChoiceProtectionDriver'
)
$TasksToConfig | Set-ScheduledTaskStateGroup
# The script must have been executed at least once.
#Restore-ScheduledTaskStateFromBackup
#Restore-ScheduledTaskStateFromBackup -FilePath 'X:\Backup\windows_scheduled_tasks_default.json'
#endregion services & tasks
# Ramdisk
#=======================================
#region ramdisk
Write-Section -Name 'Ramdisk' -SubSection
#Install-OSFMount
# src\modules\ramdisk\private\app_data
# Brave and BraveCache cannot be used together.
# Brave: Move the entire 'User Data' folder to the RamDisk.
# Only extensions, bookmarks and preferences are restored across logoff/logon.