Skip to content

Commit

Permalink
update example of Set-RsDatasource and fixed bug ot the condition to …
Browse files Browse the repository at this point in the history
…verify the type of credentials is store
  • Loading branch information
jtarquino committed Oct 23, 2016
1 parent 45cecb8 commit 83f3931
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Functions/CatalogItems/Set-RsDataSource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,23 @@ function Set-RsDataSource
.PARAMETER Proxy (optional)
Specify the Proxy to use when communicating with Reporting Services server. If Proxy is not specified, connection to Report Server will be created using ReportServerUri, ReportServerUsername and ReportServerPassword.
.PARAMETER Name
Specify the name of the the Data Source
.PARAMETER DataSourcePath
Specify the path to the data source.
.PARAMETER DataSourceDefinition
Specify the data source definition of the Data Source to update
.EXAMPLE
New-RsDataSource -Name 'My Data Source' -DataSourceDefinition $dataSourceDefinition
Set-RsDataSource -DataSourcePath '/path/to/my/datasource' -DataSourceDefinition $dataSourceDefinition
Description
-----------
This command will establish a connection to the Report Server located at http://localhost/reportserver using current user's credentials and create a new SQL Server data source called 'My Data Source' at the root folder. When connecting to this data source, it will use not specify any credentials.
This command will establish a connection to the Report Server located at http://localhost/reportserver using current user's credentials and update the details of data source found at '/path/to/my/datasource'.
.EXAMPLE
Set-RsDataSource -ReportServerUri 'http://remote-machine:8080/reportserver_sql16' -DataSourcePath '/path/to/my/datasource' -DataSourceDefinition $dataSourceDefinition
Description
-----------
This command will establish a connection to the Report Server located at http://remote-machine:8080/reportserver_sql16 using current user's credentials and update the details of data source found at '/path/to/my/datasource'.
#>

[cmdletbinding()]
Expand All @@ -45,10 +51,9 @@ function Set-RsDataSource

[Parameter(Mandatory=$True)]
[string]
$Name,
$DataSourcePath,

[Parameter(Mandatory=$True)]
[string]
$DataSourceDefinition
)

Expand All @@ -62,7 +67,7 @@ function Set-RsDataSource
throw 'Invalid object specified for DataSourceDefinition!'
}

if ($CredentialRetrieval.ToUpper() -eq 'STORE')
if ($DataSourceDefinition.CredentialRetrieval.ToString().ToUpper() -eq 'STORE')
{
if ([System.String]::IsNullOrEmpty($DataSourceDefinition.UserName) -or [System.String]::IsNullOrEmpty($DataSourceDefinition.Password))
{
Expand Down Expand Up @@ -105,7 +110,7 @@ function Set-RsDataSource
try
{
Write-Verbose "Updating data source..."
$Proxy.SetDataSourceContents($Name, $DataSourceDefinition)
$Proxy.SetDataSourceContents($DataSourcePath, $DataSourceDefinition)
Write-Information "Data source updated successfully!"
}
catch
Expand Down

0 comments on commit 83f3931

Please sign in to comment.