dbatools is a free PowerShell module with over 300 SQL Server best practice, administration, development and migration commands included. Currently, other components of SQL Server such as SSIS, SSRS and SSAS are not supported, but they are part of the overall goal.

Want to help build dbatools? We invite you to join the team.

 

Migration

Copy-DbaAgentAlert
Copy-DbaAgentCategory
Copy-DbaAgentJob
Copy-DbaAgentOperator
Copy-DbaAgentProxyAccount
Copy-DbaAgentSharedSchedule
Copy-DbaBackupDevice
Copy-DbaCentralManagementServer
Copy-DbaCredential
Copy-DbaCustomError
Copy-DbaDatabase
Copy-DbaDatabaseAssembly
Copy-DbaDatabaseMail
Copy-DbaEndpoint
Copy-DbaExtendedEvent
Copy-DbaLinkedServer
Copy-DbaLogin
Copy-DbaQueryStoreConfig
Copy-DbaResourceGovernor
Copy-DbaServerAudit
Copy-DbaServerAuditSpecification
Copy-DbaServerTrigger
Copy-DbaSpConfigure
Copy-DbaSqlDataCollector
Copy-DbaSqlPolicyManagement
Copy-DbaSqlServerAgent
Copy-DbaSsisCatalog
Copy-DbaSysDbUserObject
Start-DbaMigration
Test-DbaMigrationConstraint

Backup and Restore – Database

Backup-DbaDatabase
Get-DbaBackupHistory
Get-DbaRestoreHistory
Get-DbaLastBackup
Measure-DbaBackupThroughput
Read-DbaBackupHeader
Remove-DbaBackup
Restore-DbaDatabase
Test-DbaFullRecoveryModel
Test-DbaLastBackup

Backup and Restore – Certificates

Backup-DbaDatabaseCertificate
Backup-DbaDatabaseMasterKey
Restore-DbaDatabaseCertificate

Export

Export-DbaAvailabilityGroup
Export-DbaLogin
Export-DbaScript
Export-DbaSpConfigure
Export-DbaUser
New-DbaScriptingOption

Detach and Attach

Get-DbaDetachedDatabaseInfo
Mount-DbaDatabase
Dismount-DbaDatabase

Diagnostics and Performance

Clear-DbaSqlConnectionPool
Clear-DbaWaitStatistics
Disable-DbaTraceFlag
Enable-DbaTraceFlag
Export-DbaDiagnosticQuery
Export-DbaExecutionPlan
Get-DbaEstimatedCompletionTime
Get-DbaExecutionPlan
Get-DbaDbVirtualLogFile
Get-DbaProcess
Get-DbaQueryExecutionTime
Get-DbaTopResourceUsage
Get-DbaTraceFlag
Get-DbaWaitStatistic
Invoke-DbaDiagnosticQuery
Save-DbaDiagnosticQueryScript
Stop-DbaProcess
Test-DbaVirtualLogFile

Traces, Profiler and Extended Events

Get-DbaXESession
Get-DbaXESessionTarget
Get-DbaTraceFile
Read-DbaXEFile
Read-DbaTraceFile
Watch-DbaXESession

Databases

Expand-DbaTLogResponsibly
Find-DbaDatabase
Find-DbaDatabaseGrowthEvent
Find-DbaDuplicateIndex
Get-DbaAvailableCollation
Get-DbaDatabase
Get-DbaDatabaseAssembly
Get-DbaDatabaseCertificate
Get-DbaDatabaseEncryption
Get-DbaDatabaseFile
Get-DbaDatabaseMasterKey
Get-DbaDatabasePartitionFunction
Get-DbaDatabasePartitionScheme
Get-DbaDatabaseSpace
Get-DbaDatabaseState
Get-DbaDatabaseUdf
Get-DbaDatabaseUser
Get-DbaDatabaseView
Get-DbaDbQueryStoreOptions
Get-DbaDbStoredProcedure
Get-DbaHelpIndex
Get-DbaSuspectPage
Invoke-DbaDatabaseClone
Invoke-DbaDatabaseShrink
Invoke-DbaDatabaseUpgrade
New-DbaDatabaseCertificate
New-DbaDatabaseMasterKey
Remove-DbaDatabase
Remove-DbaDatabaseCertificate
Remove-DbaDatabaseMasterKey
Remove-DbaDatabaseSafely
Set-DbaDatabaseOwner
Set-DbaDatabaseState
Set-DbaDbCompression
Set-DbaDbQueryStoreOptions
Show-DbaDatabaseList
Test-DbaConnectionAuthScheme
Test-DbaDatabaseCollation
Test-DbaDatabaseCompatibility
Test-DbaDatabaseOwner
Test-DbaDbCompression
Test-DbaIdentityUsage
Test-DbaOptimizeForAdHoc

