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

Add option to use a time-period when using Test-DbaBuild #9259

Open pluim003 opened 4 months ago

pluim003 commented 4 months ago

Summarize Functionality

With this Test-DbaBuild you have the option to check how many CU's your instance can be behind. What I would like is that you can check on how much time the latest applied CU is behind and check for compliancy based on a time-period eg. 6 months, because for one version 2CU behind can be just 2 months whereas in other cases it might be over 1 year. That would also mean a change to dbatools-buildref-index.json by adding the releasedate of the CU.

But then you could enter f.e.

Test-DbaBuild -SqlInstance $SRV -Update -MaxTimeBehind 6Mo

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

Yes

Technical Details

Similar or close is the current one based on CU's.

If I have some more time I could fork and start testing something. If it's too much hassle to enter all releasedates in the json-file it would be an idea to do only the recent ones (f.e. released during the last year) and leave the others empty. And when running the command based on CU-age doesn't encounter a date also state that it isn't compliant.

niphlod commented 4 months ago

I mean, everything can be done, but if in some years this is the first time it pops up, I think it'll be too much of a hassle to set it up. Other cons: