I’m making use of this script here:
https://gist.github.com/3043878
to try to deploy a reporting services Visual Studio project to SSRS using Powershell. Note however that I’ve modified it to use the 2010 web service, and modified the object initialisation namespaces accordingly.
On line 115, the newly created and populated object $DataSource is returned.
On line 147 & 148, where this method is called and the resulting output used, i get the following error:
Property 'Name' cannot be found on this object. Make sure that it exists.
However, if I execute:
$DataSource | Select Name
$DataSource | Select Path
it returns the expected values
also, executing:
$DataSource | Get-Member
$DataSource | Select *
also lists the Name and Path properties.
What is Powershell actually returning from the New-SSRSDataSource method – it appears to be a lot more than just the DataSource object? Why can’t I access the Name property on what is returned?
I hate answering my own questions…
but…
in changing the service from 2005 to 2010, the CreateDataSource method went from a void return to returning a CatalogItem representing the created datasource, which also has properties of Name and Path.
When trying to access these properties after the method return, powershell was finding multiple properties of the same name, and causing confusion. It is no longer necessary to create the DataSource object in the New-SSRSDataSource method (or, there are other ways to solve the problem).