tempdb

Get-DbaTempdbUsage
Set-DbaTempDbConfiguration
Test-DbaTempDbConfiguration

Snapshots

Get-DbaDatabaseSnapshot
New-DbaDatabaseSnapshot
Restore-DbaFromDatabaseSnapshot
Remove-DbaDatabaseSnapshot

Login and User Management

Find-DbaLoginInGroup
Get-DbaLogin
New-DbaLogin
Remove-DbaOrphanUser
Rename-DbaLogin
Repair-DbaOrphanUser
Sync-DbaSqlLoginPermission
Test-DbaValidLogin
Watch-DbaDbLogin

SQL Agent

Get-DbaAgentAlert
Get-DbaAgentJob
Get-DbaAgentJobHistory
Get-DbaAgentJobOutputFile
Get-DbaAgentLog
Get-DbaAgentOperator
Get-DbaAgentSchedule
Get-DbaJobCategory
Get-DbaRunningJob
New-DbaAgentJob
New-DbaAgentJobStep
New-DbaAgentProxy
New-DbaAgentSchedule
Set-DbaAgentJob
Set-DbaAgentJobOutputFile
Set-DbaAgentJobStep
Set-DbaAgentSchedule
Remove-DbaAgentJob
Remove-DbaAgentJobStep
Remove-DbaAgentSchedule
Set-DbaJobOwner
Start-DbaAgentJob
Stop-DbaAgentJob
Test-DbaJobOwner

Mail and logging

Get-DbaDbMailHistory
Get-DbaDbMailLog
Get-DbaMaintenanceSolutionLog
Get-DbaSqlLog
Get-DbaWindowsLog
Invoke-DbaCycleErrorLog

High Availability

Disable-DbaAgHadr
Enable-DbaAgHadr
Get-DbaAgDatabase
Get-DbaAgHadr
Get-DbaAgListener
Get-DbaAgReplica
Get-DbaAvailabilityGroup
Get-DbaClusterActiveNode

Log Shipping

Invoke-DbaLogShipping
Invoke-DbaLogShippingRecovery
Test-DbaLogShippingStatus

Security and Encryption

Add-DbaComputerCertificate
Enable-DbaForceNetworkEncryption
Disable-DbaForceNetworkEncryption
Get-DbaComputerCertificate
Get-DbaCredential
Get-DbaForceNetworkEncryption
Get-DbaNetworkCertificate
Get-DbaPermission
Get-DbaPrivilege
Get-DbaServerAudit
Get-DbaServerAuditSpecification
Get-DbaUserLevelPermission
New-DbaComputerCertificate
New-DbaCredential
New-DbaServiceMasterKey
Remove-DbaComputerCertificate
Remove-DbaNetworkCertificate
Set-DbaPrivilege
Set-DbaNetworkCertificate

Community Tools

Export-DbaDiagnosticQuery
Install-DbaFirstResponderKit
Install-DbaMaintenanceSolution
Install-DbaWhoIsActive
Invoke-DbaDiagnosticQuery
Invoke-DbaWhoisActive
Save-DbaDiagnosticQueryScript

Writing to SQL Tables

Out-DbaDataTable
Write-DbaDataTable

