I need some help ... I find myself somewhat perplexed. Yet this should be easy.
So I execute a stored procedure from within a powershell function.
The SPROC is dynamic and will make new column names, based on db names etc. This all works fine and puts results into $Results
results will be x columns across (unknown name, or quantity).
results will be ONE row.
I want to write out
ColumnName = VALUE from the results
How can I tweak this part of my code?
Remember, my results are stored in $Results
So I execute a stored procedure from within a powershell function.
Quote:
function Stats-Query($SQLServer){ invoke-sqlcmd -query "EXEC SPROCNAME" -database DATABASENAME -serverinstance $SQLServer } $Results = Stats-Query $MachineName |
results will be x columns across (unknown name, or quantity).
results will be ONE row.
I want to write out
ColumnName = VALUE from the results
How can I tweak this part of my code?
Remember, my results are stored in $Results
Quote:
foreach($Column in $Results) { echo $Column + " = " + $Value } |