5 Replies Latest reply on Dec 1, 2005 1:46 PM by Sung Koo

    searching for specific files on all windows partitions

      I guess the following does not need to be via NSH, but i figured this was a good place to start. I need to locate specific files of unknown case on windows partitions. So I might be looking for something like notepad.exe or Notepad.EXE.


      There did not seem to be an ignore case option in the find command - Is there some good way to:


      find /c/ "otepad."


      but not have to re-run the command for /c, /d, /f, etc? I have many systems to go through, and while they all have /c, they may have other partitions as well.

        • 1. Re: searching for specific files on all windows partitions

          If you use the find that comes with nsh, it is case sensitive. Assuming the file is called notepad.exe the first find will get a result, the second will not:


          find /WINDOWS -name 'notepad.exe'
          find /WINDOWS -name 'Notepad.exe'


          To find files with either case, you can use the [] characters or find everything to a pipe or temp file and grep -i the results.


          This will find any case for the name but lower case extension: NoTePaD.exe

          find /WINDOWS -name '[Nn][Oo][Tt][Ee][Pp][Aa][Dd].exe'

          Find all files and use grep to case-insensitively search the results:

          find /WINDOWS | grep -i notepad.exe


          Final caveat: if you are running these commands using nsh to connect to remote agents, some forms will work faster than others, testing is recommended.

          • 2. Re: searching for specific files on all windows partitions

            If you run any of Andrews commands on / it should search through all the drives.


            find / | grep -i notepad.exe

            • 3. Re: searching for specific files on all windows partitions

              If you need to find the partitions on a box, you can execute:


              ndf -H ugc3bay10 | awk '{print $8}'


              This will get you volumes in windows in nsh format.


              Sung Koo

              • 4. Re: searching for specific files on all windows partitions

                Some good suggestions here. Thank you all very much. The problem i have now is that i can't get through the list of servers (several hundred) without NSH timing out. I'm using -p 11, which seems to be about as much as my desktop can deal with. The errors are somewhat interesting. They start with something like:


                find: /Program Files/Common Files: No such device

                and repeats this for many (all?) of the directories.


                and then for any other system thereafter, it seems to:

                cd: I/O error: //servername/


                I wasn't expecting nsh to timeout while something was actually running.

                • 5. Re: searching for specific files on all windows partitions

                  You may just be running out of resources/threads. I'm assuming you aren't explicitly disconnecting the NSH connections to the machines you are connecting to. NSH doesn't close out connections unless the shell exits or you tell it to close connections to a server (or all servers). If you are executing against several hundred systems, you are going to have several hundred connections open. After a point, you aren't going to be able to connect to any more systems. I don't know the Windows connection limit, but I believe it is throttled.


                  When executing your NSH script, after you are through with a server, disconnect from the system using:


                  disconnect HOSTNAME


                  This should fix your problem.


                  Now, if it doesn't help, then you can create an extended object that executes your script against individual servers then snapshot it to look at results. Not as nice or efficient, but it would fix your I/O error problem.