[gptalk] Re: How to set a batch file to RunOnce with GPO

  • From: "Nelson, Jamie R Contr 72 CS/SCBNF" <Jamie.Nelson.ctr@xxxxxxxxxxxxx>
  • To: <gptalk@xxxxxxxxxxxxx>
  • Date: Fri, 16 Mar 2007 13:08:49 -0500

The best thing to do is to just have the batch file create a flag file
(in a temp directory or somewhere) after performing the delete
operation. Then on any subsequent executions it should check for the
existence of the file; and if found, exit before attempting to do
anything.

I think the only way you could do it with a group policy setting would
be to create/import an ADM template that added a value to
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce.
However, the key would keep getting added back every time the policy was
forcefully refreshed (i.e. using a gpupdate /force) so the script might
run multiple times.

A startup script with flag file would be your best option, in my
opinion, if running the script no more than once is absolutely critical
to what you are doing. The latter GP option would be a huge hassle and I
am not even sure if it would work all that well.

Regards,

 

//signed//
Jamie R Nelson
Systems Engineer
Ingenium Corporation
72 CS/SCBNF
405.739.2811 (DSN 339)

________________________________

From: gptalk-bounce@xxxxxxxxxxxxx [mailto:gptalk-bounce@xxxxxxxxxxxxx]
On Behalf Of MARK SCHWARTZ
Sent: Friday, March 16, 2007 11:01 AM
To: gptalk@xxxxxxxxxxxxx
Subject: [gptalk] How to set a batch file to RunOnce with GPO

 

I need to delete a hidden file off every pc.  I have a batch file to
unhide and delete it, I just need to figureout how to have this run
once.  The only setting I could see was to run/not run the run once
commands.  I could not see where I could set them like the regular run
at startup commands.

 

 

Mark Schwartz
Chief Information Officer
Blum Shapiro & Co, P.C.
29 South Main Street
West Hartford, CT 06107
(860) 561-6893
mschwartz@xxxxxxxxxxxxxxx

Disclaimer:
ANY STATEMENTS CONTAINED HEREIN ARE NOT INTENDED OR
WRITTEN BY THE ABOVE SIGNED TO BE USED, AND NOTHING 
CONTAINED HEREIN CAN BE USED BY YOU OR ANY OTHER PERSON,
FOR THE PURPOSE OF AVOIDING PENALTIES THAT MAY BE IMPOSED 
UNDER FEDERAL TAX LAW.

This information in this email is confidential 
and may be legally privileged. It is intended 
solely for the addressee. Access to this email 
by anyone else is unauthorized. If you are not 
the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to 
be taken in reliance on it, is prohibited and 
may be unlawful. When addressed to our clients, 
any opinions or advice contained in this email 
is subject to the terms and conditions expressed 
in the governing Blum Shapiro client engagement 
contract. If you have received this message in 
error, or are not the named recipient(s), please
immediately notify the sender via reply email and
delete this communication.

Other related posts: