#Setup Script Adventures Continue

113 messages · Page 1 of 1 (latest)

oak willow
#

Tribulations I face in my setup script I request guidance on:

  • Edge doesn't want to come out but I may just be out of luck there, I think it's bugged. I'll probably just have to uninstall with GUI.
    • Maybe I could open the Settings or CPL menu straight to the appropriate page for the user to do so? Is that possible or can I only really open the apps in general
  • I'd like to configure some things automatically, for instance terminal profiles in WT and VS Code. But does anyone know if it's possible to just import the config jsons or if they have some machine-specific paths in them or something? Is there a way to configure them with PowerShell otherwise?
  • I need to figure out how to handle installing Spotify, since it refuses to work through Winget when running out of an admin session
  • I need to know how to schedule another script to run after the computer restarts
    I also have some things I'm a bit more hazy now, and will probably have to do more direct research on. But for now does anyone know it's it's on the more trivial side to, through PowerShell:
  • Enable startup app notifications
  • Configure the touchpad's actions for triple taps/swips and the like
  • Enable "End Task" on task bar
  • Enable visible file extensions
  • Enable visible hidden files
  • Enable "show full path" in Explorer
  • Enable sudo
  • I have just "Disable tips etc." in my list here?
  • Enable clipboard history
  • Enable the title bar shake to minimize (I don't even use this I just think it's fun lol)
  • Perhaps most complexly, configure automatic restore points to be taken at a certain interval
    Also, does anyone know if I should sign into my Microsoft before or after running the script? I feel like probably before, since not being signed in might cause some problems. But if I do sign in I'm afraid it might set some stuff I don't want, and I can't test it super well since I don't want to sign in on the VM
    Also also, I should probably update Windows as much as I can beforehand, right? or?
fervent roost
#

What does the first item mean about Edge? What do you mean it won’t come out?

oak willow
#

tldr, when I try to uninstall Edge through the command line it just
doesn't

#

I think it's a 24H2 bug

fervent roost
#

And is it edge through the Microsoft store? Does it have an entry in the installed apps key?

oak willow
fervent roost
#

And why do you want to uninstall? Seems like a waste of time.

oak willow
fervent roost
#

You can create a startup deal I think and maybe have it removed upon first iso boot.

#

Is this a personal setup or for an enterprise?

oak willow
oak willow
fervent roost
#

Yeah I would guess Edge is harder and harder to uninstall as it is becoming more built-in like IE.

oak willow
#

It's not even though
Edge WebView is a pretty built-in and important resource, but Edge browser itself is its own thing.
And like, you literally can remove it. It's required by law in the EU, which is what I'm taking advantage of

fervent roost
#

there is startup xml in windows for certain features that are more and more difficult to automate about the explorer shell experience.

oak willow
#

It's just broken if you try through the command line rn

fervent roost
#

Have you looked at Chris titus work in clean up ?

oak willow
#

I actually have! This is really funny actually hold on

fervent roost
#

Edge is windows so it may be impossible.

oak willow
#

