Registry Permissions & Win APIs

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello all,

First of all, I'd like to apologize if this has been asked before. I
searched the group several times and to my dis-belief my mail reader did not
come up with results. I find this to be very suspicious. Anyway, below are
my questions.

I'd like to modify registry key permissions with VBS and I would like to do
it by using the Win APIs.

I have a key under HKEY_LOCAL_MACHINE that I want to give full rights to
Administrators and System. I want to give read rights to power users and I
want to revoke all other rights for all other users.

I've done VB, but am new to VBS so please do not ostercize me for this noob
question. I have found how to do this in VB using the RegSetKeySecurity
function in advapi32.dll. However, I can't even open a key in VBS using
RegOpenKey because I receive a VBScript compilation error on the declaring
function saying "Expected Identifier"

[code]
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA"
(ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
[/code]

Also, in setting up some constants, I get a compilation error of "Expected
Literal Constant"

[code]
Private Const KEY_SET_VALUE = &H2
Private Const KEY_WRITE = ((STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or
KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))
[/code]

Is it possible to directly use the Windows APIs from VB Script? If it is
possible, what do I need to do to make this work?

If it isn't possible, then what can I do that will work on Win 2k, XP Pro,
and 2003 to change the security permissions on a registry key?

Thank you,
Travis


.



Relevant Pages

  • Re: virtual directories for the ftp server
    ... This posting is provided "AS IS" with no warranties, and confers no rights. ... "Roger N." ... >> I don't think the FTP Server can handle rooted virtual directory names ... >> the Registry Key name itself. ...
    (microsoft.public.windowsce.embedded)
  • Re: Deploy password change ? How to encrypt VBS ? or any other method ?
    ... Of course the registry key will not display the password but only the version of the password on this computer. ... I will prefere to use a VBS or another method that I can deploy through Landesk (or computer startup script in GPO), as I will have better reports than with a third party tool. ... It is for this reason that I would like a secure way to change it through Landesk. ...
    (microsoft.public.windows.server.active_directory)
  • Re: This directory partition has not been backed up since at least the
    ... This posting is provided "AS IS" with no warranties, and confers no rights. ... This directory partition has not been backed up since at least the ... you could do so by adding the following registry key. ...
    (microsoft.public.windows.server.active_directory)
  • Re: This directory partition has not been backed up since at least the
    ... This posting is provided "AS IS" with no warranties, and confers no rights. ... This directory partition has not been backed up since at least the ... you could do so by adding the following registry key. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Reading registry key date and time
    ... >I need to read and convert date and time stored in registry key ... >in readable string. ... I don't know about long Hex, but, using the VBS button, ...
    (microsoft.public.scripting.wsh)