Smart questions
Smart answers
Smart people
Join Tek-Tips Forums
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

Join Tek-Tips
*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

billbrasky (TechnicalUser) (OP)
17 May 12 18:51
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
Next
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.

Desperately,
Bill
PHV (MIS)
17 May 12 19:50
What about this ?
", Owner: " & objShellFolder.GetDetailsOf(objShellFolder.ParseName(objFSOFolder.Name),10) & _

Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

billbrasky (TechnicalUser) (OP)
17 May 12 21:09
PHV, your input is greatly appreciated! Unfortunately, it made no difference... I get the same results...
billbrasky (TechnicalUser) (OP)
10 Jun 12 4:45
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...
billbrasky (TechnicalUser) (OP)
10 Jun 12 5:04
Actually, on second thought, I think I meant ParseName not GetDetailsOf.

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!

Back To Forum

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