Because I ran into a thread on the winutil github a while ago while trying to troubleshoot this. Someone had made an issue on the Edge uninstall tweak breaking and it was because of an unexpected exit code. The script they had was checking for exit code 93 to see if the uninstallation failed but they were getting exit code 532 (the one I've been getting), and that was causing the script to get lost. The issue was fixed by making it so exit code 532 would also be detected.
I wanted to look up this issue again just earlier today, at the least so I could replicate the checking if it failed behaviour and everything. But I literally couldn't find anything. It wasn't in my history, didn't show up in search, even the code I literally remembered seeing wasn't in the script anymore, it used totally different logic.
I'm not convinced I didn't just hallucinate it all or something.

fervent roost
#

I would focus on changing your defaults.

oak willow
# fervent roost _Edge_ **is** _windows_ so it may be impossible.

No, again, like, you literally can uninstall Edge. And it's required by law in the EU. My Windows region is set to Germany, and I'm able to uninstall it fine through the Settings GUI. The CLI method I'm using is known and is meant to be what Settings is doing under the hood, but on 24H2 it fails (worked fine on 23H2 and earlier).

fervent roost
#

Defaults is a pain to automate and may be impossible now.

#

Microsoft wants you to use the UI. automation of defaults is discouraged so other vendors don’t hijack your defaults.

fervent roost
oak willow
#

That's, a good idea actually

fervent roost
#

I would avoid it as I would assume it would be a pain to maintain.

#

And edge might come back with windows updates.

#

Vscode and windows terminal have config paths you can look up and set. I think they are mainly user level in appdata.

#

I would look at spotify via chocolatey package manager or scoop.

#

There are scheduled tasks you can create to be launched on logon or runonce registry keys.

#

I’m not sure I’m familiar with startup app notifications. Is that a switch in settings for all apps or just some apps?

oak willow
#

There's a switch in settings that'll give you a notification any time something new is configured to run on startup

fervent roost
oak willow
#

procmon is really smart honestly. I'll boot up a fresh install on a VM and just record everything I do, then I can export the log and see what there is.

fervent roost
#

Generally speaking I think some of these settings are hidden programmatically to prevent malicious softwares from mucking with them. There is startup configuration for new users you can look at though.

oak willow
#

My script is entirely designed around being run after getting past OOBE, so if I were to do more pre-setup stuff I'd probably want to rework a bunch of other stuff too lol

oak willow
oak willow
oak willow
lunar vault
#

As far as setting up a task for post reboot, you can script out a scheduled task that would start on either a user logon, or a system restart, and have it flagged to automatically delete itself when complete. Explorer settings are controlled by a set of binary flags. If you look into WinSetView, you can use that to help set those flags. Https://github.com/lesferch/winsetview .

oak willow
#
  # Enable/disable show of file extensions

  $ShowExt = [Int]$iniContent['Options']['ShowExt']
  & $RegExe Add $Advn /v HideFileExt /t REG_DWORD /d (1-$ShowExt) /f```so I found this in that project
wtf
#
  # Unhide/hide AppData folder

  If ($UnhideAppData -eq 1) {& $CmdExe /c attrib -h "$UAppData"}
  Else {& $CmdExe /c attrib +h "$UAppData"}```this is how they unhide appdata (which I realize is more what I want than to enable hidden files view), it's similarly arcane
#

wait why are they using cmd 😭

#

actually this isn't arcane at all windows just has a command for that huh

#

attrib -h $env:USERPROFILE\AppData
easy

#

ok I was poking with a language model and it just spat out the command I need to enable file extensions too lol
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Value 0
tested and it works, too. I guess we take those

#

oh my god
"Display full path in title bar" doesn't do what I thought it did at all lmao

#

Set-ItemProperty -Path "HKCU:\Software\Microsoft\Clipboard" -Name "EnableClipboardHistory" -Value 1
and here's how I can enable clipboard history. Nice.

#

Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "DisallowShaking" -Value 0
simply incredible

#

is it getting defensive??

#

well it was nice while it lasted. I can probably google the rest

#

I was able to get the "end task" through taskbar pretty easily, but I'm having trouble with sudo... might need to procmon it

#

ah... and the touchpad settings... a pity the duck ran out

oak willow
#

hmm... this is strange
poking around in the registry for the startup app notifications setting... I found a key called "StartupNotify" with subkey "EnableStartupAppNotifications"

#

Ok so like
that seems pretty good, right?

#

But the first oddity I find—it's set to 0, even though I have it on

#

That's queer, but maybe the logic is inverted?
So I open settings and turn them off, but... it's still 0 in the registry

#

Maybe it's just not updating right??

#

But changing it in the registry then looking back in settings doesn't work either

#

brother what

oak willow
fervent roost
#

You can just use gsudo too. It does all the same stuff and more than the windows iteration.

oak willow
#

mORE? 🤯

#

doesn't sudo do like one thing how can it do more

fervent roost
#

Yeah there are three different ways sudo can handle IO on windows. One is it launches a new window. Second is it blocks input and allows output. And third it allows both. These three have decreasing levels of security.

oak willow
#

Doesn't the native Sudo do that too

fervent roost
#

So I was wrong. I think the feature to beat is the cache that gsudo has.

oak willow
#

What does the cache do?

fervent roost
oak willow
#

oh that's cool

oak willow
#

ok I was looking for the startup apps notifications thing (which has proven really hard to figure out, weirdly) and I think I ran into how to schedule the script post-restart??

#

oh. oh! I think I just found a guide on how to do the thing I want lol
It didn't show up earlier but investigating this key had it appear

#

hmm... but... this doesn't make sense
The value they reference doesn't exist on my machine. That shouldn't be possible.

#

what the

#

folks, this is insane

#

I've identified the setting, and you'll never guess why I couldn't find it
I mean you might idk

#

so
The reg entry in the key is just called "enabled", and it's set to 0 for off and 1 to on, logically

#

except actually

#

the value for on is actually
nothing

#

when you turn these notifs on in settings, it just deletes the value??

#

ig "on" is the default behaviour, and the default configuration is to override it to "off"
for some, idk man

#

that's also why I couldn't find it in procmon... I was looking for RegSetValue when it was actually RegDeleteValue

#

holy expletive
this is so cool to figure out lmao

#

also to be clear
setting the value to 1 through regedit does work

#

it's just, not what settings does, for some reason??

oak willow
#

edge is giving me a lot of trouble

#

I just had it survive a GUI uninstallation

#

it
it died
but then it came back

#

completely unprecedented

fervent roost
oak willow
#

win32 API? This is new territory for me, how do I look into this?

fervent roost
oak willow
#

this looks more like a guide on using the API to make notifications than changing the settings on existing ones

fervent roost
#

psdetours is another module that is great for cracking open the windows internals.

#

What is startup notifications? Is that a setting in windows?

#

Generally speaking when you want to configure windows you want to use the api as opposed to modifying registry keys. It is just a general rule though and sometimes you have to get creative.

oak willow
#

If there is some easy API for configuring settings do tell me about it because I've been doing a ton of Registry stuff lol

fervent roost
oak willow
#

interesting...

fervent roost
#

Win32 api is the lowest level windows api surface for public users.

#

I’m having trouble finding info on startup app notifications so it might just be a registry key change.

oak willow
#

I mean yeah, it was just flipping a 0 to a 1
or, a 0 to a null, technically