Disassembler0 / Win10-Initial-Setup-Script

PowerShell script for automation of routine tasks done after fresh installations of Windows 10 / Server 2016 / Server 2019
MIT License
4.7k stars 1.07k forks source link

Restart in Default.preset #152

Closed nahall closed 6 years ago

nahall commented 6 years ago

Hello,

I previously had forked your script for my personal use and edited the Default.preset but I realized that I was using your Default.preset 99% as-is and just making a handful of changes. So I thought it would be better to just create a new preset for myself "Nick.preset" and pass both of them at the command line like "--preset Default.preset -preset Nick.preset" so it runs yours first and then runs mine to undo a few of the changes the Default.preset makes.

The problem with doing this is that the Default.preset called Restart at the end so my preset never gets run. I get around that by commenting out the Restart line in Default.preset and adding it to the end of my command line, but that defeats the purpose a little of keeping my own changes separate from Default.preset.

I'm wondering if it would be better for your script to move the Restart to the command line, if others are doing things similar to how I'm doing it, or if I'm not really using your script the way you intended and should change my pattern. Thanks for creating this, it is really useful!

Disassembler0 commented 6 years ago

I had this feature in mind since the I've started to play with the command line arguments parser, probably even discussed it in #81, #99 or one of the chatty threads, but I have never found a strong reason to implement it. Your "I realized that I was using your Default.preset 99% as-is and just making a handful of changes" is exactly the use case where this comes in handy.

So I've pushed a commit which enables exclusion of tweaks. You simply have to prepend the tweak name with exclamation mark. So you can have your custom Nick.preset as

ExtraTweakIWant
!TweakIDontWant1
!TweakIDontWant2
!Restart

When you add it to arguments exactly as you said you are, it will exclude the unwanted tweaks from selection without the need to edit Default.preset directly.