Rem: Changing Registry Permissions

Sometimes I need to change permissions in a machine's registry for an application to run. For example, for Microsoft Photo Editor in the Microsoft Office 2000 suite, I need to change permissions in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools registry subkey. Otherwise, Photo Editor won't run. Up to this point, I've either used regedt32 to manually change the permissions on the user's machine or given the user Administrator privileges on the local machine. I'd much rather use a script to set these registry permissions. I know I can use WSH to read and write to the registry, but can I use WSH to set permissions in it?

You can't use the registry methods that the WshShell object exposes to set registry permissions. However, you can use subinacl.exe or adssecurity.dll. Of these solutions, only adssecurity.dll supports remote registries.

Subinacl.exe is a command-line utility in the Microsoft Windows 2000 Server Resource Kit. This utility lets you manage the security descriptor on a variety of securable objects, including the registry. You can find subinacl.exe syntax, usage instructions, and examples in the resource kit's Tools Help document.

Adssecurity.dll is a COM component in the Active Directory Service Interfaces (ADSI) software development kit (SDK). To use adssecurity.dll, you must first download the ADSI SDK from http://www.microsoft.com/ntserver/nts/downloads/other/adsi25/sdk.asp. To install the ADSI SDK, unzip the archive in your preferred target directory (e.g., C:\program files\adsi). After unzipping the archive, open a command prompt and go to the C:\program files\adsi\resourcekit (or equivalent) directory. To install the component, you must register adssecurity.dll with the Regsvr32 command

C:\program files\adsi\resourcekit>
        regsvr32 adssecurity.dll

You should receive the message DllRegisterServer in ADsSecurity.dll succeeded. You're now ready to use the component. The C:\program files\adsi\rtk.htm file contains usage instructions and sample code.

Discuss this Article 3

johnstewart (not verified)
on Jan 30, 2003

My problem is with HKEY_CURRENT_USER. I need to give the current user permissions to several subkeys when they log on. Basically, I have a vb script that runs on logon to add subkeys to secure the server. Problem is, the current users only have read permissions to those keys. I tried subinacl, but ran into the same issue - access denied because they don't have permissions. Can someone help?

Sean McNamara (not verified)
on Jun 3, 2002

I face this same issue. I am further limited by the fact that several servers I need to do this to run Windows NT 4.0 Service Pack 6a. To combat this issue, and without use of the Win2K Resource pack, I opened a case with Microsoft, who provided a utility for me to use. They wrote it for me, and it meets my needs perfectly. I would be glad to share it and post it, provided someone can tell me how. To my knowledge it is public domain now.

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottYou'll have the opportunity to experience:
• The Microsoft
Technology Roadmap
• Office 365 Implementation
• Hyper-V Optimizing
• Windows 8 Deployment
and much more!

Come See Paul Thurrott & Rod Trent in Person!

Early Registration Now Open

Upcoming Training

Mastering System Center 2012

During over 6 hours of training you can join John Savill from your computer as he will walk you through the key components and capabilities of System Center 2012, what’s involved in using the components, and the benefit they can bring to your environment.

Register Now

Current Issue

May 2013 - The NameTranslate object is useful when you need to translate Active Directory object names between different formats, but it's awkward to use from PowerShell. Here's a PowerShell script that eliminates the awkwardness.

CURRENT ISSUE / ARCHIVE / SUBSCRIBE

Windows Forums

Get answers to questions, share tips, and engage with the Windows Community in our Forums.