Any body help me in creating vb script.

I need to create SID key under my application related key which has shown like below:

So during logoff and login through stubpath i need to call the vb script which should get the current logged in user SID, so that i can create the SID key under my application related key. This should happen for every user. So I am calling this in active setup.



0 Comments   [ + ] Show Comments


Please log in to comment



I don't think so, you can achive this using ActiveSetup without giving permission.. because you are trying to create keys under HKLM through ActiveSetup.. When you try to create HKLM key through ActiveSetup, you will receive Access Denied error..

It will work only for Local Admins/Admin account, not for the standard users



Answered 08/13/2012 by: jagadeish
Red Belt

  • You could modify the keyset permissions with regini and give local users rights to that particular key and then try active setup.
    • This content is currently hidden from public view.
      Reason: Member has been banned from the site
      For more information, visit our FAQ's.
  • Yes.. Correct.. You will have to give Full Control to the User group for HKLM\Software\ABC\XYZ\
  • May I know the reason for storing SID's in HKLM hive?
Please log in to comment

You will have to take care the SID is different for all the users. This SID would be pointing to one of the user and you should try to map it to the HKCU key. Then use Active Setup or Advertised shortcut to get this registry for all the users.

Answered 08/14/2012 by: piyushnasa
Red Belt

Please log in to comment

This should work for you with bit of modifications....


Dim WshShell:     Set WshShell = CreateObject("WScript.Shell")

Dim oReg,strHKCU
Dim strKeyParent
Dim ret
Dim strKeyName
Dim arrSubKeys
Dim strAppDataChk
Dim ConfigIni,ConfigXml
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_USERS = &H80000003

Set ObjFSO=CreateObject("Scripting.filesyStemObject")

strComputerName = "."

On Error Resume Next
Set oReg=GetObject("winmgmts:root\default:StdRegProv")

strKeyParent = ""

ret = oReg.EnumKey(HKEY_USERS, strKeyParent, arrSubKeys)

oReg.EnumKey HKEY_USERS, strKeyParent, arrSubKeys

If NOT IsNull(arrSubKeys) Then
    For i=0 To UBound(arrSubKeys)
        strGUID = arrSubKeys(i)
        If Len(strGUID) > 17 AND NOT Right(strGUID,8) = "_Classes" Then
            strAppDataChk = WshShell.RegRead("HKEY_USERS\" & strGUID & "\Volatile Environment\APPDATA")

If strAppDataChk<>"" Then

msgbox strHKCU

end if

        End If
End If


Answered 08/13/2012 by: sumitsingh1984
Second Degree Green Belt

  • Sumit.. Should we use strHKCU, outside the loop.. is it?
Please log in to comment
Answer this question or Comment on this question for clarity