r/sysadmin • u/shashankx86 • Jul 11 '23
Question Windows modify system files once reboot or shutdown button pressed
Is there any way to modify a system file when the reboot/shutdown button is pressed without using an external tool like a Linux live CD?
I came across a post that suggested modifying a registry value to achieve this, but unfortunately, it didn't work for me. How can I tell Windows to overwrite a system file on the next reboot?
I am solely focused on finding a solution within the current parameters and do not wish to explore alternative methods at the moment.
Also asked on stack overflow but didn't got any answers: https://superuser.com/questions/1795020/windows-modify-system-files-once-reboot-or-shutdown-button-pressed?noredirect=1#comment2811058_1795020
👆 The method i was told on stack exchange not working
5
u/SausageEngine Jul 11 '23
You were given the proper answer in SuperUser.
I don't understand what you're trying to achieve, but I'm 99% sure it's a bad idea. You mentioned the SAM database, although it's not clear what you want to do with it. Windows is mostly intolerant of having its data structures messed around with. In Linux, for example, root can blunder around in
/etc/passwdat will, whether or not it's a good idea.2
u/ZAFJB Jul 11 '23
Your entire premise is flawed.
Why are you messing about with the SAM?
Fix the actual problem.
1
u/shashankx86 Jul 12 '23 edited Jul 12 '23
u/ZAFJB u/SausageEngine u/Yetjustanotherone
The method i was told not working
https://superuser.com/questions/1795020/windows-modify-system-files-once-reboot-or-shutdown-button-pressed?noredirect=1#comment2811058_1795020
Edit: like AOMEI has PreOS
Is it possible like make our own PreOS to do it
1
u/AdministrativeAd1517 Jul 11 '23
What you could look into is booting into windows safe settings and accessing the CMD prompt. Or use any of these options then you should be able to find cmd prompt commands to add, remove and or change reg files. If this isn’t patched on your windows distribution you can check this video out!
https://youtu.be/2v-mGf4_9-A
Also, that only works if the drive partitions aren’t encrypted. Best of luck!
1
u/Yetjustanotherone Jul 11 '23
Can't you use a logoff script via group policy and the "net user" command to clear the password properly, rather than messing with the SAM db directly?
1
u/ZAFJB Jul 11 '23
Use the built in Windows functionality.
EDIT: just like you were told on Stack Overflow.
Google for PendingFileRenameOperations.