Solved

Run script once using group policy

Posted on 2014-07-18
5
4,161 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.

776 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