dataplat / dbatools

🚀 SQL Server automation and instance migrations have never been safer, faster or freer
https://dbatools.io
MIT License
2.47k stars 803 forks source link

Add -AppendServerInstance to Invoke-DbaWhoIsActive #9540

Open ReeceGoding opened 1 week ago

ReeceGoding commented 1 week ago

Summarize Functionality

Invoke-DbaWhoIsActive calls Invoke-DbaQuery, but cannot be called with the -AppendServerInstance flag like Invoke-DbaQuery can. Let's fix that. When you call Invoke-DbaWhoIsActive on a bunch of servers at once, it pays to know which server you're seeing.

Is there a command that is similiar or close to what you are looking for?

Yes

Technical Details

This should be really easy, given that Invoke-DbaWhoIsActive calls Invoke-DbaQuery directly and already has a bunch of things built in for controlling what parameters go there.

ReeceGoding commented 6 days ago

Gave it a shot myself, but I've become confused by this line

$passedparams = $psboundparameters.Keys | Where-Object { 'Silent', 'SqlServer', 'SqlCredential', 'OutputAs', 'ServerInstance', 'SqlInstance', 'Database' -notcontains $_ }

Several of the parameters that are being filtered out aren't in Invoke-DbaWhoIsActive at all. Some where in this quite old version, so maybe the filter list is just very old?