Posts

Showing posts with the label files

VBScript to Delete Folder and all SubFolders with files

Here is the VBScript which will delete all Folders and Subfolders with even have files in it. It took me so many hours to find this perfect script and all credits go to Rob van der Woude and the original script is here: http://www.robvanderwoude.com/vbstech_folders_deltree.php I just want to keep this for my reference and for everyone so that we all can save some time. Option Explicit Dim objFSO, objTempFolder, strTempFolder Const TEMP_FOLDER = 2 Set objFSO        = CreateObject( "Scripting.FileSystemObject" ) Set objTempFolder = objFSO.GetSpecialFolder( TEMP_FOLDER ) strTempFolder     = objTempFolder.Path DelTree strTempFolder, True Sub DelTree( myFolder, blnKeepRoot ) ' With this subroutine you can delete folders and their content, ' including subfolders. ' You can specify if you only want to empty the folder, and thus ' keep the folder itself, or to delete the folder itself as well. ' Root directories and some (not all)...

Permissions to registry using setacl

Recently I was trying giving permission to one of the registry hives with Subinacl, but it was not working despite all efforts and checking all the syntax and a lot of troubeshooting. Then I came across another permission granting utility known as SetACL. It worked like a charm. So you can try using this utility is Subinacl fails. You can download SetACL from  http://helgeklein.com/download/ Here is an example to run SetACL to give registry permissions. "SetACL.exe" -on "hkcr\Interface" -ot reg -actn setowner -ownr "n:Administrators" "SetACL.exe" -on "hkcr\Interface" -ot reg -actn ace -ace "n:Users;p:full" Object name (-on) : This is the path to the object SetACL should operate on (file/directory/registry key/network share/service/printer). Object type (-ot) : What kind of object does the object name refer to: file or directory (file), registry key (reg), service (srv), printer (prn), network share (shr)? Action (-actn) : What...

Subinacl to give permissions to registry/Files

Subinacl is a useful utility to give permissions to registries. Here is a simple example how to give permissions to registry. subinacl.exe /subkeyreg HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Optika /grant=administrators=f /grant=system=f /grant=users=f /setowner=administrators >> %temp%\subinacl_output.txt /keyreg HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Optika /grant=administrators=f /grant=system=f /grant=users=f /setowner=administrators >> %temp%\subinacl_output.txt Subinacl can be downloaded from net. More detailed Usage as per your requirements. This contains lots of features. You can write your comments on what you used and if it worked. Help others by posting your real time examples. Usage :      SubInAcl [/option...] /object_type object_name [[/action[=parameter]...] /options    :     /outputlog=FileName                 /errorlog=FileName ...