Solved

Run script once using group policy

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
A quick guide on how to use Group Policy to create a custom power plan and set it active on Windows 7.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

839 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