So I am trying to copy a file down from a datastore on my host and having this issue:
Copy-DatastoreItem : 1/26/2012 6:35:54 AM VimDatastore Download of file 'https://usewdesx015:443/fo lder%2fLogs%2fdupes.report?dcPath=ha-datacenter&dsName=LOCAL-USEWDESX015' failed. Error message: The remote s erver returned an error: (404) Not Found. At line:1 char:19 + Copy-DatastoreItem <<<< -Item "ds:\Logs\dupes.report" -Destination "c:\dupes\" -Force + CategoryInfo : NotSpecified: (:) [Copy-DatastoreItem], VimException + FullyQualifiedErrorId : Client20_StorageServiceImpl_DownloadFile_DownloadFailed,VMware.VimAutomation.V iCore.Cmdlets.Commands.CopyDatastoreItem I can verify that the file I am looking for is there and also that I am connected to the datastore correctly.
PS ds:\Logs> ls Datastore path: [LOCAL-USEWDESX015] Logs LastWriteTime Type Length Name ------------- ---- ------ ---- 6/30/2011 5:15 PM File 13283 esxupdate.debug 1/26/2012 1:54 PM File 8197 dupes.report Here is my code:
CurrentLocation : Name : ds Provider : VMware.VimAutomation.Core\VimDatastore Root : \usewdesx015@443\ha-datacenter\LOCAL-USEWDESX015 Description : Credential : System.Management.Automation.PSCredential Used : Free : PSPath : VMware.VimAutomation.Core\VimDatastore::\usewdesx015@443\ha-datacenter\LOCAL-USEWDESX015\ Logs\esxupdate.debug PSParentPath : VMware.VimAutomation.Core\VimDatastore::\usewdesx015@443\ha-datacenter\LOCAL-USEWDESX015\ Logs PSChildName : esxupdate.debug PSDrive : ds PSProvider : VMware.VimAutomation.Core\VimDatastore PSIsContainer : False Length : 13283 DatastoreId : Datastore-4d931f68-983f5bd4-5450-1cc1de2607b2 Datastore : LOCAL-USEWDESX015 Name : esxupdate.debug FolderPath : [LOCAL-USEWDESX015] Logs DatastoreFullPath : [LOCAL-USEWDESX015] Logs/esxupdate.debug FullName : vmstores:\usewdesx015@443\ha-datacenter\LOCAL-USEWDESX015\Logs\esxupdate.debug ItemType : File LastWriteTime : 6/30/2011 5:15:39 PM Uid : /VIServer=blackrock\svcvmscp@usewdesx015:443/Datastore=Datastore-4d931f68-983f5bd4-5450-1 cc1de2607b2/DatastoreItem=[LOCAL-USEWDESX015] Logs&slash;esxupdate.debug/ PSPath : VMware.VimAutomation.Core\VimDatastore::\usewdesx015@443\ha-datacenter\LOCAL-USEWDESX015\ Logs\dupes.report PSParentPath : VMware.VimAutomation.Core\VimDatastore::\usewdesx015@443\ha-datacenter\LOCAL-USEWDESX015\ Logs PSChildName : dupes.report PSDrive : ds PSProvider : VMware.VimAutomation.Core\VimDatastore PSIsContainer : False Length : 8197 DatastoreId : Datastore-4d931f68-983f5bd4-5450-1cc1de2607b2 Datastore : LOCAL-USEWDESX015 Name : dupes.report FolderPath : [LOCAL-USEWDESX015] Logs DatastoreFullPath : [LOCAL-USEWDESX015] Logs/dupes.report FullName : vmstores:\usewdesx015@443\ha-datacenter\LOCAL-USEWDESX015\Logs\dupes.report ItemType : File LastWriteTime : 1/26/2012 1:54:41 PM Uid : /VIServer=blackrock\svcvmscp@usewdesx015:443/Datastore=Datastore-4d931f68-983f5bd4-5450-1 cc1de2607b2/DatastoreItem=[LOCAL-USEWDESX015] Logs&slash;dupes.report/ Copy-DatastoreItem : 1/26/2012 6:33:34 AM VimDatastore Download of file 'https://usewdesx015:443/fo lder%2fLogs%2fdupes.report?dcPath=ha-datacenter&dsName=LOCAL-USEWDESX015' failed. Error message: The remote s erver returned an error: (404) Not Found. At C:\software\VMWareScripts\PROD\AdminScripts\Automation\CheckDupesReport.ps1:15 char:19 + Copy-DatastoreItem <<<< -Item "ds:\Logs\dupes.report" -Destination "c:\dupes\" -Force + CategoryInfo : NotSpecified: (:) [Copy-DatastoreItem], VimException + FullyQualifiedErrorId : Client20_StorageServiceImpl_DownloadFile_DownloadFailed,VMware.VimAutomation.V iCore.Cmdlets.Commands.CopyDatastoreItem
The strangest part is that it will delete the file with no errors. Any help on this would be greatly appreciated.
Connect-VIServer hostname -User "user" -Password "password"
$datastore = Get-Datastore "DS Name"
New-PSDrive -Location $datastore -Name ds -PSProvider VimDatastore -Root "\"
Set-Location ds:\Logs
Get-ChildItem
Copy-DatastoreItem -Item "ds:\Logs\dupes.report" -Destination "c:\dupes\" -Force
del "ds:\Logs\dupes.report"
Disconnect-VIServer * -Confirm:$false
Here is my output: