I am new to powershell
Using a power shell script to deploy my SSRS reports
I have run into weird problem
extracts from script
----------------------------------
Create Data source function
------------------------------------
function New-SSRSDataSource ($Proxy,[string]$RdsPath,[string]$Folder,[switch]$Overwrite) {
Write-Verbose "New-SSRSDataSource -RdsPath $RdsPath -Folder $Folder"
$Folder = Normalize-SSRSFolder -Folder $Folder
[xml]$Rds = Get-Content -Path $RdsPath
$ConnProps = $Rds.RptDataSource.ConnectionProperties
$Definition = New-Object -TypeName SSRS.ReportingService2010.DataSourceDefinition
$Definition.ConnectString = $ConnProps.ConnectString
$Definition.Extension = $ConnProps.Extension
if ([Convert]::ToBoolean($ConnProps.IntegratedSecurity)) {
$Definition.CredentialRetrieval = 'Integrated'
}
$hash =@{
Name = $Rds.RptDataSource.Name
Path = $Folder + '/' + $Rds.RptDataSource.Name
}
$DataSource = New-Object -TypeName PSCustomObject -Property $hash
if ( $Overwrite -or $Proxy.GetItemType($DataSource.Path) -eq 'Unknown') {
$Proxy.CreateDataSource($DataSource.Name, $Folder, $Overwrite, $Definition, $null)
}
return $DataSource
}
----------------------------------
where Its referenced
-----------------------------------
$DataSourcePaths = @{}
$Project.SelectNodes('Project/DataSources/ProjectItem') |
ForEach-Object {
$RdsPath = $ProjectRoot | Join-Path -ChildPath $_.FullPath
"$RdsPath"
$DataSource = New-SSRSDataSource -Proxy $Proxy -RdsPath $RdsPath -Folder $DataSourceFolder
$DataSource|Out-GridView
$DataSourcePaths.Add($DataSource.Name,$DataSource.Path)
}
I have two Items in 'ProjectItem' node so essentially for loop should execute for two times
current behaivour
when I execute script for the first time
following are results from both grid view and error message at powershell prompt
Grid View
0SSRS.ReportingService2010.CatalogItemSSRS.ReportingService2010.CatalogItem
1@{Name=Verification Relational DS; Path=/Data Sources/Verification Relational DS}System.Management.Automation.PSCustomObject
Verification Relational DS/Data Sources/Verification Relational DS