Copying Large Files Using Copy-VMGuestFile
Every now and again I run into a situation where I have to copy files to virtual machines that are on an inaccessible network. With PowerCLI this can be handled easily using the Copy-VMGuestFile command.
For the most part this works as it should but I have run into issues transferring files larger than 1 GB where the operation will timeout and will receive an error stating "The request was aborted: The request was canceled". After some research I found out that the default timeout for web operations in PowerCLI is 300 seconds which does include the Copy-VMGuestFile command.This timeout can be adjusted using the Set-PowerCLIConfiguration command with the WebOperationTimeoutSeconds option and using the -1 value as seen below. The value could also be increased to a greater number of seconds to get pass the timeout limitation it would take to complete the operation but for me it is easier just to disable it.
For reference here is a link to the PowerCLI 11.4 Commands.
https://code.vmware.com/docs/9638/cmdlet-reference
For the most part this works as it should but I have run into issues transferring files larger than 1 GB where the operation will timeout and will receive an error stating "The request was aborted: The request was canceled". After some research I found out that the default timeout for web operations in PowerCLI is 300 seconds which does include the Copy-VMGuestFile command.This timeout can be adjusted using the Set-PowerCLIConfiguration command with the WebOperationTimeoutSeconds option and using the -1 value as seen below. The value could also be increased to a greater number of seconds to get pass the timeout limitation it would take to complete the operation but for me it is easier just to disable it.
For reference here is a link to the PowerCLI 11.4 Commands.
https://code.vmware.com/docs/9638/cmdlet-reference
All of your info is correct except for the final code snippet (typos), I believe it should be "Set-PowerCLIConfiguration -WebOperationTimeoutSeconds -1 -Confirm:$false" Great tip!
ReplyDelete