find-dbadbgrowthEvent with convertto-dbatimeline
Summarize Functionality
Hi,
I tried to use find-dbadbgrowthEvent with convertto-dbatimeline (find-dbadbgrowthEvent -sqlinstance
Cheers Andi
Is there a command that is similiar or close to what you are looking for?
Yes
Technical Details
No response
Thanks @AndiM1976 ! cool idea. @marcingminski would you be able to take a look?
Can you share your code?
Hi there, I had a look.
Looks like the ConvertTo-DbaTimeLine has been made to only accept input from certain commands as below.
I will see if I can make it to accept arbitrary input
if ($InputObject[0].TypeName -eq 'AgentJobHistory') {
$CallerName = "Get-DbaAgentJobHistory"
$data = $InputObject | Select-Object @{ Name = "SqlInstance"; Expression = { $_.SqlInstance } }, @{ Name = "InstanceName"; Expression = { $_.InstanceName } }, @{ Name = "vLabel"; Expression = { "[" + $($_.SqlInstance -replace "\\", "\\\") + "] " + $_.Job -replace "\'", '' } }, @{ Name = "hLabel"; Expression = { $_.Status } }, @{ Name = "Style"; Expression = { $(Convert-DbaTimelineStatusColor($_.Status)) } }, @{ Name = "StartDate"; Expression = { $(ConvertTo-JsDate($_.StartDate)) } }, @{ Name = "EndDate"; Expression = { $(ConvertTo-JsDate($_.EndDate)) } }
} elseif ($InputObject[0] -is [Sqlcollaborative.Dbatools.Database.BackupHistory]) {
$CallerName = " Get-DbaDbBackupHistory"
$data = $InputObject | Select-Object @{ Name = "SqlInstance"; Expression = { $_.SqlInstance } }, @{ Name = "InstanceName"; Expression = { $_.InstanceName } }, @{ Name = "vLabel"; Expression = { "[" + $($_.SqlInstance -replace "\\", "\\\") + "] " + $_.Database } }, @{ Name = "hLabel"; Expression = { $_.Type } }, @{ Name = "StartDate"; Expression = { $(ConvertTo-JsDate($_.Start)) } }, @{ Name = "EndDate"; Expression = { $(ConvertTo-JsDate($_.End)) } }
} else {
# sorry to be so formal, can't help it ;)
Stop-Function -Message "Unsupported input data. To request support for additional commands, please file an issue at dbatools.io/issues and we'll take a look"
return
}
$body += "$($data | ForEach-Object{ "['$($_.vLabel)','$($_.hLabel)','$($_.Style)',$($_.StartDate), $($_.EndDate)]," })"
Do you have time to work on this one?
Nope, completely forgot. Thanks for the reminder.