Set Folder and Registry Permissions with VBScript

Sample VBScript opens up registry and folder access with write access for the Everyone group:


' Create temp file with the script that regini.exe will use
set oFSO = CreateObject("Scripting.FileSystemObject")
strFileName = oFSO.GetTempName
set oFile = oFSO.CreateTextFile(strFileName)
oFile.WriteLine "HKEY_LOCAL_MACHINE\Software\TraxStar Technologies LLC\Client [1 5 7 11 17]"

' Change registry permissions with regini.exe
set oShell = CreateObject("WScript.Shell")
oShell.Run "regini " & strFileName, 8, true

' Delete temp file
oFSO.DeleteFile strFileName

Dim strHomeFolder, strHome, strUser
 Dim intRunError, objShell, objFSO

 strHomeFolder="C:\Program Files\TraxStar"

 Set objShell = CreateObject("Wscript.Shell")
 Set objFSO = CreateObject("Scripting.FileSystemObject")
 If objFSO.FolderExists(strHomeFolder) Then
 intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls """ & strHomeFolder & """ /t /c /g everyone:F ", 2, True)
 End If

– Soli Deo Gloria

2 Replies to “Set Folder and Registry Permissions with VBScript”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.