Change Data source in ODC files

Change Data source in ODC files

This script updates the data source in ODC (Office Data Connection) files. This kind of file is a connection information file that contains properties to connect to, and retrieve data from an external data source or a Reporting Services Report. It includes a connection string, data queries, authentication information, and other settings. They can be created using the Data Connection Wizard in Microsoft Excel that generates the connection information using HTML markup with included segments of XML. ODC files are stored using HTML and XML. You will find here information about ODC file usage in Reports.

These are the steps performed by the script:

  • the user odc files are located in their home folders (\\nas_server\homes$\[username]\My Documents\My Data Sources)
  • change the old datasources (db_old1 and db_old2) to the new datasource (db_datasource)
  • get all the odc file to update (odc files with old datasources)
  • backup the current odc file before updating it
  • check if the backup is successful or not
  • if the backup file is ok, update the odc file with the new datasource

Script :

<>

My Powershell script categories

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social Media Auto Publish Powered By : XYZScripts.com
%d bloggers like this: