Test code:
$importSplat = @{ InputFolder = "C:\CADDLib\TestImport" ProjectWiseFolder = "Users\KvanHaaren\TestImport" DefaultStorage = "WorkSpaces" Exclusions = @('thumbs.db','*.bak','*.tmp') Overwrite = $true IncludeEmptyFolders = $true SkipDateCheck = $true SuppressOutput = $true MultiThreaded = 20 ExcludeSourceDirectoryFromTargetPath = $true } Import-PWDocuments @importSplat -Verbose -WarningAction Continue -ErrorAction Stop
Error:
Import-PWDocuments : Value does not fall within the expected range. At C:\Code\_Tests\ImportFolderTest.ps1:13 char:1 + Import-PWDocuments @importSplat -Verbose -WarningAction Continue -Err ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Import-PWDocuments], ArgumentException + FullyQualifiedErrorId : System.ArgumentException,PWPS_DAB.ImportPWDocuments
Comment out IncludeEmptyFolders and it works (except for not creating the empty folders)
Hey Kevin, can you include the verbose messages leading to the error. Just want to try and figure out where it is erroring.
[13:01]C:\Code\_Tests>.\ImportFolderTest.ps1 VERBOSE: Searching 'C:\CADDLib\TestImport'... VERBOSE: Found 1 files. VERBOSE: Processing file '\\?\C:\CADDLib\TestImport\SubFolder2\Test File.txt'... VERBOSE: Target ProjectWise folder 'Users\KvanHaaren\TestImport\SubFolder2'... VERBOSE: Found/created 1 folders. VERBOSE: 1 files to import using up to 1000 threads... VERBOSE: Waiting for all threads to complete... VERBOSE: Threads completed. VERBOSE: Processing empty folders in 'C:\CADDLib\TestImport... Import-PWDocuments : Value does not fall within the expected range. At C:\Code\_Tests\ImportFolderTest.ps1:13 char:1 + Import-PWDocuments @importSplat -Verbose -WarningAction Continue -Err ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Import-PWDocuments], ArgumentException + FullyQualifiedErrorId : System.ArgumentException,PWPS_DAB.ImportPWDocuments
It imports all the files successfully then errors at the Processing empty folders
Looks like there is an issue with a method (GetAllDirectories) within the PWSearch being used. Going to require Dave or team to troubleshoot.