I have multiple rows of data in a powershell script that look like:
SSAS=PerformanceAnalysisService, Provider=SQLNCLI11.1;Data Source=LAP123;Integrated Security=SSPI;Initial Catalog=PerformanceDataMart:
SSAS=EnvironmentalAnalysisService, Provider=SQLNCLI11.1;Data Source=LAP123;Integrated Security=SSPI;Initial Catalog=EnvironmentalDataMart:
I'm currently using:
ConvertFrom-String -Delimiter ";" -PropertyNames Server, Provider, Source, Security, Catalog.
Which gives me:
Server Provider Source Security
------ -------- ------ --------
SSAS=EnvironmentalAnalysisService, Provider=SQLNCLI11.1 Data Source=LAP123 Integrated Security=SSPI Initial Catalog=EnvironmentalDataMart:
SSAS=PerformanceAnalysisService, Provider=SQLNCLI11.1 Data Source=DEV-EDW Integrated Security=SSPI Initial Catalog=PerformanceDataMart:
I'd like to create a table, with the key as the column headings, or even to be able to strip the key out of the table data.
+------------------------------+-------------+-------------+-----------------+-----------------------+
| SSAS | Provider | Data Source | Security | Catalog |
+------------------------------+-------------+-------------+-----------------+-----------------------+
| EnvironmentalAnalysisService | SQLNCLI11.1 | LAP123 | Integrated SSPI | EnvironmentalDataMart |
| PerformanceAnalysisService | SQLNCLI11.1 | LAP123 | Integrated SSPI | PerformanceDataMart |
+------------------------------+-------------+-------------+-----------------+-----------------------+
But is there a way to identify the key/column names and the strip them out dynamically?
The end result will be used by SQL. So either returning the data as seperate columns, or comma seperated would be great.