Forum Discussion
Change data source connection strings with PowerShell in other IP address
- Anonymous1 year ago
Hi, alexyin1053
You can run PowerShell commands on different IP addresses, such as your company's personal desktop, to change the data source connection string. However, you need to pay attention to the firewall and network configuration.
Make sure the necessary ports are open on the firewall (default is 5985 for HTTP and 5986 for HTTPS) to allow remote PowerShell connections. Also verify that your network policy allows remote connections to the report server.
Also make sure that the user account you're using has the necessary permissions to execute PowerShell scripts on the report server.Make sure PowerShell Remoting is enabled on the report server. You can enable it on the server with the following command:
Enable-PSRemoting -ForceOn your personal desktop, you can use the Invoke-Command cmdlet to run PowerShell scripts on a remote server
$session = New-PSSession -ComputerName "ReportServerIP" -Credential (Get-Credential) Invoke-Command -Session $session -ScriptBlock { # Your PowerShell script to change the connection string } Remove-PSSession -Session $sessionA PowerShell script that changes the connection string of a data source might look like this
$dataSource = Get-RsDataSource -ReportServerUri "http://ReportServerIP/ReportServer" -Path "/path/to/report" $dataSource.ConnectionString = "data source=ProductDataServer;initial catalog=ProductDatabase;persist security info=False" Set-RsDataSource -ReportServerUri "http://ReportServerIP/ReportServer" -Path "/path/to/report" -DataSource $dataSourceYou can refer to it.
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, alexyin1053
You can run PowerShell commands on different IP addresses, such as your company's personal desktop, to change the data source connection string. However, you need to pay attention to the firewall and network configuration.
Make sure the necessary ports are open on the firewall (default is 5985 for HTTP and 5986 for HTTPS) to allow remote PowerShell connections. Also verify that your network policy allows remote connections to the report server.
Also make sure that the user account you're using has the necessary permissions to execute PowerShell scripts on the report server.
Make sure PowerShell Remoting is enabled on the report server. You can enable it on the server with the following command:
Enable-PSRemoting -Force
On your personal desktop, you can use the Invoke-Command cmdlet to run PowerShell scripts on a remote server
$session = New-PSSession -ComputerName "ReportServerIP" -Credential (Get-Credential)
Invoke-Command -Session $session -ScriptBlock {
# Your PowerShell script to change the connection string
}
Remove-PSSession -Session $session
A PowerShell script that changes the connection string of a data source might look like this
$dataSource = Get-RsDataSource -ReportServerUri "http://ReportServerIP/ReportServer" -Path "/path/to/report"
$dataSource.ConnectionString = "data source=ProductDataServer;initial catalog=ProductDatabase;persist security info=False"
Set-RsDataSource -ReportServerUri "http://ReportServerIP/ReportServer" -Path "/path/to/report" -DataSource $dataSource
You can refer to it.
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.