bin/dbatools-index.json

[
    {
        "CommandName": "Backup-DbaDatabase",
        "Description": "Performs a backup of a specified type of 1 or more databases on a SQL Server Instance.\nThese backups may be Full, Differential or Transaction log backups",
        "Tags": [
                     "DisasterRecovery",
                     "Backup",
                     "Restore"
                 ],
        "Synopsis": "Backup one or more SQL Sever databases from a SQL Server SqlInstance",
        "Name": "Backup-DbaDatabase",
        "Links": null,
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eBackup-DbaDatabase -SqlInstance Server1 -Databases HR, Finance\r\n\r\nThis will perform a full database backup on the databases HR and Finance on SQL Server Instance Server1 to Server1\u0027s \r\ndefault backup directory\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eBackup-DbaDatabase -SqlInstance sql2016 -BackupDirectory C:\\temp -Databases AdventureWorks2014 -Type Full\r\n\r\nBacks up AdventureWorks2014 to sql2016\u0027s C:\\temp folder\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Clear-DbaSqlConnectionPool",
        "Description": "This command resets (or empties) the connection pool. \n\t\nIf there are connections in use at the time of the call, they are marked appropriately and will be discarded (instead of being returned to the pool) when Close is called on them.\n\nRef: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.clearallpools(v=vs.110).aspx",
        "Tags": "WSMan",
        "Synopsis": "Resets (or empties) the connection pool.",
        "Name": "Clear-DbaSqlConnectionPool",
        "Links": "https://dbatools.io/Clear-DbaSqlConnectionPool",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eClear-DbaSqlConnectionPool\r\n\r\nClears all local connection pools\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eClear-DbaSqlConnectionPool -ComputerName workstation27\r\n\r\nClears all connection pools on workstation27\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Connect-DbaSqlServer",
        "Description": "This command is efficient because it initializes properties that do not cause enumeration by default. It also supports both Windows and SQL Server credentials and detects which alternative credentials. \n\nBy default, this command also sets the client to \"dbatools PowerShell module - dbatools.io - custom connection\" if you\u0027re doing anything that requires profiling, you can look for this client name.\n\nAlternatively, you can pass in whichever client name you\u0027d like using the -ClientName parameter. There are a ton of other parameters for you to explore as well.\n\t\nSee https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx\nand https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnectionstringbuilder.aspx\nand https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx\n\nTo execute SQL commands, you can use $server.ConnectionContext.ExecuteReader($sql) or $server.Databases[\u0027master\u0027].ExecuteNonQuery($sql)",
        "Synopsis": "Creates an efficient SMO SQL Server object.",
        "Name": "Connect-DbaSqlServer",
        "Links": "https://dbatools.io/Connect-DbaSqlServer",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eConnect-DbaSqlServer -SqlServer sql2014\r\n\r\nCreates an SMO Server object that connects using Windows Authentication\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e$wincred = Get-Credential ad\\sqladmin\r\n\r\nConnect-DbaSqlServer -SqlServer sql2014 -Credential $wincred\r\n\r\nCreates an SMO Server object that connects using alternative Windows credentials\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003e$sqlcred = Get-Credential sqladmin\r\n\r\n$server = Connect-DbaSqlServer -SqlServer sql2014 -Credential $sqlcred\r\n\r\nLogin to sql2014 as SQL login sqladmin.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003e$server = Connect-DbaSqlServer -SqlServer sql2014 -ClientName \"mah connection\"\r\n\r\nCreates an SMO Server object that connects using Windows Authentication and uses the client name \"mah connection\". So \r\nwhen you open up profiler or use extended events, you can search for \"mah connection\".\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003e$server = Connect-DbaSqlServer -SqlServer sql2014 -AppendConnectionString \"Packet \r\nSize=4096;AttachDbFilename=C:\\MyFolder\\MyDataFile.mdf;User Instance=true;\"\r\n\r\nCreates an SMO Server object that connects to sql2014 using Windows Authentication, then it sets the packet size (this \r\ncan also be done via -PacketSize) and other connection attributes.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 6 --------------------------\r\n\r\nPS C:\\\u003e$server = Connect-DbaSqlServer -SqlServer sql2014 -NetworkProtocol TcpIp -MultiSubnetFailover\r\n\r\nCreates an SMO Server object that connects using Windows Authentication that uses TCPIP and has MultiSubnetFailover \r\nenabled.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 7 --------------------------\r\n\r\nPS C:\\\u003e$server = Connect-DbaSqlServer sql2016 -ApplicationIntent ReadOnly\r\n\r\nConnects with ReadOnly ApplicantionIntent.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-DbaQueryStoreConfig",
        "Description": "Copies the configuration of a Query Store enabled database and sets the copied configuration on other databases.",
        "Tags": "QueryStore",
        "Author": "Enrico van de Laar ( @evdlaar )",
        "Synopsis": "Copies the configuration of a Query Store enabled database and sets the copied configuration on other databases.",
        "Name": "Copy-DbaQueryStoreConfig",
        "Links": "https://dbatools.io/Copy-QueryStoreConfig",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-DbaQueryStoreConfig -Source ServerA\\SQL -SourceDatabase AdventureWorks -Destination ServerB\\SQL \r\n-AllDatabases\r\n\r\nCopy the Query Store configuration of the AdventureWorks database in the ServerA\\SQL Instance and apply it on all user \r\ndatabases in the ServerB\\SQL Instance.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-DbaQueryStoreConfig -Source ServerA\\SQL -SourceDatabase AdventureWorks -Destination ServerB\\SQL \r\n-DestinationDatabase WorldWideTraders\r\n\r\nCopy the Query Store configuration of the AdventureWorks database in the ServerA\\SQL Instance and apply it to the \r\nWorldWideTraders database in the ServerB\\SQL Instance.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlAgentCategory",
        "Description": "By default, all SQL Agent categories for Jobs, Operators and Alerts are copied. \n\nThe -OperatorCategories parameter is autopopulated for command-line completion and can be used to copy only specific operator categories.\nThe -AgentCategories parameter is autopopulated for command-line completion and can be used to copy only specific agent categories.\nThe -JobCategories parameter is autopopulated for command-line completion and can be used to copy only specific job categories.\n\nIf the category already exists on the destination, it will be skipped unless -Force is used.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlAgentCategory migrates SQL Agent categories from one SQL Server to another. This is similar to sp_add_category.\n\nhttps://msdn.microsoft.com/en-us/library/ms181597.aspx",
        "Name": "Copy-SqlAgentCategory",
        "Links": "https://dbatools.io/Copy-SqlAgentCategory",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlAgentCategory -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all operator categories from sqlserver2014a to sqlcluster, using Windows credentials. If operator categories \r\nwith the same name exist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlAgentCategory -Source sqlserver2014a -Destination sqlcluster -OperatorCategory PSOperator \r\n-SourceSqlCredential $cred -Force\r\n\r\nCopies a single operator category, the PSOperator operator category from sqlserver2014a to sqlcluster, using SQL \r\ncredentials for sqlserver2014a and Windows credentials for sqlcluster. If a operator category with the same name exists \r\non sqlcluster, it will be dropped and recreated because -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlAgentCategory -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlAlert",
        "Description": "By default, all alerts are copied. The -Alerts parameter is autopopulated for command-line completion and can be used to copy only specific alerts.\n\nIf the alert already exists on the destination, it will be skipped unless -Force is used.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlAlert migrates alerts from one SQL Server to another.",
        "Name": "Copy-SqlAlert",
        "Links": "https://dbatools.io/Copy-SqlAlert",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlAlert -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all alerts from sqlserver2014a to sqlcluster, using Windows credentials. If alerts with the same name exist on \r\nsqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlAlert -Source sqlserver2014a -Destination sqlcluster -Alert PSAlert -SourceSqlCredential $cred -Force\r\n\r\nCopies a single alert, the PSAlert alert from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a \r\nand Windows credentials for sqlcluster. If a alert with the same name exists on sqlcluster, it will be dropped and \r\nrecreated because -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlAlert -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlAudit",
        "Description": "By default, all audits are copied. The -Audits parameter is autopopulated for command-line completion and can be used to copy only specific audits.\n\nIf the audit already exists on the destination, it will be skipped unless -Force is used.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlAudit migrates server audits from one SQL Server to another.",
        "Name": "Copy-SqlAudit",
        "Links": "https://dbatools.io/Copy-SqlAudit",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlAudit -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all server audits from sqlserver2014a to sqlcluster, using Windows credentials. If audits with the same name \r\nexist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlAudit -Source sqlserver2014a -Destination sqlcluster -Audit tg_noDbDrop -SourceSqlCredential $cred -Force\r\n\r\nCopies a single audit, the tg_noDbDrop audit from sqlserver2014a to sqlcluster, using SQL credentials for \r\nsqlserver2014a and Windows credentials for sqlcluster. If an audit with the same name exists on sqlcluster, it will be \r\ndropped and recreated because -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlAudit -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlAuditSpecification",
        "Description": "By default, all audits are copied. The -ServerAuditSpecifications parameter is autopopulated for command-line completion and can be used to copy only specific audits.\n\nIf the audit specification already exists on the destination, it will be skipped unless -Force is used.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlAuditSpecification migrates server audit specifications from one SQL Server to another.",
        "Name": "Copy-SqlAuditSpecification",
        "Links": "https://dbatools.io/Copy-SqlAuditSpecification",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlAuditSpecification -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all server audits from sqlserver2014a to sqlcluster, using Windows credentials. If audits with the same name \r\nexist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlAuditSpecification -Source sqlserver2014a -Destination sqlcluster -ServerAuditSpecifications tg_noDbDrop \r\n-SourceSqlCredential $cred -Force\r\n\r\nCopies a single audit, the tg_noDbDrop audit from sqlserver2014a to sqlcluster, using SQL credentials for \r\nsqlserver2014a and Windows credentials for sqlcluster. If an audit with the same name exists on sqlcluster, it will be \r\ndropped and recreated because -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlAuditSpecification -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlBackupDevice",
        "Description": "Backups are migrated using Admin shares. If destination directory does not exist, SQL Server\u0027s default backup directory will be used.\n\nIf backup device with same name exists on destination, it will not be dropped and recreated unless -Force is used.\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": [
                     "Migration",
                     "DisasterRecovery",
                     "Backup"
                 ],
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copies backup devices one by one. Copies both SQL code and the backup file itself.",
        "Name": "Copy-SqlBackupDevice",
        "Links": "https://dbatools.io/Copy-SqlBackupDevice",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlBackupDevice -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all server backup devices from sqlserver2014a to sqlcluster, using Windows credentials. If backup devices with \r\nthe same name exist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlBackupDevice -Source sqlserver2014a -Destination sqlcluster -BackupDevices backup01 -SourceSqlCredential \r\n$cred -Force\r\n\r\nCopies a single backup device, backup01, from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a\r\nand Windows credentials for sqlcluster. If a backup device with the same name exists on sqlcluster, it will be dropped \r\nand recreated because -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlBackupDevice -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlCentralManagementServer",
        "Description": "Copy-SqlCentralManagementServer copies all groups, subgroups, and server instances from one SQL Server to another.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Migrates SQL Server Central Management groups and server instances from one SQL Server to another.",
        "Name": "Copy-SqlCentralManagementServer",
        "Links": "https://dbatools.io/Copy-SqlCentralManagementServer",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlCentralManagementServer -Source sqlserver2014a -Destination sqlcluster\r\n\r\nIn the above example, all groups, subgroups, and server instances are copied from sqlserver\u0027s Central Management Server \r\nto sqlcluster\u0027s Central Management Server.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlCentralManagementServer -Source sqlserver2014a -Destination sqlcluster -CMSGroups Group1,Group3\r\n\r\nIn the above example, top level Group1 and Group3, along with its subgroups and server instances are copied from \r\nsqlserver to sqlcluster.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlCentralManagementServer -Source sqlserver2014a -Destination sqlcluster -CMSGroups Group1,Group3 \r\n-SwitchServerName -SourceSqlCredential $SourceSqlCredential -DestinationSqlCredential $DestinationSqlCredential\r\n\r\nIn the above example, top level Group1 and Group3, along with its subgroups and server instances are copied from \r\nsqlserver to sqlcluster. When adding sql instances to sqlcluster, if the server name of the migrating instance is \r\n\"sqlcluster\", it will be switched to \"sqlserver\". If SwitchServerName is not specified, \"sqlcluster\" will be skipped.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlCredential",
        "Description": "By using password decryption techniques provided by Antti Rantasaari (NetSPI, 2014), this script migrates SQL Server Credentials from one server to another, while maintaining username and password.\n\nCredit: https://blog.netspi.com/decrypting-mssql-database-link-server-passwords/\nLicense: BSD 3-Clause http://opensource.org/licenses/BSD-3-Clause\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": [
                     "WSMan",
                     "Migration"
                 ],
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlCredential migrates SQL Server Credentials from one SQL Server to another, while maintaining Credential passwords.",
        "Name": "Copy-SqlCredential",
        "Links": "https://dbatools.io/Copy-SqlCredential",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlCredential -Source sqlserver2014a -Destination sqlcluster\r\n\r\nDescription\r\nCopies all SQL Server Credentials on sqlserver2014a to sqlcluster. If credentials exist on destination, they will be \r\nskipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlCredential -Source sqlserver2014a -Destination sqlcluster -Credentials \"PowerShell Proxy Account\" -Force\r\n\r\nDescription\r\nCopies over one SQL Server Credential (PowerShell Proxy Account) from sqlserver to sqlcluster. If the credential \r\nalready exists on the destination, it will be dropped and recreated.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlCustomError",
        "Description": "By default, all custom errors are copied. The -CustomErrors parameter is autopopulated for command-line completion and can be used to copy only specific custom errors.\n\nIf the custom error already exists on the destination, it will be skipped unless -Force is used. Interesting fact, if you drop the us_english version, all the other languages will be dropped for that specific ID as well.\n\nAlso, the us_english version must be created first.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlCustomError migrates custom errors (user defined messages) from one SQL Server to another.",
        "Name": "Copy-SqlCustomError",
        "Links": "https://dbatools.io/Copy-SqlCustomError",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlCustomError -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all server custom errors from sqlserver2014a to sqlcluster, using Windows credentials. If custom errors with the \r\nsame name exist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlCustomError -Source sqlserver2014a -Destination sqlcluster -Trigger 60000 -SourceSqlCredential $cred \r\n-Force\r\n\r\nCopies a single custom error, the custom error with ID number 6000 from sqlserver2014a to sqlcluster, using SQL \r\ncredentials for sqlserver2014a and Windows credentials for sqlcluster. If a custom error with the same name exists on \r\nsqlcluster, it will be updated because -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlCustomError -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlDatabase",
        "Description": "This script provides the ability to migrate databases using detach/copy/attach or backup/restore. This script works with named instances, clusters and Sql Express.\n\nBy default, databases will be migrated to the destination Sql Server\u0027s default data and log directories. You can override this by specifying -ReuseSourceFolderStructure. Filestreams and filegroups are also migrated. Safety is emphasized.\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": [
                     "Migration",
                     "DisasterRecovery",
                     "Backup",
                     "Restore"
                 ],
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Migrates Sql Server databases from one Sql Server to another.",
        "Name": "Copy-SqlDatabase",
        "Links": "https://dbatools.io/Copy-SqlDatabase",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlDatabase -Source sqlserver2014a -Destination sqlserver2014b -Database TestDB -BackupRestore \r\n-NetworkShare \\\\fileshare\\sql\\migration\r\n\r\nMigrates a single user database TestDB using Backup and restore from instance sqlserver2014a to sqlserver2014b. Backup \r\nfiles are stored in \\\\fileshare\\sql\\migration.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlDatabase -Source sqlserver2014a -Destination sqlcluster -DetachAttach -Reattach\r\n\r\nDatabases will be migrated from sqlserver2014a to sqlcluster using the detach/copy files/attach method.The following \r\nwill be perfomed: kick all users out of the database, detach all data/log files, move files across the network over an \r\nadmin share (\\\\SqlSERVER\\M$\\MSSql...), attach file on destination server, reattach at source. If the database files \r\n(*.mdf, *.ndf, *.ldf) on *destination* exist and aren\u0027t in use, they will be overwritten.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlDatabase -Source sqlserver2014a -Destination sqlcluster -Exclude Northwind, pubs -IncludeSupportDbs \r\n-Force -BackupRestore -NetworkShare \\\\fileshare\\sql\\migration\r\n\r\nMigrates all user databases except for Northwind and pubs by using backup/restore (copy-only). Backup files are stored \r\nin \\\\fileshare\\sql\\migration. If the database exists on the destination, it will be dropped prior to attach.\r\n\r\nIt also includes the support databases (ReportServer, ReportServerTempDb, distribution).\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlDatabaseAssembly",
        "Description": "By default, all assemblies are copied. The -Assemblies parameter is autopopulated for command-line completion and can be used to copy only specific assemblies.\n\nIf the assembly already exists on the destination, it will be skipped unless -Force is used. \n\t\nThis script does not yet copy dependents.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlDatabaseAssembly migrates assemblies from one SQL Server to another.",
        "Name": "Copy-SqlDatabaseAssembly",
        "Links": "http://dbatools.io/Get-SqlDatabaseAssembly",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlDatabaseAssembly -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all assemblies from sqlserver2014a to sqlcluster, using Windows credentials. If assemblies with the same name \r\nexist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlDatabaseAssembly -Source sqlserver2014a -Destination sqlcluster -Assemblies dbname.assemblyname, \r\ndbname3.anotherassembly -SourceSqlCredential $cred -Force\r\n\r\nCopies two assemblies, the dbname.assemblyname and dbname3.anotherassembly, from sqlserver2014a to sqlcluster, using \r\nSQL credentials for sqlserver2014a and Windows credentials for sqlcluster. If a assembly with the same name exists on \r\nsqlcluster, it will be dropped and recreated because -Force was used.\r\n\t\r\nIn this example, anotherassembly will be copied to the dbname3 database on the server \"sqlcluster\".\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlThing -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlDatabaseMail",
        "Description": "By default, all mail configurations for Profiles, Accounts, Mail Servers and Configs are copied. \n \nThe -Profiles parameter is autopopulated for command-line completion and can be used to copy only specific mail profiles.\nThe -Accounts parameter is autopopulated for command-line completion and can be used to copy only specific mail accounts.\nThe -MailServers parameter is autopopulated for command-line completion and can be used to copy only specific mail servers.\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Migrates Mail Profiles, Accounts, Mail Servers and Mail Server Configs from one SQL Server to another.",
        "Name": "Copy-SqlDatabaseMail",
        "Links": "https://dbatools.io/Copy-SqlDatabaseMail",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlDatabaseMail -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all database mail objects from sqlserver2014a to sqlcluster, using Windows credentials. If database mail objects \r\nwith the same name exist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlDatabaseMail -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred\r\n\r\nCopies all database mail objects from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and \r\nWindows credentials for sqlcluster.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlDatabaseMail -Source sqlserver2014a -Destination sqlcluster -WhatIf\r\n\r\nShows what would happen if the command were executed.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlDataCollector",
        "Description": "By default, all data collector objects are migrated. If the object already exists on the destination, it will be skipped unless -Force is used. \n\t\nThe -CollectionSets parameter is autopopulated for command-line completion and can be used to copy only specific objects.\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Migrates user SQL Data Collector collection sets. SQL Data Collector configuration is on the agenda, but it\u0027s hard.",
        "Name": "Copy-SqlDataCollector",
        "Links": "https://dbatools.io/Copy-SqlDataCollector",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlDataCollector -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all Data Collector Objects and Configurations from sqlserver2014a to sqlcluster, using Windows credentials.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlDataCollector -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred\r\n\r\nCopies all Data Collector Objects and Configurations from sqlserver2014a to sqlcluster, using SQL credentials for \r\nsqlserver2014a and Windows credentials for sqlcluster.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlDataCollector -Source sqlserver2014a -Destination sqlcluster -WhatIf\r\n\r\nShows what would happen if the command were executed.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlDataCollector -Source sqlserver2014a -Destination sqlcluster -CollectionSets \u0027Server Activity\u0027, \u0027Table \r\nUsage Analysis\u0027\r\n\r\nCopies two Collection Sets, Server Activity and Table Usage Analysis, from sqlserver2014a to sqlcluster.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlEndpoint",
        "Description": "By default, all endpoints are copied. The -Endpoints parameter is autopopulated for command-line completion and can be used to copy only specific endpoints.\n\nIf the endpoint already exists on the destination, it will be skipped unless -Force is used.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlEndpoint migrates server endpoints from one SQL Server to another.",
        "Name": "Copy-SqlEndpoint",
        "Links": "https://dbatools.io/Copy-SqlEndpoint",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlEndpoint -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all server endpoints from sqlserver2014a to sqlcluster, using Windows credentials. If endpoints with the same \r\nname exist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlEndpoint -Source sqlserver2014a -Destination sqlcluster -Endpoint tg_noDbDrop -SourceSqlCredential $cred \r\n-Force\r\n\r\nCopies a single endpoint, the tg_noDbDrop endpoint from sqlserver2014a to sqlcluster, using SQL credentials for \r\nsqlserver2014a and Windows credentials for sqlcluster. If an endpoint with the same name exists on sqlcluster, it will \r\nbe dropped and recreated because -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlEndpoint -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlExtendedEvent",
        "Description": "By default, all non-system extended events are migrated. If the event already exists on the destination, it will be skipped unless -Force is used. \n\t\nThe -Sessions parameter is autopopulated for command-line completion and can be used to copy only specific objects.\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Migrates SQL Extended Event Sessions except the two default sessions, AlwaysOn_health and system_health.",
        "Name": "Copy-SqlExtendedEvent",
        "Links": "https://dbatools.io/Copy-SqlExtendedEvent",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlExtendedEvent -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all extended event sessions from sqlserver2014a to sqlcluster, using Windows credentials.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlExtendedEvent -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred\r\n\r\nCopies all extended event sessions from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and \r\nWindows credentials for sqlcluster.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlExtendedEvent -Source sqlserver2014a -Destination sqlcluster -WhatIf\r\n\r\nShows what would happen if the command were executed.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlExtendedEvent -Source sqlserver2014a -Destination sqlcluster -Sessions CheckQueries, \r\nMonitorUserDefinedException\r\n\r\nCopies two Extended Events, CheckQueries and MonitorUserDefinedException, from sqlserver2014a to sqlcluster.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlJob",
        "Description": "By default, all jobs are copied. The -Jobs parameter is autopopulated for command-line completion and can be used to copy only specific jobs.\n\nIf the job already exists on the destination, it will be skipped unless -Force is used.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlJob migrates jobs from one SQL Server to another.",
        "Name": "Copy-SqlJob",
        "Links": "https://dbatools.io/Copy-SqlJob",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlJob -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all jobs from sqlserver2014a to sqlcluster, using Windows credentials. If jobs with the same name exist on \r\nsqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlJob -Source sqlserver2014a -Destination sqlcluster -Job PSJob -SourceSqlCredential $cred -Force\r\n\r\nCopies a single job, the PSJob job from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and \r\nWindows credentials for sqlcluster. If a job with the same name exists on sqlcluster, it will be dropped and recreated \r\nbecause -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlJob -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlLinkedServer",
        "Description": "By using password decryption techniques provided by Antti Rantasaari (NetSPI, 2014), this script migrates SQL Server Linked Servers from one server to another, while maintaining username and password.\n\nCredit: https://blog.netspi.com/decrypting-mssql-database-link-server-passwords/\nLicense: BSD 3-Clause http://opensource.org/licenses/BSD-3-Clause\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": [
                     "WSMan",
                     "Migration"
                 ],
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlLinkedServer migrates Linked Servers from one SQL Server to another. Linked Server logins and passwords are migrated as well.",
        "Name": "Copy-SqlLinkedServer",
        "Links": "https://dbatools.io/Copy-SqlLinkedServer",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlLinkedServer -Source sqlserver2014a -Destination sqlcluster\r\n\r\nDescription\r\nCopies all SQL Server Linked Servers on sqlserver2014a to sqlcluster. If Linked Server exists on destination, it will \r\nbe skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlLinkedServer -Source sqlserver2014a -Destination sqlcluster -LinkedServers SQL2K5,SQL2k -Force\r\n\r\nDescription\r\nCopies over two SQL Server Linked Servers (SQL2K and SQL2K2) from sqlserver to sqlcluster. If the credential already \r\nexists on the destination, it will be dropped.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlLogin",
        "Description": "SQL Server 2000: Migrates logins with SIDs, passwords, server roles and database roles.\n\nSQL Server 2005 \u0026 above: Migrates logins with SIDs, passwords, defaultdb, server roles \u0026 securables, database permissions \u0026 securables, login attributes (enforce password policy, expiration, etc.)\n\nThe login hash algorithm changed in SQL Server 2012, and is not backwards compatible with previous SQL versions. This means that while SQL Server 2000 logins can be migrated to SQL Server 2012, logins created in SQL Server 2012 can only be migrated to SQL Server 2012 and above.\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Migrates logins from source to destination SQL Servers. Supports SQL Server versions 2000 and above.",
        "Name": "Copy-SqlLogin",
        "Links": "https://dbatools.io/Copy-SqlLogin",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlLogin -Source sqlserver2014a -Destination sqlcluster -Force\r\n\r\nCopies all logins from source server to destination server. If a SQL login on source exists on the destination, the \r\ndestination login will be dropped and recreated.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlLogin -Source sqlserver2014a -Destination sqlcluster -Exclude realcajun -SourceSqlCredential $scred \r\n-DestinationSqlCredential $dcred\r\n\r\nAuthenticates to SQL Servers using SQL Authentication.\r\n\r\nCopies all logins except for realcajun. If a login already exists on the destination, the login will not be migrated.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlLogin -Source sqlserver2014a -Destination sqlcluster -Logins realcajun, netnerds -force\r\n\r\nCopies ONLY logins netnerds and realcajun. If login realcajun or netnerds exists on the destination, they will be \r\ndropped and recreated.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlLogin -Source sqlserver2014a -Destination sqlcluster -SyncOnly\r\n\r\nSyncs only SQL Server login permissions, roles, etc. Does not add or drop logins or users. If a matching login does not \r\nexist on the destination, the login will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlLogin -LoginRenameHashtable @{ \"OldUser\" =\"newlogin\" } -Source $Sql01 -Destination Localhost \r\n-SourceSqlCredential $sqlcred\r\n\r\nCopys down OldUser and then renames it to newlogin.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlOperator",
        "Description": "By default, all operators are copied. The -Operators parameter is autopopulated for command-line completion and can be used to copy only specific operators.\n\nIf the associated credentials for the operator do not exist on the destination, it will be skipped. If the operator already exists on the destination, it will be skipped unless -Force is used.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlOperator migrates operators from one SQL Server to another.",
        "Name": "Copy-SqlOperator",
        "Links": "https://dbatools.io/Copy-SqlOperator",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlOperator -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all operators from sqlserver2014a to sqlcluster, using Windows credentials. If operators with the same name \r\nexist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlOperator -Source sqlserver2014a -Destination sqlcluster -Operator PSOperator -SourceSqlCredential $cred \r\n-Force\r\n\r\nCopies a single operator, the PSOperator operator from sqlserver2014a to sqlcluster, using SQL credentials for \r\nsqlserver2014a and Windows credentials for sqlcluster. If an operator with the same name exists on sqlcluster, it will \r\nbe dropped and recreated because -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlOperator -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlPolicyManagement",
        "Description": "By default, all policies and conditions are copied. If an object already exist on the destination, it will be skipped unless -Force is used. \n\t\nThe -Policies and -Conditions parameters are autopopulated for command-line completion and can be used to copy only specific objects.\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Migrates SQL Policy Based Management Objects, including both policies and conditions.",
        "Name": "Copy-SqlPolicyManagement",
        "Links": "https://dbatools.io/Copy-SqlPolicyManagement",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlPolicyManagement -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all policies and conditions from sqlserver2014a to sqlcluster, using Windows credentials.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlPolicyManagement -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred\r\n\r\nCopies all policies and conditions from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and \r\nWindows credentials for sqlcluster.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlPolicyManagement -Source sqlserver2014a -Destination sqlcluster -WhatIf\r\n\r\nShows what would happen if the command were executed.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlPolicyManagement -Source sqlserver2014a -Destination sqlcluster -Policy \u0027xp_cmdshell must be disabled\u0027\r\n\r\nCopies only one policy, \u0027xp_cmdshell must be disabled\u0027 from sqlserver2014a to sqlcluster. No conditions are migrated.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlProxyAccount",
        "Description": "By default, all proxy accounts are copied. The -ProxyAccounts parameter is autopopulated for command-line completion and can be used to copy only specific proxy accounts.\n\nIf the associated credential for the account does not exist on the destination, it will be skipped. If the proxy account already exists on the destination, it will be skipped unless -Force is used.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlProxyAccount migrates proxy accounts from one SQL Server to another.",
        "Name": "Copy-SqlProxyAccount",
        "Links": "https://dbatools.io/Copy-SqlProxyAccount",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlProxyAccount -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all proxy accounts from sqlserver2014a to sqlcluster, using Windows credentials. If proxy accounts with the same \r\nname exist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlProxyAccount -Source sqlserver2014a -Destination sqlcluster -ProxyAccount PSProxy -SourceSqlCredential \r\n$cred -Force\r\n\r\nCopies a single proxy account, the PSProxy proxy account from sqlserver2014a to sqlcluster, using SQL credentials for \r\nsqlserver2014a and Windows credentials for sqlcluster. If a proxy account with the same name exists on sqlcluster, it \r\nwill be dropped and recreated because -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlProxyAccount -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlResourceGovernor",
        "Description": "By default, all non-system resource pools are migrated. If the pool already exists on the destination, it will be skipped unless -Force is used. \n\t\nThe -ResourcePools parameter is autopopulated for command-line completion and can be used to copy only specific objects.\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Migrates Resource Pools",
        "Name": "Copy-SqlResourceGovernor",
        "Links": "https://dbatools.io/Copy-SqlResourceGovernor",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlResourceGovernor -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all extended event policies from sqlserver2014a to sqlcluster, using Windows credentials.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlResourceGovernor -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred\r\n\r\nCopies all extended event policies from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and \r\nWindows credentials for sqlcluster.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlResourceGovernor -Source sqlserver2014a -Destination sqlcluster -WhatIf\r\n\r\nShows what would happen if the command were executed.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlServerAgent",
        "Description": "This function could use some refining, as *all* job objects are copied. \n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copies *all* ProxyAccounts, JobSchedule, SharedSchedules, AlertSystem, JobCategories, \nOperatorCategories AlertCategories, Alerts, TargetServerGroups, TargetServers, \nOperators, Jobs, Mail and general SQL Agent settings from one SQL Server Agent \nto another. $sourceserver and $destserver are SMO server objects. \n\nIgnores -force: does not drop and recreate.",
        "Name": "Copy-SqlServerAgent",
        "Links": "https://dbatools.io/Copy-SqlServerAgent",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlServerAgent -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all job server objects from sqlserver2014a to sqlcluster, using Windows credentials. If job objects with the \r\nsame name exist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlServerAgent -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred\r\n\r\nCopies all job objects from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and Windows \r\ncredentials for sqlcluster.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlServerTrigger -Source sqlserver2014a -Destination sqlcluster -WhatIf\r\n\r\nShows what would happen if the command were executed.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlServerRole",
        "Description": "By default, all roles are copied. The -Roles parameter is autopopulated for command-line completion and can be used to copy only specific roles.\n\nIf the role already exists on the destination, it will be skipped unless -Force is used.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlServerRole migrates server roles from one SQL Server to another.",
        "Name": "Copy-SqlServerRole",
        "Links": "https://dbatools.io/Copy-SqlServerRole",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlServerRole -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all server roles from sqlserver2014a to sqlcluster, using Windows credentials. If roles with the same name exist \r\non sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlServerRole -Source sqlserver2014a -Destination sqlcluster -Role tg_noDbDrop -SourceSqlCredential $cred \r\n-Force\r\n\r\nCopies a single role, the tg_noDbDrop role from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a \r\nand Windows credentials for sqlcluster. If a role with the same name exists on sqlcluster, it will be dropped and \r\nrecreated because -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlServerRole -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlServerTrigger",
        "Description": "By default, all triggers are copied. The -Triggers parameter is autopopulated for command-line completion and can be used to copy only specific triggers.\n\nIf the trigger already exists on the destination, it will be skipped unless -Force is used.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlServerTrigger migrates server triggers from one SQL Server to another.",
        "Name": "Copy-SqlServerTrigger",
        "Links": "https://dbatools.io/Copy-SqlServerTrigger",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlServerTrigger -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all server triggers from sqlserver2014a to sqlcluster, using Windows credentials. If triggers with the same name \r\nexist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlServerTrigger -Source sqlserver2014a -Destination sqlcluster -Trigger tg_noDbDrop -SourceSqlCredential \r\n$cred -Force\r\n\r\nCopies a single trigger, the tg_noDbDrop trigger from sqlserver2014a to sqlcluster, using SQL credentials for \r\nsqlserver2014a and Windows credentials for sqlcluster. If a trigger with the same name exists on sqlcluster, it will be \r\ndropped and recreated because -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlServerTrigger -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlSharedSchedule",
        "Description": "By default, all shared job schedules are copied. The -SharedSchedules parameter is autopopulated for command-line completion and can be used to copy only specific shared job schedules.\n\nIf the associated credential for the account does not exist on the destination, it will be skipped. If the shared job schedule already exists on the destination, it will be skipped unless -Force is used.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlSharedSchedule migrates shared job schedules from one SQL Server to another.",
        "Name": "Copy-SqlSharedSchedule",
        "Links": "https://dbatools.io/Copy-SqlSharedSchedule",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlSharedSchedule -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all shared job schedules from sqlserver2014a to sqlcluster, using Windows credentials. If shared job schedules \r\nwith the same name exist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlSharedSchedule -Source sqlserver2014a -Destination sqlcluster -SharedSchedule Weekly \r\n-SourceSqlCredential $cred -Force\r\n\r\nCopies a single shared job schedule, the Weekly shared job schedule from sqlserver2014a to sqlcluster, using SQL \r\ncredentials for sqlserver2014a and Windows credentials for sqlcluster. If a shared job schedule with the same name \r\nexists on sqlcluster, it will be dropped and recreated because -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlSharedSchedule -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlSpConfigure",
        "Description": "By default, all configuration values are copied. The -Configs parameter is autopopulated for command-line completion and can be used to copy only specific configs.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlSpConfigure migrates configuration values from one SQL Server to another.",
        "Name": "Copy-SqlSpConfigure",
        "Links": "https://dbatools.io/Copy-SqlSpConfigure",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlSpConfigure -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all sp_configure settings from sqlserver2014a to sqlcluster\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlSpConfigure -Source sqlserver2014a -Destination sqlcluster -Configs DefaultBackupCompression, \r\nIsSqlClrEnabled -SourceSqlCredential $cred -Force\r\n\r\nUpdates the values for two configs, the IsSqlClrEnabled and DefaultBackupCompression, from sqlserver2014a to \r\nsqlcluster, using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlSpConfigure -Source sqlserver2014a -Destination sqlcluster -WhatIf\r\n\r\nShows what would happen if the command were executed.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlSsisCatalog",
        "Description": "By default, all folders, projects, and environments are copied. \nThe -Project parameter can be specified to copy only one project, if desired.\nThe parameters get more granular from the Folder level. i.e. specifying folder will only deploy projects/environments from within that folder.",
        "Tags": "Migration",
        "Synopsis": "Copy-SqlSsisCatalog migrates Folders, SSIS projects, and environments from one SQL Server to another.",
        "Name": "Copy-SqlSsisCatalog",
        "Links": "https://dbatools.io/Copy-SqlSsisCatalog",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlSsisCatalog -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all folders, environments and all ssis Projects from sqlserver2014a to sqlcluster, using Windows credentials. If \r\nfolders with the same name exist on the destination they will be skipped, but projects will be redeployed.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlSsisCatalog -Source sqlserver2014a -Destination sqlcluster -Project Archive_Tables -SourceSqlCredential \r\n$cred -Force\r\n\r\nCopies a single Project, the Archive_Tables Project from sqlserver2014a to sqlcluster, using SQL credentials for \r\nsqlserver2014a\r\nand Windows credentials for sqlcluster. If a Project with the same name exists on sqlcluster, it will be deleted and \r\nrecreated because -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlSsisCatalog -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003e$SecurePW = Read-Host \"Enter password\" -AsSecureString\r\n\r\nCopy-SqlSsisCatalog -Source sqlserver2014a -Destination sqlcluster -CreateCatalogPassword $SecurePW\r\n\r\nDeploy entire SSIS catalog to an instance without a destination catalog. Passing -CreateCatalogPassword will bypass \r\nany user prompts for creating the destination catalog.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlSysDbUserObjects",
        "Description": "Imports *all* user objects found in source SQL Server\u0027s master, msdb and model databases to the destination. This is useful because many DBA\u0027s store backup/maintenance procs/tables/triggers/etc (among other things) in master or msdb.\n\nIt is also useful for migrating objects within the model database.",
        "Tags": "Migration",
        "Synopsis": "Imports *all* user objects found in source SQL Server\u0027s master, msdb and model databases to the destination.",
        "Name": "Copy-SqlSysDbUserObjects",
        "Links": "https://dbatools.io/Get-DetachedDbInfo",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlSysDbUserObjects $sourceserver $destserver\r\n\r\nCopies user objects from source to destination\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Expand-SqlTLogResponsibly",
        "Description": "As you may already know, having a TLog file with too many VLFs can hurt your database performance in many ways.\n\nExample:\n Too many virtual log files can cause transaction log backups to slow down and can also slow down database recovery and, in extreme cases, even affect insert/update/delete performance. \n References:\n http://www.sqlskills.com/blogs/kimberly/transaction-log-vlfs-too-many-or-too-few/\n http://blogs.msdn.com/b/saponsqlserver/archive/2012/02/22/too-many-virtual-log-files-vlfs-can-cause-slow-database-recovery.aspx\n http://www.brentozar.com/blitz/high-virtual-log-file-vlf-count/\n \n\tIn order to get rid of this fragmentation we need to grow the file taking the following into consideration:\n - How many VLFs are created when we perform a grow operation or when an auto-grow is invoked?\n Note: In SQL Server 2014 this algorithm has changed (http://www.sqlskills.com/blogs/paul/important-change-vlf-creation-algorithm-sql-server-2014/)\n\nAttention:\n We are growing in MB instead of GB because of known issue prior to SQL 2012:\n More detail here: \n http://www.sqlskills.com/BLOGS/PAUL/post/Bug-log-file-growth-broken-for-multiples-of-4GB.aspx\n\t and \n http://connect.microsoft.com/SQLServer/feedback/details/481594/log-growth-not-working-properly-with-specific-growth-sizes-vlfs-also-not-created-appropriately\n\t or \n https://connect.microsoft.com/SQLServer/feedback/details/357502/transaction-log-file-size-will-not-grow-exactly-4gb-when-filegrowth-4gb\n\nUnderstanding related problems:\n http://www.sqlskills.com/blogs/kimberly/transaction-log-vlfs-too-many-or-too-few/\n http://blogs.msdn.com/b/saponsqlserver/archive/2012/02/22/too-many-virtual-log-files-vlfs-can-cause-slow-database-recovery.aspx\n http://www.brentozar.com/blitz/high-virtual-log-file-vlf-count/\n \nKnown bug before SQL Server 2012\n http://www.sqlskills.com/BLOGS/PAUL/post/Bug-log-file-growth-broken-for-multiples-of-4GB.aspx\n http://connect.microsoft.com/SQLServer/feedback/details/481594/log-growth-not-working-properly-with-specific-growth-sizes-vlfs-also-not-created-appropriately\n https://connect.microsoft.com/SQLServer/feedback/details/357502/transaction-log-file-size-will-not-grow-exactly-4gb-when-filegrowth-4gb\n\nHow it works?\n The transaction log will growth in chunks until it reachs the desired size. \n Example: If you have a log file with 8192MB and you say that the target size is 81920MB (80GB) it will growth in chunks of 8192MB until reach the 81920MB. 8192 -\u003e 16384 -\u003e 24576 ... 73728 -\u003e 81920",
        "Tags": [
                     "Storage",
                     "Backup"
                 ],
        "Synopsis": "This command will help you to automatically grow your T-Log database file in a responsible way (preventing the generation of too many VLFs).",
        "Name": "Expand-SqlTLogResponsibly",
        "Links": "https://dbatools.io/Expand-SqlTLogResponsibly",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eExpand-SqlTLogResponsibly -SqlServer sqlcluster -Databases db1 -TargetLogSizeMB 50000\r\n\r\nThis is the simplest example. The increment value will be calculated and will grow the T-Log of the db1 database on \r\nsqlcluster to 50000 MB.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eExpand-SqlTLogResponsibly -SqlServer sqlcluster -Databases db1, db2 -TargetLogSizeMB 10000 -IncrementSizeMB 200\r\n\r\nGrows the T-Log of db1 and db2 databases on sqlcluster to 1000MB. If you don\u0027t provide this parameter, the value will \r\nbe calculated automatically. Otherwise, the input value will be compared with the suggested value for your target size. \r\nIf these values differ, you will be prompted to confirm your choice.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eExpand-SqlTLogResponsibly -SqlServer sqlcluster -Databases db1 -TargetLogSizeMB 10000 -LogFileId 9\r\n\r\nGrows the T-Log with FielId 9 of the db1 database on sqlcluster instance to 10000MB.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eExpand-SqlTLogResponsibly -SqlServer sqlcluster -Databases (Get-Content D:\\DBs.txt) -TargetLogSizeMB 50000\r\n\r\nGrows the T-Log of the databases specified in the file \u0027D:\\DBs.txt\u0027 on sqlcluster instance to 50000MB.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eExpand-SqlTLogResponsibly -SqlServer sqlcluster -Databases db1, db2 -TargetLogSizeMB 50000\r\n\r\nGrows the T-Log of the databases db1 and db2 on the sqlcluster instance to 50000MB.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 6 --------------------------\r\n\r\nPS C:\\\u003eExpand-SqlTLogResponsibly -SqlServer sqlcluster -Databases \u0027db with space\u0027 -TargetLogSizeMB 50000 -Verbose\r\n\r\nUse -Verbose to view in detail all actions performed by this script\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 7 --------------------------\r\n\r\nPS C:\\\u003eExpand-SqlTLogResponsibly -SqlServer sqlserver -Databases db1,db2 -TargetLogSizeMB 100 -IncrementSizeMB 10 \r\n-ShrinkLogFile -ShrinkSizeMB 10 -BackupDirectory R:\\MSSQL\\Backup\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Export-DbaAvailabilityGroup",
        "Description": "Exports SQL Server Availability Groups creation scripts to a T-SQL file. This is a function that is not available in SSMS.",
        "Author": "Chris Sommer (@cjsommer), cjsommmer.com",
        "Synopsis": "Exports SQL Server Availability Groups to a T-SQL file.",
        "Name": "Export-DbaAvailabilityGroup",
        "Links": "https://dbatools.io/Export-DbaAvailabilityGroup",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eExport-DbaAvailabilityGroup -SqlServer sql2012\r\n\r\nExports all Availability Groups from SQL server \"sql2012\". Output scripts are written to the Documents\\SqlAgExports \r\ndirectory by default.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eExport-DbaAvailabilityGroup -SqlServer sql2012 -FilePath C:\\temp\\availability_group_exports\r\n\r\nExports all Availability Groups from SQL server \"sql2012\". Output scripts are written to the \r\nC:\\temp\\availability_group_exports directory.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eExport-DbaAvailabilityGroup -SqlServer sql2012 -FilePath \u0027C:\\dir with spaces\\availability_group_exports\u0027 \r\n-AvailabilityGroups AG1,AG2\r\n\r\nExports Availability Groups AG1 and AG2 from SQL server \"sql2012\". Output scripts are written to the C:\\dir with \r\nspaces\\availability_group_exports directory.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eExport-DbaAvailabilityGroup -SqlServer sql2014 -FilePath C:\\temp\\availability_group_exports -NoClobber\r\n\r\nExports all Availability Groups from SQL server \"sql2014\". Output scripts are written to the \r\nC:\\temp\\availability_group_exports directory. If the export file already exists it will not be overwritten.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Export-DbaExecutionPlan",
        "Description": "Exports execution plans to disk. Can pipe from Export-DbaExecutionPlan :D\n\t\nThanks to \n\thttps://www.simple-talk.com/sql/t-sql-programming/dmvs-for-query-plan-metadata/\n\tand\n\thttp://www.scarydba.com/2017/02/13/export-plans-cache-sqlplan-file/\nfor the idea and query.",
        "Tags": "Performance",
        "Synopsis": "Exports execution plans to disk.",
        "Name": "Export-DbaExecutionPlan",
        "Links": "https://dbatools.io/Export-DbaExecutionPlan",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eExport-DbaExecutionPlan -SqlInstance sqlserver2014a\r\n\r\nExports all execution plans for sqlserver2014a.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eExport-DbaExecutionPlan -SqlInstance sqlserver2014a -Databases db1, db2 -SinceLastExecution \u00277/1/2016 10:47:00\u0027\r\n\r\nExports all execution plans for databases db1 and db2 on sqlserve2014a since July 1, 2016 at 10:47 AM.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Export-SqlLogin",
        "Description": "Exports Windows and SQL Logins to a T-SQL file. Export includes login, SID, password, default database, default language, server permissions, server roles, db permissions, db roles.\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Exports Windows and SQL Logins to a T-SQL file. Export includes login, SID, password, default database, default language, server permissions, server roles, db permissions, db roles.",
        "Name": "Export-SqlLogin",
        "Links": [
                      "https://dbatools.io/Export-SqlLogin",
                      "https://dbatools.io/Export-SqlLogin"
                  ],
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eExport-SqlLogin -SqlServer sql2005 -FilePath C:\\temp\\sql2005-logins.sql\r\n\r\nExports SQL for the logins in server \"sql2005\" and writes them to the file \"C:\\temp\\sql2005-logins.sql\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eExport-SqlLogin -SqlServer sqlserver2014a -Exclude realcajun -SqlCredential $scred -FilePath C:\\temp\\logins.sql \r\n-Append\r\n\r\nAuthenticates to sqlserver2014a using SQL Authentication. Exports all logins except for realcajun to \r\nC:\\temp\\logins.sql, and appends to the file if it exists. If not, the file will be created.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eExport-SqlLogin -SqlServer sqlserver2014a -Login realcajun, netnerds -FilePath C:\\temp\\logins.sql\r\n\r\nExports ONLY logins netnerds and realcajun fron sqlsever2014a to the file C:\\temp\\logins.sql\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Export-SqlSpConfigure",
        "Description": "Exports advanced sp_configure global configuration options to sql file.",
        "Synopsis": "Exports advanced sp_configure global configuration options to sql file.",
        "Name": "Export-SqlSpConfigure",
        "Links": null,
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eExport-SqlSpConfigure $sourceserver -Path C:\\temp\\sp_configure.sql\r\n\r\nExports the SPConfigure on sourceserver to the file C:\\temp\\sp_configure.sql\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Export-SqlUser",
        "Description": "Exports users creation and its permissions to a T-SQL file or host. Export includes user, create and add to role(s), database level permissions, object level permissions.\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Synopsis": "Exports users creation and its permissions to a T-SQL file or host.",
        "Name": "Export-SqlUser",
        "Links": "https://dbatools.io/Export-SqlUser",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eExport-SqlUser -SqlServer sql2005 -FilePath C:\\temp\\sql2005-users.sql\r\n\r\nExports SQL for the users in server \"sql2005\" and writes them to the file \"C:\\temp\\sql2005-users.sql\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eExport-SqlUser -SqlServer sqlserver2014a $scred -FilePath C:\\temp\\users.sql -Append\r\n\r\nAuthenticates to sqlserver2014a using SQL Authentication. Exports all users to C:\\temp\\users.sql, and appends to the \r\nfile if it exists. If not, the file will be created.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eExport-SqlUser -SqlServer sqlserver2014a -User User1, User2 -FilePath C:\\temp\\users.sql\r\n\r\nExports ONLY users User1 and User2 fron sqlsever2014a to the file C:\\temp\\users.sql\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eExport-SqlUser -SqlServer sqlserver2008 -User User1 -FilePath C:\\temp\\users.sql -DestinationVersion SQLServer2016\r\n\r\nExports user User1 fron sqlsever2008 to the file C:\\temp\\users.sql with sintax to run on SQL Server 2016\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Find-DbaAgentJob",
        "Description": "This command filters SQL Agent jobs giving the DBA a list of jobs that may need attention or could possibly be options for removal.",
        "Tags": [
                     "DisasterRecovery",
                     "Backup"
                 ],
        "Author": "Stephen Bennett: https://sqlnotesfromtheunderground.wordpress.com/",
        "Synopsis": "Find-DbaAgentJob finds agent job/s that fit certain search filters.",
        "Name": "Find-DbaAgentJob",
        "Links": "https://dbatools.io/Find-DbaAgentJob",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaAgentJob -SQLServer Dev01 -Name backup\r\n\r\nReturns all agent job(s) that have backup in the name\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaAgentJob -SQLServer Dev01 -LastUsed 10\r\n\r\nReturns all agent job(s) that have not ran in 10 days\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaAgentJob -SQLServer Dev01 -Disabled -NoEmailNotification -NoSchedule\r\n\r\nReturns all agent job(s) that are either disabled, have no email notification or dont have a schedule. returned with \r\ndetail\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaAgentJob -SQLServer Dev01 -LastUsed 10 -Exclude \"Yearly - RollUp Workload\", \"SMS - Notification\"\r\n\r\nReturns all agent jobs that havent ran in the last 10 ignoring jobs \"Yearly - RollUp Workload\" and \"SMS - Notification\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaAgentJob -SqlServer Dev01 -Category \"REPL-Distribution\", \"REPL-Snapshot\" -Detailed | Format-Table \r\n-AutoSize -Wrap\r\n\r\nReturns all job/s on Dev01 that are in either category \"REPL-Distribution\" or \"REPL-Snapshot\" with detailed output\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 6 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaAgentJob -SQLServer Dev01, Dev02 -Failed -Since \u00277/1/2016 10:47:00\u0027\r\n\r\nReturns all agent job(s) that have failed since July of 2016 (and still have history in msdb)\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 7 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlRegisteredServerName -SqlServer CMSServer -Group Production | Find-DbaAgentJob -Disabled -NoSchedule \r\n-Detailed | Format-Table -AutoSize -Wrap\r\n\r\nQueries CMS server to return all SQL instances in the Production folder and then list out all agent jobs that have \r\neither been disabled or have no schedule.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 8 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaAgentJob -SQLServer Dev01, Dev02 -Name Mybackup -Exact\r\n\r\nReturns all agent job(s) that are named exactly Mybackup\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Find-DbaCommand",
        "Description": "Finds dbatools commands searching through the inline help text, building a consolidated json index and querying it because Get-Help is too slow",
        "Tags": "find",
        "Author": "niphlod",
        "Synopsis": "Finds dbatools commands searching through the inline help text",
        "Name": "Find-DbaCommand",
        "Links": "https://dbatools.io/Find-DbaCommand",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaCommand \"snapshot\"\r\n\r\nFor lazy typers: finds all commands searching the entire help for \"snapshot\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaCommand -Pattern \"snapshot\"\r\n\r\nFor rigorous typers: finds all commands searching the entire help for \"snapshot\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaCommand -Tag copy\r\n\r\nFinds all commands tagged with \"copy\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaCommand -Tag copy,user\r\n\r\nFinds all commands tagged with BOTH \"copy\" and \"user\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaCommand -Author chrissy\r\n\r\nFinds every command whose author contains our beloved \"chrissy\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 6 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaCommand -Author chrissy -Tag copy\r\n\r\nFinds every command whose author contains our beloved \"chrissy\" and it tagged as \"copy\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 7 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaCommand -Pattern snapshot -Rebuild\r\n\r\nFinds all commands searching the entire help for \"snapshot\", rebuilding the index (good for developers)\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Find-DbaDatabase",
        "Description": "Allows you to search SQL Server instances for database that have either the same name, owner or service broker guid.\n\nThere a several reasons for the service broker guid not matching on a restored database primarily using alter database new broker. or turn off broker to return a guid of 0000-0000-0000-0000.",
        "Tags": "DisasterRecovery",
        "Author": "Stephen Bennett: https://sqlnotesfromtheunderground.wordpress.com/",
        "Synopsis": "Find database/s on multiple servers that match critea you input",
        "Name": "Find-DbaDatabase",
        "Links": "https://dbatools.io/Find-DbaDatabase",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaDatabase -SqlServer \"DEV01\", \"DEV02\", \"UAT01\", \"UAT02\", \"PROD01\", \"PROD02\" -Pattern Report\r\n\r\nReturns all database from the SqlInstances that have a database with Report in the name\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaDatabase -SqlServer \"DEV01\", \"DEV02\", \"UAT01\", \"UAT02\", \"PROD01\", \"PROD02\" -Pattern TestDB -Exact \r\n-Detailed\r\n\r\nReturns all database from the SqlInstances that have a database named TestDB with a detailed output.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaDatabase -SqlServer \"DEV01\", \"DEV02\", \"UAT01\", \"UAT02\", \"PROD01\", \"PROD02\" -Property ServiceBrokerGuid \r\n-Pattern \u0027-faeb-495a-9898-f25a782835f5\u0027 -Detailed\r\n\r\nReturns all database from the SqlInstances that have the same Service Broker GUID with a deatiled output\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Find-DbaLoginInGroup",
        "Description": "Outputs all the active directory groups members for a server, or limits it to find a specific AD user in the groups",
        "Synopsis": "Finds Logins in Active Directory groups that have logins on the SQL Instance.",
        "Name": "Find-DbaLoginInGroup",
        "Links": "https://dbatools.io/Find-DbaLoginInGroup",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaLoginInGroup -SqlInstance DEV01 -Login \"MyDomain\\Stephen.Bennett\"\r\n\r\nReturns all active directory groups with logins on Sql Instance DEV01 that contain the AD user Stephen.Bennett.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaLoginInGroup -SqlInstance DEV01\r\n\r\nReturns all active directory users within all windows AD groups that have logins on the instance.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaLoginInGroup -SqlInstance DEV01 | Where-Object Login -like \u0027*stephen*\u0027\r\n\r\nReturns all active directory users within all windows AD groups that have logins on the instance whose login contains \r\n\u0027stephen\u0027\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Find-DbaOrphanedFile",
        "Description": "This command searches all directories associated with SQL database files for database files that are not currently in use by the SQL Server instance.\n\nBy default, it looks for orphaned .mdf, .ldf and .ndf files in the root\\data directory, the default data path, the default log path, the system paths and any directory in use by any attached directory.\n\t\nYou can specify additional filetypes using the -FileType parameter, and additional paths to search using the -Path parameter.",
        "Tags": [
                     "DisasterRecovery",
                     "Orphan"
                 ],
        "Author": "Sander Stad (@sqlstad), sqlstad.nl",
        "Synopsis": "Find-DbaOrphanedFile finds orphaned database files. Orphaned database files are files not associated with any attached database.",
        "Name": "Find-DbaOrphanedFile",
        "Links": "https://dbatools.io/Find-DbaOrphanedFile",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaOrphanedFile -SqlServer sqlserver2014a\r\n\r\nLogs into the SQL Server \"sqlserver2014a\" using Windows credentials and searches for orphaned files. Returns server \r\nname, local filename, and unc path to file.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaOrphanedFile -SqlServer sqlserver2014a -SqlCredential $cred\r\n\r\nLogs into the SQL Server \"sqlserver2014a\" using alternative credentials and searches for orphaned files. Returns server \r\nname, local filename, and unc path to file.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaOrphanedFile -SqlServer sql2014 -Path \u0027E:\\Dir1\u0027, \u0027E:\\Dir2\u0027\r\n\r\nFinds the orphaned files in \"E:\\Dir1\" and \"E:Dir2\" in addition to the default directories.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaOrphanedFile -SqlServer sql2014 -LocalOnly\r\n\r\nReturns only the local filepath. Using LocalOnly with multiple servers is not recommended since it does not return the \r\nassociated server name.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaOrphanedFile -SqlServer sql2014 -RemoteOnly\r\n\r\nReturns only the remote filepath. Using LocalOnly with multiple servers is not recommended since it does not return the \r\nassociated server name.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 6 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaOrphanedFile -SqlServer sql2014, sql2016 -FileType fsf, mld\r\n\r\nFinds the orphaned ending with \".fsf\" and \".mld\" in addition to the default filetypes \".mdf\", \".ldf\", \".ndf\" for both \r\nthe servers sql2014 and sql2016.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Find-DbaStoredProcedure",
        "Description": "This function can either run against specific databases or all databases searching all user or user and system stored procedures.",
        "Synopsis": "Returns all stored procedures that contain a specific case-insensitive string or regex pattern.",
        "Name": "Find-DbaStoredProcedure",
        "Links": "https://dbatools.io/Find-DbaStoredProcedure",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaStoredProcedure -SqlInstance DEV01 -Pattern whatever\r\n\r\nSearches all user databases stored procedures for \"whatever\" in the textbody\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaStoredProcedure -SqlInstance sql2016 -Pattern \u0027\\w+@\\w+\\.\\w+\u0027\r\n\r\nSearches all databases for all stored procedures that contain a valid email pattern in the textbody\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaStoredProcedure -SqlInstance DEV01 -Databases MyDB -Pattern \u0027some string\u0027 -Verbose\r\n\r\nSearches in \"mydb\" database stored procedures for \"some string\" in the textbody\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaStoredProcedure -SqlInstance sql2016 -Databases MyDB -Pattern RUNTIME -IncludeSystemObjects\r\n\r\nSearches in \"mydb\" database stored procedures for \"runtime\" in the textbody\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Find-DbaUserObject",
        "Description": "Looks at the below list of objects to see if they are either owned by a user or a specific user (using the parameter -Pattern)\n Database Owner\n Agent Job Owner\n Used in Credential\n USed in Proxy\n SQL Agent Steps using a Proxy\n Endpoints\n Database Schemas\n Database Roles\n Dabtabase Assembles\n Database Synonyms",
        "Synopsis": "Searches SQL Server to find user-owned objects (ie. not dbo or sa) or for any object owned by a specific user specified by the Pattern parameter.",
        "Name": "Find-DbaUserObject",
        "Links": "https://dbatools.io/Find-DbaUserObject",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaUserObject -SqlInstance DEV01 -Pattern ad\\stephen\r\n\r\nSearches user objects for owner ad\\stephen\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eFind-DbaUserObject -SqlInstance DEV01 -Verbose\r\n\r\nShows all user owned (non-sa, non-dbo) objects and verbose output\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Find-SqlDuplicateIndex",
        "Description": "This command will help you to find duplicate and overlapping indexes on a database or a list of databases\n\nWhen 2008+ filtered property also come to comparison\nAlso tells how much space you can save by dropping the index.\nWe show the type of compression so you can make a more considered decision.\nFor now only supported for CLUSTERED and NONCLUSTERED indexes\n\nYou can select the indexes you want to drop on the gridview and by click OK the drop statement will be generated.\n\nOutput:\n TableName\n IndexName\n KeyCols\n IncludedCols\n IndexSizeMB\n IndexType\n CompressionDesc (When 2008+)\n NumberRows\n IsDisabled\n IsFiltered (When 2008+)",
        "Synopsis": "Find duplicate and overlapping indexes",
        "Name": "Find-SqlDuplicateIndex",
        "Links": "https://dbatools.io/Find-SqlDuplicateIndex",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eFind-SqlDuplicateIndex -SqlServer sql2005 -FilePath C:\\temp\\sql2005-DuplicateIndexes.sql\r\n\r\nExports SQL for the duplicate indexes in server \"sql2005\" choosen on grid-view and writes them to the file \r\n\"C:\\temp\\sql2005-DuplicateIndexes.sql\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eFind-SqlDuplicateIndex -SqlServer sql2005 -FilePath C:\\temp\\sql2005-DuplicateIndexes.sql -Append\r\n\r\nExports SQL for the duplicate indexes in server \"sql2005\" choosen on grid-view and writes/appends them to the file \r\n\"C:\\temp\\sql2005-DuplicateIndexes.sql\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eFind-SqlDuplicateIndex -SqlServer sqlserver2014a -SqlCredential $cred\r\n\r\nWill find exact duplicate indexes on all user databases present on sqlserver2014a will be verified using SQL \r\ncredentials.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eFind-SqlDuplicateIndex -SqlServer sqlserver2014a -Databases db1, db2\r\n\r\nWill find exact duplicate indexes on both db1 and db2 databases\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eFind-SqlDuplicateIndex -SqlServer sqlserver2014a -IncludeOverlapping\r\n\r\nWill find exact duplicate or overlapping indexes on all user databases\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Find-SqlUnusedIndex",
        "Description": "This command will help you to find Unused indexes on a database or a list of databases\n\nAlso tells how much space you can save by dropping the index.\nWe show the type of compression so you can make a more considered decision.\nFor now only supported for CLUSTERED and NONCLUSTERED indexes\n\nYou can select the indexes you want to drop on the gridview and by click OK the drop statement will be generated.\n\nOutput:\n TableName\n IndexName\n KeyCols\n IncludedCols\n IndexSizeMB\n IndexType\n CompressionDesc (When 2008+)\n NumberRows\n IsDisabled\n IsFiltered (When 2008+)",
        "Synopsis": "Find Unused indexes",
        "Name": "Find-SqlUnusedIndex",
        "Links": "https://dbatools.io/Find-SqlUnusedIndex",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eFind-SqlUnusedIndex -SqlServer sql2005 -FilePath C:\\temp\\sql2005-UnusedIndexes.sql\r\n\r\nExports SQL for the Unused indexes in server \"sql2005\" choosen on grid-view and writes them to the file \r\n\"C:\\temp\\sql2005-UnusedIndexes.sql\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eFind-SqlUnusedIndex -SqlServer sql2005 -FilePath C:\\temp\\sql2005-UnusedIndexes.sql -Append\r\n\r\nExports SQL for the Unused indexes in server \"sql2005\" choosen on grid-view and writes/appends them to the file \r\n\"C:\\temp\\sql2005-UnusedIndexes.sql\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eFind-SqlUnusedIndex -SqlServer sqlserver2016 -SqlCredential $cred\r\n\r\nWill find exact Unused indexes on all user databases present on sqlserver2016 will be verified using SQL credentials.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eFind-SqlUnusedIndex -SqlServer sqlserver2016 -Databases db1, db2\r\n\r\nWill find exact Unused indexes on both db1 and db2 databases\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eFind-SqlUnusedIndex -SqlServer sqlserver2016\r\n\r\nWill find exact Unused indexes on all user databases\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaAgentAlert",
        "Description": "This function returns SQL Agent alerts.",
        "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )",
        "Synopsis": "Returns all SQL Agent alerts on a SQL Server Agent.",
        "Name": "Get-DbaAgentAlert",
        "Links": "https://dbatools.io/Get-DbaAgentAlert",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaAgentAlert -SqlInstance ServerA,ServerB\\instanceB\r\n\r\nReturns all SQL Agent alerts on serverA and serverB\\instanceB\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e\u0027serverA\u0027,\u0027serverB\\instanceB\u0027 | Get-DbaAgentAlert\r\n\r\nReturns all SQL Agent alerts on serverA and serverB\\instanceB\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaAgentOperator",
        "Description": "This function returns SQL Agent operators.",
        "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )",
        "Synopsis": "Returns all SQL Agent operators on a SQL Server Agent.",
        "Name": "Get-DbaAgentOperator",
        "Links": "https://dbatools.io/Get-DbaAgentOperator",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaAgentOperator -SqlInstance ServerA,ServerB\\instanceB\r\n\r\nReturns any SQL Agent operators on serverA and serverB\\instanceB\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e\u0027serverA\u0027,\u0027serverB\\instanceB\u0027 | Get-DbaAgentOperator\r\n\r\nReturns all SQL Agent operators on serverA and serverB\\instanceB\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaAvailabilityGroup",
        "Description": "By default outputs a small set of information around the Availability Group found on the server.",
        "Tags": [
                     "DisasterRecovery",
                     "Backup"
                 ],
        "Synopsis": "Outputs information of the Availabilty Group(s) found on the server.",
        "Name": "Get-DbaAvailabilityGroup",
        "Links": "https://dbatools.io/Get-DbaAvailabilityGroup",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlServer sqlserver2014a\r\n\r\nReturns basic information on all the Availability Group(s) found on sqlserver2014a\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlServer sqlserver2014a -Simple\r\n\r\nShow only server name, availability groups and role\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlServer sqlserver2014a -Detailed\r\n\r\nReturns basic information plus additional info on each replica for all Availability Group(s) on sqlserver2014a\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlServer sqlserver2014a -AvailabilityGroup AG-a\r\n\r\nShows basic information on the Availability Group AG-a on sqlserver2014a\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlServer sqlserver2014a -AvailabilityGroup AG-a -IsPrimary\r\n\r\nReturns true/false if the server, sqlserver2014a, is the primary replica for AG-a Availability Group\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaBackupHistory",
        "Description": "Returns backup history details for some or all databases on a SQL Server. \n\nYou can even get detailed information (including file path) for latest full, differential and log files.\n\t\nReference: http://www.sqlhub.com/2011/07/find-your-backup-history-in-sql-server.html",
        "Tags": [
                     "Storage",
                     "DisasterRecovery",
                     "Backup"
                 ],
        "Synopsis": "Returns backup history details for databases on a SQL Server",
        "Name": "Get-DbaBackupHistory",
        "Links": "https://dbatools.io/Get-DbaBackupHistory",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaBackupHistory -SqlServer sqlserver2014a\r\n\r\nReturns server name, database, username, backup type, date for all backups databases on sqlserver2014a. This may return \r\na ton of rows; consider using filters that are included in other examples.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e$cred = Get-Credential sqladmin\r\n\r\nGet-DbaBackupHistory -SqlServer sqlserver2014a -SqlCredential $cred\r\n\r\nDoes the same as above but logs in as SQL user \"sqladmin\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaBackupHistory -SqlServer sqlserver2014a -Databases db1, db2 -Since \u00277/1/2016 10:47:00\u0027\r\n\r\nReturns backup information only for databases db1 and db2 on sqlserve2014a since July 1, 2016 at 10:47 AM.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaBackupHistory -SqlServer sql2014 -Databases AdventureWorks2014, pubs -Force | Format-Table\r\n\r\nReturns information only for AdventureWorks2014 and pubs, and makes the output pretty\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaBackupHistory -SqlServer sql2014 -Databases AdventureWorks2014 -Last\r\n\r\nReturns information about the most recent full, differential and log backups for AdventureWorks2014 on sql2014\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 6 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaBackupHistory -SqlServer sql2014 -Databases AdventureWorks2014 -LastFull\r\n\r\nReturns information about the most recent full backup for AdventureWorks2014 on sql2014\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 7 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlRegisteredServerName -SqlServer sql2016 | Get-DbaBackupHistory\r\n\r\nReturns database backup information for every database on every server listed in the Central Management Server on \r\nsql2016\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 8 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaBackupHistory -SqlServer sqlserver2014a, sql2016 -Force\r\n\r\nLots of detailed information for all databases on sqlserver2014a and sql2016.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaClientProtocol",
        "Description": "Gets the SQL Server related client protocols on one or more computers.\n\nRequires Local Admin rights on destination computer(s).\nThe client protocols can be enabled and disabled when retrieved via WSMan.",
        "Tags": "Protocol",
        "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )",
        "Synopsis": "Gets the SQL Server related client protocols on a computer.",
        "Name": "Get-DbaClientProtocol",
        "Links": "https://dbatools.io/Get-DbaClientProtocol",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaClientProtocol -ComputerName sqlserver2014a\r\n\r\nGets the SQL Server related client protocols on computer sqlserver2014a.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\u0027,\u0027sql3\u0027 | Get-DbaClientProtocol\r\n\r\nGets the SQL Server related client protocols on computers sql1, sql2 and sql3.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaClientProtocol -ComputerName sql1,sql2 | Out-Gridview\r\n\r\nGets the SQL Server related client protocols on computers sql1 and sql2, and shows them in a grid view.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003e(Get-DbaClientProtocol -ComputerName sql1 | Where { $_.DisplayName = \u0027via\u0027 }).Disable()\r\n\r\nDisables the VIA ClientNetworkProtocol on computer sql1.\r\nIf succesfull, returncode 0 is shown.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaClusterActiveNode",
        "Description": "Returns a string of the current owner. If -Detailed is specified, a datatable of details will be returned.",
        "Synopsis": "Returns the active node of a SQL Cluster",
        "Name": "Get-DbaClusterActiveNode",
        "Links": "https://dbatools.io/Get-DbaClusterActiveNode",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaClusterActiveNode -SqlServer sqlcluster\r\n\r\nReturns a simple string with the ComputerNamePhysicalNetBIOS property\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaClusterActiveNode -SqlServer sqlcluster -Detailed\r\n\r\nReturns a datatable with details\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaConfig",
        "Description": "Retrieves configuration elements by name.\nCan be used to search the existing configuration list.",
        "Tags": "Config",
        "Author": "Friedrich Weinmann",
        "Synopsis": "Retrieves configuration elements by name.",
        "Name": "Get-DbaConfig",
        "Links": null,
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaConfig \u0027Mail.To\u0027\r\n\r\nRetrieves the configuration element for the key \"Mail.To\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaConfig -Force\r\n\r\nRetrieve all configuration elements from all modules, even hidden ones.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaConfigValue",
        "Description": "Returns the configuration value stored under the specified name.\nIt requires the full name (\u003cModule\u003e.\u003cName\u003e) and is usually only called by functions.",
        "Tags": "Config",
        "Author": "Friedrich Weinmann",
        "Synopsis": "Returns the configuration value stored under the specified name.",
        "Name": "Get-DbaConfigValue",
        "Links": null,
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaConfigValue -Name \u0027System.MailServer\u0027\r\n\r\nReturns the configured value that was assigned to the key \u0027System.MailServer\u0027\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaConfigValue -Name \u0027Default.CoffeeMilk\u0027 -Fallback 0\r\n\r\nReturns the configured value for \u0027Default.CoffeeMilk\u0027. If no such value is configured, it returns \u00270\u0027 instead.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaDatabase",
        "Description": "The Get-DbaDatabase command gets SQL database information for each database that is present in the target instance(s) of\nSQL Server. If the name of the database is provided, the command will return only the specific database information.",
        "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com",
        "Synopsis": "Gets SQL Database information for each database that is present in the target instance(s) of SQL Server.",
        "Name": "Get-DbaDatabase",
        "Links": "https://dbatools.io/Get-DbaDatabase",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDatabase -SqlServer localhost\r\n\r\nReturns all databases on the local default SQL Server instance\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDatabase -SqlServer localhost -NoUserDb\r\n\r\nReturns only the system databases on the local default SQL Server instance\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDatabase -SqlServer localhost -NoSystemDb\r\n\r\nReturns only the user databases on the local default SQL Server instance\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003e\u0027localhost\u0027,\u0027sql2016\u0027 | Get-DbaDatabase\r\n\r\nReturns databases on multiple instances piped into the function\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaDatabaseFreespace",
        "Description": "This function returns database file space information for a SQL Instance or group of SQL \nInstances. Information is based on a query against sys.database_files and the FILEPROPERTY\nfunction to query and return information. The function can accept a single instance or\nmultiple instances. By default, only user dbs will be shown, but using the IncludeSystemDBs\nswitch will include system databases",
        "Synopsis": "Returns database file space information for database files on a SQL instance.",
        "Name": "Get-DbaDatabaseFreespace",
        "Links": "https://dbatools.io/Get-DbaDatabaseFreespace",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDatabaseFreespace -SqlServer localhost\r\n\r\nReturns all user database files and free space information for the local host\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDatabaseFreespace -SqlServer localhost | Where-Object {$_.PercentUsed -gt 80}\r\n\r\nReturns all user database files and free space information for the local host. Filters\r\nthe output object by any files that have a percent used of greater than 80%.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003e@(\u0027localhost\u0027,\u0027localhost\\namedinstance\u0027) | Get-DbaDatabaseFreespace\r\n\r\nReturns all user database files and free space information for the localhost and\r\nlocalhost\\namedinstance SQL Server instances. Processes data via the pipeline.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDatabaseFreespace -SqlServer localhost -Databases db1, db2\r\n\r\nReturns database files and free space information for the db1 and db2 on localhost.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaDatabaseSnapshot",
        "Description": "Retrieves the list of database snapshot available, along with their base (the db they are the snapshot of) and creation time",
        "Tags": "Snapshot",
        "Author": "niphlod",
        "Synopsis": "Get database snapshots with details",
        "Name": "Get-DbaDatabaseSnapshot",
        "Links": "https://dbatools.io/Get-DbaDatabaseSnapshot",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDatabaseSnapshot -SqlServer sqlserver2014a\r\n\r\nReturns a custom object displaying Server, Database, DatabaseCreated, SnapshotOf, SizeMB, DatabaseCreated\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDatabaseSnapshot -SqlServer sqlserver2014a -Databases HR, Accounting\r\n\r\nReturns information for database snapshots having HR and Accounting as base dbs\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDatabaseSnapshot -SqlServer sqlserver2014a -Snapshots HR_snapshot, Accounting_snapshot\r\n\r\nReturns information for database snapshots HR_snapshot and Accounting_snapshot\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaDatabaseState",
        "Description": "Gets some common \"states\" on databases:\n - \"RW\" options : READ_ONLY or READ_WRITE\n - \"Status\" options : ONLINE, OFFLINE, EMERGENCY\n - \"Access\" options : SINGLE_USER, RESTRICTED_USER, MULTI_USER\n\nReturns an object with SqlInstance, Database, RW, Status, Access",
        "Author": "niphlod",
        "Synopsis": "Gets various options for databases, hereby called \"states\"",
        "Name": "Get-DbaDatabaseState",
        "Links": "https://dbatools.io/Get-DbaDatabaseState",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDatabaseState -SqlInstance sqlserver2014a\r\n\r\nGets options for all databases of the sqlserver2014a instance\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDatabaseState -SqlInstance sqlserver2014a -Database HR, Accounting\r\n\r\nGets options for both HR and Accounting database of the sqlserver2014a instance\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDatabaseState -SqlInstance sqlserver2014a -Exclude HR\r\n\r\nGets options for all databases of the sqlserver2014a instance except HR\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003e\u0027sqlserver2014a\u0027, \u0027sqlserver2014b\u0027 | Get-DbaDatabaseState\r\n\r\nGets options for all databases of sqlserver2014a and sqlserver2014b instances\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaDetachedDatabaseInfo",
        "Description": "This script gathers the following information from detached database files: database name, SQL Server version (compatibility level), collation, and file structure. \n\t\n\"Data files\" and \"Log file\" report the structure of the data and log files as they were when the database was detached. \"Database version\" is the comptability level.\n\nMDF files are most easily read by using a SQL Server to interpret them. Because of this, you must specify a SQL Server and the path must be relative to the SQL Server.",
        "Tags": "DisasterRecovery",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Get detailed information about detached SQL Server database files.",
        "Name": "Get-DbaDetachedDatabaseInfo",
        "Links": "https://dbatools.io/Get-DbaDetachedDatabaseInfo",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDetachedDatabaseInfo -SqlServer sql2016 -Path M:\\Archive\\mydb.mdf\r\n\r\nSQL Server is required to process offilne MDF files. The abvoe example reutrns information about the detached database \r\nfile, M:\\Archive\\mydb.mdf. This path is relative to the SQL Server \"sql2016\".\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaDiskSpace",
        "Description": "Returns a custom object with Server name, name of disk, label of disk, total size, free size, percent free, block size and filesystem.\n\nBy default, this funtion only shows drives of type 2 and 3 (removable disk and local disk).\n\nRequires: Windows administrator access on SQL Servers",
        "Tags": "Storage",
        "Author": "Chrissy LeMaire (clemaire@gmail.com) \u0026 Jakob Bindslet (jakob@bindslet.dk)",
        "Synopsis": "Displays Disk information for all local drives on a server",
        "Name": "Get-DbaDiskSpace",
        "Links": "https://dbatools.io/Get-DbaDiskSpace",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDiskSpace -ComputerName srv0042 | Format-Table -AutoSize\r\n\r\nGet diskspace for the server srv0042\r\n\r\nServer Name Label SizeInGB FreeInGB PercentFree BlockSize\r\n------ ---- ----- -------- -------- ----------- ---------\r\nsrv0042 C:\\ System 126,45 114,12 90,25 4096\r\nsrv0042 E:\\ Data1 97,62 96,33 98,67 4096\r\nsrv0042 F:\\ DATA2 29,2 29,2 100 16384\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDiskSpace -ComputerName srv0042 -Unit MB | Format-Table -AutoSize\r\n\r\nGet diskspace for the server srv0042, display in MB\r\n\r\nServer Name Label SizeInMB FreeInMB PercentFree BlockSize\r\n------ ---- ----- -------- -------- ----------- ---------\r\nsrv0042 C:\\ System 129481 116856,11 90,25 4096\r\nsrv0042 E:\\ Data1 99968 98637,56 98,67 4096\r\nsrv0042 F:\\ DATA2 29901 29900,92 100 16384\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDiskSpace -ComputerName srv0042, srv0007 -Unit TB | Format-Table -AutoSize\r\n\r\nGet diskspace from two servers, display in TB\r\n\r\nServer Name Label SizeInTB FreeInTB PercentFree BlockSize\r\n------ ---- ----- -------- -------- ----------- ---------\r\nsrv0042 C:\\ System 0,12 0,11 90,25 4096\r\nsrv0042 E:\\ Data1 0,1 0,09 98,67 4096\r\nsrv0042 F:\\ DATA2 0,03 0,03 100 16384\r\nsrv0007 C:\\ System 0,07 0,01 11,92 4096\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDiskSpace -ComputerName srv0042 -Detailed | Format-Table -AutoSize\r\n\r\nGet detailed diskspace information\r\n\r\nServer Name Label SizeInGB FreeInGB PercentFree BlockSize IsSqlDisk \r\nFileSystem DriveType\r\n------ ---- ----- -------- -------- ----------- --------- --------- \r\n---------- ---------\r\nsrv0042 C:\\ System 126,45 114,12 90,25 4096 False \r\nNTFS Local Disk\r\nsrv0042 E:\\ Data1 97,62 96,33 98,67 4096 False \r\nReFS Local Disk\r\nsrv0042 F:\\ DATA2 29,2 29,2 100 16384 False \r\nFAT32 Local Disk\r\nsrv0042 \\\\?\\Volume{7a31be94-b842-42f5-af71-e0464a1a9803}\\ Recovery 0,44 0,13 30,01 4096 False \r\nNTFS Local Disk\r\nsrv0042 D:\\ 0 0 0 False \r\n Compact Disk\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaExecutionPlan",
        "Description": "Gets execution plans and metadata. Can pipe to Export-DbaExecutionPlan :D\n\t\nThanks to \n\thttps://www.simple-talk.com/sql/t-sql-programming/dmvs-for-query-plan-metadata/\n\tand\n\thttp://www.scarydba.com/2017/02/13/export-plans-cache-sqlplan-file/\nfor the idea and query.",
        "Tags": "Performance",
        "Synopsis": "Gets execution plans and metadata",
        "Name": "Get-DbaExecutionPlan",
        "Links": "https://dbatools.io/Get-DbaExecutionPlan",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaExecutionPlan -SqlInstance sqlserver2014a\r\n\r\nGets all execution plans on sqlserver2014a\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaExecutionPlan -SqlInstance sqlserver2014a -Databases db1, db2 -SinceLastExecution \u00277/1/2016 10:47:00\u0027\r\n\r\nGets all execution plans for databases db1 and db2 on sqlserve2014a since July 1, 2016 at 10:47 AM.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaExecutionPlan -SqlInstance sqlserver2014a, sql2016 -Exclude db1 | Format-Table\r\n\r\nGets execution plan info for all databases except db1 on sqlserver2014a and sql2016 and makes the output pretty\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaExecutionPlan -SqlInstance sql2014 -Databases AdventureWorks2014, pubs -Force\r\n\r\nGets super detailed information for execution plans on only for AdventureWorks2014 and pubs\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaHelpIndex",
        "Description": "This function will return detailed information on indexes (and optionally statistics) for all indexes in a database, or a given index should one be passed along.\nAs this uses SQL Server DMVs to access the data it will only work in 2005 and up (sorry folks still running SQL Server 2000).\nFor performance reasons certain statistics information will not be returned from SQL Server 2005 if an ObjectName is not provided.\n\nThe data includes:\n\t- ObjectName: the table containing the index\n\t- IndexType: clustered/non-clustered/columnstore and whether the index is unique/primary key\n\t- KeyColumns: the key columns of the index\n\t- IncludeColumns: any include columns in the index\n\t- FilterDefinition: any filter that may have been used in the index \n\t- DataCompression: row/page/none depending upon whether or not compression has been used\n\t- IndexReads: the number of reads of the index since last restart or index rebuild\n\t- IndexUpdates: the number of writes to the index since last restart or index rebuild\n\t- SizeKB: the size the index in KB\n\t- IndexRows: the number of the rows in the index (note filtered indexes will have fewer rows than exist in the table)\n\t- IndexLookups: the number of lookups that have been performed (only applicable for the heap or clustered index)\n\t- MostRecentlyUsed: when the index was most recently queried (default to 1900 for when never read)\n\t- StatsSampleRows: the number of rows queried when the statistics were built/rebuilt (not included in SQL Server 2005 unless ObjectName is specified)\n\t- StatsRowMods: the number of changes to the statistics since the last rebuild\n\t- HistogramSteps: the number of steps in the statistics histogram (not included in SQL Server 2005 unless ObjectName is specified)\n\t- StatsLastUpdated: when the statistics were last rebuilt (not included in SQL Server 2005 unless ObjectName is specified)",
        "Synopsis": "Returns size, row and configuration information for indexes in databases.",
        "Name": "Get-DbaHelpIndex",
        "Links": "https://dbatools.io/Get-DbaHelpIndex",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaHelpIndex -SqlServer localhost -Databases MyDB\r\n\r\nReturns information on all indexes on the MyDB database on the localhost.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaHelpIndex -SqlServer localhost -Databases MyDB,MyDB2\r\n\r\nReturns information on all indexes on the MyDB, MyDB2 databases\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaHelpIndex -SqlServer localhost -Databases MyDB -ObjectName dbo.Table1\r\n\r\nReturns index information on the object dbo.Table1 in the database MyDB\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaHelpIndex -SqlServer localhost -Databases MyDB -ObjectName dbo.Table1 -IncludeStats\r\n\r\nReturns information on the indexes and statistics for the table dbo.Table1 in the MyDB database\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaHelpIndex -SqlServer localhost -Database MyDB -ObjectName dbo.Table1 -IncludeDataTypes\r\n\r\nReturns the index information for the table dbo.Table1 in the MyDB database, and includes the data types for the key \r\nand include columns\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 6 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaHelpIndex -SqlServer localhost -Database MyDB -ObjectName dbo.Table1 -FormatResults\r\n\r\nReturns the index information for the table dbo.Table1 in the MyDB database, and returns the numerical data with \r\nseparators to make it more readable (ie 1234 becomes 1,234)\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 7 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaHelpIndex -SqlServer localhost -Database MyDB -IncludeStats -FormatResults\r\n\r\nReturns the index information for all index in the MyDB database, as well as statistics, and formats the numerical data \r\nto be more redable\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaLastBackup",
        "Description": "Retrieves and compares the date/time for the last known backups, as well as the creation date/time for the database.\n\nDefault output includes columns Server, Database, RecoveryModel, LastFullBackup, LastDiffBackup, LastLogBackup, SinceFull, SinceDiff, SinceLog, Status, DatabaseCreated, DaysSinceDbCreated.",
        "Tags": [
                     "DisasterRecovery",
                     "Backup"
                 ],
        "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )",
        "Synopsis": "Get date/time for last known backups",
        "Name": "Get-DbaLastBackup",
        "Links": "https://dbatools.io/Get-DbaLastBackup",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaLastBackup -SqlServer ServerA\\sql987\r\n\r\nReturns a custom object displaying Server, Database, RecoveryModel, LastFullBackup, LastDiffBackup, LastLogBackup, \r\nSinceFull, SinceDiff, SinceLog, Status, DatabaseCreated, DaysSinceDbCreated\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaLastBackup -SqlServer ServerA\\sql987 -Simple\r\n\r\nReturns a custom object with Server name, Database name, and the date the last time backups were performed\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaLastBackup -SqlServer ServerA\\sql987 | Out-Gridview\r\n\r\nReturns a gridview displaying Server, Database, RecoveryModel, LastFullBackup, LastDiffBackup, LastLogBackup, \r\nSinceFull, SinceDiff, SinceLog, Status, DatabaseCreated, DaysSinceDbCreated\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaLastGoodCheckDb",
        "Description": "Retrieves and compares the date/time for the last known good DBCC CHECKDB, as well as the creation date/time for the database.\n\nThis function supports SQL Server 2005+\n\nPlease note that this script uses the DBCC DBINFO() WITH TABLERESULTS. DBCC DBINFO has several known weak points, such as:\n - DBCC DBINFO is an undocumented feature/command.\n - The LastKnowGood timestamp is updated when a DBCC CHECKFILEGROUP is performed.\n - The LastKnowGood timestamp is updated when a DBCC CHECKDB WITH PHYSICAL_ONLY is performed.\n - The LastKnowGood timestamp does not get updated when a database in READ_ONLY.\n\nAn empty ($null) LastGoodCheckDb result indicates that a good DBCC CHECKDB has never been performed.\n\nSQL Server 2008R2 has a \"bug\" that causes each databases to possess two dbi_dbccLastKnownGood fields, instead of the normal one.\nThis script will only displaythis function to only display the newest timestamp. If -Verbose is specified, the function will announce every time more than one dbi_dbccLastKnownGood fields is encountered.",
        "Synopsis": "Get date/time for last known good DBCC CHECKDB",
        "Name": "Get-DbaLastGoodCheckDb",
        "Links": null,
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaLastGoodCheckDb -SqlServer ServerA\\sql987\r\n\r\nReturns a custom object with Server name, Database name, and the date the last time a good checkdb was performed\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaLastGoodCheckDb -SqlServer ServerA\\sql987 -Detailed | Format-Table -AutoSize\r\n\r\nReturns a formatted table displaying Server, Database, DatabaseCreated, LastGoodCheckDb, DaysSinceDbCreated, \r\nDaysSinceLastGoodCheckDb, Status and DataPurityEnabled\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaMaxMemory",
        "Description": "This command retrieves the SQL Server \u0027Max Server Memory\u0027 configuration setting as well as the total physical installed on the server.",
        "Tags": "Memory",
        "Synopsis": "Gets the \u0027Max Server Memory\u0027 configuration setting and the memory of the server. Works on SQL Server 2000-2014.",
        "Name": "Get-DbaMaxMemory",
        "Links": "https://dbatools.io/Get-DbaMaxMemory",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaMaxMemory -SqlServer sqlcluster,sqlserver2012\r\n\r\nGet memory settings for all servers within the SQL Server Central Management Server \"sqlcluster\".\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaMaxMemory -SqlServer sqlcluster | Where-Object { $_.SqlMaxMB -gt $_.TotalMB }\r\n\r\nFind all servers in Server Central Management Server that have \u0027Max Server Memory\u0027 set to higher than the total memory \r\nof the server (think 2147483647)\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaMemoryUsage",
        "Description": "Retrieves the amount of memory per performance counter. Default output includes columns Server, counter instance, counter, number of pages, memory in KB, memory in MB\nSSAS and SSIS are included.\n\t\nSSRS does not have memory counters, only memory shrinks and memory pressure state.\n\nThis function requires local admin role on the targeted computers.",
        "Tags": "Memory",
        "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )",
        "Synopsis": "Get amount of memory in use by *all* SQL Server components and instances",
        "Name": "Get-DbaMemoryUsage",
        "Links": "https://dbatools.io/Get-DbaMemoryUsage",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaMemoryUsage -ComputerName ServerA\r\n\r\nReturns a custom object displaying Server, counter instance, counter, number of pages, memory in KB, memory in MB\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaMemoryUsage -ComputerName ServerA\\sql987 -Simple\r\n\r\nReturns a custom object with Server, counter instance, counter, number of pages, memory in KB, memory in MB\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaMemoryUsage -ComputerName ServerA\\sql987 | Out-Gridview\r\n\r\nReturns a gridview displaying Server, counter instance, counter, number of pages, memory in KB, memory in MB\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaMsdtc",
        "Description": "Returns a custom object with Computer name, state of the MSDTC Service, security settings of MSDTC and CID\u0027s\n\nRequires: Windows administrator access on Servers",
        "Tags": [
                     "WSMan",
                     "CIM"
                 ],
        "Author": "Klaas Vandenberghe ( powerdbaklaas )",
        "Synopsis": "Displays information about the Distributed Transactioon Coordinator (MSDTC) on a server",
        "Name": "Get-DbaMsdtc",
        "Links": "https://dbatools.io/Get-DbaMsdtc",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaMsdtc -ComputerName srv0042\r\n\r\nGet DTC status for the server srv0042\r\n\r\nComputerName : srv0042\r\nDTCServiceName : Distributed Transaction Coordinator\r\nDTCServiceState : Running\r\nDTCServiceStatus : OK\r\nDTCServiceStartMode : Manual\r\nDTCServiceAccount : NT AUTHORITY\\NetworkService\r\nDTCCID_MSDTC : b2aefacb-85d1-46b8-8047-7bb88e08d38a\r\nDTCCID_MSDTCUIS : 205bd32c-b022-4d0c-aa3e-2e5dc65c6d35\r\nDTCCID_MSDTCTIPGW : 3e743aa0-ead6-4569-ba7b-fe1aaea0a1eb\r\nDTCCID_MSDTCXATM : 667fc4b8-c2f5-4c3f-ad75-728b113f36c5\r\nnetworkDTCAccess : 0\r\nnetworkDTCAccessAdmin : 0\r\nnetworkDTCAccessClients : 0\r\nnetworkDTCAccessInbound : 0\r\nnetworkDTCAccessOutBound : 0\r\nnetworkDTCAccessTip : 0\r\nnetworkDTCAccessTransactions : 0\r\nXATransactions : 0\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e$Computers = (Get-Content D:\\configfiles\\SQL\\MySQLInstances.txt | % {$_.split(\u0027\\\u0027)[0]})\r\n\r\n$Computers | Get-DbaMsdtc\r\n\r\nGet DTC status for all the computers in a .txt file\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaMsdtc -Computername $Computers | where { $_.dtcservicestate -ne \u0027running\u0027 }\r\n\r\nGet DTC status for all the computers where the MSDTC Service is not running\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaMsdtc -ComputerName srv0042 | Out-Gridview\r\n\r\nGet DTC status for the computer srv0042 and show in a grid view\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaPageFileSetting",
        "Description": "WMI class Win32_ComputerSystem tells us if Page File is managed automatically.\nIf TRUE all other properties do not exist.\nIf FALSE classes Win32_PageFile, Win32_PageFileSetting en Win32_PageFileUsage are examined.\nCIM is used, first via WinRM, and if not successful, via DCOM.\nThis function needs to be executed as a user with local admin rights on the target computer(s).",
        "Tags": "CIM",
        "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )",
        "Synopsis": "Returns information about the network connection of the target computer including NetBIOS name, IP Address, domain name and fully qualified domain name (FQDN).",
        "Name": "Get-DbaPageFileSetting",
        "Links": "https://dbatools.io/Get-DbaPageFileSetting",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaPageFileSetting -ComputerName ServerA,ServerB\r\n\r\nReturns a custom object displaying ComputerName, AutoPageFile, FileName, Status, LastModified, LastAccessed, \r\nAllocatedBaseSize, InitialSize, MaximumSize, PeakUsage, CurrentUsage for ServerA and ServerB\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e\u0027ServerA\u0027 | Get-DbaPageFileSetting\r\n\r\nReturns a custom object displaying ComputerName, AutoPageFile, FileName, Status, LastModified, LastAccessed, \r\nAllocatedBaseSize, InitialSize, MaximumSize, PeakUsage, CurrentUsage for ServerA\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaPermission",
        "Description": "Retrieves a list of permissions\n\nPermissions link principals to securables.\nPrincipals exist on Windows, Instance and Database level.\nSecurables exist on Instance and Database level.\nA permission state can be GRANT, DENY or REVOKE.\nThe permission type can be SELECT, CONNECT, EXECUTE and more.\n\t\nSee https://msdn.microsoft.com/en-us/library/ms191291.aspx for more information",
        "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )",
        "Synopsis": "Get a list of Server and Database level permissions",
        "Name": "Get-DbaPermission",
        "Links": "https://dbatools.io/Get-DbaPermission",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaPermission -SqlServer ServerA\\sql987\r\n\r\nReturns a custom object with Server name, Database name, permission state, permission type, grantee and securable\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaPermission -SqlServer ServerA\\sql987 -Detailed | Format-Table -AutoSize\r\n\r\nReturns a formatted table displaying Server, Database, permission state, permission type, grantee, granteetype, \r\nsecurable and securabletype\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaPermission -SqlServer ServerA\\sql987 -NoSystemObjects -IncludeServerLevel\r\n\r\nReturns a custom object with Server name, Database name, permission state, permission type, grantee and securable\r\nin all databases and on the server level, but not on system securables\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaPermission -SqlServer sql2016 -Databases master\r\n\r\nReturns a custom object with permissions for the master database\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaPrivilege",
        "Description": "Gets the users with local privileges \u0027Lock Pages in Memory\u0027, \u0027Instant File Initialization\u0027, \u0027Logon as Batch\u0027 on one or more computers.\n\nRequires Local Admin rights on destination computer(s).",
        "Tags": "Privilege",
        "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )",
        "Synopsis": "Gets the users with local privileges on one or more computersr.",
        "Name": "Get-DbaPrivilege",
        "Links": "https://dbatools.io/Get-DbaPrivilege",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaPrivilege -ComputerName sqlserver2014a\r\n\r\nGets the local privileges on computer sqlserver2014a.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\u0027,\u0027sql3\u0027 | Get-DbaPrivilege\r\n\r\nGets the local privileges on computers sql1, sql2 and sql3.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaPrivilege -ComputerName sql1,sql2 | Out-Gridview\r\n\r\nGets the local privileges on computers sql1 and sql2, and shows them in a grid view.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaProcess",
        "Description": "This command displays processes associated with a spid, login, host, program or database.",
        "Synopsis": "This command displays SQL Server processes.",
        "Name": "Get-DbaProcess",
        "Links": "https://dbatools.io/Get-DbaProcess",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaProcess -SqlServer sqlserver2014a -Logins base\\ctrlb, sa\r\n\r\nShows information about the processes for base\\ctrlb and sa on sqlserver2014a. Uses Windows Authentication to login to \r\nsqlserver2014a.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaProcess -SqlServer sqlserver2014a -SqlCredential $credential -Spids 56, 77\r\n\r\nShows information about the processes for spid 56 and 57. Uses alternative (SQL or Windows) credentials to login to \r\nsqlserver2014a.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaProcess -SqlServer sqlserver2014a -Programs \u0027Microsoft SQL Server Management Studio\u0027\r\n\r\nShows information about the processes that were created in Microsoft SQL Server Management Studio.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaProcess -SqlServer sqlserver2014a -Hosts workstationx, server100\r\n\r\nShows information about the processes that were initiated by hosts (computers/clients) workstationx and server 1000.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaQueryStoreConfig",
        "Description": "Retrieves and returns the Query Store configuration for every database that has the Query Store feature enabled.",
        "Tags": "QueryStore",
        "Author": "Enrico van de Laar ( @evdlaar )",
        "Synopsis": "Get the Query Store configuration for Query Store enabled databases.",
        "Name": "Get-DbaQueryStoreConfig",
        "Links": "https://dbatools.io/Get-QueryStoreConfig",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaQueryStoreConfig -SqlServer ServerA\\sql\r\n\r\nReturns Query Store configuration settings for every database on the ServerA\\sql instance.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaQueryStoreConfig -SqlServer ServerA\\sql | Where-Object {$_.ActualState -eq \"ReadWrite\"}\r\n\r\nReturns the Query Store configuration for all databases on ServerA\\sql where the Query Store feature is in Read/Write \r\nmode.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaQueryStoreConfig -SqlServer localhost | format-table -AutoSize -Wrap\r\n\r\nReturns Query Store configuration settings for every database on the ServerA\\sql instance inside a table format.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaRestoreHistory",
        "Description": "By default, this command will return the server name, database, username, restore type, date, from file and to files.\n\nThanks to https://www.mssqltips.com/sqlservertip/1724/when-was-the-last-time-your-sql-server-database-was-restored/ for the query and https://sqlstudies.com/2016/07/27/when-was-this-database-restored/ for the idea.",
        "Tags": [
                     "DisasterRecovery",
                     "Backup",
                     "Restore"
                 ],
        "Synopsis": "Returns restore history details for databases on a SQL Server",
        "Name": "Get-DbaRestoreHistory",
        "Links": "https://dbatools.io/Get-DbaRestoreHistory",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaRestoreHistory -SqlServer sqlserver2014a\r\n\r\nReturns server name, database, username, restore type, date for all restored databases on sqlserver2014a.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaRestoreHistory -SqlServer sqlserver2014a -Databases db1, db2 -Since \u00277/1/2016 10:47:00\u0027\r\n\r\nReturns restore information only for databases db1 and db2 on sqlserve2014a since July 1, 2016 at 10:47 AM.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaRestoreHistory -SqlServer sqlserver2014a, sql2016 -Exclude db1\r\n\r\nLots of detailed information for all databases except db1 on sqlserver2014a and sql2016\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaRestoreHistory -SqlServer sql2014 -Databases AdventureWorks2014, pubs | Format-Table\r\n\r\nAdds From and To file information to output, returns information only for AdventureWorks2014 and pubs, and makes the \r\noutput pretty\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlRegisteredServerName -SqlServer sql2016 | Get-DbaRestoreHistory\r\n\r\nReturns database restore information for every database on every server listed in the Central Management Server on \r\nsql2016\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaRoleMember",
        "Description": "Get members of all roles on a Sql instance.\n\nDefault output includes columns SQLServer, Database, Role, Member.",
        "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )",
        "Synopsis": "Get members of all roles on a Sql instance.",
        "Name": "Get-DbaRoleMember",
        "Links": "https://dbatools.io/Get-DbaRoleMember",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaRoleMember -SqlServer ServerA\r\n\r\nReturns a custom object displaying SQLServer, Database, Role, Member for all DatabaseRoles.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaRoleMember -SqlServer sql2016 | Out-Gridview\r\n\r\nReturns a gridview displaying SQLServer, Database, Role, Member for all DatabaseRoles.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaRoleMember -SqlServer ServerA\\sql987 -IncludeServerLevel\r\n\r\nReturns a gridview displaying SQLServer, Database, Role, Member for both ServerRoles and DatabaseRoles.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaRunningJob",
        "Description": "This function returns agent jobs that active on the SQL Server intance when calling the command. The information is gathered the SMO JobServer.jobs and be returned either in detailed or standard format",
        "Synopsis": "Returns all non idle agent jobs running on the server.",
        "Name": "Get-DbaRunningJob",
        "Links": "https://dbatools.io/Get-DbaRunningJob",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaRunningJob -SqlServer localhost\r\n\r\nReturns any active jobs on the localhost\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaRunningJob -SqlServer localhost -Detailed\r\n\r\nReturns a detailed output of any active jobs on the localhost\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003e\u0027localhost\u0027,\u0027localhost\\namedinstance\u0027 | Get-DbaRunningJob\r\n\r\nReturns all active jobs on multiple instances piped into the function\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaServerProtocol",
        "Description": "Gets the SQL Server related server protocols on one or more computers.\n\nRequires Local Admin rights on destination computer(s).\nThe server protocols can be enabled and disabled when retrieved via WSMan.",
        "Tags": "Protocol",
        "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )",
        "Synopsis": "Gets the SQL Server related server protocols on a computer.",
        "Name": "Get-DbaServerProtocol",
        "Links": "https://dbatools.io/Get-DbaServerProtocol",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaServerProtocol -ComputerName sqlserver2014a\r\n\r\nGets the SQL Server related server protocols on computer sqlserver2014a.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\u0027,\u0027sql3\u0027 | Get-DbaServerProtocol\r\n\r\nGets the SQL Server related server protocols on computers sql1, sql2 and sql3.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaServerProtocol -ComputerName sql1,sql2 | Out-Gridview\r\n\r\nGets the SQL Server related server protocols on computers sql1 and sql2, and shows them in a grid view.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003e(Get-DbaServerProtocol -ComputerName sql1 | Where { $_.DisplayName = \u0027via\u0027 }).Disable()\r\n\r\nDisables the VIA ServerNetworkProtocol on computer sql1.\r\nIf succesfull, returncode 0 is shown.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaSpConfigure",
        "Description": "This function returns server level system configuration (sys.configuration/sp_configure) information. The information is gathered through SMO Configuration.Properties.\nThe data includes the default value for each configuration, for quick identification of values that may have been changed.",
        "Synopsis": "Returns all server level system configuration (sys.configuration/sp_configure) information",
        "Name": "Get-DbaSpConfigure",
        "Links": "https://dbatools.io/Get-DbaSpConfigure",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaSpConfigure -SqlServer localhost\r\n\r\nReturns server level configuration data on the localhost (ServerName, ConfigName, DisplayName, Description, IsAdvanced, \r\nIsDynamic, MinValue, MaxValue, ConfiguredValue, RunningValue, DefaultValue, IsRunningDefaultValue)\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e\u0027localhost\u0027,\u0027localhost\\namedinstance\u0027 | Get-DbaSpConfigure\r\n\r\nReturns system configuration information on multiple instances piped into the function\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaSpConfigure -SqlServer localhost\r\n\r\nReturns server level configuration data on the localhost (ServerName, ConfigName, DisplayName, Description, IsAdvanced, \r\nIsDynamic, MinValue, MaxValue, ConfiguredValue, RunningValue, DefaultValue, IsRunningDefaultValue)\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaSpConfigure -SqlServer sql2012 -Configs MaxServerMemory\r\n\r\nReturns only the system configuration for MaxServerMemory. Configs is autopopulated for tabbing convenience.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaSpn",
        "Description": "Get a list of set SPNs. SPNs are set at the AD account level. You can either retrieve set SPNs for a computer, or any SPNs set for\na given active directry account. You can query one, or both. You\u0027ll get a list of every SPN found for either search term.",
        "Tags": "SPN",
        "Author": "Drew Furgiuele (@pittfurg), http://www.port1433.com",
        "Synopsis": "Returns a list of set service principal names for a given computer/AD account",
        "Name": "Get-DbaSpn",
        "Links": "https://dbatools.io/Get-DbaSpn",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaSpn -ServerName SQLSERVERA -Credential (Get-Credential)\r\n\r\nReturns a custom object with SearchTerm (ServerName) and the SPNs that were found\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaSpn -AccountName doamain\\account -Credential (Get-Credential)\r\n\r\nReturns a custom object with SearchTerm (domain account) and the SPNs that were found\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaSpn -ServerName SQLSERVERA,SQLSERVERB -Credential (Get-Credential)\r\n\r\nReturns a custom object with SearchTerm (ServerName) and the SPNs that were found for multiple computers\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaSqlService",
        "Description": "Gets the SQL Server related services on one or more computers.\n\nRequires Local Admin rights on destination computer(s).",
        "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )",
        "Synopsis": "Gets the SQL Server related services on a computer.",
        "Name": "Get-DbaSqlService",
        "Links": "https://dbatools.io/Get-DbaSqlService",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaSqlService -ComputerName sqlserver2014a\r\n\r\nGets the SQL Server related services on computer sqlserver2014a.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\u0027,\u0027sql3\u0027 | Get-DbaSqlService\r\n\r\nGets the SQL Server related services on computers sql1, sql2 and sql3.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaSqlService -ComputerName sql1,sql2 | Out-Gridview\r\n\r\nGets the SQL Server related services on computers sql1 and sql2, and shows them in a grid view.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaSqlService -ComputerName $MyServers -Type SSRS\r\n\r\nGets the SQL Server related services of type \"SSRS\" (Reporting Services) on computers in the variable MyServers.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaStartupParameter",
        "Description": "Displays values for a detailed list of SQL Server Startup Parameters including Master Data Path, Master Log path, Error Log, Trace Flags, Parameter String and much more.\n\nThis command relies on remote Windows Server (SQL WMI/WinRm) access. You can pass alternative Windows credentials by using the -Credential parameter. \n\t\nSee https://msdn.microsoft.com/en-us/library/ms190737.aspx for more information.",
        "Tags": [
                     "WSMan",
                     "SQLWMI",
                     "Memory"
                 ],
        "Synopsis": "Displays values for a detailed list of SQL Server Startup Parameters.",
        "Name": "Get-DbaStartupParameter",
        "Links": "https://dbatools.io/Get-DbaStartupParameter",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaStartupParameter -SqlServer sql2014\r\n\r\nLogs into SQL WMI as the current user then displays the values for numerous startup parameters.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e$wincred = Get-Credential ad\\sqladmin\r\n\r\nGet-DbaStartupParameter -SqlServer sql2014 -Credential $wincred -Simple\r\n\r\nLogs in to WMI using the ad\\sqladmin credential and gathers simplified information about the SQL Server Startup \r\nParameters.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaTcpPort",
        "Description": "By default, this command returns just the TCP port used by the specified SQL Server. \n\t\nIf -Detailed is specified, server name, IPAddress (ipv4 and ipv6), port number and if the port assignment is static.",
        "Tags": "SQLWMI",
        "Synopsis": "Returns the TCP port used by the specified SQL Server.",
        "Name": "Get-DbaTcpPort",
        "Links": "https://dbatools.io/Get-DbaTcpPort",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaTcpPort -SqlServer sqlserver2014a\r\n\r\nReturns just the port number for the default instance on sqlserver2014a\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaTcpPort -SqlServer winserver\\sqlexpress, sql2016\r\n\r\nReturns an object with server name and port number for the sqlexpress on winserver and the default instance on sql2016\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaTcpPort -SqlServer sqlserver2014a, sql2016 -Detailed\r\n\r\nReturns an object with server name, IPAddress (ipv4 and ipv6), port and static ($true/$false) for sqlserver2014a and \r\nsql2016\r\n\t\r\nRemote sqlwmi is used by default. If this doesn\u0027t work, then remoting is used. If neither work, it defaults to T-SQL \r\nwhich can provide only the port.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlRegisteredServerName -SqlServer sql2014 | Get-DbaTcpPort -NoIpV6 -Detailed -Verbose\r\n\r\nReturns an object with server name, IPAddress (just ipv4), port and static ($true/$false) for every server listed in \r\nthe Central Management Server on sql2014\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaTrigger",
        "Description": "Get all existing triggers on one or more SQL instances.\n\nDefault output includes columns ComputerName, SqlInstance, Database, TriggerName, IsEnabled and DateLastMofied.",
        "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )",
        "Synopsis": "Get all existing triggers on one or more SQL instances.",
        "Name": "Get-DbaTrigger",
        "Links": "https://dbatools.io/Get-DbaTrigger",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaTrigger -SqlInstance ComputerA\\sql987\r\n\r\nReturns a custom object displaying ComputerName, SqlInstance, Database, TriggerName, IsEnabled and DateLastMofied.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaTrigger -SqlInstance \u0027ComputerA\\sql987\u0027,\u0027ComputerB\u0027\r\n\r\nReturns a custom object displaying ComputerName, SqlInstance, Database, TriggerName, IsEnabled and DateLastMofied from \r\ntwo instances.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaTrigger -SqlInstance ComputerA\\sql987 | Out-Gridview\r\n\r\nReturns a gridview displaying ComputerName, SqlInstance, Database, TriggerName, IsEnabled and DateLastMofied.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003e\u0027ComputerA\\sql987\u0027,\u0027ComputerB\u0027 | Get-DbaTrigger | Out-Gridview\r\n\r\nReturns a custom object displaying ComputerName, SqlInstance, Database, TriggerName, IsEnabled and DateLastMofied from \r\ntwo instances.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaUptime",
        "Description": "By default, this command returns for each SQL Server instance passed in:\nSQL Instance last startup time, Uptime as a PS TimeSpan, Uptime as a formatted string\nHosting Windows server last startup time, Uptime as a PS TimeSpan, Uptime as a formatted string",
        "Tags": "CIM",
        "Synopsis": "Returns the uptime of the SQL Server instance, and if required the hosting windows server",
        "Name": "Get-DbaUptime",
        "Links": "https://dbatools.io/Get-DbaUptime",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaUptime -SqlServer SqlBox1\\Instance2\r\n\r\nReturns an object with SQL Server start time, uptime as TimeSpan object, uptime as a string, and Windows host boot \r\ntime, host uptime as TimeSpan objects and host uptime as a string for the sqlexpress instance on winserver\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaUptime -SqlServer winserver\\sqlexpress, sql2016\r\n\r\nReturns an object with SQL Server start time, uptime as TimeSpan object, uptime as a string, and Windows host boot \r\ntime, host uptime as TimeSpan objects and host uptime as a string for the sqlexpress instance on host winserver and \r\nthe default instance on host sql2016\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaUptime -SqlServer sqlserver2014a, sql2016 -SqlOnly\r\n\r\nReturns an object with SQL Server start time, uptime as TimeSpan object, uptime as a string for the sqlexpress instance \r\non host winserver and the default instance on host sql2016\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlRegisteredServerName -SqlServer sql2014 | Get-DbaUptime\r\n\r\nReturns an object with SQL Server start time, uptime as TimeSpan object, uptime as a string, and Windows host boot \r\ntime, host uptime as TimeSpan objects and host uptime as a string for every server listed in the Central Management \r\nServer on sql2014\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DbaXEventsSession",
        "Description": "Retrieves a list of Extended Events Sessions",
        "Tags": "Memory",
        "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )",
        "Synopsis": "Get a list of Extended Events Sessions",
        "Name": "Get-DbaXEventsSession",
        "Links": "https://dbatools.io/Get-DbaXEventsSession",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaXEventsSession -SqlServer ServerA\\sql987\r\n\r\nReturns a custom object with ComputerName, SQLInstance, Session, StartTime, Status and other properties.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaXEventsSession -SqlServer ServerA\\sql987 | Format-Table ComputerName, SQLInstance, Session, Status \r\n-AutoSize\r\n\r\nReturns a formatted table displaying ComputerName, SQLInstance, Session, and Status.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003e\u0027ServerA\\sql987\u0027,\u0027ServerB\u0027 | Get-DbaXEventsSession\r\n\r\nReturns a custom object with ComputerName, SQLInstance, Session, StartTime, Status and other properties, from multiple \r\nSQL Instances.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-SqlRegisteredServerName",
        "Description": "Returns a simple array of server names",
        "Synopsis": "Gets list of SQL Server names stored in SQL Server Central Management Server",
        "Name": "Get-SqlRegisteredServerName",
        "Links": "https://dbatools.io/Get-SqlRegisteredServerName",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlRegisteredServerName -SqlServer sqlserver2014a\r\n\r\nGets a list of all server names from the Central Management Server on sqlserver2014a, using Windows Credentials\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlRegisteredServerName -SqlServer sqlserver2014a -SqlCredential $credential\r\n\r\nGets a list of all server names from the Central Management Server on sqlserver2014a, using SQL Authentication\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlRegisteredServerName -SqlServer sqlserver2014a -Groups HR, Accounting\r\n\r\nGets a list of server names in the HR and Accounting groups from the Central Management Server on sqlserver2014a.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlRegisteredServerName -SqlServer sqlserver2014a -Groups HR, Accounting -IpAddr\r\n\r\nGets a list of server IP addresses in the HR and Accounting groups from the Central Management Server on sqlserver2014a.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-SqlServerKey",
        "Description": "Using a string of servers, a text file, or Central Management Server to provide a list of servers, this script will go to each server and get the product key for all installed instances. Clustered instances are supported as well. Requires regular user access to the SQL instances, SMO installed locally, Remote Registry enabled and acessible by the account running the script.\n\nUses key decoder by Jakob Bindslet (http://goo.gl/1jiwcB)",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Gets SQL Server Product Keys from local on destination SQL Servers. Works with SQL Server 2005-2014",
        "Name": "Get-SqlServerKey",
        "Links": "https://dbatools.io/Get-SqlServerKey",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlServerKey winxp, sqlservera, sqlserver2014a, win2k8\r\n\r\nGets SQL Server versions, editions and product keys for all instances within each server or workstation.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlServerKey -SqlCms sqlserver01\r\n\r\nGets SQL Server versions, editions and product keys for all instances within sqlserver01\u0027s Central Management Server\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlServerKey -ServersFromFile C:\\Scripts\\servers.txt\r\n\r\nGets SQL Server versions, editions and product keys for all instances listed within C:\\Scripts\\servers.txt\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Import-CsvToSql",
        "Description": "Import-CsvToSql takes advantage of .NET\u0027s super fast SqlBulkCopy class to import CSV files into SQL Server at up to 90,000 rows a second.\n\t\nThe entire import is contained within a transaction, so if a failure occurs or the script is aborted, no changes will persist.\n\nIf the table specified does not exist, it will be automatically created using best guessed data types. In addition, the destination table can be truncated prior to import. \n\nThe Query parameter will be used to import only the data returned from a SQL Query executed against the CSV file(s). This function supports a number of bulk copy options. Please see parameter list for details.\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Efficiently imports very large (and small) CSV files into SQL Server using only the .NET Framework and PowerShell.",
        "Name": "Import-CsvToSql",
        "Links": "https://blog.netnerds.net/2015/09/import-csvtosql-super-fast-csv-to-sql-server-import-powershell-module/",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eImport-CsvToSql -Csv C:\\temp\\housing.csv -SqlServer sql001 -Database markets\r\n\r\nImports the entire *comma delimited* housing.csv to the SQL \"markets\" database on a SQL Server named sql001.\r\n\r\nSince a table name was not specified, the table name is automatically determined from filename as \"housing\" and a \r\nprompt will appear to confirm table name.\r\n\r\nThe first row is not skipped, as it does not contain column names.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eImport-CsvToSql -Csv .\\housing.csv -SqlServer sql001 -Database markets -Table housing -First 100000 -Safe \r\n-Delimiter \"`t\" -FirstRowColumns\r\n\r\nImports the first 100,000 rows of the tab delimited housing.csv file to the \"housing\" table in the \"markets\" database \r\non a SQL Server named sql001. Since Safe was specified, the OleDB method will be used for the bulk import. It\u0027s assumed \r\nSafe was used because the first attempt without -Safe resulted in an import error. The first row is skipped, as it \r\ncontains column names.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eImport-CsvToSql -csv C:\\temp\\huge.txt -sqlserver sqlcluster -Database locations -Table latitudes -Delimiter \"|\" \r\n-Turbo\r\n\r\nImports all records from the pipe delimited huge.txt file using the fastest method possible into the latitudes table \r\nwithin the locations database. Obtains a table lock for the duration of the bulk copy operation. This specific command \r\nhas been used \r\nto import over 10.5 million rows in 2 minutes.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eImport-CsvToSql -Csv C:\\temp\\housing.csv, .\\housing2.csv -SqlServer sql001 -Database markets -Table housing \r\n-Delimiter \"`t\" -query \"select top 100000 column1, column3 from csv\" -Truncate\r\n\r\nTruncates the \"housing\" table, then imports columns 1 and 3 of the first 100000 rows of the tab-delimited housing.csv \r\nin the C:\\temp directory, and housing2.csv in the current directory. Since the query is executed against both files, a \r\ntotal of 200,000 rows will be imported.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eImport-CsvToSql -Csv C:\\temp\\housing.csv -SqlServer sql001 -Database markets -Table housing -query \"select \r\naddress, zip from csv where state = \u0027Louisiana\u0027\" -FirstRowColumns -Truncate -FireTriggers\r\n\r\nUses the first line to determine CSV column names. Truncates the \"housing\" table on the SQL Server, then imports the \r\naddress and zip columns from all records in the housing.csv where the state equals Louisiana.\r\n\r\nTriggers are fired for all rows. Note that this does slightly slow down the import.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Import-SqlSpConfigure",
        "Description": "Updates sp_configure settings on destination server.",
        "Synopsis": "Updates sp_configure settings on destination server.",
        "Name": "Import-SqlSpConfigure",
        "Links": null,
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eImport-SqlSpConfigure sqlserver sqlcluster $SourceSqlCredential $DestinationSqlCredential\r\n\r\nImports the spconfigure settings from the source server sqlserver and sets them on the sqlcluster server\r\nusing the SQL credentials stored in the variables\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eImport-SqlSpConfigure -SqlServer sqlserver -Path .\\spconfig.sql -SqlCredential $SqlCredential\r\n\r\nImports the spconfigure settings from the file .\\spconfig.sql and sets them on the sqlcluster server\r\nusing the SQL credential stored in the variables\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Install-DbaWatchUpdate",
        "Description": "Adds the scheduled task to support Watch-DbaUpdate.",
        "Tags": "JustForFun",
        "Synopsis": "Adds the scheduled task to support Watch-DbaUpdate",
        "Name": "Install-DbaWatchUpdate",
        "Links": "https://dbatools.io/Install-DbaWatchUpdate",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eInstall-DbaWatchUpdate\r\n\r\nAdds the scheduled task needed by Watch-DbaUpdate\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Install-SqlWhoIsActive",
        "Description": "This command downloads, extracts and installs sp_whoisactive with Adam\u0027s permission. To read more about sp_WhoIsActive, please visit:\n\nUpdates: http://sqlblog.com/blogs/adam_machanic/archive/tags/who+is+active/default.aspx\n\nAlso, consider donating to Adam if you find this stored procedure helpful: http://tinyurl.com/WhoIsActiveDonate",
        "Synopsis": "Automatically installs or updates sp_WhoIsActive by Adam Machanic.",
        "Name": "Install-SqlWhoIsActive",
        "Links": "https://dbatools.io/Install-SqlWhoIsActive",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eInstall-SqlWhoIsActive -SqlServer sqlserver2014a -Database master\r\n\r\nInstalls sp_WhoIsActive to sqlserver2014a\u0027s master database. Logs in using Windows Authentication.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eInstall-SqlWhoIsActive -SqlServer sqlserver2014a -SqlCredential $cred\r\n\r\nPops up a dialog box asking which database on sqlserver2014a you want to install the proc to. Logs into SQL Server \r\nusing SQL Authentication.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003e$servers = Get-SqlRegisteredServerName sqlserver\r\n\r\nInstall-SqlWhoIsActive -SqlServer $servers -Database master\r\n\r\nThis command doesn\u0027t support passing both servers and default database, but you can accomplish the same thing by \r\npassing an array and specifying a database.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Invoke-Sqlcmd2",
        "Description": "Runs a T-SQL script. Invoke-Sqlcmd2 runs the whole scipt and only captures the first selected result set, such as the output of PRINT statements when -verbose parameter is specified.\nParamaterized queries are supported.\n\nHelp details below borrowed from Invoke-Sqlcmd",
        "Synopsis": "Runs a T-SQL script.",
        "Name": "Invoke-Sqlcmd2",
        "Links": [
                      "https://github.com/sqlcollaborative/Invoke-SqlCmd2",
                      "https://github.com/RamblingCookieMonster/PowerShell",
                      null
                  ],
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eInvoke-Sqlcmd2 -ServerInstance \"MyComputer\\MyInstance\" -Query \"SELECT login_time AS \u0027StartTime\u0027 FROM \r\nsysprocesses WHERE spid = 1\"\r\n\r\nThis example connects to a named instance of the Database Engine on a computer and runs a basic T-SQL query.\r\nStartTime\r\n-----------\r\n2010-08-12 21:21:03.593\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eInvoke-Sqlcmd2 -ServerInstance \"MyComputer\\MyInstance\" -InputFile \"C:\\MyFolder\\tsqlscript.sql\" | Out-File \r\n-filePath \"C:\\MyFolder\\tsqlscript.rpt\"\r\n\r\nThis example reads a file containing T-SQL statements, runs the file, and writes the output to another file.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eInvoke-Sqlcmd2 -ServerInstance \"MyComputer\\MyInstance\" -Query \"PRINT \u0027hello world\u0027\" -Verbose\r\n\r\nThis example uses the PowerShell -Verbose parameter to return the message output of the PRINT command.\r\nVERBOSE: hello world\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eInvoke-Sqlcmd2 -ServerInstance MyServer\\MyInstance -Query \"SELECT ServerName, VCNumCPU FROM tblServerInfo\" -as \r\nPSObject | ?{$_.VCNumCPU -gt 8}\r\n\r\nInvoke-Sqlcmd2 -ServerInstance MyServer\\MyInstance -Query \"SELECT ServerName, VCNumCPU FROM tblServerInfo\" -as PSObject \r\n| ?{$_.VCNumCPU}\r\n\r\nThis example uses the PSObject output type to allow more flexibility when working with results.\r\n\r\nIf we used DataRow rather than PSObject, we would see the following behavior:\r\n Each row where VCNumCPU does not exist would produce an error in the first example\r\n Results would include rows where VCNumCPU has DBNull value in the second example\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003e\u0027Instance1\u0027, \u0027Server1/Instance1\u0027, \u0027Server2\u0027 | Invoke-Sqlcmd2 -query \"Sp_databases\" -as psobject \r\n-AppendServerInstance\r\n\r\nThis example lists databases for each instance. It includes a column for the ServerInstance in question.\r\n DATABASE_NAME DATABASE_SIZE REMARKS ServerInstance\r\n ------------- ------------- ------- --------------\r\n REDACTED 88320 Instance1\r\n master 17920 Instance1\r\n ...\r\n msdb 618112 Server1/Instance1\r\n tempdb 563200 Server1/Instance1\r\n ...\r\n OperationsManager 20480000 Server2\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 6 --------------------------\r\n\r\nPS C:\\\u003e#Construct a query using SQL parameters\r\n\r\n$Query = \"SELECT ServerName, VCServerClass, VCServerContact FROM tblServerInfo WHERE VCServerContact LIKE \r\n@VCServerContact AND VCServerClass LIKE @VCServerClass\"\r\n\r\n#Run the query, specifying values for SQL parameters\r\n Invoke-Sqlcmd2 -ServerInstance SomeServer\\NamedInstance -Database ServerDB -query $query -SqlParameters @{ \r\nVCServerContact=\"%cookiemonster%\"; VCServerClass=\"Prod\" }\r\n\r\n ServerName VCServerClass VCServerContact\r\n ---------- ------------- ---------------\r\n SomeServer1 Prod cookiemonster, blah\r\n SomeServer2 Prod cookiemonster\r\n SomeServer3 Prod blah, cookiemonster\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 7 --------------------------\r\n\r\nPS C:\\\u003eInvoke-Sqlcmd2 -SQLConnection $Conn -Query \"SELECT login_time AS \u0027StartTime\u0027 FROM sysprocesses WHERE spid = 1\"\r\n\r\nThis example uses an existing SQLConnection and runs a basic T-SQL query against it\r\n\r\nStartTime\r\n-----------\r\n2010-08-12 21:21:03.593\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Measure-DbaBackupThroughput",
        "Description": "Returns backup history details for some or all databases on a SQL Server. \n\nOutput looks like this\nSqlInstance : sql2016\nDatabase : SharePoint_Config\nAvgThroughputMB : 1.07\nAvgSizeMB : 24.17\nAvgDuration : 00:00:01.1000000\nMinThroughputMB : 0.02\nMaxThroughputMB : 2.26\nMinBackupDate : 8/6/2015 10:22:01 PM\nMaxBackupDate : 6/19/2016 12:57:45 PM\nBackupCount : 10",
        "Tags": [
                     "DisasterRecovery",
                     "Backup"
                 ],
        "Synopsis": "Determines how quickly SQL Server is backing up databases to media.",
        "Name": "Measure-DbaBackupThroughput",
        "Links": "https://dbatools.io/Measure-DbaBackupThroughput",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eMeasure-DbaBackupThroughput -SqlInstance sql2016\r\n\r\nParses every backup in msdb\u0027s backuphistory for stats on all databases\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eMeasure-DbaBackupThroughput -SqlInstance sql2016 -Databases AdventureWorks2014\r\n\r\nParses every backup in msdb\u0027s backuphistory for stats on AdventureWorks2014\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eMeasure-DbaBackupThroughput -SqlInstance sql2005 -Last\r\n\r\nProcesses the last full, diff and log backups every backup for all databases on sql2005\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eMeasure-DbaBackupThroughput -SqlInstance sql2005 -Last -Type Log\r\n\r\nProcesses the last log backups every backup for all databases on sql2005\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eMeasure-DbaBackupThroughput -SqlInstance sql2016 -Since (Get-Date).AddDays(-7)\r\n\r\nGets backup calculations for the last week\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 6 --------------------------\r\n\r\nPS C:\\\u003eMeasure-DbaBackupThroughput -SqlInstance sql2016 -Since (Get-Date).AddDays(-365) -Databases bigoldb\r\n\r\nGets backup calculations, limited to the last year and only the bigoldb database\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "New-DbaDatabaseSnapshot",
        "Description": "Creates database snapshots without hassles",
        "Tags": [
                     "DisasterRecovery",
                     "Snapshot",
                     "Restore"
                 ],
        "Author": "niphlod",
        "Synopsis": "Creates database snapshots",
        "Name": "New-DbaDatabaseSnapshot",
        "Links": "https://dbatools.io/New-DbaDatabaseSnapshot",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eNew-DbaDatabaseSnapshot -SqlServer sqlserver2014a -Database HR, Accounting\r\n\r\nCreates snapshot for HR and Accounting, returning a custom object displaying Server, Database, DatabaseCreated, \r\nSnapshotOf, SizeMB, DatabaseCreated, PrimaryFilePath, Status, Notes\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eNew-DbaDatabaseSnapshot -SqlServer sqlserver2014a -Databases HR -Name _snap\r\n\r\nCreates snapshot named \"HR_snap\" for HR\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eNew-DbaDatabaseSnapshot -SqlServer sqlserver2014a -Databases HR -Name \u0027fool_{0}_snap\u0027\r\n\r\nCreates snapshot named \"fool_HR_snap\" for HR\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eNew-DbaDatabaseSnapshot -SqlServer sqlserver2014a -Databases HR, Accounting -Path F:\\snapshotpath\r\n\r\nCreates snapshots for HR and Accounting databases, storing files under the F:\\snapshotpath\\ dir\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "New-DbaSqlDirectory",
        "Description": "Uses master.dbo.xp_create_subdir to create the path\nReturns $true if the path can be created, $false otherwise",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Creates new path as specified by the path variable",
        "Name": "New-DbaSqlDirectory",
        "Links": "https://dbatools.io/New-DbaSqlDirectory",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eNew-DbaSqlDirectory -SqlServer sqlcluster -Path L:\\MSAS12.MSSQLSERVER\\OLAP\r\n\r\nIf the SQL Server instance sqlcluster can create the path L:\\MSAS12.MSSQLSERVER\\OLAP it will do and return $true, if \r\nnot it will return $false.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e$credential = Get-Credential\r\n\r\nNew-DbaSqlDirectory -SqlServer sqlcluster -SqlCredential $credential -Path L:\\MSAS12.MSSQLSERVER\\OLAP\r\n\r\nIf the SQL Server instance sqlcluster can create the path L:\\MSAS12.MSSQLSERVER\\OLAP it will do and return $true, if \r\nnot it will return $false. Uses a SqlCredential to connect\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Out-DbaDataTable",
        "Description": "Creates a DataTable based on an objects properties. This allows you to easily write to SQL Server tables\n\t\nThanks to Chad Miller, this script is all him. https://gallery.technet.microsoft.com/scriptcenter/4208a159-a52e-4b99-83d4-8048468d29dd",
        "Synopsis": "Creates a DataTable for an object",
        "Name": "Out-DbaDataTable",
        "Links": "https://dbatools.io/Out-DbaDataTable",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-Service | Out-DbaDataTable\r\n\r\nCreates a $datatable based off of the output of Get-Service\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eOut-DbaDataTable -InputObject $csv.cheesetypes\r\n\r\nCreates a DataTable from the CSV object, $csv.cheesetypes\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003e$dblist | Out-DbaDataTable\r\n\r\nSimilar to above but $dbalist gets piped in\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Read-DbaBackupHeader",
        "Description": "Reads full, differential and transaction log backups. An online SQL Server is required to parse the backup files and the path specified must be relative to that SQL Server.",
        "Tags": [
                     "DisasterRecovery",
                     "Backup",
                     "Restore"
                 ],
        "Synopsis": "Reads and displays detailed information about a SQL Server backup",
        "Name": "Read-DbaBackupHeader",
        "Links": "https://dbatools.io/Read-DbaBackupHeader",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eRead-DbaBackupHeader -SqlServer sql2016 -Path S:\\backups\\mydb\\mydb.bak\r\n\r\nLogs into sql2016 using Windows authentication and reads the local file on sql2016, S:\\backups\\mydb\\mydb.bak.\r\n\t\r\nIf you are running this command on a workstation and connecting remotely, remember that sql2016 cannot access files on \r\nyour own workstation.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eRead-DbaBackupHeader -SqlServer sql2016 -Path \\\\nas\\sql\\backups\\mydb\\mydb.bak, \r\n\\\\nas\\sql\\backups\\otherdb\\otherdb.bak\r\n\r\nLogs into sql2016 and reads two backup files - mydb.bak and otherdb.bak. The SQL Server service account must have \r\nrights to read this file.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eRead-DbaBackupHeader -SqlServer . -Path C:\\temp\\myfile.bak -Simple\r\n\r\nLogs into the local workstation (or computer) and shows simplified output about C:\\temp\\myfile.bak. The SQL Server \r\nservice account must have rights to read this file.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003e$backupinfo = Read-DbaBackupHeader -SqlServer . -Path C:\\temp\\myfile.bak\r\n\r\n$backupinfo.FileList\r\n\t\r\nDisplays detailed information about each of the datafiles contained in the backupset.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eRead-DbaBackupHeader -SqlServer . -Path C:\\temp\\myfile.bak -FileList\r\n\r\nAlso returns detailed information about each of the datafiles contained in the backupset.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 6 --------------------------\r\n\r\nPS C:\\\u003e\"C:\\temp\\myfile.bak\", \"\\backupserver\\backups\\myotherfile.bak\" | Read-DbaBackupHeader -SqlServer sql2016\r\n\r\nSimilar to running Read-DbaBackupHeader -SqlServer sql2016 -Path \"C:\\temp\\myfile.bak\", \r\n\"\\backupserver\\backups\\myotherfile.bak\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 7 --------------------------\r\n\r\nPS C:\\\u003eGet-ChildItem \\\\nas\\sql\\*.bak | Read-DbaBackupHeader -SqlServer sql2016\r\n\r\nGets a list of all .bak files on the \\\\nas\\sql share and reads the headers using the server named \"sql2016\". This means \r\nthat the server, sql2016, must have read access to the \\\\nas\\sql share.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Remove-DbaBackup",
        "Description": "Provides all of the same functionality for removing SQL backups from disk as a standard maintenance plan would.\n\nAs an addition you have the ability to check the Archive bit on files before deletion. This will allow you to ensure\nbackups have been archived to your archive location before removal.\n\nAlso included is the ability to remove empty folders as part of this cleanup activity.",
        "Tags": [
                     "Storage",
                     "DisasterRecovery",
                     "Backup"
                 ],
        "Synopsis": "Remove SQL Server backups from disk",
        "Name": "Remove-DbaBackup",
        "Links": "https://dbatools.io/Remove-DbaBackup",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eRemove-DbaBackup -Path \u0027C:\\MSSQL\\SQL Backup\\\u0027 -BackupFileExtension trn -RetentionPeriod 48h\r\n\r\nThe cmdlet will remove \u0027*.trn\u0027 files from \u0027C:\\MSSQL\\SQL Backup\\\u0027 and all subdirectories that are more than 48 hours.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eRemove-DbaBackup -Path \u0027C:\\MSSQL\\SQL Backup\\\u0027 -BackupFileExtension trn -RetentionPeriod 48h -WhatIf\r\n\r\nSame as example #1, but using the WhatIf parameter. The WhatIf parameter will allow the cmdlet show you what it will \r\ndo, without actually doing it.\r\nIn this case, no trn files will be deleted. Instead, the cmdlet will output what it will do when it runs. This is a \r\ngood preventatitive measure\r\nespecially when you are first configuring the cmdlet calls.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eRemove-DbaBackup -Path \u0027C:\\MSSQL\\Backup\\\u0027 -BackupFileExtension bak -RetentionPeriod 7d -CheckArchiveBit\r\n\r\nThe cmdlet will remove \u0027*.bak\u0027 files from \u0027C:\\MSSQL\\Backup\\\u0027 and all subdirectories that are more than 7 days old. \r\nIt will also ensure that the bak files have been archived using the archive bit before removing them.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eRemove-DbaBackup -Path \u0027C:\\MSSQL\\Backup\\\u0027 -BackupFileExtension bak -RetentionPeriod 1w -RemoveEmptyBackupFolder\r\n\r\nThe cmdlet will remove \u0027*.bak\u0027 files from \u0027C:\\MSSQL\\Backup\\\u0027 and all subdirectories that are more than 1 week old. \r\nIt will also remove any backup folders that no longer contain backup files.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Remove-DbaDatabaseSnapshot",
        "Description": "Removes (drops) database snapshots from the server",
        "Tags": "Snapshot",
        "Author": "niphlod",
        "Synopsis": "Removes database snapshots",
        "Name": "Remove-DbaDatabaseSnapshot",
        "Links": "https://dbatools.io/Remove-DbaDatabaseSnapshot",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eRemove-DbaDatabaseSnapshot -SqlServer sqlserver2014a\r\n\r\nRemoves all database snapshots from sqlserver2014a\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eRemove-DbaDatabaseSnapshot -SqlServer sqlserver2014a -Snapshots HR_snap_20161201, HR_snap_20161101\r\n\r\nRemoves database snapshots named HR_snap_20161201 and HR_snap_20161101\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eRemove-DbaDatabaseSnapshot -SqlServer sqlserver2014a -Databases HR, Accounting\r\n\r\nRemoves all database snapshots having HR and Accounting as base dbs\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eRemove-DbaDatabaseSnapshot -SqlServer sqlserver2014a -Snapshots HR_snapshot, Accounting_snapshot\r\n\r\nRemoves HR_snapshot and Accounting_snapshot\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDatabaseSnapshot -SqlServer sql2016 | Where SnapshotOf -like \u0027*dumpsterfire*\u0027 | Remove-DbaDatabaseSnapshot\r\n\r\nRemoves all snapshots associated with databases that have dumpsterfire in the name\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Remove-DbaSpn",
        "Description": "This function will connect to Active Directory and search for an account. If the account is found, it will attempt to remove the specified SPN. Once the SPN is removed, the function will also set delegation to that service. \n\nIn order to run this function, the credential you provide must have write access to Active Directory.\n\nNote: This function supports -WhatIf",
        "Tags": "SPN",
        "Author": "Drew Furgiuele (@pittfurg), http://www.port1433.com",
        "Synopsis": "Sets an SPN for a given service account in active directory, and also enables delegation to the same SPN",
        "Name": "Remove-DbaSpn",
        "Links": "https://dbatools.io/Remove-DbaSpn",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eRemove-DbaSpn -SPN MSSQLSvc\\SQLSERVERA.domain.something -ServiceAccount domain\\account\r\n\r\nConnects to Active Directory and removes a provided SPN to the given account.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eRemove-DbaSpn -SPN MSSQLSvc\\SQLSERVERA.domain.something -ServiceAccount domain\\account -Credential \r\n(Get-Credential)\r\n\r\nConnects to Active Directory and removes a provided SPN to the given account. Uses alternative account to connect to AD.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaSpn -ComputerName sql2005 | Where { $_.isSet -eq $true } | Remove-DbaSpn -WhatIf\r\n\r\nConnects to Active Directory and removes a provided SPN to the given account. Uses alternative account to connect to AD.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Remove-SqlDatabaseSafely",
        "Description": "Performs a DBCC CHECKDB on the database, backs up the database with Checksum and verify only to a Final Backup location, creates an Agent Job to restore from that backup, Drops the database, runs the agent job to restore the database,\nperforms a DBCC CHECKDB and drops the database\n\nBy default the initial DBCC CHECKDB is performed\nBy default the jobs and databases are created on the same server. Use -Destination to use a seperate server\n\nIt will start the SQL Agent Service on the Destination Server if it is not running",
        "Tags": [
                     "DisasterRecovery",
                     "Backup",
                     "Restore"
                 ],
        "Synopsis": "Safely removes a SQL Database and creates an Agent Job to restore it",
        "Name": "Remove-SqlDatabaseSafely",
        "Links": "https://dbatools.io/Remove-SqlDatabaseSafely",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eRemove-SqlDatabaseSafely -SqlServer \u0027Fade2Black\u0027 -Databases RideTheLightning -BackupFolder \r\n\u0027C:\\MSSQL\\Backup\\Rationalised - DO NOT DELETE\u0027\r\n\r\nFor the database RideTheLightning on the server Fade2Black Will perform a DBCC CHECKDB and if there are no errors \r\nbackup the database to the folder C:\\MSSQL\\Backup\\Rationalised - DO NOT DELETE. It will then create an Agent Job to \r\nrestore the database \r\nfrom that backup. It will drop the database, run the agent job to restore it, perform a DBCC ChECK DB and then drop the \r\ndatabase.\r\n\r\nAny DBCC errors will be written to your documents folder\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e$Databases = \u0027DemoNCIndex\u0027,\u0027RemoveTestDatabase\u0027\r\n\r\nRemove-SqlDatabaseSafely -SqlServer \u0027Fade2Black\u0027 -Databases $Databases -BackupFolder \u0027C:\\MSSQL\\Backup\\Rationalised - DO \r\nNOT DELETE\u0027\r\n\r\nFor the databases \u0027DemoNCIndex\u0027,\u0027RemoveTestDatabase\u0027 on the server Fade2Black Will perform a DBCC CHECKDB and if there \r\nare no errors \r\nbackup the database to the folder C:\\MSSQL\\Backup\\Rationalised - DO NOT DELETE. It will then create an Agent Job for \r\neach database \r\nto restore the database from that backup. It will drop the database, run the agent job, perform a DBCC ChECK DB and \r\nthen drop the database\r\n\r\nAny DBCC errors will be written to your documents folder\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eRemove-SqlDatabaseSafely -SqlServer \u0027Fade2Black\u0027 -DestinationServer JusticeForAll -Databases RideTheLightning \r\n-BackupFolder \u0027\\\\BACKUPSERVER\\BACKUPSHARE\\MSSQL\\Rationalised - DO NOT DELETE\u0027\r\n\r\nFor the database RideTheLightning on the server Fade2Black Will perform a DBCC CHECKDB and if there are no errors \r\nbackup the database to the folder \\\\BACKUPSERVER\\BACKUPSHARE\\MSSQL\\Rationalised - DO NOT DELETE It will then create an \r\nAgent Job on the server \r\nJusticeForAll to restore the database from that backup. It will drop the database on Fade2Black, run the agent job to \r\nrestore it on JusticeForAll, \r\nperform a DBCC ChECK DB and then drop the database\r\n\r\nAny DBCC errors will be written to your documents folder\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eRemove-SqlDatabaseSafely -SqlServer IronMaiden -Databases $Databases -DestinationServer TheWildHearts \r\n-DBCCErrorFolder C:\\DBCCErrors -BackupFolder z:\\Backups -NoDBCCCheck -UseDefaultFilePaths -JobOwner \u0027THEBEARD\\Rob\u0027\r\n\r\nFor the databases $Databases on the server IronMaiden Will NOT perform a DBCC CHECKDB \r\nIt will backup the databases to the folder Z:\\Backups It will then create an Agent Job on the server with a Job Owner \r\nof THEBEARD\\Rob \r\nTheWildHearts to restore the database from that backup using the instance default filepaths. \r\nIt will drop the database on IronMaiden, run the agent job to restore it on TheWildHearts using the default file paths \r\nfor the instance, perform \r\na DBCC ChECK DB and then drop the database\r\n\r\nAny DBCC errors will be written to your documents folder\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eRemove-SqlDatabaseSafely -SqlServer IronMaiden -Databases $Databases -DestinationServer TheWildHearts \r\n-DBCCErrorFolder C:\\DBCCErrors -BackupFolder z:\\Backups -UseDefaultFilePaths -ContinueAfterDbccError\r\n\r\nFor the databases $Databases on the server IronMaiden will backup the databases to the folder Z:\\Backups It will then \r\ncreate an Agent Job\r\nTheWildHearts to restore the database from that backup using the instance default filepaths. \r\nIt will drop the database on IronMaiden, run the agent job to restore it on TheWildHearts using the default file paths \r\nfor the instance, perform \r\na DBCC ChECK DB and then drop the database\r\n\r\nIf there is a DBCC Error it will continue to perform rest of the actions and will create an Agent Job with DBCCERROR in \r\nthe name and a Backup file with DBCCError in the name\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Remove-SqlOrphanUser",
        "Description": "An orphan user is defined by a user that does not have their matching login. (Login property = \"\").\nIf user is the owner of the schema with the same name and if if the schema does not have any underlying objects the schema will be dropped.\nIf user owns more than one schema, the owner of the schemas that does not have the same name as the user, will be changed to \u0027dbo\u0027. If schemas have underlying objects, you must specify the -Force parameter so the user can be dropped.\nIf exists a login to map the drop will not be performed unless you specify the -Force parameter (only when calling from Repair-SqlOrphanUser.",
        "Tags": "Orphan",
        "Synopsis": "Drop orphan users with no existing login to map",
        "Name": "Remove-SqlOrphanUser",
        "Links": "https://dbatools.io/Remove-SqlOrphanUser",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eRemove-SqlOrphanUser -SqlServer sql2005\r\n\r\nWill find and drop all orphan users without matching login of all databases present on server \u0027sql2005\u0027\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eRemove-SqlOrphanUser -SqlServer sqlserver2014a -SqlCredential $cred\r\n\r\nWill find and drop all orphan users without matching login of all databases present on server \u0027sqlserver2014a\u0027. Will be \r\nverified using SQL credentials.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eRemove-SqlOrphanUser -SqlServer sqlserver2014a -Databases db1, db2 -Force\r\n\r\nWill find all and drop orphan users even if exists their matching login on both db1 and db2 databases\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eRemove-SqlOrphanUser -SqlServer sqlserver2014a -Users OrphanUser\r\n\r\nWill remove from all databases the user OrphanUser only if not have their matching login\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eRemove-SqlOrphanUser -SqlServer sqlserver2014a -Users OrphanUser -Force\r\n\r\nWill remove from all databases the user OrphanUser EVEN if exists their matching login. First will change any schema \r\nthat it owns to \u0027dbo\u0027.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Rename-DbaLogin",
        "Description": "There are times where you might want to rename a login that was copied down, or if the name is not descriptive for what it does. \n\nIt can be a pain to update all of the mappings for a spefic user, this does it for you.",
        "Synopsis": "Rename-DbaLogin will rename login and database mapping for a specified login.",
        "Name": "Rename-DbaLogin",
        "Links": "https://dbatools.io/Rename-DbaLogin",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eRename-DbaLogin -SqlInstance localhost -Login DbaToolsUser -NewLogin captain\r\n\r\nSQL Login Example\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eRename-DbaLogin -SqlInstance localhost -Login domain\\oldname -NewLogin domain\\newname\r\n\r\nChange the windowsuser login name.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eRename-DbaLogin -SqlInstance localhost -Login dbatoolsuser -NewLogin captain -WhatIf\r\n\r\nWhatIf Example\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Repair-DbaServerName",
        "Description": "When a SQL Server\u0027s host OS is renamed, the SQL Server should be as well. This helps with Availability Groups and Kerberos.\n\nThis command renames @@SERVERNAME to match with the Windows name. The new name is automatically determined. It does not matter if you use an alias to connect to the SQL instance.\n\t\t\nIf the automatically determiend new name matches the old name, the command will not run.\n\t\nhttps://www.mssqltips.com/sqlservertip/2525/steps-to-change-the-server-name-for-a-sql-server-machine/",
        "Tags": "SPN",
        "Synopsis": "Renames @@SERVERNAME to match with the Windows name.",
        "Name": "Repair-DbaServerName",
        "Links": "https://dbatools.io/Repair-DbaServerName",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eRepair-DbaServerName -SqlServer sql2014\r\n\r\nChecks to see if the server is updatable, prompts galore, changes name.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eRepair-DbaServerName -SqlServer sql2014 -AutoFix\r\n\r\nEven more prompts/confirms, but removes Replication or breaks mirroring if necessary.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eRepair-DbaServerName -SqlServer sql2014 -AutoFix -Force\r\n\r\nSkips some prompts/confirms but not all of them.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Repair-SqlOrphanUser",
        "Description": "An orphan user is defined by a user that does not have their matching login. (Login property = \"\")\n\t\nIf the matching login exists it must be:\n Enabled\n Not a system object\n Not locked\n Have the same name that user\n\nYou can drop users that does not have their matching login by especifing the parameter -RemoveNotExisting This will be made by calling Remove-SqlOrphanUser function.",
        "Tags": "Orphan",
        "Synopsis": "Find orphan users with existing login and remap.",
        "Name": "Repair-SqlOrphanUser",
        "Links": "https://dbatools.io/Repair-SqlOrphanUser",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eRepair-SqlOrphanUser -SqlServer sql2005\r\n\r\nWill find and repair all orphan users of all databases present on server \u0027sql2005\u0027\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eRepair-SqlOrphanUser -SqlServer sqlserver2014a -SqlCredential $cred\r\n\r\nWill find and repair all orphan users of all databases present on server \u0027sqlserver2014a\u0027. Will be verified using SQL \r\ncredentials.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eRepair-SqlOrphanUser -SqlServer sqlserver2014a -Databases db1, db2\r\n\r\nWill find and repair all orphan users on both db1 and db2 databases\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eRepair-SqlOrphanUser -SqlServer sqlserver2014a -Databases db1 -Users OrphanUser\r\n\r\nWill find and repair user \u0027OrphanUser\u0027 on \u0027db1\u0027 database\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eRepair-SqlOrphanUser -SqlServer sqlserver2014a -Users OrphanUser\r\n\r\nWill find and repair user \u0027OrphanUser\u0027 on all databases\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 6 --------------------------\r\n\r\nPS C:\\\u003eRepair-SqlOrphanUser -SqlServer sqlserver2014a -RemoveNotExisting\r\n\r\nWill find all orphan users of all databases present on server \u0027sqlserver2014a\u0027\r\nWill also remove all users that does not have their matching login by calling Remove-SqlOrphanUser function\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Reset-SqlAdmin",
        "Description": "This function allows administrators to regain access to local or remote SQL Servers by either resetting the sa password, adding sysadmin role to existing login,\nor adding a new login (SQL or Windows) and granting it sysadmin privileges.\n\nThis is accomplished by stopping the SQL services or SQL Clustered Resource Group, then restarting SQL via the command-line\nusing the /mReset-SqlAdmin paramter which starts the server in Single-User mode, and only allows this script to connect.\n\nOnce the service is restarted, the following tasks are performed:\n- Login is added if it doesn\u0027t exist\n- If login is a Windows User, an attempt is made to ensure it exists\n- If login is a SQL Login, password policy will be set to OFF when creating the login, and SQL Server authentication will be set to Mixed Mode.\n- Login will be enabled and unlocked\n- Login will be added to sysadmin role\n\nIf failures occur at any point, a best attempt is made to restart the SQL Server.\n\nIn order to make this script as portable as possible, System.Data.SqlClient and Get-WmiObject are used (as opposed to requiring the Failover Cluster Admin tools or SMO).\nIf using this function against a remote SQL Server, ensure WinRM is configured and accessible. If this is not possible, run the script locally.\n\nTested on Windows XP, 7, 8.1, Server 2012 and Windows Server Technical Preview 2.\nTested on SQL Server 2005 SP4 through 2016 CTP2.",
        "Tags": "WSMan",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "This function will allow administrators to regain access to SQL Servers in the event that passwords or access was lost.\n\nSupports SQL Server 2005 and above. Windows administrator access is required.",
        "Name": "Reset-SqlAdmin",
        "Links": "https://dbatools.io/Reset-SqlAdmin",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eReset-SqlAdmin -SqlServer sqlcluster\r\n\r\nPrompts for password, then resets the \"sa\" account password on sqlcluster.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eReset-SqlAdmin -SqlServer sqlserver\\sqlexpress -Login ad\\administrator\r\n\r\nPrompts user to confirm that they understand the SQL Service will be restarted.\r\n\r\nAdds the domain account \"ad\\administrator\" as a sysadmin to the SQL instance. \r\nIf the account already exists, it will be added to the sysadmin role.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eReset-SqlAdmin -SqlServer sqlserver\\sqlexpress -Login sqladmin -Force\r\n\r\nSkips restart confirmation, prompts for passsword, then adds a SQL Login \"sqladmin\" with sysadmin privleges. \r\nIf the account already exists, it will be added to the sysadmin role and the password will be reset.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Resolve-DbaNetworkName",
        "Description": "Retrieves the IPAddress, ComputerName from one computer.\nThe object can be used to take action against its name or IPAddress.\n\nFirst ICMP is used to test the connection, and get the connected IPAddress.\n\nIf your local Powershell version is not higher than 2, WMI is tried to get the computername.\nIf not, CIM is used, first via WinRM, and if not successful, via DCOM.",
        "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )",
        "Synopsis": "Returns information about the network connection of the target computer including NetBIOS name, IP Address, domain name and fully qualified domain name (FQDN).",
        "Name": "Resolve-DbaNetworkName",
        "Links": "https://dbatools.io/Resolve-DbaNetworkName",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eResolve-DbaNetworkName -ComputerName ServerA\r\n\r\nReturns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, Domain, FQDN for ServerA\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eResolve-DbaNetworkName -SqlServer sql2016\\sqlexpress\r\n\r\nReturns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, Domain, FQDN for the SQL instance \r\nsql2016\\sqlexpress\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eResolve-DbaNetworkName -SqlServer sql2016\\sqlexpress, sql2014\r\n\r\nReturns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, Domain, FQDN for the SQL instance \r\nsql2016\\sqlexpress and sql2014\r\n\r\nGet-SqlRegisteredServerName -SqlServer sql2014 | Resolve-DbaNetworkName\r\n\r\nReturns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, Domain, FQDN for all SQL Servers \r\nreturned by Get-SqlRegisteredServerName\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Restore-DbaDatabase",
        "Description": "Upon bein passed a list of potential backups files this command will scan the files, select those that contain SQL Server\nbackup sets. It will then filter those files down to a set that can perform the requested restore, checking that we have a \nfull restore chain to the point in time requested by the caller.\n\nThe function defaults to working on a remote instance. This means that all paths passed in must be relative to the remote instance.\nXpDirTree will be used to perform the file scans\n\n\nVarious means can be used to pass in a list of files to be considered. The default is to non recursively scan the folder\npassed in.",
        "Tags": [
                     "DisasterRecovery",
                     "Backup",
                     "Restore"
                 ],
        "Synopsis": "Restores a SQL Server Database from a set of backupfiles",
        "Name": "Restore-DbaDatabase",
        "Links": null,
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eRestore-DbaDatabase -SqlServer server1\\instance1 -Path \\\\server2\\backups\r\n\r\nScans all the backup files in \\\\server2\\backups, filters them and restores the database to server1\\instance1\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eRestore-DbaDatabase -SqlServer server1\\instance1 -Path \\\\server2\\backups -MaintenanceSolutionBackup \r\n-DestinationDataDirectory c:\\restores\r\n\r\nScans all the backup files in \\\\server2\\backups$ stored in an Ola Hallengren style folder structure,\r\n filters them and restores the database to the c:\\restores folder on server1\\instance1\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-ChildItem c:\\SQLbackups1\\, \\\\server\\sqlbackups2 | Restore-DbaDatabase -SqlServer server1\\instance1\r\n\r\nTakes the provided files from multiple directories and restores them on server1\\instance1\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003e$RestoreTime = Get-Date(\u002711:19 23/12/2016\u0027)\r\n\r\nRestore-DbaDatabase -SqlServer server1\\instance1 -Path \\\\server2\\backups -MaintenanceSolutionBackup \r\n-DestinationDataDirectory c:\\restores -RestoreTime $RestoreTime\r\n\r\nScans all the backup files in \\\\server2\\backups stored in an Ola Hallengren style folder structure,\r\n filters them and restores the database to the c:\\restores folder on server1\\instance1 up to 11:19 23/12/2016\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eRestore-DbaDatabase -SqlServer server1\\instance1 -Path \\\\server2\\backups -DestinationDataDirectory c:\\restores \r\n-OutputScriptOnly | Select-Object -ExpandPropert Tsql | Out-File -Filepath c:\\scripts\\restore.sql\r\n\r\nScans all the backup files in \\\\server2\\backups stored in an Ola Hallengren style folder structure,\r\n filters them and generate the T-SQL Scripts to restore the database to the latest point in time, \r\n and then stores the output in a file for later retrieval\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 6 --------------------------\r\n\r\nPS C:\\\u003eRestore-DbaDatabase -SqlServer server1\\instance1 -Path c:\\backups -DestinationDataDirectory c:\\DataFiles \r\n-DestinationLogDirectory c:\\LogFile\r\n\r\nScans all the files in c:\\backups and then restores them onto the SQL Server Instance server1\\instance1, placing data \r\nfiles\r\nc:\\DataFiles and all the log files into c:\\LogFiles\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 7 --------------------------\r\n\r\nPS C:\\\u003e$File = Get-ChildItem c:\\backups, \\\\server1\\backups -recurse\r\n\r\n$File | Restore-DbaDatabase -SqlServer Server1\\Instance -UseDestinationDefaultDirectories\r\n\r\nThis will take all of the files found under the folders c:\\backups and \\\\server1\\backups, and pipeline them into\r\nRestore-DbaDatabase. Restore-DbaDatabase will then scan all of the files, and restore all of the databases included\r\nto the latest point in time covered by their backups. All data and log files will be moved to the default SQL Sever \r\nfolder for those file types as defined on the target instance.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Restore-DbaFromDatabaseSnapshot",
        "Description": "Restores the database from the snapshot, discarding every modification made to the database\nNB: Restoring to a snapshot will result in every other snapshot of the same database to be dropped\nIt also fixes some long-standing bugs in SQL Server when restoring from snapshots",
        "Tags": [
                     "DisasterRecovery",
                     "Snapshot",
                     "Backup",
                     "Restore"
                 ],
        "Author": "niphlod",
        "Synopsis": "Restores databases from snapshots",
        "Name": "Restore-DbaFromDatabaseSnapshot",
        "Links": "https://dbatools.io/Restore-DbaFromDatabaseSnapshot",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eRestore-DbaFromDatabaseSnapshot -SqlServer sqlserver2014a -Databases HR, Accounting\r\n\r\nRestores HR and Accounting databases using the latest snapshot available\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eRestore-DbaFromDatabaseSnapshot -SqlServer sqlserver2014a -Snapshots HR_snap_20161201, Accounting_snap_20161101\r\n\r\nRestores databases from snapshots named HR_snap_20161201 and Accounting_snap_20161101\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Restore-SqlBackupFromDirectory",
        "Description": "Many SQL Server database administrators use Ola Hallengren\u0027s SQL Server Maintenance Solution which can be found at http://ola.hallengren.com\nHallengren uses a predictable backup structure which made it relatively easy to create a script that can restore an entire SQL Server database instance, down to the master database (next version), to a new server. This script is intended to be used in the event that the originating SQL Server becomes unavailable, thus rendering my other SQL restore script (http://goo.gl/QmfQ6s) ineffective.",
        "Tags": [
                     "DisasterRecovery",
                     "Backup",
                     "Restore"
                 ],
        "Synopsis": "Restores SQL Server databases from the backup directory structure created by Ola Hallengren\u0027s database maintenance scripts. Different structures coming soon.",
        "Name": "Restore-SqlBackupFromDirectory",
        "Links": "https://dbatools.io/Restore-SqlBackupFromDirectory",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eRestore-SqlBackupFromDirectory -ServerName sqlcluster -Path \\\\fileserver\\share\\sqlbackups\\SQLSERVER2014A\r\n\r\nDescription\r\n\r\nAll user databases contained within \\\\fileserver\\share\\sqlbackups\\SQLSERVERA will be restored to sqlcluster, down the \r\nmost recent full/differential/logs.\r\n\r\n\r\nRequires -Version 3.0\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Set-DbaConfig",
        "Description": "This function creates or changes configuration values.\nThese are used in a larger framework to provide dynamic configuration information outside the PowerShell variable system.",
        "Tags": "Config",
        "Author": "Friedrich Weinmann",
        "Synopsis": "Sets configuration entries.",
        "Name": "Set-DbaConfig",
        "Links": null,
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaConfig -Name \u0027User\u0027 -Value \"Friedrich\" -Description \"The user under which the show must go on.\"\r\n\r\nCreates a configuration entry named \"User\" with the value \"Friedrich\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaConfig \u0027ConfigLink\u0027 \u0027https://www.example.com/config.xml\u0027 \u0027Company\u0027 -Hidden\r\n\r\nCreates a configuration entry named \"ConfigLink\" in the \"Company\" module with the value \r\n\u0027https://www.example.com/config.xml\u0027.\r\nThis entry is hidden from casual discovery using Get-Config.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaConfig \u0027Network.Firewall\u0027 \u002710.0.0.2\u0027 -Default\r\n\r\nCreates a configuration entry named \"Firewall\" in the \"Network\" module with the value \u002710.0.0.2\u0027\r\nThis is only set, if the setting does not exist yet. If it does, this command will apply no changes.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Set-DbaDatabaseOwner",
        "Description": "This function will alter database ownershipt to match a specified login if their current owner does not match the target login. By default, the target login will be \u0027sa\u0027, but the fuction will allow the user to specify a different login for ownership. The user can also apply this to all databases or only to a select list of databases (passed as either a comma separated list or a string array).\n\nBest Practice reference: http://weblogs.sqlteam.com/dang/archive/2008/01/13/Database-Owner-Troubles.aspx",
        "Synopsis": "Sets database owners with a desired login if databases do not match that owner.",
        "Name": "Set-DbaDatabaseOwner",
        "Links": "https://dbatools.io/Set-DbaDatabaseOwner",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaDatabaseOwner -SqlServer localhost\r\n\r\nSets database owner to \u0027sa\u0027 on all databases where the owner does not match \u0027sa\u0027.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaDatabaseOwner -SqlServer localhost -TargetLogin DOMAIN\\account\r\n\r\nTo set the database owner to DOMAIN\\account on all databases where the owner does not match DOMAIN\\account. Note that \r\nTargetLogin must be a valid security principal that exists on the target server.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaDatabaseOwner -SqlServer sqlserver -Databases db1, db2\r\n\r\nSets database owner to \u0027sa\u0027 on the db1 and db2 databases if their current owner does not match \u0027sa\u0027.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Set-DbaDatabaseState",
        "Description": "Sets some common \"states\" on databases:\n - \"RW\" options (ReadOnly, ReadWrite)\n - \"Status\" options (Online, Offline, Emergency, plus a special \"Detached\")\n - \"Access\" options (SingleUser, RestrictedUser, MultiUser)\n\nReturns an object with SqlInstance, Database, RW, Status, Access, Notes\n\nNotes gets filled when something went wrong setting the state",
        "Author": "niphlod",
        "Synopsis": "Sets various options for databases, hereby called \"states\"",
        "Name": "Set-DbaDatabaseState",
        "Links": "https://dbatools.io/Set-DbaDatabaseState",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaDatabaseState -SqlServer sqlserver2014a -Database HR -Offline\r\n\r\nSets the HR database as OFFLINE\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaDatabaseState -SqlServer sqlserver2014a -AllDatabases -Exclude HR -Readonly -Force\r\n\r\nSets all databases of the sqlserver2014a instance, except for HR, as READ_ONLY\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDatabaseState -SqlInstance sql2016 | Where-Object Status -eq \u0027Offline\u0027 | Set-DbaDatabaseState -Online\r\n\r\nFinds all offline databases and sets them to online\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaDatabaseState -SqlServer sqlserver2014a -Database HR -SingleUser\r\n\r\nSets the HR database as SINGLE_USER\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaDatabaseState -SqlServer sqlserver2014a -Database HR -SingleUser -Force\r\n\r\nSets the HR database as SINGLE_USER, dropping all other connections (and rolling back open transactions)\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Set-DbaJobOwner",
        "Description": "This function will alter SQL Agent Job ownership to match a specified login if their\ncurrent owner does not match the target login. By default, the target login will\nbe \u0027sa\u0027, but the fuction will allow the user to specify a different login for \nownership. The user can also apply this to all jobs or only to a select list\nof jobs (passed as either a comma separated list or a string array).\n\t\nBest practice reference: http://sqlmag.com/blog/sql-server-tip-assign-ownership-jobs-sysadmin-account",
        "Synopsis": "Sets SQL Agent job owners with a desired login if jobs do not match that owner.",
        "Name": "Set-DbaJobOwner",
        "Links": "https://dbatools.io/Set-DbaJobOwner",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaJobOwner -SqlServer localhost\r\n\r\nSets SQL Agent Job owner to sa on all jobs where the owner does not match sa.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaJobOwner -SqlServer localhost -TargetLogin DOMAIN\\account\r\n\r\nSets SQL Agent Job owner to sa on all jobs where the owner does not match \u0027DOMAIN\\account\u0027. Note\r\nthat TargetLogin must be a valid security principal that exists on the target server.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaJobOwner -SqlServer localhost -Job job1, job2\r\n\r\nSets SQL Agent Job owner to \u0027sa\u0027 on the job1 and job2 jobs if their current owner does not match \u0027sa\u0027.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003e\u0027sqlserver\u0027,\u0027sql2016\u0027 | Set-DbaJobOwner\r\n\r\nSets SQL Agent Job owner to sa on all jobs where the owner does not match sa on both sqlserver and sql2016.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Set-DbaMaxDop",
        "Description": "Uses the Test-DbaMaxDop command to get the recommended value if -MaxDop parameter is not specified.\n\nThese are just general recommendations for SQL Server and are a good starting point for setting the \"max degree of parallelism\" option.\nYou can set MaxDop database scoped configurations if the server is version 2016.\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Synopsis": "Sets SQL Server max dop then displays information relating to SQL Server Max DOP configuration settings. Works on SQL Server 2005-2016.",
        "Name": "Set-DbaMaxDop",
        "Links": "https://dbatools.io/Set-DbaMaxDop",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaMaxDop -SqlServer sql2008, sql2012\r\n\r\nSet recommended Max DOP setting for servers sql2008 and sql2012.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaMaxDop -SqlServer sql2014 -MaxDop 4\r\n\r\nSet Max DOP setting to 4 for server sql2014.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaMaxDop -SqlServer sql2008 | Set-DbaMaxDop\r\n\r\nGet Max DOP recommended setting from Test-DbaMaxDop and applies to sql2008 instance\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaMaxDop -SqlServer sql2016 -Databases db1\r\n\r\nSet recommended Max DOP setting database db1 on server sql2016.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaMaxDop -SqlServer sql2016 -AllDatabases\r\n\r\nSet recommended Max DOP setting for all databases on server sql2016.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Set-DbaMaxMemory",
        "Description": "Sets SQL Server max memory then displays information relating to SQL Server Max Memory configuration settings. \n\nInspired by Jonathan Kehayias\u0027s post about SQL Server Max memory (http://bit.ly/sqlmemcalc), this uses a formula to \ndetermine the default optimum RAM to use, then sets the SQL max value to that number.\n\nJonathan notes that the formula used provides a *general recommendation* that doesn\u0027t account for everything that may \nbe going on in your specific environment.",
        "Synopsis": "Sets SQL Server \u0027Max Server Memory\u0027 configuration setting to a new value then displays information this setting.",
        "Name": "Set-DbaMaxMemory",
        "Links": "https://dbatools.io/Set-DbaMaxMemory",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaMaxMemory sqlserver1\r\n\r\nSet max memory to the recommended MB on just one server named \"sqlserver1\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaMaxMemory -SqlServer sqlserver1 -MaxMb 2048\r\n\r\nExplicitly max memory to 2048 MB on just one server, \"sqlserver1\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlRegisteredServerName -SqlServer sqlserver| Test-DbaMaxMemory | Where-Object { $_.SqlMaxMB -gt $_.TotalMB \r\n} | Set-DbaMaxMemory\r\n\r\nFind all servers in SQL Server Central Management server that have Max SQL memory set to higher than the total memory \r\nof the server (think 2147483647), then pipe those to Set-DbaMaxMemory and use the default recommendation.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Set-DbaPowerPlan",
        "Description": "Sets the SQL Server OS\u0027s Power Plan. It defaults to High Performance which is Best Practice.\n\t\nIf your organization uses a custom power plan that is considered best practice, specify -CustomPowerPlan.\n\t\nReferences:\nhttps://support.microsoft.com/en-us/kb/2207548\nhttp://www.sqlskills.com/blogs/glenn/windows-power-plan-effects-on-newer-intel-processors/",
        "Synopsis": "Sets the SQL Server OS\u0027s Power Plan.",
        "Name": "Set-DbaPowerPlan",
        "Links": "https://dbatools.io/Set-DbaPowerPlan",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaPowerPlan -ComputerName sqlserver2014a\r\n\r\nSets the Power Plan to High Performance. Skips it if its already set.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaPowerPlan -ComputerName sqlcluster -CustomPowerPlan \u0027Maximum Performance\u0027\r\n\r\nSets the Power Plan to the custom power plan called \"Maximum Performance\". Skips it if its already set.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Set-DbaQueryStoreConfig",
        "Description": "Configure Query Store settings for a specific or multiple databases.",
        "Tags": "QueryStore",
        "Author": "Enrico van de Laar ( @evdlaar )",
        "Synopsis": "Configure Query Store settings for a specific or multiple databases.",
        "Name": "Set-DbaQueryStoreConfig",
        "Links": "https://dbatools.io/Set-QueryStoreConfig",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaQueryStoreConfig -SqlInstance ServerA\\SQL -State ReadWrite -FlushInterval 600 -CollectionInterval 10 \r\n-MaxSize 100 -CaptureMode All -CleanupMode Auto -StaleQueryThreshold 100 -AllDatabases\r\n\r\nConfigure the Query Store settings for all user databases in the ServerA\\SQL Instance.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaQueryStoreConfig -SqlInstance ServerA\\SQL -FlushInterval 600\r\n\r\nOnly configure the FlushInterval setting for all Query Store databases in the ServerA\\SQL Instance.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaQueryStoreConfig -SqlInstance ServerA\\SQL -Databases AdventureWorks -State ReadWrite -FlushInterval 600 \r\n-CollectionInterval 10 -MaxSize 100 -CaptureMode all -CleanupMode Auto -StaleQueryThreshold 100\r\n\r\nConfigure the Query Store settings for the AdventureWorks database in the ServerA\\SQL Instance.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaQueryStoreConfig -SqlInstance ServerA\\SQL -Exclude AdventureWorks -State ReadWrite -FlushInterval 600 \r\n-CollectionInterval 10 -MaxSize 100 -CaptureMode all -CleanupMode Auto -StaleQueryThreshold 100\r\n\r\nConfigure the Query Store settings for all user databases except the AdventureWorks database in the ServerA\\SQL \r\nInstance.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Set-DbaSpn",
        "Description": "This function will connect to Active Directory and search for an account. If the account is found, it will attempt to add an SPN. Once the SPN\nis added, the function will also set delegation to that service. In order to run this function, the credential you provide must have write\naccess to Active Directory.\n\nNote: This function supports -WhatIf",
        "Tags": "SPN",
        "Author": "Drew Furgiuele (@pittfurg), http://www.port1433.com",
        "Synopsis": "Sets an SPN for a given service account in active directory, and also enables delegation to the same SPN",
        "Name": "Set-DbaSpn",
        "Links": "https://dbatools.io/Set-DbaSpn",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaSpn -SPN MSSQLSvc\\SQLSERVERA.domain.something -ServiceAccount domain\\account\r\n\r\nConnects to Active Directory and adds a provided SPN to the given account.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaSpn -SPN MSSQLSvc\\SQLSERVERA.domain.something -ServiceAccount domain\\account -Credential (Get-Credential)\r\n\r\nConnects to Active Directory and adds a provided SPN to the given account. Uses alternative account to connect to AD.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaSpn -ComputerName sql2016 | Where { $_.isSet -eq $false } | Set-DbaSpn -WhatIf\r\n\r\nConnects to Active Directory and adds a provided SPN to the given account. Uses alternative account to connect to AD.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Set-SqlTempDbConfiguration",
        "Description": "Function to calculate tempdb size and file configurations based on passed parameters, calculated values, and Microsoft\nbest practices. User must declare SQL Server to be configured and total data file size as mandatory values. Function will\nthen calculate number of data files based on logical cores on the target host and create evenly sized data files based\non the total data size declared by the user, with a log file 25% of the total data file size. Other parameters can adjust \nthe settings as the user desires (such as different file paths, number of data files, and log file size). The function will\nnot perform any functions that would shrink or delete data files. If a user desires this, they will need to reduce tempdb\nso that it is \"smaller\" than what the function will size it to before runnint the function.",
        "Synopsis": "Sets tempdb data and log files according to best practices.",
        "Name": "Set-SqlTempDbConfiguration",
        "Links": "https://dbatools.io/Set-SqltempdbConfiguration",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eSet-SqltempdbConfiguration -SqlServer localhost -DataFileSizeMB 1000\r\n\r\nCreates tempdb with a number of datafiles equal to the logical cores where\r\neach one is equal to 1000MB divided by number of logical cores and a log file\r\nof 250MB\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eSet-SqltempdbConfiguration -SqlServer localhost -DataFileSizeMB 1000 -DataFileCount 8\r\n\r\nCreates tempdb with a number of datafiles equal to the logical cores where\r\neach one is equal to 125MB and a log file of 250MB\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eSet-SqltempdbConfiguration -SqlServer localhost -DataFileSizeMB 1000 -Script\r\n\r\nProvides a SQL script output to configure tempdb according to the passed parameters\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eSet-SqltempdbConfiguration -SqlServer localhost -DataFileSizeMB 1000 -Script\r\n\r\nReturns PSObject representing tempdb configuration.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Show-SqlDatabaseList",
        "Description": "Shows a list of databases in a GUI. Returns a simple string. Hitting cancel returns null.",
        "Synopsis": "Shows a list of databases in a GUI",
        "Name": "Show-SqlDatabaseList",
        "Links": "https://dbatools.io/Show-SqlDatabaseList",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eShow-SqlDatabaseList -SqlServer sqlserver2014a\r\n\r\nShows a GUI list of databases and uses Windows Authentication to log into the SQL Server. Returns a string of the \r\nselected database.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eShow-SqlDatabaseList -Source sqlserver2014a -SqlCredential $cred\r\n\r\nShows a GUI list of databases and SQL credentials to log into the SQL Server. Returns a string of the selected database.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Show-SqlServerFileSystem",
        "Description": "Similar to the remote file system popup you see when browsing a remote SQL Server in SQL Server Management Studio, this command allows you to traverse the remote SQL Server\u0027s file structure.\n\nShow-SqlServerFileSystem uses SQL Management Objects to browse the directories and what you see is limited to the permissions of the account running the command.",
        "Tags": "Storage",
        "Synopsis": "Shows file system on remote SQL Server and returns the directory name of the directory you select.",
        "Name": "Show-SqlServerFileSystem",
        "Links": "https://dbatools.io/Show-SqlServerFileSystem",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eShow-SqlServerFileSystem -SqlServer sqlserver2014a\r\n\r\nShows a GUI and uses Windows Authentication to log into the SQL Server. Returns a string of the path you selected.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eShow-SqlServerFileSystem -Source sqlserver2014a -SqlCredential $cred\r\n\r\nShows a GUI and uses SQL credentials to log into the SQL Server. Returns a string of the path you selected.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Show-SqlWhoIsActive",
        "Description": "Output results of Adam Machanic\u0027s sp_WhoIsActive to a GridView (default) or DataTable, and installs it if necessary. \nGridView is good for analysis while DataTable is good for SqlBulkCopy uploads to keep track.\n\nThis command was built with Adam\u0027s permission. To read more about sp_WhoIsActive, please visit:\n\nUpdates: http://sqlblog.com/blogs/adam_machanic/archive/tags/who+is+active/default.aspx\n\nAlso, consider donating to Adam if you find this stored procedure helpful: http://tinyurl.com/WhoIsActiveDonate",
        "Tags": "Memory",
        "Synopsis": "Outputs results of Adam Machanic\u0027s sp_WhoIsActive to a GridView (default) or DataTable, and installs it if necessary.",
        "Name": "Show-SqlWhoIsActive",
        "Links": "https://dbatools.io/Show-SqlWhoIsActive",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eShow-SqlWhoIsActive -SqlServer sqlserver2014a\r\n\r\nExecute sp_whoisactive on sqlserver2014a. This command expects sp_WhoIsActive to be in the master database. Logs into \r\nthe SQL Server with Windows credentials.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eShow-SqlWhoIsActive -SqlServer sqlserver2014a -SqlCredential $credential -Database dbatools\r\n\r\nExecute sp_whoisactive on sqlserver2014a. This command expects sp_WhoIsActive to be in the dbatools database. Logs into \r\nthe SQL Server with SQL Authentication.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eShow-SqlWhoIsActive -SqlServer sqlserver2014a -GetAverageTime\r\n\r\nSimilar to running sp_WhoIsActive @get_avg_time\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eShow-SqlWhoIsActive -SqlServer sqlserver2014a -GetOuterCommand -FindBlockLeaders\r\n\r\nSimilar to running sp_WhoIsActive @get_outer_command = 1, @find_block_leaders = 1\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Start-SqlMigration",
        "Description": "Start-SqlMigration consolidates most of the migration tools in dbatools into one command. This is useful when you\u0027re looking to migrate entire instances. It less flexible than using the underlying functions. Think of it as an easy button. It migrates:\n\nAll user databases. Use -NoDatabases to skip.\nAll logins. Use -NoLogins to skip.\nAll database mail objects. Use -NoDatabaseMail\nAll credentials. Use -NoCredentials to skip.\nAll objects within the Job Server (SQL Agent). Use -NoAgentServer to skip.\nAll linked servers. Use -NoLinkedServers to skip.\nAll groups and servers within Central Management Server. Use -NoCentralManagementServer to skip.\nAll SQL Server configuration objects (everything in sp_configure). Use -NoSpConfigure to skip.\nAll user objects in system databases. Use -NoSysDbUserObjects to skip.\nAll system triggers. Use -NoSystemTriggers to skip.\nAll system backup devices. Use -NoBackupDevices to skip.\nAll Audits. Use -NoAudits to skip.\nAll Endpoints. Use -NoEndpoints to skip.\nAll Extended Events. Use -NoExtendedEvents to skip.\nAll Policy Management objects. Use -NoPolicyManagement to skip.\nAll Resource Governor objects. Use -NoResourceGovernor to skip.\nAll Server Audit Specifications. Use -NoServerAuditSpecifications to skip.\nAll Custom Errors (User Defined Messages). Use -NoCustomErrors to skip.\nCopies All Data Collector collection sets. Does not configure the server. Use -NoDataCollector to skip.\n\nThis script provides the ability to migrate databases using detach/copy/attach or backup/restore. SQL Server logins, including passwords, SID and database/server roles can also be migrated. In addition, job server objects can be migrated and server configuration settings can be exported or migrated. This script works with named instances, clusters and SQL Express.\n\nBy default, databases will be migrated to the destination SQL Server\u0027s default data and log directories. You can override this by specifying -ReuseSourceFolderStructure. Filestreams and filegroups are also migrated. Safety is emphasized.\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": [
                     "Migration",
                     "DisasterRecovery",
                     "Backup",
                     "Restore"
                 ],
        "Author": "Chrissy LeMaire",
        "Synopsis": "Migrates SQL Server *ALL* databases, logins, database mail profies/accounts, credentials, SQL Agent objects, linked servers, \nCentral Management Server objects, server configuration settings (sp_configure), user objects in systems databases,\nsystem triggers and backup devices from one SQL Server to another. \n\nFor more granular control, please use one of the -No parameters and use the other functions available within the dbatools module.\n\nAutomatically outputs a transcript to disk.",
        "Name": "Start-SqlMigration",
        "Links": "https://dbatools.io/Start-SqlMigration",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eStart-SqlMigration -Source sqlserver\\instance -Destination sqlcluster -DetachAttach\r\n\r\nDescription\r\n\r\nAll databases, logins, job objects and sp_configure options will be migrated from sqlserver\\instance to sqlcluster. \r\nDatabases will be migrated using the detach/copy files/attach method. Dbowner will be updated. User passwords, SIDs, \r\ndatabase roles and server roles will be migrated along with the login.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eStart-SqlMigration -Verbose -Source sqlcluster -Destination sql2016 -SourceSqlCredential $scred \r\n-ReuseSourceFolderStructure -DestinationSqlCredential $cred -Force -NetworkShare \r\n\\\\fileserver\\share\\sqlbackups\\Migration -BackupRestore\r\n\r\nMigrate databases uses backup/restore. Also migrate logins, database mail, credentials, SQL Agent, Central Management \r\nServer, SQL global configuration.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eStart-SqlMigration -Verbose -Source sqlcluster -Destination sql2016 -NoDatabases -NoLogins\r\n\r\nMigrates everything but logins and databases.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eStart-SqlMigration -Verbose -Source sqlcluster -Destination sql2016 -DetachAttach -Reattach -SetSourceReadonly\r\n\r\nMigrate databases using detach/copy/attach. Reattach at source and set source databases read-only. Also migrates \r\neverything else.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Stop-DbaProcess",
        "Description": "This command kills all spids associated with a spid, login, host, program or database.\n\t\nIf you are attempting to kill your own login sessions, the process performing the kills will be skipped.",
        "Synopsis": "This command finds and kills SQL Server processes.",
        "Name": "Stop-DbaProcess",
        "Links": "https://dbatools.io/Stop-DbaProcess",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eStop-DbaProcess -SqlServer sqlserver2014a -Logins base\\ctrlb, sa\r\n\r\nFinds all processes for base\\ctrlb and sa on sqlserver2014a, then kills them. Uses Windows Authentication to login to \r\nsqlserver2014a.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eStop-DbaProcess -SqlServer sqlserver2014a -SqlCredential $credential -Spids 56, 77\r\n\r\nFinds processes for spid 56 and 57, then kills them. Uses alternative (SQL or Windows) credentials to login to \r\nsqlserver2014a.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eStop-DbaProcess -SqlServer sqlserver2014a -Programs \u0027Microsoft SQL Server Management Studio\u0027\r\n\r\nFinds processes that were created in Microsoft SQL Server Management Studio, then kills them.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eStop-DbaProcess -SqlServer sqlserver2014a -Hosts workstationx, server100\r\n\r\nFinds processes that were initiated by hosts (computers/clients) workstationx and server 1000, then kills them.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eStop-DbaProcess -SqlServer sqlserver2014 -Databases tempdb -WhatIf\r\n\r\nShows what would happen if the command were executed.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 6 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaProcess -SqlServer sql2016 -Programs \u0027dbatools PowerShell module - dbatools.io\u0027 | Stop-DbaProcess\r\n\r\nFinds processes that were created with dbatools, then kills them.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Sync-SqlLoginPermissions",
        "Description": "Syncs only SQL Server login permissions, roles, etc. Does not add or drop logins. If a matching login does not exist on the destination, the login will be skipped. \nCredential removal not currently supported for Syncs. TODO: Application role sync\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copies SQL login permission from one server to another.",
        "Name": "Sync-SqlLoginPermissions",
        "Links": [
                      "https://dbatools.io/Sync-SqlLoginPermissions",
                      "https://dbatools.io/Sync-SqlLoginPermissions"
                  ],
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eSync-SqlLoginPermissions -Source sqlserver2014a -Destination sqlcluster\r\n\r\nSyncs only SQL Server login permissions, roles, etc. Does not add or drop logins or users. To copy logins and their \r\npermissions, use Copy-SqlLogin.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eSync-SqlLoginPermissions -Source sqlserver2014a -Destination sqlcluster -Exclude realcajun -SourceSqlCredential \r\n$scred -DestinationSqlCredential $dcred\r\n\r\nAuthenticates to SQL Servers using SQL Authentication.\r\n\r\nCopies all login permissions except for realcajun. If a login already exists on the destination, the permissions will \r\nnot be migrated.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eSync-SqlLoginPermissions -Source sqlserver2014a -Destination sqlcluster -Login realcajun, netnerds\r\n\r\nCopies permissions ONLY for logins netnerds and realcajun.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaConnectionAuthScheme",
        "Description": "By default, this command will return the ConnectName, ServerName, Transport and AuthScheme of the current connection.\n\t\nConnectName is the name you used to connect. ServerName is the name that the SQL Server reports as its @@SERVERNAME which is used to register its SPN. If you were expecting a Kerberos connection and got NTLM instead, ensure ConnectName and ServerName match. \n\nIf -Kerberos or -Ntlm is specified, the $true/$false results of the test will be returned. Returns $true or $false by default for one server. Returns Server name and Results for more than one server.",
        "Tags": "SPN",
        "Synopsis": "Returns the transport protocol and authentication scheme of the connection. This is useful to determine if your connection is using Kerberos.",
        "Name": "Test-DbaConnectionAuthScheme",
        "Links": "https://dbatools.io/Test-DbaConnectionAuthScheme",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaConnectionAuthScheme -SqlServer sqlserver2014a, sql2016\r\n\r\nReturns ConnectName, ServerName, Transport and AuthScheme for sqlserver2014a and sql2016.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaConnectionAuthScheme -SqlServer sqlserver2014a -Kerberos\r\n\r\nReturns $true or $false depending on if the connection is Kerberos or not.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaConnectionAuthScheme -SqlServer sqlserver2014a -Detailed\r\n\r\nReturns the results of \"SELECT * from sys.dm_exec_connections WHERE session_id = @@SPID\"\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaDatabaseCollation",
        "Description": "Compares Database Collations to Server Collation",
        "Synopsis": "Compares Database Collations to Server Collation",
        "Name": "Test-DbaDatabaseCollation",
        "Links": "https://dbatools.io/Test-DbaDatabaseCollation",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDatabaseCollation -SqlServer sqlserver2014a\r\n\r\nReturns server name, databse name and true/false if the collations match for all databases on sqlserver2014a\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDatabaseCollation -SqlServer sqlserver2014a -Databases db1, db2\r\n\r\nReturns server name, databse name and true/false if the collations match for the db1 and db2 databases on sqlserver2014a\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDatabaseCollation -SqlServer sqlserver2014a, sql2016 -Detailed -Exclude db1\r\n\r\nLots of detailed information for database and server collations for all databases except db1 on sqlserver2014a and \r\nsql2016\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlRegisteredServerName -SqlServer sql2016 | Test-DbaDatabaseCollation\r\n\r\nReturns db/server collation information for every database on every server listed in the Central Management Server on \r\nsql2016\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaDatabaseCompatibility",
        "Description": "Compares Database Compatibility level to Server Compatibility",
        "Synopsis": "Compares Database Compatibility level to Server Compatibility",
        "Name": "Test-DbaDatabaseCompatibility",
        "Links": "https://dbatools.io/Test-DbaDatabaseCompatibility",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDatabaseCompatibility -SqlServer sqlserver2014a\r\n\r\nReturns server name, databse name and true/false if the compatibility level match for all databases on sqlserver2014a\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDatabaseCompatibility -SqlServer sqlserver2014a -Databases db1, db2\r\n\r\nReturns server name, databse name and true/false if the compatibility level match for the db1 and db2 databases on \r\nsqlserver2014a\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDatabaseCompatibility -SqlServer sqlserver2014a, sql2016 -Detailed -Exclude db1\r\n\r\nLots of detailed information for database and server compatibility level for all databases except db1 on sqlserver2014a \r\nand sql2016\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlRegisteredServerName -SqlServer sql2014 | Test-DbaDatabaseCompatibility\r\n\r\nReturns db/server compatibility information for every database on every server listed in the Central Management Server \r\non sql2016\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaDatabaseOwner",
        "Description": "This function will check all databases on an instance against a SQL login to validate if that\nlogin owns those databases or not. By default, the function will check against \u0027sa\u0027 for \nownership, but the user can pass a specific login if they use something else. Only databases\nthat do not match this ownership will be displayed, but if the -Detailed switch is set all\ndatabases will be shown.\n\nBest Practice reference: http://weblogs.sqlteam.com/dang/archive/2008/01/13/Database-Owner-Troubles.aspx",
        "Synopsis": "Checks database owners against a login to validate which databases do not match that owner.",
        "Name": "Test-DbaDatabaseOwner",
        "Links": "https://dbatools.io/Test-DbaDatabaseOwner",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDatabaseOwner -SqlServer localhost\r\n\r\nReturns all databases where the owner does not match \u0027sa\u0027.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDatabaseOwner -SqlServer localhost -TargetLogin \u0027DOMAIN\\account\u0027\r\n\r\nReturns all databases where the owner does not match \u0027DOMAIN\\account\u0027. Note\r\nthat TargetLogin must be a valid security principal that exists on the target server.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaDiskAlignment",
        "Description": "Returns $true or $false by default for one server. Returns Server name and IsBestPractice for more than one server.\n \nSpecify -Detailed for additional information which returns some additional optional \"best practice\" columns, which may show false even though you pass the alignment test.\nThis is because your offset is not one of the \"expected\" values that Windows uses, but your disk is still physically aligned.\n\nPlease refer to your storage vendor best practices before following any advice below. \n By default issues with disk alignment should be resolved by a new installation of Windows Server 2008, Windows Vista, or later operating systems, but verifying disk alignment continues to be recommended as a best practice.\n While some versions of Windows use different starting alignments, if you are starting anew 1MB is generally the best practice offset for current operating systems (because it ensures that the partition offset % common stripe unit sizes == 0 ) \n\nCaveats: \n Dynamic drives (or those provisioned via third party software) may or may not have accurate results when polled by any of the built in tools, see your vendor for details.\n Windows does not have a reliable way to determine stripe unit Sizes. These values are obtained from vendor disk management software or from your SAN administrator.\n System drives in versions previous to Windows Server 2008 cannot be aligned, but it is generally not recommended to place SQL Server databases on system drives.",
        "Tags": "Storage",
        "Synopsis": "Verifies that your non-dynamic disks are aligned according to physical constraints.",
        "Name": "Test-DbaDiskAlignment",
        "Links": "https://dbatools.io/Test-DbaDiskAlignment",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDiskAlignment -ComputerName sqlserver2014a\r\n\r\nTests the disk alignment of a single server named sqlserver2014a\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDiskAlignment -ComputerName sqlserver2014a, sqlserver2014b, sqlserver2014c\r\n\r\nTests the disk alignment of mulitiple servers\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDiskAlignment -ComputerName sqlserver2014a, sqlserver2014b, sqlserver2014c -Detailed\r\n\r\nDisplays details about the disk alignmenet calcualtions from multiple servers\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaDiskAllocation",
        "Description": "Returns $true or $false by default for one server. Returns Server name and IsBestPractice for more than one server.\n\t\nSpecify -Detailed for details.\n\t\nReferences:\nhttps://technet.microsoft.com/en-us/library/dd758814(v=sql.100).aspx - \"The performance question here is usually not one of correlation per the formula, but whether the cluster size ..has been explicitly defined at 64 KB, which is a best practice for SQL Server.\"\nhttp://tk.azurewebsites.net/2012/08/",
        "Tags": [
                     "CIM",
                     "Storage"
                 ],
        "Synopsis": "Checks all disks on a computer to see if they are formatted to 64k.",
        "Name": "Test-DbaDiskAllocation",
        "Links": "https://dbatools.io/Test-DbaDiskAllocation",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDiskAllocation -ComputerName sqlserver2014a\r\n\r\nTo return true or false for any disk not being formatted to 64k\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDiskAllocation -ComputerName sqlserver2014 -Detailed\r\n\r\nTo return detailed information about disks containing SQL data from any instance being formatted to 64k\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDiskAllocation -ComputerName sqlserver2014a -NoSqlCheck\r\n\r\nTo return true or false for ALL disks being formatted to 64k\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaFullRecoveryModel",
        "Description": "When you switch a database into FULL recovery model, it will behave like a SIMPLE recovery model until a full backup is taken in order to begin a log backup chain.\nThis state is also known as \u0027pseudo-Simple\u0027.\n\nInspired by Paul Randal\u0027s post (http://www.sqlskills.com/blogs/paul/new-script-is-that-database-really-in-the-full-recovery-mode/)",
        "Tags": [
                     "DisasterRecovery",
                     "Backup"
                 ],
        "Synopsis": "Find if database is really in the Full recovery model or not.",
        "Name": "Test-DbaFullRecoveryModel",
        "Links": "https://dbatools.io/Test-DbaFullRecoveryModel",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaFullRecoveryModel -SqlServer sql2005\r\n\r\nShows all databases which actual configured recovery model is FULL and says if they are really in FULL recovery model \r\nor not\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaFullRecoveryModel -SqlServer . | Where-Object {$_.ActualRecoveryModel -ne \"FULL\"}\r\n\r\nOnly shows the databases that are in \u0027pseudo-simple\u0027 mode.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaFullRecoveryModel -SqlServer sql2008 | Sort-Object Server, ActualRecoveryModel -Descending\r\n\r\nShows all databases which actual configured recovery model is FULL and says if they are really in FULL recovery model \r\nor not. Will show in first place the ones that are in \u0027pseudo-simple\u0027 mode.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaJobOwner",
        "Description": "This function will check all SQL Agent Job on an instance against a SQL login to validate if that\nlogin owns those SQL Agent Jobs or not. By default, the function will check against \u0027sa\u0027 for \nownership, but the user can pass a specific login if they use something else. Only SQL Agent Jobs\nthat do not match this ownership will be displayed, but if the -Detailed switch is set all\nSQL Agent Jobs will be shown.\n\t\nBest practice reference: http://sqlmag.com/blog/sql-server-tip-assign-ownership-jobs-sysadmin-account",
        "Synopsis": "Checks SQL Agent Job owners against a login to validate which jobs do not match that owner.",
        "Name": "Test-DbaJobOwner",
        "Links": "https://dbatools.io/Test-DbaJobOwner",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaJobOwner -SqlServer localhost\r\n\r\nReturns all databases where the owner does not match \u0027sa\u0027.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaJobOwner -SqlServer localhost -TargetLogin DOMAIN\\account\r\n\r\nReturns all databases where the owner does not match DOMAIN\\account. Note\r\nthat TargetLogin must be a valid security principal that exists on the target server.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaLastBackup",
        "Description": "Restores all or some of the latest backups and performs a DBCC CHECKTABLE\n\n1. Gathers information about the last full backups\n2. Restores the backps to the Destination with a new name. If no Destination is specified, the originating SqlServer wil be used.\n3. The database is restored as \"dbatools-testrestore-$databaseName\" by default, but you can change dbatools-testrestore to whatever you would like using -Prefix\n4. The internal file names are also renamed to prevent conflicts with original database\n5. A DBCC CHECKTABLE is then performed\n6. And the test database is finally dropped",
        "Tags": [
                     "DisasterRecovery",
                     "Backup",
                     "Restore"
                 ],
        "Synopsis": "Quickly and easily tests the last set of full backups for a server",
        "Name": "Test-DbaLastBackup",
        "Links": "https://dbatools.io/Test-DbaLastBackup",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaLastBackup -SqlServer sql2016\r\n\r\nDetermines the last full backup for ALL databases, attempts to restore all databases (with a different name and file \r\nstructure), then performs a DBCC CHECKTABLE\r\n\r\nOnce the test is complete, the test restore will be dropped\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaLastBackup -SqlServer sql2016 -Databases master\r\n\r\nDetermines the last full backup for master, attempts to restore it, then performs a DBCC CHECKTABLE\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaLastBackup -SqlServer sql2016 -Databases model, master -VerifyOnly\r\n\r\n\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaLastBackup -SqlServer sql2016 -NoCheck -NoDrop\r\n\r\nSkips the DBCC CHECKTABLE check. This can help speed up the tests but makes it less tested. NoDrop means that the test \r\nrestores will remain on the server.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaLastBackup -SqlServer sql2016 -DataDirectory E:\\bigdrive -LogDirectory L:\\bigdrive -MaxMB 10240\r\n\r\nRestores data and log files to alternative locations and only restores databases that are smaller than 10 GB\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaMaxDop",
        "Description": "Inspired by Sakthivel Chidambaram\u0027s post about SQL Server MAXDOP Calculator (https://blogs.msdn.microsoft.com/sqlsakthi/p/maxdop-calculator-sqlserver/), \nthis script displays a SQL Server\u0027s: max dop configured, and the calculated recommendation.\n\nFor SQL Server 2016 shows:\n - Instance max dop configured and the calculated recommendation\n - max dop configured per database (new feature)\n\nMore info: \n https://support.microsoft.com/en-us/kb/2806535\n https://blogs.msdn.microsoft.com/sqlsakthi/2012/05/23/wow-we-have-maxdop-calculator-for-sql-server-it-makes-my-job-easier/\n\nThese are just general recommendations for SQL Server and are a good starting point for setting the \"max degree of parallelism\" option.\n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Synopsis": "Displays information relating to SQL Server Max Degree of Paralellism setting. Works on SQL Server 2005-2016.",
        "Name": "Test-DbaMaxDop",
        "Links": "https://dbatools.io/Test-DbaMaxDop",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaMaxDop -SqlServer sql2008, sqlserver2012\r\n\r\nGet Max DOP setting for servers sql2008 and sqlserver2012 and also the recommended one.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaMaxDop -SqlServer sql2014 -Detailed\r\n\r\nShows Max DOP setting for server sql2014 with the recommended value. As the -Detailed switch was used will also show \r\nthe \u0027NUMANodes\u0027 and \u0027NumberOfCores\u0027 of each instance\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaMaxDop -SqlServer sqlserver2016 -Detailed\r\n\r\nGet Max DOP setting for servers sql2016 with the recommended value. As the -Detailed switch was used will also show the \r\n\u0027NUMANodes\u0027 and \u0027NumberOfCores\u0027 of each instance. Because it is an 2016 instance will be shown \u0027InstanceVersion\u0027, \r\n\u0027Database\u0027 and \u0027DatabaseMaxDop\u0027 columns.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaMaxMemory",
        "Description": "Inspired by Jonathan Kehayias\u0027s post about SQL Server Max memory (http://bit.ly/sqlmemcalc), this script displays a SQL Server\u0027s: \ntotal memory, currently configured SQL max memory, and the calculated recommendation.\n\nJonathan notes that the formula used provides a *general recommendation* that doesn\u0027t account for everything that may be going on in your specific environment.",
        "Tags": "Memory",
        "Synopsis": "Calculates the recommended value for SQL Server \u0027Max Server Memory\u0027 configuration setting. Works on SQL Server 2000-2014.",
        "Name": "Test-DbaMaxMemory",
        "Links": "https://dbatools.io/Test-DbaMaxMemory",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaMaxMemory -SqlServer sqlcluster,sqlserver2012\r\n\r\nCalculate the \u0027Max Server Memory\u0027 settings for all servers within the SQL Server Central Management Server \"sqlcluster\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaMaxMemory -SqlServer sqlcluster | Where-Object { $_.SqlMaxMB -gt $_.TotalMB } | Set-DbaMaxMemory\r\n\r\nFind all servers in CMS that have Max SQL memory set to higher than the total memory of the server (think 2147483647) \r\nand set it to recommended value.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaOptimizeForAdHoc",
        "Description": "When this option is set, plan cache size is further reduced for single-use adhoc OLTP workload.\n\nMore info: https://msdn.microsoft.com/en-us/library/cc645587.aspx\nhttp://www.sqlservercentral.com/blogs/glennberry/2011/02/25/some-suggested-sql-server-2008-r2-instance-configuration-settings/\n\nThese are just general recommendations for SQL Server and are a good starting point for setting the \"optimize for adhoc workloads\" option.",
        "Author": "Brandon Abshire, netnerds.net",
        "Synopsis": "Displays information relating to SQL Server Optimize for AdHoc Workloads setting. Works on SQL Server 2008-2016.",
        "Name": "Test-DbaOptimizeForAdHoc",
        "Links": "https://dbatools.io/Test-DbaOptimizeAdHoc",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaOptimizeAdHoc -SqlServer sql2008, sqlserver2012\r\n\r\nGet Optimize for AdHoc Workloads setting for servers sql2008 and sqlserver2012 and also the recommended one.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaPowerPlan",
        "Description": "Returns $true or $false by default for one server. Returns Server name and IsBestPractice for more than one server.\n\nSpecify -Detailed for details.\n\nReferences:\nhttps://support.microsoft.com/en-us/kb/2207548\nhttp://www.sqlskills.com/blogs/glenn/windows-power-plan-effects-on-newer-intel-processors/",
        "Synopsis": "Checks SQL Server Power Plan, which Best Practices recommends should be set to High Performance",
        "Name": "Test-DbaPowerPlan",
        "Links": "https://dbatools.io/Test-DbaPowerPlan",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaPowerPlan -ComputerName sqlserver2014a\r\n\r\nTo return true or false for Power Plan being set to High Performance\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaPowerPlan -ComputerName sqlserver2014a -CustomPowerPlan \u0027Maximum Performance\u0027\r\n\r\nTo return true or false for Power Plan being set to the custom power plan called Maximum Performance\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaPowerPlan -ComputerName sqlserver2014a -Detailed\r\n\r\nTo return detailed information Power Plans\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaServerName",
        "Description": "When a SQL Server\u0027s host OS is renamed, the SQL Server should be as well. This helps with Availability Groups and Kerberos.\n\nThis command helps determine if your OS and SQL Server names match, and thus, if a rename is required.\n\nIt then checks conditions that would prevent a rename like database mirroring and replication.\n\nhttps://www.mssqltips.com/sqlservertip/2525/steps-to-change-the-server-name-for-a-sql-server-machine/",
        "Tags": "SPN",
        "Synopsis": "Tests to see if it\u0027s possible to easily rename the server at the SQL Server instance level, or if it even needs to be changed.",
        "Name": "Test-DbaServerName",
        "Links": "https://dbatools.io/Test-DbaServerName",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaServerName -SqlServer sqlserver2014a\r\n\r\nReturns ServerInstanceName, SqlServerName, IsEqual and RenameRequired for sqlserver2014a.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaServerName -SqlServer sqlserver2014a, sql2016\r\n\r\nReturns ServerInstanceName, SqlServerName, IsEqual and RenameRequired for sqlserver2014a and sql2016.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaServerName -SqlServer sqlserver2014a, sql2016 -Detailed\r\n\r\nReturns ServerInstanceName, SqlServerName, IsEqual and RenameRequired for sqlserver2014a and sql2016.\r\n\r\nIf a Rename is required, it will also show Updatable, and Reasons if the servername is not updatable.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaSpn",
        "Description": "This function is designed to take in a server name(s) and attempt to determine required SPNs. It was initially written to mimic the (previously)\nbroken functionality of the Microsoft Kerberos Configuration manager and SQL Server 2016. The functon will connect to a remote server and,\nthrough WMI, discover all running intances of SQL Server. For any instances with TCP/IP enabled, the script will determine which port(s)\nthe instances are listening on and generate the required SPNs. For named instances NOT using dynamic ports, the script will generate a port-\nbased SPN for those instances as well. At a minimum, the script will test a base, port-less SPN for each instance discovered.\n\nOnce the required SPNs are generated, the script will connect to Active Directory and search for any of the SPNs (if any) that are already\nset.\n\nThe function will return a custom object(s) that contains the server name checked, the instance name discovered, the account the service is\nrunning under, and what the \"required\" SPN should be. It will also return a boolean property indicating if the SPN is set in Active Directory\nor not.",
        "Tags": [
                     "SQLWMI",
                     "SPN"
                 ],
        "Author": "Drew Furgiuele (@pittfurg), http://www.port1433.com",
        "Synopsis": "Test-DbaSpn will determine what SPNs *should* be set for a given server (and any instances of SQL running on it) and return\nwhether the SPNs are set or not.",
        "Name": "Test-DbaSpn",
        "Links": "https://dbatools.io/Test-DbaSpn",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaSpn -ComputerName SQLSERVERA -Credential (Get-Credential)\r\n\r\nConnects to a computer (SQLSERVERA) and queries WMI for all SQL instances and return \"required\" SPNs. It will then take \r\neach SPN it generates\r\nand query Active Directory to make sure the SPNs are set.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaSpn -ComputerName SQLSERVERA,SQLSERVERB -Credential (Get-Credential)\r\n\r\nConnects to multiple computers (SQLSERVERA, SQLSERVERB) and queries WMI for all SQL instances and return \"required\" \r\nSPNs. \r\nIt will then take each SPN it generates and query Active Directory to make sure the SPNs are set.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaSpn -ComputerName SQLSERVERC -Domain domain.something -Credential (Get-Credential)\r\n\r\nConnects to a computer (SQLSERVERC) on a specified and queries WMI for all SQL instances and return \"required\" SPNs. \r\nIt will then take each SPN it generates and query Active Directory to make sure the SPNs are set. Note that the \r\ncredential you pass must\r\nhave be a valid login with appropriate rights on the domain you specify\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaValidLogin",
        "Description": "The purpose of this function is to find SQL Server logins that are used by active directory users that are either disabled or removed from the domain. It allows you to \nkeep your logins accurate and up to date by removing accounts that are no longer needed.",
        "Author": "Stephen Bennett: https://sqlnotesfromtheunderground.wordpress.com/",
        "Synopsis": "Test-DbaValidLogin Finds any logins on SQL instance that are AD logins with either disabled AD user accounts or ones that nolonger exist",
        "Name": "Test-DbaValidLogin",
        "Links": "https://dbatools.io/Test-DbaValidLogin",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaValidLogin -SqlServer Dev01\r\n\r\nTests all logins in the domain ran from (check $env:domain) that are either disabled or do not exist\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaValidLogin -SqlServer Dev01 -FilterBy GroupsOnly -Detailed\r\n\r\nTests all Active directory groups that have logins on Dev01 returning a detailed view.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaValidLogin -SqlServer Dev01 -ExcludeDomains subdomain.ad.local\r\n\r\nTests all logins excluding any that are from the mydomain Domain\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-DbaVirtualLogFile",
        "Description": "As you may already know, having a TLog file with too many VLFs can hurt database performance.\n\nToo many virtual log files can cause transaction log backups to slow down and can also slow down database recovery and, in extreme cases, even affect insert/update/delete performance.\n\n\tReferences:\n\thttp://www.sqlskills.com/blogs/kimberly/transaction-log-vlfs-too-many-or-too-few/\n\thttp://blogs.msdn.com/b/saponsqlserver/archive/2012/02/22/too-many-virtual-log-files-vlfs-can-cause-slow-database-recovery.aspx\n\nIf you\u0027ve got a high number of VLFs, you can use Expand-SqlTLogResponsibly to reduce the number.",
        "Tags": [
                     "DisasterRecovery",
                     "Backup"
                 ],
        "Synopsis": "Returns database virtual log file information for database files on a SQL instance.",
        "Name": "Test-DbaVirtualLogFile",
        "Links": "https://dbatools.io/Test-DbaVirtualLogFile",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaVirtualLogFile -SqlServer sqlcluster\r\n\r\nReturns all user database virtual log file counts for the sqlcluster instance\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaVirtualLogFile -SqlServer sqlserver | Where-Object {$_.Count -ge 50}\r\n\r\nReturns user databases that have more than or equal to 50 VLFs\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003e@(\u0027sqlserver\u0027,\u0027sqlcluster\u0027) | Test-DbaVirtualLogFile\r\n\r\nReturns all VLF information for the sqlserver and sqlcluster SQL Server instances. Processes data via the pipeline.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaVirtualLogFile -SqlServer sqlcluster -Databases db1, db2\r\n\r\nReturns VLF counts for the db1 and db2 databases on sqlcluster.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-SqlConnection",
        "Description": "Tests a the connection to a single instance and shows the output.",
        "Tags": "CIM",
        "Synopsis": "Exported function. Tests a the connection to a single instance and shows the output.",
        "Name": "Test-SqlConnection",
        "Links": null,
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-SqlConnection sql01\r\n\r\nSample output:\r\n\r\nLocal PowerShell Enviornment\r\n\r\nWindows : 10.0.10240.0\r\nPowerShell : 5.0.10240.16384\r\nCLR : 4.0.30319.42000\r\nSMO : 13.0.0.0\r\nDomainUser : True\r\nRunAsAdmin : False\r\n\r\nSQL Server Connection Information\r\n\r\nServerName : sql01\r\nBaseName : sql01\r\nInstanceName : (Default)\r\nAuthType : Windows Authentication (Trusted)\r\nConnectingAsUser : ad\\dba\r\nConnectSuccess : True\r\nSqlServerVersion : 12.0.2370\r\nAddlConnectInfo : N/A\r\nRemoteServer : True\r\nIPAddress : 10.0.1.4\r\nNetBIOSname : SQLSERVER2014A\r\nRemotingAccessible : True\r\nPingable : True\r\nDefaultSQLPortOpen : True\r\nRemotingPortOpen : True\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-SqlMigrationConstraint",
        "Description": "When you want to migrate from a higher edition to a lower one there are some features that can\u0027t be used.\nThis function will validate if you have any of this features in use and will report to you.\nThe validation will be made ONLY on on SQL Server 2008 or higher using the \u0027sys.dm_db_persisted_sku_features\u0027 dmv.\n\nThis function only validate SQL Server 2008 versions or higher.\nThe editions supported by this function are:\n - Enterprise\n - Developer\n - Evaluation\n - Standard\n - Express\n\nTake into account the new features introduced on SQL Server 2016 SP1 for all versions. More information at https://blogs.msdn.microsoft.com/sqlreleaseservices/sql-server-2016-service-pack-1-sp1-released/\n\t\nThe -Databases parameter is autopopulated for command-line completion.",
        "Synopsis": "Show if you can migrate the database(s) between the servers.",
        "Name": "Test-SqlMigrationConstraint",
        "Links": "https://dbatools.io/Test-SqlMigrationConstraint",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-SqlMigrationConstraint -Source sqlserver2014a -Destination sqlcluster\r\n\r\nDescription\r\n\r\nAll databases will be verified for features in use that can\u0027t be supported on the destination server\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-SqlMigrationConstraint -Source sqlserver2014a -Destination sqlcluster -SqlCredential $cred\r\n\r\nDescription\r\n\r\nAll databases will be verified for features in use that can\u0027t be supported on the destination server using SQL \r\ncredentials for sqlserver2014a\r\nand Windows credentials for sqlcluster.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-SqlMigrationConstraint -Source sqlserver2014a -Destination sqlcluster -Databases db1\r\n\r\nOnly db1 database will be verified for features in use that can\u0027t be supported on the destination server\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-SqlNetworkLatency",
        "Description": "This function is intended to help measure SQL Server network latency by establishing a connection and making a simple query. This is a better alternative\nthan ping because it actually creates the connection to the SQL Server, and times not ony the entire routine, but also how long the actual queries take vs\nhow long it takes to get the results.\n\nServer\nCount\nTotalMs\nAvgMs\nExecuteOnlyTotalMS\nExecuteOnlyAvgMS",
        "Synopsis": "Tests how long a query takes to return from SQL Server",
        "Name": "Test-SqlNetworkLatency",
        "Links": "https://dbatools.io/Test-SqlNetworkLatency",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-SqlNetworkLatency -SqlServer sqlserver2014a, sqlcluster\r\n\r\nTimes the roundtrip return of \"SELECT TOP 100 * FROM information_schema.tables\" on sqlserver2014a and sqlcluster using \r\nWindows credentials.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-SqlNetworkLatency -SqlServer sqlserver2014a -SqlCredential $cred\r\n\r\nTimes the execution results return of \"SELECT TOP 100 * FROM information_schema.tables\" on sqlserver2014a using SQL \r\ncredentials.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-SqlNetworkLatency -SqlServer sqlserver2014a, sqlcluster, sqlserver -Query \"select top 10 * from \r\notherdb.dbo.table\" -Count 10\r\n\r\nTimes the execution results return of \"select top 10 * from otherdb.dbo.table\" 10 times on sqlserver2014a, sqlcluster, \r\nand sqlserver using Windows credentials.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-SqlPath",
        "Description": "Uses master.dbo.xp_fileexist to determine if a file or directory exists",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Tests if file or directory exists from the perspective of the SQL Server service account",
        "Name": "Test-SqlPath",
        "Links": "https://dbatools.io/Test-SqlPath",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-SqlPath -SqlServer sqlcluster -Path L:\\MSAS12.MSSQLSERVER\\OLAP\r\n\r\nTests whether the service account running the \"sqlcluster\" SQL Server isntance can access L:\\MSAS12.MSSQLSERVER\\OLAP. \r\nLogs into sqlcluster using Windows credentials.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e$credential = Get-Credential\r\n\r\nTest-SqlPath -SqlServer sqlcluster -SqlCredential $credential -Path L:\\MSAS12.MSSQLSERVER\\OLAP\r\n\r\nTests whether the service account running the \"sqlcluster\" SQL Server isntance can access L:\\MSAS12.MSSQLSERVER\\OLAP. \r\nLogs into sqlcluster using SQL authentication.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-SqlTempDbConfiguration",
        "Description": "Evaluates tempdb aganst a set of rules to match best practices. The rules are:\nTF 1118 enabled - Is Trace Flag 1118 enabled (See KB328551).\nFile Count - Does the count of data files in tempdb match the number of logical cores, up to 8.\nFile Growth - Are any files set to have percentage growth, as best practice is all files have an explicit growth value.\nFile Location - Is tempdb located on the C:\\? Best practice says to locate it elsewhere.\nFile MaxSize Set(optional) - Do any files have a max size value? Max size could cause tempdb problems if it isn\u0027t allowed to grow.\n\nOther rules can be added at a future date. Only results that don\u0027t match best practices will be displayed. To display all results,\nuse the -Detailed switch.",
        "Synopsis": "Evaluates tempdb against several rules to match best practices.",
        "Name": "Test-SqlTempDbConfiguration",
        "Links": "https://dbatools.io/Test-SqlTempDbConfiguration",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-SqlTempDbConfiguration -SqlServer localhost\r\n\r\nChecks tempdb on the localhost machine.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-SqlTempDbConfiguration -SqlServer localhost -Detailed\r\n\r\nChecks tempdb on the localhost machine. All rest results are shown.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Uninstall-DbaWatchUpdate",
        "Description": "Removes the scheduled task created for Watch-DbaUpdate by Install-DbaWatchUpdate so that notifications no longer pop up.",
        "Tags": "JustForFun",
        "Synopsis": "Removes the scheduled task created for Watch-DbaUpdate by Install-DbaWatchUpdate so that notifications no longer pop up.",
        "Name": "Uninstall-DbaWatchUpdate",
        "Links": "https://dbatools.io/Uninstall-DbaWatchUpdate",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eUninstall-DbaWatchUpdate\r\n\r\nRemoves the scheduled task created by Install-DbaWatchUpdate.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Update-dbatools",
        "Description": "Exported function. Updates dbatools. Deletes current copy and replaces it with freshest copy.",
        "Synopsis": "Exported function. Updates dbatools. Deletes current copy and replaces it with freshest copy.",
        "Name": "Update-dbatools",
        "Links": "https://dbatools.io/Update-dbatools",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eUpdate-dbatools\r\n\r\nUpdates dbatools. Deletes current copy and replaces it with freshest copy.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Update-SqlWhoIsActive",
        "Description": "If -Path is not specified, this command downloads, extracts and updates sp_whoisactive with Adam\u0027s permission. \n\nTo read more about sp_WhoIsActive, please visit http://sqlblog.com/blogs/adam_machanic/archive/tags/who+is+active/default.aspx\n\nAlso, consider donating to Adam if you find this stored procedure helpful: http://tinyurl.com/WhoIsActiveDonate",
        "Synopsis": "Automatically updates sp_WhoIsActive by Adam Machanic.",
        "Name": "Update-SqlWhoIsActive",
        "Links": "https://dbatools.io/Update-SqlWhoIsActive",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eUpdate-SqlWhoIsActive -SqlServer sqlserver2014a -Database master\r\n\r\nUpdates sp_WhoIsActive to sqlserver2014a\u0027s master database. Logs in using Windows Authentication.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eUpdate-SqlWhoIsActive -SqlServer sqlserver2014a -SqlCredential $cred\r\n\r\nPops up a dialog box asking which database on sqlserver2014a you want to install the proc to. Logs into SQL Server \r\nusing SQL Authentication.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Watch-DbaUpdate",
        "Description": "Just for fun - checks the PowerShell Gallery every 3 hours for updates to dbatools. Notifies once max per release.\n\t\nAnyone know how to make it clickable so that it opens an URL?",
        "Tags": "JustForFun",
        "Synopsis": "Just for fun - checks the PowerShell Gallery every 3 hours for updates to dbatools. Notifies once max per release.",
        "Name": "Watch-DbaUpdate",
        "Links": "https://dbatools.io/Watch-DbaUpdate",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eWatch-DbaUpdate\r\n\r\nWatches the gallery for updates to dbatools.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Watch-SqlDbLogin",
        "Description": "Watch-SqlDbLogin uses SQL Server process enumeration to track logins in a SQL Server table. This is helpful when you \nneed to migrate a SQL Server, and update connection strings, but have inadequate documentation on which servers/applications \nare logging into your SQL instance. \n\nRunning this script every 5 minutes for a week should give you a sufficient idea about database and login usage.",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Tracks SQL Server logins: which host they came from, what database they\u0027re using, and what program is being used to log in.",
        "Name": "Watch-SqlDbLogin",
        "Links": "https://dbatools.io/Watch-SqlDbLogin",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eWatch-SqlDbLogin -SqlServer sqlserver -SqlCms SqlCms1\r\n\r\nIn the above example, a list of servers is generated using all database instances within the Central Management Server \r\n\"SqlCms1\". Using this list, the script then enumerates all the processes and gathers login information, and saves it to \r\nthe table \"Dblogins\" within the \"DatabaseLogins\" database on the SQL Server \"sqlserver\".\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eWatch-SqlDbLogin -SqlServer sqlcluster -Database CentralAudit -ServersFromFile .\\sqlservers.txt\r\n\r\nIn the above example, a list of servers is gathered from the file sqlservers.txt in the current directory. Using this \r\nlist, the script then enumerates all the processes and gathers login information, and saves it to the table \"Dblogins\" \r\nwithin the \"CentralAudit\" database on the SQL Server \"sqlcluster\".\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eWatch-SqlDbLogin -SqlServer sqlserver -SqlCms SqlCms1 -SqlCmsGroups SQL2014Clusters -SqlCredential $cred\r\n\r\nIn the above example, a list of servers is generated using database instance names within the \"SQL2014Clusters\" group \r\non the Central Management Server \"SqlCms1\". Using this list, the script then enumerates all the processes and gathers \r\nlogin information, and saves it to the table \"Dblogins\" within the \"DatabaseLogins\" database on \"sqlserver\".\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Write-DbaDataTable",
        "Description": "Writes a .NET DataTable to a SQL Server table using SQL Bulk Copy",
        "Synopsis": "Writes data to a SQL Server Table",
        "Name": "Write-DbaDataTable",
        "Links": "https://dbatools.io/Write-DbaDataTable",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003e$datatable = Import-Csv C:\\temp\\customers.csv | Out-DbaDataTable\r\n\r\nWrite-DbaDataTable -SqlServer sql2014 -InputObject $datatable -Table mydb.dbo.customers\r\n\r\nQuickly and efficiently performs a bulk insert of all the data in customers.csv into database: mydb, schema: dbo, \r\ntable: customers\r\nShows progress as rows are inserted. If table does not exist, import is halted.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003e$datatable = Import-Csv C:\\temp\\customers.csv | Out-DbaDataTable\r\n\r\n$datatable | Write-DbaDataTable -SqlServer sql2014 -Table mydb.dbo.customers\r\n\r\nPerforms row by row insert. Super slow. No progress bar. Don\u0027t do this. Use -InputObject instead.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003e$datatable = Import-Csv C:\\temp\\customers.csv | Out-DbaDataTable\r\n\r\nWrite-DbaDataTable -SqlServer sql2014 -InputObject $datatable -Table mydb.dbo.customers -AutoCreateTable\r\n\r\nQuickly and efficiently performs a bulk insert of all the data. If mydb.dbo.customers does not exist, it will be \r\ncreated with inefficient but forgiving datatypes.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003e$datatable = Import-Csv C:\\temp\\customers.csv | Out-DbaDataTable\r\n\r\nWrite-DbaDataTable -SqlServer sql2014 -InputObject $datatable -Table mydb.dbo.customers -Truncate\r\n\r\nQuickly and efficiently performs a bulk insert of all the data. Prompts to confirm that truncating mydb.dbo.customers \r\nprior to import is desired.\r\nPrompts again to perform the import. Answer A for Yes to All.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 5 --------------------------\r\n\r\nPS C:\\\u003e$datatable = Import-Csv C:\\temp\\customers.csv | Out-DbaDataTable\r\n\r\nWrite-DbaDataTable -SqlServer sql2014 -InputObject $datatable -Database mydb -Table customers -KeepNulls\r\n\r\nQuickly and efficiently performs a bulk insert of all the data into mydb.dbo.customers -- since Schema was not \r\nspecified, dbo was used.\r\n\t\r\nPer Microsoft, KeepNulls will \"Preserve null values in the destination table regardless of the settings for default \r\nvalues. When not specified, null values are replaced by default values where applicable.\"\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlJobServer",
        "Description": "This function could use some refining, as *all* job objects are copied. \n\nTHIS CODE IS PROVIDED \"AS IS\", WITH NO WARRANTIES.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copies *all* ProxyAccounts, JobSchedule, SharedSchedules, AlertSystem, JobCategories, \nOperatorCategories AlertCategories, Alerts, TargetServerGroups, TargetServers, \nOperators, Jobs, Mail and general SQL Agent settings from one SQL Server Agent \nto another. $sourceserver and $destserver are SMO server objects. \n\nIgnores -force: does not drop and recreate.",
        "Name": "Copy-SqlServerAgent",
        "Links": "https://dbatools.io/Copy-SqlServerAgent",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlServerAgent -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all job server objects from sqlserver2014a to sqlcluster, using Windows credentials. If job objects with the \r\nsame name exist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlServerAgent -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred\r\n\r\nCopies all job objects from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and Windows \r\ncredentials for sqlcluster.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlServerTrigger -Source sqlserver2014a -Destination sqlcluster -WhatIf\r\n\r\nShows what would happen if the command were executed.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Copy-SqlUserDefinedMessage",
        "Description": "By default, all custom errors are copied. The -CustomErrors parameter is autopopulated for command-line completion and can be used to copy only specific custom errors.\n\nIf the custom error already exists on the destination, it will be skipped unless -Force is used. Interesting fact, if you drop the us_english version, all the other languages will be dropped for that specific ID as well.\n\nAlso, the us_english version must be created first.",
        "Tags": "Migration",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "Copy-SqlCustomError migrates custom errors (user defined messages) from one SQL Server to another.",
        "Name": "Copy-SqlCustomError",
        "Links": "https://dbatools.io/Copy-SqlCustomError",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlCustomError -Source sqlserver2014a -Destination sqlcluster\r\n\r\nCopies all server custom errors from sqlserver2014a to sqlcluster, using Windows credentials. If custom errors with the \r\nsame name exist on sqlcluster, they will be skipped.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlCustomError -Source sqlserver2014a -Destination sqlcluster -Trigger 60000 -SourceSqlCredential $cred \r\n-Force\r\n\r\nCopies a single custom error, the custom error with ID number 6000 from sqlserver2014a to sqlcluster, using SQL \r\ncredentials for sqlserver2014a and Windows credentials for sqlcluster. If a custom error with the same name exists on \r\nsqlcluster, it will be updated because -Force was used.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eCopy-SqlCustomError -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\r\n\r\nShows what would happen if the command were executed using force.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-DiskSpace",
        "Description": "Returns a custom object with Server name, name of disk, label of disk, total size, free size, percent free, block size and filesystem.\n\nBy default, this funtion only shows drives of type 2 and 3 (removable disk and local disk).\n\nRequires: Windows administrator access on SQL Servers",
        "Tags": "Storage",
        "Author": "Chrissy LeMaire (clemaire@gmail.com) \u0026 Jakob Bindslet (jakob@bindslet.dk)",
        "Synopsis": "Displays Disk information for all local drives on a server",
        "Name": "Get-DbaDiskSpace",
        "Links": "https://dbatools.io/Get-DbaDiskSpace",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDiskSpace -ComputerName srv0042 | Format-Table -AutoSize\r\n\r\nGet diskspace for the server srv0042\r\n\r\nServer Name Label SizeInGB FreeInGB PercentFree BlockSize\r\n------ ---- ----- -------- -------- ----------- ---------\r\nsrv0042 C:\\ System 126,45 114,12 90,25 4096\r\nsrv0042 E:\\ Data1 97,62 96,33 98,67 4096\r\nsrv0042 F:\\ DATA2 29,2 29,2 100 16384\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDiskSpace -ComputerName srv0042 -Unit MB | Format-Table -AutoSize\r\n\r\nGet diskspace for the server srv0042, display in MB\r\n\r\nServer Name Label SizeInMB FreeInMB PercentFree BlockSize\r\n------ ---- ----- -------- -------- ----------- ---------\r\nsrv0042 C:\\ System 129481 116856,11 90,25 4096\r\nsrv0042 E:\\ Data1 99968 98637,56 98,67 4096\r\nsrv0042 F:\\ DATA2 29901 29900,92 100 16384\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDiskSpace -ComputerName srv0042, srv0007 -Unit TB | Format-Table -AutoSize\r\n\r\nGet diskspace from two servers, display in TB\r\n\r\nServer Name Label SizeInTB FreeInTB PercentFree BlockSize\r\n------ ---- ----- -------- -------- ----------- ---------\r\nsrv0042 C:\\ System 0,12 0,11 90,25 4096\r\nsrv0042 E:\\ Data1 0,1 0,09 98,67 4096\r\nsrv0042 F:\\ DATA2 0,03 0,03 100 16384\r\nsrv0007 C:\\ System 0,07 0,01 11,92 4096\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 4 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaDiskSpace -ComputerName srv0042 -Detailed | Format-Table -AutoSize\r\n\r\nGet detailed diskspace information\r\n\r\nServer Name Label SizeInGB FreeInGB PercentFree BlockSize IsSqlDisk \r\nFileSystem DriveType\r\n------ ---- ----- -------- -------- ----------- --------- --------- \r\n---------- ---------\r\nsrv0042 C:\\ System 126,45 114,12 90,25 4096 False \r\nNTFS Local Disk\r\nsrv0042 E:\\ Data1 97,62 96,33 98,67 4096 False \r\nReFS Local Disk\r\nsrv0042 F:\\ DATA2 29,2 29,2 100 16384 False \r\nFAT32 Local Disk\r\nsrv0042 \\\\?\\Volume{7a31be94-b842-42f5-af71-e0464a1a9803}\\ Recovery 0,44 0,13 30,01 4096 False \r\nNTFS Local Disk\r\nsrv0042 D:\\ 0 0 0 False \r\n Compact Disk\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Get-SqlMaxMemory",
        "Description": "This command retrieves the SQL Server \u0027Max Server Memory\u0027 configuration setting as well as the total physical installed on the server.",
        "Tags": "Memory",
        "Synopsis": "Gets the \u0027Max Server Memory\u0027 configuration setting and the memory of the server. Works on SQL Server 2000-2014.",
        "Name": "Get-DbaMaxMemory",
        "Links": "https://dbatools.io/Get-DbaMaxMemory",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaMaxMemory -SqlServer sqlcluster,sqlserver2012\r\n\r\nGet memory settings for all servers within the SQL Server Central Management Server \"sqlcluster\".\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eGet-DbaMaxMemory -SqlServer sqlcluster | Where-Object { $_.SqlMaxMB -gt $_.TotalMB }\r\n\r\nFind all servers in Server Central Management Server that have \u0027Max Server Memory\u0027 set to higher than the total memory \r\nof the server (think 2147483647)\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Reset-SqlSaPassword",
        "Description": "This function allows administrators to regain access to local or remote SQL Servers by either resetting the sa password, adding sysadmin role to existing login,\nor adding a new login (SQL or Windows) and granting it sysadmin privileges.\n\nThis is accomplished by stopping the SQL services or SQL Clustered Resource Group, then restarting SQL via the command-line\nusing the /mReset-SqlAdmin paramter which starts the server in Single-User mode, and only allows this script to connect.\n\nOnce the service is restarted, the following tasks are performed:\n- Login is added if it doesn\u0027t exist\n- If login is a Windows User, an attempt is made to ensure it exists\n- If login is a SQL Login, password policy will be set to OFF when creating the login, and SQL Server authentication will be set to Mixed Mode.\n- Login will be enabled and unlocked\n- Login will be added to sysadmin role\n\nIf failures occur at any point, a best attempt is made to restart the SQL Server.\n\nIn order to make this script as portable as possible, System.Data.SqlClient and Get-WmiObject are used (as opposed to requiring the Failover Cluster Admin tools or SMO).\nIf using this function against a remote SQL Server, ensure WinRM is configured and accessible. If this is not possible, run the script locally.\n\nTested on Windows XP, 7, 8.1, Server 2012 and Windows Server Technical Preview 2.\nTested on SQL Server 2005 SP4 through 2016 CTP2.",
        "Tags": "WSMan",
        "Author": "Chrissy LeMaire (@cl), netnerds.net",
        "Synopsis": "This function will allow administrators to regain access to SQL Servers in the event that passwords or access was lost.\n\nSupports SQL Server 2005 and above. Windows administrator access is required.",
        "Name": "Reset-SqlAdmin",
        "Links": "https://dbatools.io/Reset-SqlAdmin",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eReset-SqlAdmin -SqlServer sqlcluster\r\n\r\nPrompts for password, then resets the \"sa\" account password on sqlcluster.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eReset-SqlAdmin -SqlServer sqlserver\\sqlexpress -Login ad\\administrator\r\n\r\nPrompts user to confirm that they understand the SQL Service will be restarted.\r\n\r\nAdds the domain account \"ad\\administrator\" as a sysadmin to the SQL instance. \r\nIf the account already exists, it will be added to the sysadmin role.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eReset-SqlAdmin -SqlServer sqlserver\\sqlexpress -Login sqladmin -Force\r\n\r\nSkips restart confirmation, prompts for passsword, then adds a SQL Login \"sqladmin\" with sysadmin privleges. \r\nIf the account already exists, it will be added to the sysadmin role and the password will be reset.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Restore-HallengrenBackup",
        "Description": "Many SQL Server database administrators use Ola Hallengren\u0027s SQL Server Maintenance Solution which can be found at http://ola.hallengren.com\nHallengren uses a predictable backup structure which made it relatively easy to create a script that can restore an entire SQL Server database instance, down to the master database (next version), to a new server. This script is intended to be used in the event that the originating SQL Server becomes unavailable, thus rendering my other SQL restore script (http://goo.gl/QmfQ6s) ineffective.",
        "Tags": [
                     "DisasterRecovery",
                     "Backup",
                     "Restore"
                 ],
        "Synopsis": "Restores SQL Server databases from the backup directory structure created by Ola Hallengren\u0027s database maintenance scripts. Different structures coming soon.",
        "Name": "Restore-SqlBackupFromDirectory",
        "Links": "https://dbatools.io/Restore-SqlBackupFromDirectory",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eRestore-SqlBackupFromDirectory -ServerName sqlcluster -Path \\\\fileserver\\share\\sqlbackups\\SQLSERVER2014A\r\n\r\nDescription\r\n\r\nAll user databases contained within \\\\fileserver\\share\\sqlbackups\\SQLSERVERA will be restored to sqlcluster, down the \r\nmost recent full/differential/logs.\r\n\r\n\r\nRequires -Version 3.0\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Set-SqlMaxMemory",
        "Description": "Sets SQL Server max memory then displays information relating to SQL Server Max Memory configuration settings. \n\nInspired by Jonathan Kehayias\u0027s post about SQL Server Max memory (http://bit.ly/sqlmemcalc), this uses a formula to \ndetermine the default optimum RAM to use, then sets the SQL max value to that number.\n\nJonathan notes that the formula used provides a *general recommendation* that doesn\u0027t account for everything that may \nbe going on in your specific environment.",
        "Synopsis": "Sets SQL Server \u0027Max Server Memory\u0027 configuration setting to a new value then displays information this setting.",
        "Name": "Set-DbaMaxMemory",
        "Links": "https://dbatools.io/Set-DbaMaxMemory",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaMaxMemory sqlserver1\r\n\r\nSet max memory to the recommended MB on just one server named \"sqlserver1\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eSet-DbaMaxMemory -SqlServer sqlserver1 -MaxMb 2048\r\n\r\nExplicitly max memory to 2048 MB on just one server, \"sqlserver1\"\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eGet-SqlRegisteredServerName -SqlServer sqlserver| Test-DbaMaxMemory | Where-Object { $_.SqlMaxMB -gt $_.TotalMB \r\n} | Set-DbaMaxMemory\r\n\r\nFind all servers in SQL Server Central Management server that have Max SQL memory set to higher than the total memory \r\nof the server (think 2147483647), then pipe those to Set-DbaMaxMemory and use the default recommendation.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Show-SqlMigrationConstraint",
        "Description": "When you want to migrate from a higher edition to a lower one there are some features that can\u0027t be used.\nThis function will validate if you have any of this features in use and will report to you.\nThe validation will be made ONLY on on SQL Server 2008 or higher using the \u0027sys.dm_db_persisted_sku_features\u0027 dmv.\n\nThis function only validate SQL Server 2008 versions or higher.\nThe editions supported by this function are:\n - Enterprise\n - Developer\n - Evaluation\n - Standard\n - Express\n\nTake into account the new features introduced on SQL Server 2016 SP1 for all versions. More information at https://blogs.msdn.microsoft.com/sqlreleaseservices/sql-server-2016-service-pack-1-sp1-released/\n\t\nThe -Databases parameter is autopopulated for command-line completion.",
        "Synopsis": "Show if you can migrate the database(s) between the servers.",
        "Name": "Test-SqlMigrationConstraint",
        "Links": "https://dbatools.io/Test-SqlMigrationConstraint",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-SqlMigrationConstraint -Source sqlserver2014a -Destination sqlcluster\r\n\r\nDescription\r\n\r\nAll databases will be verified for features in use that can\u0027t be supported on the destination server\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-SqlMigrationConstraint -Source sqlserver2014a -Destination sqlcluster -SqlCredential $cred\r\n\r\nDescription\r\n\r\nAll databases will be verified for features in use that can\u0027t be supported on the destination server using SQL \r\ncredentials for sqlserver2014a\r\nand Windows credentials for sqlcluster.\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-SqlMigrationConstraint -Source sqlserver2014a -Destination sqlcluster -Databases db1\r\n\r\nOnly db1 database will be verified for features in use that can\u0027t be supported on the destination server\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    },
    {
        "CommandName": "Test-SqlDiskAllocation",
        "Description": "Returns $true or $false by default for one server. Returns Server name and IsBestPractice for more than one server.\n\t\nSpecify -Detailed for details.\n\t\nReferences:\nhttps://technet.microsoft.com/en-us/library/dd758814(v=sql.100).aspx - \"The performance question here is usually not one of correlation per the formula, but whether the cluster size ..has been explicitly defined at 64 KB, which is a best practice for SQL Server.\"\nhttp://tk.azurewebsites.net/2012/08/",
        "Tags": [
                     "CIM",
                     "Storage"
                 ],
        "Synopsis": "Checks all disks on a computer to see if they are formatted to 64k.",
        "Name": "Test-DbaDiskAllocation",
        "Links": "https://dbatools.io/Test-DbaDiskAllocation",
        "Examples": "\r\n-------------------------- EXAMPLE 1 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDiskAllocation -ComputerName sqlserver2014a\r\n\r\nTo return true or false for any disk not being formatted to 64k\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 2 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDiskAllocation -ComputerName sqlserver2014 -Detailed\r\n\r\nTo return detailed information about disks containing SQL data from any instance being formatted to 64k\r\n\r\n\r\n\r\n\r\n-------------------------- EXAMPLE 3 --------------------------\r\n\r\nPS C:\\\u003eTest-DbaDiskAllocation -ComputerName sqlserver2014a -NoSqlCheck\r\n\r\nTo return true or false for ALL disks being formatted to 64k\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    }
]