Creates a DataTable based on an object’s properties. This allows you to easily write to SQL Server tables.
Thanks to Chad Miller, this is based on his script. Technet
If the attempt to convert to datatable fails, try the -Raw parameter for less accurate datatype detection.
Creates a DataTable from the output of Get-Service.
Get-Service | ConvertTo-DbaDataTable
Creates a DataTable from the CSV object $csv.cheesetypes.
ConvertTo-DbaDataTable -InputObject $csv.cheesetypes
Creates a DataTable from the $dblist object passed in via pipeline.
$dblist | ConvertTo-DbaDataTable
Creates a DataTable with the running processes and converts any TimeSpan property to TotalSeconds.
Get-Process | ConvertTo-DbaDataTable -TimeSpanType TotalSeconds
This command was created by Chrissy LeMaire. You can find Chrissy on Twitter.