Format Output into Table

%3CLINGO-SUB%20id%3D%22lingo-sub-3041389%22%20slang%3D%22en-US%22%3EFormat%20Output%20into%20Table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3041389%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20script%20outputs%20the%20format%20as%20follows%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3ESubscription%20Name%20%3A%20DEV%0AResource%20Group%20%20%20%20%3A%20use2-dev-rg%0ASQL%20Server%20Name%20%20%20%3A%20dev-rg-sql%0ADataBase%20Name%20%20%20%20%20%3A%20devrg%0ACreation%20Date%20%20%20%20%20%3A%2010%2F22%2F2020%202%3A33%3A11%20PM%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20output%20above%20is%20cutoff%20as%20there%20are%20multiple%20resource%20groups.%26nbsp%3B%20I'd%20like%20for%20it%20to%20be%20columnar%20with%20Subscription%20Name%2C%20Resource%20Group%2C%20etc%20as%20the%20heading.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20the%20script%20for%20output%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24dateString%20%3D%20(Get-Date).ToString(%22yyyyMMdd%22)%0A%24fileName%20%3D%20(%22AzrSQLDatabases_%22%20%2B%20%24SubscriptionName%20%2B%20%22_%22%20%2B%20%24dateString%20%2B%20%22.xls%22)%0A%24AzureSQLBackupInventory%20%7C%20Out-File%20(%22C%3A%5CTemp%5C%22%20%2B%20%24fileName)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance%20for%20your%20help!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3041389%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20SQL%20DB%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3043241%22%20slang%3D%22en-US%22%3ERe%3A%20Format%20Output%20into%20Table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3043241%22%20slang%3D%22en-US%22%3Eusually%2C%20the%20%7C%20FT%20can%20help%3CBR%20%2F%3E%24AzureSQLBackupInventory%20%7C%20ft%3C%2FLINGO-BODY%3E
New Contributor

Hello,

 

My script outputs the format as follows:

 

 

Subscription Name : DEV
Resource Group    : use2-dev-rg
SQL Server Name   : dev-rg-sql
DataBase Name     : devrg
Creation Date     : 10/22/2020 2:33:11 PM

 

 

The output above is cutoff as there are multiple resource groups.  I'd like for it to be columnar with Subscription Name, Resource Group, etc as the heading.

 

This is the script for output:

 

 

$dateString = (Get-Date).ToString("yyyyMMdd")
$fileName = ("AzrSQLDatabases_" + $SubscriptionName + "_" + $dateString + ".xls")
$AzureSQLBackupInventory | Out-File ("C:\Temp\" + $fileName)

 

Thanks in advance for your help!

1 Reply
usually, the | FT can help
$AzureSQLBackupInventory | ft