We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Delete Reg key

supernaut76
supernaut76 asked
on
Medium Priority
372 Views
Last Modified: 2010-04-13
Hey All,

Im trying to get a key in the registry deleted. Ive looked around and see there being 2 major choices. Using GP which seems quite a process or a login script which seems fairly simple.

Ive tried out using a reg file to remove the entry which works fine but the problem is if using it in a login script, the standard user does not have access to delete a key in registry, so it fails. So how do i get it done?

Thanks in advance

Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2013

Commented:
Perhaps in Group Policy use a start up script rather than a logon script. I believe it executes before logon and uses system/admin credentials.
Computer Configuration | Windows Settings | Scripts | StartUp

Author

Commented:
Thanks for the response guys, i will try and do some testing with group policy logon scripts. My pervious experinece with them though was i found it to be slower than a regular script, is that normal?

Also the tune up software, is the trial version a fully functionall version?

Thanks
D
CERTIFIED EXPERT
Top Expert 2013

Commented:
>>"i found it to be slower than a regular script, is that normal"
No I haven't found that. It's the same script just being enforced by a different service, so it shouldn't be. If you have a lot of group policies.....a lot that is, it can slow down logons.
Dushan De SilvaTechnology Architect

Commented:
Hi supernaut76 !
tune-up trial version is not fully functional. You can have a look and if you interested with it you can get full version. I'm having personaly good experience with it. And please check following solutions too :)

http://www.experts-exchange.com/Applications/MultiMedia_Applications/Q_21778874.html#16232324
http://www.experts-exchange.com/Programming/Q_21797328.html
http://www.experts-exchange.com/Programming/Q_21797314.html
http://www.experts-exchange.com/Applications/Q_21761816.html


BR Dushan
Steve KnightIT Consultancy
CERTIFIED EXPERT

Commented:
GP Login / Logoff and Startup scripts seem fine to me too, have many long ones running all over the place...

Another alternative is to give the user rights to the required registry key using a GPO then use your .REG file to delete it... look under Computer config, Windows settings, Security Settings, Registry.  Add the key and give suitable people rights.

hth

Steve

Author

Commented:
Tried the group policy script and i am still getting  a pop up "Do you want to add information to the registry..." So the user can still click on no and cancel the whole thing. How do i keep it hidden? The script is calling a registry file which deletes the key in question.

D
IT Consultancy
CERTIFIED EXPERT
Commented:
Try regedit /s regfile.reg

rather than just regedit regfile.reg  or  start regfile.reg


Steve

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT
Top Expert 2013

Commented:
Sorry, ISP down most of today.
Try:
reg  delete  <key name>  /f
f = force

Use      reg  delete  /?      to read full syntax of command if you want specify full key, value, etc.

Author

Commented:
Ok guys i tried regedit /s regfile.reg in a group policy script and the script runs perfectly and the prompt is successfully suppressed. All looks good but...

The only problem is the reg key does not get deleted if i am logging in as a standard user. It does work when logging as an admin user. So the group policy script still uses permissions that the user has at login time.

D
Steve KnightIT Consultancy
CERTIFIED EXPERT

Commented:
Correct.  See my post above about giving the user permissions through a GPO.

If you run it as a computer startup GPO script then it will run with local system rights rather than the user rights that the GPO user login script runs as...

Either way should make it work.  

Steve

Author

Commented:
Oops didnt see that...will give it a go a.s.a.p.

Author

Commented:
Ok so I added the same script to computer configuration, with the option to keep it visible (so i can see whats going on) but when you log in, you cannot see the script runnig and the reg key doesnt get deleted even if im logging in as an admin user.

How can it work under user config and not computer config? Am i doing something wrong?

D
Steve KnightIT Consultancy
CERTIFIED EXPERT

Commented:
The computer startup script runs before the user logs in.  What is the key you are trying to update?  Is it under HKCU or HKLM (or elsewhere?).

I would really just do it through giving rights under GPO to your users then running it from the user logon script...

Steve

Author

Commented:
Its under HKLM\system\currentcontrolset\services

Stupid question where would i assign this right in GPO?

D
Steve KnightIT Consultancy
CERTIFIED EXPERT

Commented:
see my post above.  if you need more than that let me know:

### Another alternative is to give the user rights to the required registry key using a GPO then use your .REG file to delete it... look under Computer config, Windows settings, Security Settings, Registry.  Add the key and give suitable people rights. ###

Steve

Author

Commented:
Thanks Steve, that did it...
Steve KnightIT Consultancy
CERTIFIED EXPERT

Commented:
no prob. thanks for the points.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.