2

I have a HTA and I need it to list folder size for things such as documents, videos, downloads ect..

I have this VBS section that works on any folder except things like documents where I get access denied, I am trying to get this working on windows 7

dim FSO, objFolder,datafolder, foldername

foldername = strHomeFolder+"\Documents" 
msgBox(foldername)
Set fso= CreateObject("Scripting.FileSystemObject")

If fso.FolderExists(foldername ) Then   
Set objFolder= FSO.GetFolder(foldername )  'getting folder size objFolder.Size\par
ShowFolderDetails objFolder

Sub ShowFolderDetails(oF)
datafolder  = oF.Size
End sub

docSize = datafolder
End If
msgBox(docSize)
docSize = docSize / 1024
docSize = docSize / 1024
docSize = docSize / 1024
docSize = Round(docSize,1)

Why does this return access denied? It is a local folder and the user account is an administrator, I have even tried running the HTA as administrator still to no avail.

CSiciliano
  • 35
  • 3
  • Are you running the `mshta.exe` in elevated mode? If not this will be the problem, UAC is a real pain even when trying to run things as an Administrator. – user692942 Sep 29 '17 at 16:10
  • Im not sure to be honest, like I said this is inside a HTA and I am hoping to just run the HTA as normal – CSiciliano Sep 29 '17 at 16:34
  • Have you tried [this](https://stackoverflow.com/questions/32799751/make-an-hta-file-run-as-admin-elevated)? – Teemu Sep 30 '17 at 15:24

0 Answers0