I have a Powershell script that I am using to move SharePoint 2010 Document Sets from one document library to another document library in the same site. The script works fine for most of the document sets, but for some it does not. Here is the relevant portion of the script:
$web = get-spweb http://mysite
$list = $web.Lists["Purchase Orders Archive"]
$item = getItem $list "7581"
$docSet = [Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::GetDocumentSet($item.Folder)
[Byte] $compressedFile = $docset.Export()
The getItem function locates a specific document set within the library. I know that I am getting the correct document library item back because I have inspected the return $item variable values. The problem is that on some document sets, the final Export() call never completes. There are no errors or messages, no return from the call; no CPU or memory or disk I/O is being utilized by the process. The process just seems to go into an infinite wait. There are no messages in the Windows Error Log and no messages in the ULS log.
Does anyone know what may be happening and how I might fix this? We are running a fairly early patch level of SharePoint 2010 if that enters into the discussion, but I don't want to just start patching a production system unless there is evidence of a fix that will help.