Solved

Run script once using group policy

Posted on 2014-07-18
5
3,827 Views
Last Modified: 2014-07-28
Hello,

I would like to run a script (or batch file) once (per user or computer, whichever is easier)) preferably using group policy.

The script is to delete a registry key and its subkeys.

The environment consists of Windows 7 client workstations connected to a Windows 2003 Active directory network.

I would like to delete this key once per computer

HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles

Can this be done? If so, how?

Thanks in advance.

Mark
0
Comment
Question by:mbudman
  • 2
  • 2
5 Comments
 
LVL 13

Expert Comment

by:Gabriel Clifton
ID: 40204556
You could use group policy to write a registry key to add the script to runonce and have that policy apply and not get reapplied.
0
 
LVL 1

Author Comment

by:mbudman
ID: 40204575
The problem is that "runonce" is not executed when someone connects to network via VPN.

All I would like to do is run delete a registry key once per computer.

The registry key in question contains the configuration information for a particular program. If the key is deleted (or does not exist), the program automatically runs the set up wizard, which is what I want to happen.

However, I do not want the set up wizard to run all the time - just once per computer.
0
 
LVL 13

Expert Comment

by:Gabriel Clifton
ID: 40204587
Ok, I am really not familiar with networks via VPN so do scheduled tasks work across the VPN? If so then use group policy to create a scheduled task that executes once.
0
 
LVL 4

Accepted Solution

by:
Neeraj Kumar earned 500 total points
ID: 40204690
You can use below mentioned command to delete a registry key via group policy . Put the same in login script or machine startup script.

reg delete "HKCU\Some\Registry\Path" /f

Also you can use group policy preference options from Win7 machine as your DC is windows 2003 to delete the registry key.

You can refer below mentioned article

http://social.technet.microsoft.com/Forums/en-US/a48b08db-b1a8-43db-90f8-ec785b9af9d7/set-and-remove-registry-keys-using-gpo?forum=winserverGP
0
 
LVL 1

Author Closing Comment

by:mbudman
ID: 40225230
Thank you for your assistance.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition …
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now