W
win2knovice
Hello
I need a particular script to be executed at reboot/shutdown time. I
believe this script needs to be added in the scripts.ini file in
%systemroot%\system32\grouppolicy\machine\scripts directory under
the Shutdown header. However this needs to be done programatically and
cannot be done via gpedit.msc.
Currently, I have compiled an executable that does the above. The
executable edits/creates the scripts.ini file in the same way as it
would be done via gpedit.msc.
But the problem I have is that it the script is not being executed in
all cases at shutdown time. For instance, in one machine I had to view
the script entry via gpedit.msc before the shutdown scripts started
working.
This made me believe that gpedit.msc needs to be executed atleast once
on a given machine
I did notice that whenever I viewed it via gpedit.msc , the
"Version" variable in gpt.ini at %systemroot%\system32\grouppolicy
is incremented. So I tried setting that variable to "0" (trying to
mimic the case where gpedit.msc has not yet been called on this
machine), but the script still got executed.
I would like to know the steps that I need to take to ensure that the
shutdown scripts are executed (whether or not gpedit.msc has been
opened on that machine ). Is there anything else done other than
editing the script.ini file when one uses gpedit.msc ? I did notice
that the timestamp on the scripts.ini changes when one only views the
entries in it via gpedit.msc, but the scripts.ini file did’t change.
Any help is greatly appreciated
Thanks
Adeep
I need a particular script to be executed at reboot/shutdown time. I
believe this script needs to be added in the scripts.ini file in
%systemroot%\system32\grouppolicy\machine\scripts directory under
the Shutdown header. However this needs to be done programatically and
cannot be done via gpedit.msc.
Currently, I have compiled an executable that does the above. The
executable edits/creates the scripts.ini file in the same way as it
would be done via gpedit.msc.
But the problem I have is that it the script is not being executed in
all cases at shutdown time. For instance, in one machine I had to view
the script entry via gpedit.msc before the shutdown scripts started
working.
This made me believe that gpedit.msc needs to be executed atleast once
on a given machine
I did notice that whenever I viewed it via gpedit.msc , the
"Version" variable in gpt.ini at %systemroot%\system32\grouppolicy
is incremented. So I tried setting that variable to "0" (trying to
mimic the case where gpedit.msc has not yet been called on this
machine), but the script still got executed.
I would like to know the steps that I need to take to ensure that the
shutdown scripts are executed (whether or not gpedit.msc has been
opened on that machine ). Is there anything else done other than
editing the script.ini file when one uses gpedit.msc ? I did notice
that the timestamp on the scripts.ini changes when one only views the
entries in it via gpedit.msc, but the scripts.ini file did’t change.
Any help is greatly appreciated
Thanks
Adeep