Welcome, Register for free! or Login below:
EduGeek.net RSS Feeds Register FAQ Members Social Groups User Map Calendar Search Today's Posts Mark Forums Read

Scripts If you need or have any scripts then get 'em here.

Go Back   EduGeek.net Forums > Coding and Web Development > Scripts
Reply
 
LinkBack Thread Tools Search Thread
Sponsored Links
Old 02-12-2008, 03:24 PM   #1
 
MicrodigitUK's Avatar
 
Join Date: May 2007
Location: Wiltshire (Sheldon/John of Gaunt)
Posts: 88
uk
Thanks: 4
Thanked 7 Times in 6 Posts
Rep Power: 6 MicrodigitUK is on a distinguished road
Default Script a changing of the owner on regkeys?

I am having some problems with sophos so have needed to uninstall and reinstall it. Because Sophos can be a pain to uninstall on some workstation, Sophos tech support has supplied me with a script that un installs Sophos to apply on startup.

I am still having problems uninstalling with the script on a number of workstations. And I found that there seem to be some corrupt reg keys that it can’t delete.

When I manually load regedit and try to delete the keys I still can’t. I then checked the permissions and the owner of the reg keys did not exist. After adding a owner I could manually delete the corrupt keys.

Is there any way to script a changing of the owner on regkeys? I did look at regini.exe but that only changes permissions and not the owner.
  Reply With Quote
Old 02-12-2008, 04:29 PM   #2
 
Lithium's Avatar
 
Join Date: Jul 2007
Location: Devon
Posts: 234
Thanks: 8
Thanked 9 Times in 8 Posts
Rep Power: 5 Lithium is on a distinguished road
Default

I've just looked into this to prevent NetSupport School and other programs changing the DCI key to disable DirectX

The way I went about it was to use the Security Tool snap-in, change the bits I wanted, then remove all the trash and deploy this to the machines using a batch file - worked very well.

Batch Files: SeCEdit - Security Configuration Editor
  Reply With Quote
The Following User Says Thank You to Lithium For This Useful Post:
MicrodigitUK (03-12-2008)
Old 02-12-2008, 04:45 PM   #3
 
srochford's Avatar
 
Join Date: Aug 2005
Location: London
Posts: 1,698
uk
Thanks: 9
Thanked 200 Times in 178 Posts
Blog Entries: 1
Rep Power: 47 srochford has much to be proud ofsrochford has much to be proud ofsrochford has much to be proud ofsrochford has much to be proud ofsrochford has much to be proud ofsrochford has much to be proud ofsrochford has much to be proud ofsrochford has much to be proud of
Default

You can also use group policy to change permissions on a registry key - given that you want to delete the key, I'd just set the permissions to "everyone - full control"

subinacl and setacl can also do reg permission but the syntax is hard :-)
  Reply With Quote
The Following User Says Thank You to srochford For This Useful Post:
MicrodigitUK (03-12-2008)
Old 03-12-2008, 10:17 AM   #4
 
PcDude's Avatar
 
Join Date: Nov 2008
Location: Cape Wrath
Posts: 29
uk
Thanks: 0
Thanked 3 Times in 3 Posts
Rep Power: 2 PcDude is on a distinguished road
Default

Script to add Administrators group and SYSTEM account to all keys. NOTE: This is just adding!

Please make a full backup of the computer before using this script.

1. Download and install SubInACL - Download details: SubInACL (SubInACL.exe)

2. Create a file named reset.cmd in C:\Program Files\Windows Resource Kits\Tools folder.
????: EduGeek.net Forums http://www.edugeek.net/forums/scripts/27424-script-changing-owner-regkeys.html

3. Edit the reset.cmd file with the following content.

subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=administrators=f
subinacl /subkeyreg HKEY_CURRENT_USER /grant=administrators=f
subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=administrators=f
subinacl /subdirectories %SystemDrive% /grant=administrators=f

subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=system=f
subinacl /subkeyreg HKEY_CURRENT_USER /grant=system=f
subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=system=f
subinacl /subdirectories %SystemDrive% /grant=system=f

4. Enter the following command into the Run... box under the Start Menu:

"C:\Program Files\Windows Resource Kits\Tools\reset.cmd"

5. After a few minutes by processing subinacl, the permission will be reset.
(Errors will pop up about keys that the script does not have permission to change, this is normal behaviour)




FYI:

"setowner=owner" will change the owner of the object e.g.
subinacl /subkeyreg HKEY_LOCAL_MACHINE /setowner=MyDomain\Administrators
  Reply With Quote
The Following User Says Thank You to PcDude For This Useful Post:
MicrodigitUK (03-12-2008)
Old 03-12-2008, 01:05 PM   #5
 
MicrodigitUK's Avatar
 
Join Date: May 2007
Location: Wiltshire (Sheldon/John of Gaunt)
Posts: 88
uk
Thanks: 4
Thanked 7 Times in 6 Posts
Rep Power: 6 MicrodigitUK is on a distinguished road
Default

I have tried the "SECEDIT" method but on the owner tab the "Replace Owner on subcontainers and objects" tick box that is normally on the bottom if you go through advanced permeations on regedit is not available. This means that I still can’t change the owner on the corrupted reg keys using this method.

I then tried the "subinacl" method and it worked like a dream. Below is the actual command I used in the end.

Code:
"%programfiles%\Windows Resource Kits\Tools\subinacl" /subkeyreg HKEY_LOCAL_MACHINE\Software\sophos /setowner=Administrators /grant=everyone=f
Thanks everyone for the help.
  Reply With Quote
Reply
Similar Threads
Thread Thread Starter Forum Replies Last Post
Script or *method* of changing 'department' in all users in an OU Ben_Stanton Scripts 9 12-09-2008 08:53 AM
Changing passwords for SIMS users by script academic_mwnci MIS Systems 3 04-09-2008 10:52 AM
ProFTPD owner of files Mintsoft *nix 12 28-11-2007 01:55 PM
Logon script & Printer script question. Galway Windows 3 29-08-2007 11:00 AM
Resolution Changing for RM Mintsoft Windows 17 10-05-2006 07:39 AM



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search Thread
Search Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:30 AM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 ©2009, Crawlability, Inc.
Copyright EduGeek.net




website uptime

© 2005 - 2009 EduGeek.net
no new posts