11 Replies Latest reply on Sep 20, 2018 9:49 AM by LucD

    Downloading a datastore folder using Powershell

    bingscott Novice

      I am attempting to download all of the files in a particular datastore to a local USB drive using Powershell.  Some of the files are *.vmdk files.  When an *.vmdk file is downloaded the system splits it into two files - a 1KB descriptor file and a flat vmdx file.  When the GetDatastoreItem command encounters an *.vmdk file, the copy process quits with the following error:

       

      PS C:\> Copy-DatastoreItem -Item ds:\alb-sys-factsprod\* -Destination F:\sbing\Downloads\ESX_NFS_FACTS_SSD\alb-sys-factsprod\Backup\

      Copy-DatastoreItem : 9/17/2018 11:20:38 AM VimDatastore Download of file 'https://alb-sys-vcsprd.ad

      .cyfd.state.nm.us/folder%2falb-sys-factsprod%2falb-sys-factsprod-e5800be6.vswp?dcPath=ABQ&dsName=ESX

      _NFS_FACTS_SSD' failed. Error message: Response status code does not indicate success: 500

      (Internal Server Error).

      At line:1 char:1

      + Copy-DatastoreItem -Item ds:\alb-sys-factsprod\* -Destination F:\sbin ...

      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

          + CategoryInfo          : NotSpecified: (:) [Copy-DatastoreItem], VimException

          + FullyQualifiedErrorId : Client20_StorageServiceImpl_DownloadFile_DownloadFailed,VMware.VimAut

         omation.ViCore.Cmdlets.Commands.CopyDatastoreItem

       

      Copy-DatastoreItem : Object reference not set to an instance of an object.

      At line:1 char:1

      + Copy-DatastoreItem -Item ds:\alb-sys-factsprod\* -Destination F:\sbin ...

      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

          + CategoryInfo          : NotSpecified: (:) [Copy-DatastoreItem], NullReferenceException

          + FullyQualifiedErrorId : System.NullReferenceException,VMware.VimAutomation.ViCore.Cmdlets.Com

         mands.CopyDatastoreItem

       

      What am I missing? I used an exact copy of a Copy-DatastoreItem command used by someone else to copy a datastore folder containing *.vmdk files and everything worked perfectly for them.  Perhaps the Copy-DatastoreItem command cannot handle *.vmdk files.

       

      here is my complete Copy-DatastoreItem command:

       

      PS C:\> Copy-DatastoreItem -Item ds:\alb-sys-factsprod\* -Destination F:\sbing\Downloads\ESX_NFS_FACTS_SSD\alb-sys-factsprod\Backup\