Welcome to MSFN

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.


Sign in to follow this  
Followers 0
poster

Shut Down Script

14 posts in this topic

I have made a script which is placed in c:\ and removes c:\windows\prefecth\*.*. how to make it run every time i press shut down. usually i configure it by the command gpedit.msc in the run box. but i want to make it from the registry (unattended). any ideas?

0

Share this post


Link to post
Share on other sites

Use Logoff script...

I cant remember, where in registry it is, but simply run regmon looking for writing to registry and define logoff in policy...

0

Share this post


Link to post
Share on other sites

Whether it's a shutdown or logoff script, all gpedit.msc does is write an entry to the registry. It took me less than 60 seconds to discover (simply by adding a script and then using regedit to search for that name) that the key for shutdown scripts is:

HKLM\Software\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts...

Adding a script adds multiple keys below that path. You should try adding a script using gpedit and examine the changes. It shouldn't be too hard to then create custom .reg (Or, better yet, WSH scripts using RegWrite) to add shutdown scripts.

0

Share this post


Link to post
Share on other sites

i'll try it but...

if anyone knows how exactly the registry file should look, please write here. 10x to the

people who tried to help

0

Share this post


Link to post
Share on other sites

why not just add it to your startup? Whats it matter if theyre deleted right before you log off or right when you logon? This way all you need to do is make a batch file and toss it in there...

0

Share this post


Link to post
Share on other sites

it matters. if you remove your files from the prefetch folder and restart immediately you will see how faster it loads without those files. there is no effect to remove them on startup because later when you use your pc your prefecth folder will be full of files and it will load slow. try this and you'll see better startup speed of windows. i found the keys in the registry and they are as follows:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown\0]
"GPO-ID"="LocalGPO"
"SOM-ID"="Local"
"FileSysPath"="C:\\WINDOWS\\System32\\GroupPolicy\\Machine"
"DisplayName"="Local Group Policy"
"GPOName"="Local Group Policy"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown\0\0]
"Script"="C:\\windows\\system32\\ntbootos.bat"
"Parameters"=""
"ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Startup]

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System\Scripts]

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System\Scripts\Shutdown]

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System\Scripts\Shutdown\0]
"GPO-ID"="LocalGPO"
"SOM-ID"="Local"
"FileSysPath"="C:\\WINDOWS\\System32\\GroupPolicy\\Machine"
"DisplayName"="Local Group Policy"
"GPOName"="Local Group Policy"

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System\Scripts\Shutdown\0\0]
"Script"="C:\\windows\\system32\\ntbootos.bat"
"Parameters"=""
"ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System\Scripts\Startup]

EDIT: of course you might put ntbootos.bat into system32. my ntbootos.bat is:

del "c:\windows\prefetch\*.*" /q

0

Share this post


Link to post
Share on other sites

Well, speeding computer by deleting prefetch file is only hoax... Only time, when it matters is when there is too much prefetching files - I mean after half year or so.

Personally I am deleting prefetch directory every month using scheduled tasks...

0

Share this post


Link to post
Share on other sites
Well, speeding computer by deleting prefetch file is only hoax... Only time, when it matters is when there is too much prefetching files - I mean after half year or so.

Personally I am deleting prefetch directory every month using scheduled tasks...

i used to think the same way but my computer is p4 2,6 ghz 512 mb ram .... and when the boot screen appeared the blue thing was moving 6-10 times. i tryed everything, boosting programs, registry cleaning programs, even format didn't help. i tryed a program of microsoft which is designed to make booting faster but it didn't help too. one day I read about this in a forum and thought to myself "What will i lose if i try it?". after i tryed the blue thing moved just one time. it really worked. i don't want to lie you, just try!

0

Share this post


Link to post
Share on other sites

Heh, sound strange :) I am never turning off my computer at works and hibernating at notebook and tablet, so I dont solve problems like this. But prefetching shouldnt cause slow problems like this...

Well, but reasons R not important, important is you find your solution and it is working :)

0

Share this post


Link to post
Share on other sites

very good said. thanks to all who helped me making my bat file on unattended installation. very soon my version of windows will be released :) look for it in the stores :P

0

Share this post


Link to post
Share on other sites

Correct me if Im wrong, but isnt the entire reason prefetching exists is to speed up loading times of applications? So if you remove these its going to slow down the overall startup time of all of your programs which use it.

I dont know about you guys, but I restart my pc maybe once every other week and Id much rather have my programs load up faster over my pc booting up an extra 3 seconds faster.

Just my 2 cents.

0

Share this post


Link to post
Share on other sites

2durex: It depends from person to person - I never turn off my work PCs/NB/tablet, but with my home PC I am usually more time booting than working with it :)

0

Share this post


Link to post
Share on other sites

I'm trying to run a bat script to kill windows audio services at shutdown due to it hanging. My batch file is in working order as i've checked that out. My problem is the registry.

I've input all the data supplied above into the registry (ovbviously changed the file paths! lol) But to no avail.

If someone could help me with this it would be awesome.

0

Share this post


Link to post
Share on other sites

Ahh prefetch

There is so much BS spread about it ...enable/disable..how often to clear etc

Heres the scoop, according to...well, me

1) Install Windows

2) install applications

3) clear prefetch - you want to do it now because it will have prefetch data for all your setup .exe's and .msi's etc, and you dont need those fetched at boot

4) reboot

5) go about your life and once every 3 months or so (or more if youre installing lots of software) clear it

6) worry about more important things.....

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.