Services

Get-DbaSqlService
Restart-DbaSqlService
Start-DbaSqlService
Stop-DbaSqlService
Update-DbaSqlServiceAccount

Server Management

Get-DbaComputerSystem
Get-DbaDiskSpace
Get-DbaClientProtocol
Get-DbaOperatingSystem
Get-DbaLocaleSetting
Get-DbaNetworkActivity
Get-DbaPageFileSetting
Get-DbaMemoryUsage
Get-DbaSqlRegistryRoot
Get-DbaServerProtocol

dbatools Support tools

Find-DbaCommand
Get-DbatoolsLog
New-DbatoolsSupportPackage
Update-Dbatools

File System and Storage

Get-DbaDefaultPath
Get-DbaFile
New-DbaSqlDirectory
Remove-DbaBackup
Show-DbaServerFileSystem
Test-DbaSqlPath
Test-DbaDiskAlignment
Test-DbaDiskAllocation

Utilities

Connect-DbaInstance
Get-DbaDependency
Get-DbaLastGoodCheckDb
Get-DbaSchemaChangeHistory
Get-DbaServerInstallDate
Get-DbaSqlProductKey
Get-DbaSqlBuildReference
Get-DbaUptime
Import-DbaCsvToSql
Invoke-Sqlcmd2
Read-DbaTransactionLog
Repair-DbaServerName
Reset-DbaAdmin
Set-DbaMaxDop
Set-DbaPowerPlan
Test-DbaPowerPlan
Test-DbaMaxDop
Test-DbaServerName

Connection Strings

New-DbaSqlConnectionString
New-DbaSqlConnectionStringBuilder

Network and connectivity

Test-DbaConnection
Resolve-DbaNetworkName
Get-DbaTcpPort
Set-DbaTcpPort
Test-DbaNetworkLatency
Test-DbaLinkedServerConnection

Service Principal Names (SPNs)

Get-DbaSpn
Remove-DbaSpn
Set-DbaSpn
Test-DbaSpn

SQL Client Configuration

Get-DbaClientAlias
New-DbaClientAlias
Remove-DbaClientAlias

SSIS

Get-DbaSsisEnvironmentVariable
New-DbaSsisCatalog

General

Get-DbaBackupDevice
Get-DbaCustomError
Get-DbaEndpoint
Get-DbaLinkedServer
Get-DbaMsdtc
Get-DbaPolicy
Get-DbaRoleMember
Get-DbaSqlInstanceProperty
Get-DbaSqlInstanceUserOption
Get-DbaSqlModule
Get-DbaTable
Get-DbaTrigger

Finders

Find-DbaAgentJob
Find-DbaDatabase
Find-DbaDatabaseGrowthEvent
Find-DbaDuplicateIndex
Find-DbaOrphanedFile
Find-DbaSimilarTable
Find-DbaStoredProcedure
Find-DbaTrigger
Find-DbaUnusedIndex
Find-DbaUserObject
Find-DbaView

SQL Management Objects

Get-DbaSqlManagementObject
Test-DbaSqlManagementObject

sp_configure

Get-DbaSpConfigure
Export-DbaSpConfigure
Import-DbaSpConfigure
Set-DbaSpConfigure

System startup

Set-DbaStartupParameter
Get-DbaStartupParameter

Max Memory

Get-DbaMaxMemory
Test-DbaMaxMemory
Set-DbaMaxMemory

Replication

Get-DbaDistributor

Registered Servers

Get-DbaRegisteredServer
Get-DbaRegisteredServersStore

dbatools Configuration

Get-DbaConfig
Get-DbaConfigValue
Set-DbaConfig

dbatools Computer Management

Get-DbaCmConnection
Get-DbaCmObject
New-DbaCmConnection
Set-DbaCmConnection
Remove-DbaCmConnection
Test-DbaCmConnection

dbatools update watcher

Install-DbaWatchUpdate
Uninstall-DbaWatchUpdate
Watch-DbaUpdate