Hi all,
in a script I copy some files from a shared NFS datastore to a local, non-shared VMFS. The copy itself seems to succeed, at least the files are there and have the correct sizes and contents. But I receive an error for every file thus copied:
Copy-DatastoreItem : Operation is not valid due to the current state of the object.
At E:\Myscript.ps1:138 char:25
+ Copy-DatastoreItem <<<< -Item $_ -Destination $To -Force -Confirm:$false
+ CategoryInfo : NotSpecified: (:) [Copy-DatastoreItem], InvalidOperationException
+ FullyQualifiedErrorId : System.InvalidOperationException,VMware.VimAutomation.ViCore.Cmdlets.Commands.CopyDatastoreItem
What is the cause for this error? Is it safe to ignore it?
Regards,
Peter
Hi,
Can you provide more detailed information about error?
What is the output of Exception and InnerException details of the error:
$error[0].Exception | select *
$error[0].Exception.InnerException | select *
If it's possible can you attach the result of Get-ErrorReport cmdet (Zip file located in c:\errorReport\ folder):
Get-ErrorReport -ProblemDescription "Copy-DatstoreItem problem" `
-ProblemScriptTimeoutSeconds 1200 `
-Destination c:\errorReport\ `
-DontIncludeServerLogs `
-ProblemScript {Copy-DatastoreItem .....}
Thanks,
Yasen
PowerCLI Dev Team
Here are the Exception and InnerExeption data:
Copy-DatastoreItem : Operation is not valid due to the current state of the object.
At E:\Myscript.ps1:138 char:25
+ Copy-DatastoreItem <<<< -Item $_ -Destination $To -Force -Confirm:$false
+ CategoryInfo : NotSpecified: (:) [Copy-DatastoreItem], InvalidOperationException
+ FullyQualifiedErrorId : System.InvalidOperationException,VMware.VimAutomation.ViCore.Cmdlets.Commands.CopyDatastoreIt
em
Message : Operation is not valid due to the current state of the object.
Data : {}
InnerException :
TargetSite : Void BeginTaskCompletionPoll(System.Collections.Generic.List`1[VMware.VimAutomation.Sdk.Interop.V1.Task.TaskInterop])
StackTrace : at VMware.VimAutomation.ViCore.Impl.V1.Task.ViCoreTaskCoreServiceProviderImpl.BeginTaskCompletionPoll(List`1 taskList)
at VMware.VimAutomation.Sdk.Impl.V1.Task.CoreTaskServiceImpl.WaitForTask(IEnumerable`1 taskList, ProgressCallback progressCallback)
at VMware.VimAutomation.ViCore.Cmdlets.Provider.DatastoreProvider.VmStoreProvider.CopyFile(String path,String destinationPath)
at VMware.VimAutomation.ViCore.Cmdlets.Provider.DatastoreProvider.VmStoreProvider.CopyItem(String path,String copyPath, Boolean recurse)
at VMware.VimAutomation.ViCore.Cmdlets.Commands.CopyDatastoreItem.ProcessRecordErrorHandled()
at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ErrorCallbackCmdletBase.ProcessRecord()
at System.Management.Automation.Cmdlet.DoProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
HelpLink :
Source : VMware.VimAutomation.ViCore.Impl
The Copy-DatastoreItem cmdlet is executed while connected to a vCenter. The vCenter Task list correctly logs the "Copy file" operation.
Regards,
Peter
Thanks for the error details. It seems that we've experienced this issue when we're getting task information from the server and this does not affect the operation itself. Similar issue was reported in this thread with New-VM cmdlet.
Unfortunately it's an issue that is very difficult to reproduce so any additional information will be very helpful for us. Can you attach Get-ErrorReport information and give us more details about previous actions that script does?
Is this error reproducible all the time?
Thanks,
Yasen
BTW Are you using PowerGUI to run the script? If yes, can you try in the powerCLI console?
Message was edited by: ykalchev