Symptom

Cannot convert argument “Definition”, with value: “SSRS.ReportingService2010.DataSourceDefinition”, for “CreateDataSource” to type “SSRS.ReportingService2010.DataSourceDefinition”: “Cannot convert the “SSRS.ReportingService2010.DataSourceDefinition” value of type “SSRS.ReportingService2010.DataSourceDefinition” to type “SSRS.ReportingService2010.DataSourceDefinition”.”

 

Cannot convert argument “Properties”, with value: “System.Object[]”, for “CreateCatalogItem” to type “SSRS.ReportingService2010.Property[]”: “Cannot convert the “SSRS.ReportingService2010.Property” value of type “SSRS.ReportingService2010.Property” to type “SSRS.ReportingService2010.Property”.”

 

Root Cause
Even we defined our own namespace (in this case, “SSRS.ReportingService2010”), PowerShell still use its own namespace when executing the WebServiceProxy for SSRS while trying to create a DataSource

Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy23tServer_ReportService2010_asmx.Property

Solution

Use the autogenerated namespace in all the references.
$namespace = $proxy.GetType().Namespace

Credit

Thanks Belle’s insight on his site

Advertisements