dataplat / dbatools

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

Get-DbaErrorLog when instance is offline #9330

Closed pollusb closed 2 months ago

pollusb commented 2 months ago

Summarize Functionality

Investigating problems with and SQL Server instance that has stopped running or won't start.

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

Yes

Technical Details

Get-DbaErrorLog should return the file itself instead of returning the result of the SMO, Server.ReadErrorLog method when the instanec is down.

niphlod commented 2 months ago

if the instance is down, or there are several instances, how can we figure out what errorlog to target ?

pollusb commented 2 months ago

That's a good question. Since Get-DbaErrorLog receive SqlInstance as a parameter we can get from remote registry, the information needed to find the ERRORLOG file in the server's registry.

wsmelton commented 2 months ago

Get-DbaErrorLog should return the file itself instead of returning the result of the SMO, Server.ReadErrorLog method when the instanec is down.

I would consider this out of scope as it adds ton of complexity to a simple command, but also requires a much more permission (e.g., admin rights to the servers, admin shares being enabled) compared to pulling the log via the database engine.

If this is really desired it would be better suited for a stand-alone command like Get-DbaErrorLogFile or something of that nature.

pollusb commented 2 months ago

@wsmelton I understand your point. Since they would not return the same objet format, they should be 2 distinct functions. Do I need to close this ticket and open a new one or can this one can be switched to a new feature?

pollusb commented 2 months ago

I create a new feature request #9333