1 2 3 Previous Next 30 Replies Latest reply on Apr 1, 2011 9:50 PM by Sureshadmin Go to original post
      • 15. Re: Way to report on Orphaned .VMDK files
        LucD Guru
        User ModeratorsvExpertCommunity Warriors

        Carter confirms this is a bug, although it's not clear if it's a PowerCLI or a API bug.

        The bypass is to leave out the details property completely.

        In this script the details of the files (.vmdk) that are returned are not used in the script.

         

        Attached a "vSphere" version of the script (with the "details" property left out).

        Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
        • 16. Re: Way to report on Orphaned .VMDK files
          mdparker Novice

          The script runs without any runtime errors now and the output of the CSV file looks awesome.  I could definitely see a use to schedule this once a Month as part of my health scripts, but sadly, there is still a couple of problems.  All of the vmdk files show 0 in size and a ModDate of 1/1/0001 12:00:00 AM.

           

          I appreciate you help very much and I hate to bother you more, but is there any chance you can dig a little deeper to resolve that issue?

           

          Thanks very much.

          • 17. Re: Way to report on Orphaned .VMDK files
            ykalchev Expert
            VMware Employees

            Hi,

            All of the vmdk files show 0 in size and a ModDate of 1/1/0001 12:00:00 AM.

            This is caused by the the bypass of the details property completely.

            I've modified the script to workaround the bug LucD mentioned so I hope this will solve your task.

             

            Regards,

            Yasen

            • 18. Re: Way to report on Orphaned .VMDK files
              LucD Guru
              Community WarriorsUser ModeratorsvExpert

              Thanks Yasen.

               

              Where can we find more info on \[VMware.Vim.VIConvert\] ?

              Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
              • 19. Re: Way to report on Orphaned .VMDK files
                mdparker Novice

                Awesome.  Thank you both very much!  It seems to work perfectly now.  This will be very handy indeed.

                • 20. Re: Way to report on Orphaned .VMDK files
                  seaJhawk Lurker

                   

                  I'm running the script against some of my ESX servers. It processed fine for a number of servers, but it's hanging (not crashing, not failing - just continuing to process w/o any CPU activity) at the following line for a long time - probably 10 minutes at least.

                   

                   

                    $searchResult = $dsBrowser.SearchDatastoreSubFolders($rootPath, $searchSpec)

                   

                   

                  The ESX servers are all on the same network and I'm running the script on the VirtualCenter Server.

                   

                   

                  Is it normal for "SearchDatastoreSubFolders" method to take such a long time? I did browse the datastores through Infrastructure Client and browsing some of the datastores on the same ESX servers took a VERY long time too. Any idea what could be causing it to be so slow?

                   

                   

                  Thanks,

                   

                   

                  Chris

                   

                   

                  • 21. Re: Way to report on Orphaned .VMDK files
                    seaJhawk Lurker

                     

                    Never mind.

                     

                     

                    After the datastore browser finished searching for files I found that there were a couple thousand old log files in several of the folders in the datastore. I'm guessing this is why it's slow, but it would be nice if I could speed up the search.

                     

                     

                    Great Script!

                     

                     

                    Thanks,

                     

                     

                    Chris

                     

                     

                    • 22. Re: Way to report on Orphaned .VMDK files
                      Adidas6 Novice

                       

                      I just wanted to chime in as well and say that this is an amazingly helpful script!  It has helped me clear out much space on my datastores.  I tore it down and wrote about a half dozen scripts based on it to report on several different types of file-related issues.  (Log bloat, random .iso's, etc)

                       

                      LucD thanks for pointing out those fixes!  I recently upgraded to vSphere and was worried about stuff like that breaking.

                       

                       

                      • 23. Re: Way to report on Orphaned .VMDK files
                        sbrad001 Novice

                         

                        I've tried to run this with teh updated code for vSphere, but I keep getting this error:

                         

                         

                        Exception calling "SearchDatastoreSubFolders" with "2" argument(s): "Datastore '[SAN001 (LUN 804)]' is not accessible."

                         

                         

                        At :line:38 char:55

                         

                         

                        ++ $searchResult = $dsBrowser.SearchDatastoreSubFolders <<<< ($rootPath, $searchSpec)+

                         

                         

                        This isnt the first lun it hits. I've tried excluding that LUN thinking there was an issue.. but it will just hang up on the next LUN.  I checked that I can browse them just fine.

                         

                         

                        • 24. Re: Way to report on Orphaned .VMDK files
                          kkkoh Lurker

                          I'm also try to get more info about vmware.vim.viconvert but no luck. Any idea how to convert this script in vb.net using vmware.vim dll as I can't find any resource available? It seems vimapi_40 class from vmware.vim is different from vim25api class for vSphere 4.

                          • 25. Re: Way to report on Orphaned .VMDK files
                            marrag Novice

                             

                            Is there a solution now for the    "Not initialized: boolean fileOwner" Problem ?

                             

                             

                            I have excact the same Problem a s mentioned above, even when i set the $searchSpec.Details.FileOwner =$true explicit.

                             

                             

                            I'm  using  PowerCLI 4.0 build 162509 on a VSphere environment.

                             

                             

                               

                             

                             

                            Greetings

                             

                             

                             

                             

                             

                            • 26. Re: Way to report on Orphaned .VMDK files
                              LucD Guru
                              User ModeratorsvExpertCommunity Warriors

                              Yes, see Yasen's reply in  Way to report on Orphaned .VMDK files

                              Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                              • 27. Re: Way to report on Orphaned .VMDK files
                                PauloFreitas Lurker

                                Thanks a lot Lucd for this great and very useful script, and Yasen for the work around for vSphere 4 fileOwner bug.

                                 

                                I'm new to powercli and vsphere scripting and I have one question, How can I suppress the ctk.vmdk files from the results, since they aren't actually orphaned vmdks but "change tracking" vmdk files?

                                 

                                 

                                Or even better, is it possible to just show the ctk.vmdk file if it is associated with a vmdk  file which in turn is orphaned? In the mean time I will keep looking into this and will post any findings I might have...

                                 

                                 

                                Thanks in advance,

                                 

                                 

                                 

                                Kind regards from Brazil,

                                 

                                 

                                 

                                Paulo

                                • 28. Re: Way to report on Orphaned .VMDK files
                                  LucD Guru
                                  Community WarriorsvExpertUser Moderators

                                  You could try changing the test

                                  if (-not ($arrUsedDisks -contains ($folder.FolderPath + $fileResult.Path))){
                                  

                                  into

                                  if (-not ($arrUsedDisks -contains ($folder.FolderPath + $fileResult.Path) -and $fileResult.Path -notmatch "ctk.vmdk ")){
                                  

                                   

                                   

                                   

                                   

                                  ____________

                                  Blog: LucD notes

                                  Twitter: lucd22

                                  Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                                  • 29. Re: Way to report on Orphaned .VMDK files
                                    PauloFreitas Lurker

                                    It worked!

                                    Just had to change the parenthesis to

                                    if (-not ($arrUsedDisks -contains ($folder.FolderPath + $fileResult.Path)) -and $fileResult.Path -notmatch "ctk.vmdk"){
                                    

                                     

                                     

                                    Thanks a lot!

                                     

                                    PS. An observation: Yasen workaround also suppressed flat.vmdk from the results (which appeared when the "details" property were left out) maybe there is a way of using "VMware.Vim.VIConvert" as a way of tying ctk with its respective vmdk and that way if there is an orphaned ctk file it would show up on the results.  Not that it matters since CTK files ain't that big, but I thought it was worth mentioning.