-
Notifications
You must be signed in to change notification settings - Fork 219
Description
Do you want to request a feature or report a bug?
bug
What is the current behavior?
On SSRS 2016 Server, When I run Out-RsFolderContent -recurse on a folder with a Datasets folder. It tries to create some of the dataset items before it creates the Datasets folder. It then fails to validate that the folder does exist.
Out-RsCatalogItem : Cannot validate argument on parameter 'Destination'. The " Test-Path $_ -PathType Container" validation script for the argument with value "C:\Temp\test\DataSets" did not return a result of True. Determine why the validation script failed, and then try the command again.
At C:\Program Files\WindowsPowerShell\Modules\ReportingServicesTools\0.0.4.7\Functions\CatalogItems\Out-RsFolderContent.ps1:122 char:79
- ... RsCatalogItem -proxy $proxy -RsFolder $item.Path -Destination $folder
-
~~~~~~~- CategoryInfo : InvalidData: (:) [Out-RsCatalogItem], ParameterBindingValidationException
- FullyQualifiedErrorId : ParameterArgumentValidationError,Out-RsCatalogItem
In looking at the code for this function, I can see it's not ordering the result of Get-RsFolderContent and sure enough, that returns items in the sub-folders before it returns the folders. It should probably process all Folders first, but even that, if there are nested folders I guess there could be an issue of ordering those.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
On an SSRS 2016 Server
Create an RS Folder tree with reports in the top level and datasets in a Datasets folder.
Out-RsFolderContent -ReportServerUri http://xxx/reportserver -Recurse -RsFolder /TestFolder -Destination c:\Temp\test
I just don't know how get-RsFolder is ordering the results to give you an exact example. They don't seem to be in alpha order. It appears random.
When I run this against an SSRS 2008R2 server, it processes everything in alpha order (RSFolder Path order) so then it's ok. the /TestFolder/DataSets comes before /Testfolder/DataSets/MyDataSet.
What is the expected behavior?
I expect the command to be able to write out all the catalog items in the folder I give it. If -recurse is specified, I expect to have the sub folders created and the items written to those sub folders. All this without error. But, it errors because it tries to output an item in a sub folder before the sub folder's directory is created.
Which versions of Powershell and which OS are affected by this issue? Did this work in previous versions of our scripts?
Windows 10
Name Value
PSVersion 5.0.10586.117
PSCompatibleVersions {1.0, 2.0, 3.
BuildVersion 10.0.10586.11
CLRVersion 4.0.30319.420
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
It appears to work as you'd expect on an SSRS 2008 R2 server, but not an SSRS 2016 server.