Set-DbaDbOwner
Michael Fal (@Mike_Fal), mikefal.net
Set-DbaDbOwner View Source Michael Fal (@Mike_Fal), mikefal.net Windows, Linux, macOS Synopsis Changes database ownership to a specified login when current ownership doesn’t match the target. Description Changes database ownership to standardize who owns your databases across an instance. This is particularly useful for maintaining consistent ownership patterns after restoring databases from other environments, where databases may have orphaned owners or inconsistent ownership. By default, the function sets ownership to ‘sa’ (or the renamed sysadmin account), but you can specify any valid login.
Read more
dbatools