Thor Logo dbatools

Owner

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

Test-DbaAgentJobOwner

Michael Fal (@Mike_Fal), mikefal.net

Test-DbaAgentJobOwner View Source Michael Fal (@Mike_Fal), mikefal.net Windows, Linux, macOS Synopsis Identifies SQL Agent jobs with incorrect ownership for security compliance auditing Description This function audits SQL Agent job ownership by comparing each job’s current owner against a target login, typically ‘sa’ or another sysadmin account. Jobs owned by inappropriate accounts can pose security risks, especially if those accounts are disabled, deleted, or have reduced permissions. By default, it checks against the ‘sa’ account (or renamed sysadmin), but you can specify any valid login for your organization’s security standards.

Read more

Test-DbaDbOwner

Michael Fal (@Mike_Fal), mikefal.net

Test-DbaDbOwner View Source Michael Fal (@Mike_Fal), mikefal.net Windows, Linux, macOS Synopsis Identifies databases with incorrect ownership for security compliance and best practice enforcement. Description This function compares the current owner of each database against a target login and returns only databases that do NOT match the expected owner. By default, it checks against ‘sa’ (or the renamed sysadmin account if ‘sa’ was changed), but you can specify any valid login.

Read more