Skip to main content
Question

Box Powershell - Move Folder timeout

  • May 21, 2025
  • 3 replies
  • 54 views

Forum|alt.badge.img

Hi All,

I'm using the Box Powershell SDK and I'm running into an issue with the "Move-BoxRootFolder" function. If the user that I want to move owns a lot of content, the request will timeout. I'm not sure if this is an issue with Powershell or with the Box API. Is anyone else having any timeout issues on long running tasks? Here's the actual error message that is returned:

Invoke-RestMethod :
Server Connection Closed
Server Connection Closed
Description: The server requested closed the connection before
the transaction was completed.
At line:363 char:15
+ ... $return = Invoke-RestMethod -Uri $uri -Method Put -Headers $headers ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

 

3 replies

Forum|alt.badge.img

Bump?

 

Anyone else experience timeouts when trying to move a root folder that contains a lot of data?


Forum|alt.badge.img

1 thing: can you verify that even the timeout occured, the contents got transferred or not?

Another thing is you can add timeout in the command and try again. 

 

Invoke-RestMethod -Uri "whatever" -TimeoutSec 240

Well, you may not be able to guess how long it would take but usually it doesn't take more than 5 mins even if contents are huge. Internally box is only updating the owner emails -  not exactly transferring the whole content. 

 

thanks,

Bibek

 

 

Forum|alt.badge.img

Thanks for the reply... I did verify that all files are being transferred.

 

I also tried adding a timeout to the invoke-webrequest command it didn't seem to help. Further looking at that timeout parameter... it's related to resolving the hostname and not the webrequest itself... 


It seems that this is definitely just an issue with Powershell and not the API. I'll keep digging to see what I can find.