Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Desperate for debugging of very short script using GetDetailsOf and ParseName

Desperate for debugging of very short script using GetDetailsOf and ParseName

Desperate for debugging of very short script using GetDetailsOf and ParseName

I'm a humble guy. I'm far from being a VBScript guru, but I always try to do my own research and solve my own problems. I hardly ever ask people for help, but I've been working on this ONE problem for two solid days now, and I'm rapidly becoming a danger to myself and others. I come to you all because I now surrender. You win, VBScript. It's a pretty short script, but I simply don't understand why it won't work.

This command-line script remotely enumerates all folders (along with some folder properties) within a specified path.

For example, if this script was named myscript.vbs, and you had a remote workstation on your network called Icebox, and it had a local folder with the path of C:\Common, the command-line synax would be:
C:\> myscript.vbs Icebox c:\common

Here's the code:

' Converts arguments from Icebox c:\common to \\icebox\c$\common
strPath = "\\" & WScript.Arguments(0) & "\" & Replace(WScript.Arguments(1),":","$")
' The subroutine below is called
ShowFolderDetails strPath

Sub ShowFolderDetails(strPath)
Set objFSOFolder = CreateObject("Scripting.FileSystemObject").GetFolder(strPath)
Set objShellFolder = CreateObject("Shell.Application").Namespace(strPath)
' The following line indents and prints a preceding \ to the relative path
WScript.Echo Space(UBound(Split(objFSOFolder.Path,"\"))-3) & "\" & _
objFSOFolder.Name & " - " & _
FormatNumber(objFSOFolder.Size/1000,0) & "k" & _
", Owner: " & objShellFolder.GetDetailsOf(objShellFolder.ParseName(objShellFolder.Title),10) & _
", Last Accessed: " & objFSOFolder.DateLastAccessed
' The loop below iterates through each subfolder, this subroutine recursively calls itself as needed
For Each Subfolder in objFSOFolder.Subfolders
ShowFolderDetails Subfolder.Path
End Sub

The problem is with the line in bold. When I manually substitute in a value for objShellFolder.Title (such as "testfolder"), it works fine for that one folder. When I switch it to a variable that I've confirmed contains that same correct string value, it just won't work. It outputs the file's extended property name instead of it's value (it outputs the word "Owner" instead of Icebox\LocalAdmin).

ParseName needs to accept a variable because the script is on a loop and it's the only way to output the data. ParseName simply won't work when it's fed a variable. I've wasted so much time trying to code around it, and I'm coming apart over here. Please help.


RE: Desperate for debugging of very short script using GetDetailsOf and ParseName

PHV, your input is greatly appreciated! Unfortunately, it made no difference... I get the same results...

RE: Desperate for debugging of very short script using GetDetailsOf and ParseName

Thanks to all those who helped, and even those who read this thread hoping they could help.

For all those like myself who spent hours searching for the answer to this problem, the solution lies in the knowledge that the GetDetailsOf method can ONLY get the details of items WITHIN the object, but cannot get details of the object itself. Hope this post eventually helps somebody stuck in the same predicament I was...

RE: Desperate for debugging of very short script using GetDetailsOf and ParseName

Actually, on second thought, I think I meant ParseName not GetDetailsOf.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close