Folders

Author Message
snapper1969

  • Total Posts : 5
  • Scores: 0
  • Reward points : 0
  • Joined: 5/11/2005
  • Location:
  • Status: offline
Folders Sunday, May 15, 2005 9:38 PM (permalink)
0
Hi,

I need to check under the c: drive for various folders and output the computer names and folders that were found. Can anybody assist?.

thx
 
#1
    crazymatt

    • Total Posts : 310
    • Scores: 0
    • Reward points : 0
    • Joined: 3/4/2005
    • Location:
    • Status: offline
    Re: Folders Sunday, May 15, 2005 9:59 PM (permalink)
    0
    Please post your script so far and it will be easier to help.

    Here is a snippet for getting all the folders on C:
    ---
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

    strFolderName = "c:\"

    Set colSubfolders = objWMIService.ExecQuery _
    ("Associators of {Win32_Directory.Name='" & strFolderName & "'} " _
    & "Where AssocClass = Win32_Subdirectory " _
    & "ResultRole = PartComponent")

    For Each objFolder in colSubfolders
    Wscript.Echo objFolder.Name
    Next
    ----------

    /Matt
     
    #2
      snapper1969

      • Total Posts : 5
      • Scores: 0
      • Reward points : 0
      • Joined: 5/11/2005
      • Location:
      • Status: offline
      Re: Folders Sunday, May 15, 2005 11:24 PM (permalink)
      0
      This is the code I have at the moment:

      Set FSO = CreateObject("Scripting.FileSystemObject")
      ShowSubfolders FSO.GetFolder("C:\program files\adobe")

      Sub ShowSubFolders(Folder)
      For Each Subfolder in Folder.SubFolders
      Wscript.Echo Subfolder.Path
      ShowSubFolders Subfolder
      Next
      End Sub

      I want to enumerate all the folders where adobe is listed.

      I also need this to be be able to rune on remote conputers.

      Thx
       
      #3
        crazymatt

        • Total Posts : 310
        • Scores: 0
        • Reward points : 0
        • Joined: 3/4/2005
        • Location:
        • Status: offline
        Re: Folders Sunday, May 15, 2005 11:59 PM (permalink)
        0
        Just need to clarify one thing, in your script you list a folders under the adobe folder? But then you write that you want to list all folders where adobe is listed. Im a lil confused.

        Could you please explain the purpose of your script, if feels like your are trying to find installations of adobe, rather than the folders itself. If that guess is correct there are better ways (eg checking the AddRemove program key for any installations of adobe.) Serching a whole disk for folders could take long time, atleast if you are planning to do this on many computers and often.

        /Matt
         
        #4
          snapper1969

          • Total Posts : 5
          • Scores: 0
          • Reward points : 0
          • Joined: 5/11/2005
          • Location:
          • Status: offline
          Re: Folders Monday, May 16, 2005 12:13 AM (permalink)
          0
          We are trying to find installations of Adobe Acrobat but NOT reader. I've tried the w32_product but that only gives me the software installed via MSI, I've also tried the registry uninstall way but that gives me all the instances of adobe and it doesn't distinguish between the reader and writer. I was going to try the GUID key but some of the versions that I've looked at in the registry don't have this key. I'm really scratching my head on this one. My last thought was top find any adobe directory where there is a 'distillr' or an Acrobat directory under an Adobe acrobat dir. Hope this explains a bit better.

          Thx
           
          #5
            crazymatt

            • Total Posts : 310
            • Scores: 0
            • Reward points : 0
            • Joined: 3/4/2005
            • Location:
            • Status: offline
            Re: Folders Monday, May 16, 2005 12:45 AM (permalink)
            0
            Hi again.

            Hope this works for you. It checks the Win32Reg_AddRemovePrograms for Adobe, if adobe is found it checks for "Reader" (and i also included a check for "update" cause often you have two or more instances of the program where only one is the original and all other are updates and crap.)

            Edit: Sorry, missed the part that u DIDNT search for Reader, now the code is corrected and searches for everything beside reader and update.

            ------------------
            on Error Resume Next

            Const wbemFlagReturnImmediately = &h10
            Const wbemFlagForwardOnly = &h20
            sProgram = UCASE("Adobe")
            sProgram2 = UCASE("Reader")
            sProgram3 = UCASE("Update")
            arrComputers = Array(".")
            For Each strComputer In arrComputers


            Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
            Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32Reg_AddRemovePrograms", "WQL", _
            wbemFlagReturnImmediately + wbemFlagForwardOnly)

            For Each objItem In colItems
            sString = UCase(objItem.DisplayName)
            sFound = InStr(sString, sProgram)
            ' Msgbox sString
            If sFound > 0 Then
            sFound2 = InStr(sString, sProgram2)
            sFound3 = InStr(sString, sProgram3)
            If sFound2 = 0 and sFound3 = 0 Then
            WScript.Echo "DisplayName: " & objItem.DisplayName & VbCrLf & _
            "InstallDate: " & objItem.InstallDate & VbCrLf & _
            "ProdID: " & objItem.ProdID & VbCrLf & _
            "Publisher: " & objItem.Publisher & VbCrLf & _
            "Version: " & objItem.Version
            End If
            End If
            Next
            Next
            -------
             
            #6
              token

              • Total Posts : 1917
              • Scores: 0
              • Reward points : 0
              • Joined: 1/14/2005
              • Location:
              • Status: offline
              Re: Folders Monday, May 16, 2005 7:49 AM (permalink)
              0
              Note that you need to have SMS server 2003 installed on that computer to use that class.

               
              #7
                crazymatt

                • Total Posts : 310
                • Scores: 0
                • Reward points : 0
                • Joined: 3/4/2005
                • Location:
                • Status: offline
                Re: Folders Monday, May 16, 2005 8:58 PM (permalink)
                0
                Oh didnt know that, i do have SMS installed so it worked nice for me :)
                But thanks for the tip, good to know.

                /Matt
                 
                #8

                  Online Bookmarks Sharing: Share/Bookmark

                  Jump to:

                  Current active users

                  There are 0 members and 1 guests.

                  Icon Legend and Permission

                  • New Messages
                  • No New Messages
                  • Hot Topic w/ New Messages
                  • Hot Topic w/o New Messages
                  • Locked w/ New Messages
                  • Locked w/o New Messages
                  • Read Message
                  • Post New Thread
                  • Reply to message
                  • Post New Poll
                  • Submit Vote
                  • Post reward post
                  • Delete my own posts
                  • Delete my own threads
                  • Rate post

                  2000-2012 ASPPlayground.NET Forum Version 3.9