bin/dbatools-index.json
[
{ "Name": "Add-DbaAgDatabase", "Description": "Adds database(s) to an Availability Group on a SQL Server instance.\n\nAfter checking for prerequisites, the commands runs these five steps for every database:\nStep 1: Setting seeding mode if needed.\n If -SeedingMode is used and the current seeding mode of the replica is not in the desired mode, the seeding mode of the replica is changed.\n The seeding mode will not be changed back but stay in this mode.\n If the seeding mode is changed to Automatic, the necessary rigths to create databases will be granted.\nStep 2: Running backup and restore if needed.\n Action is only taken for replicas with a desired seeding mode of Manual and where the database does not yet exist.\n If -UseLastBackup is used, the restore will be performed based on the backup history of the database.\n Otherwise a full and log backup will be taken at the primary and those will be restored at the replica.\nStep 3: Add the database to the Availability Group on the primary replica.\nStep 4: Add the database to the Availability Group on the secondary replicas.\nStep 5: Wait for the database to finish joining the Availability Group on the secondary replicas.\n\nUse Test-DbaAvailabilityGroup with -AddDatabase to test if all prerequisites are met.\n\nIn case you need a special setup for the database at the replicas, please do the backup restore part\n\nIf you have special requirements for the setup for the database at the replicas,\nperform the backup and restore part with Backup-DbaDatabase and Restore-DbaDatabase in advance.\nPlease make sure that the last log backup has been restored before running Add-DbaAgDatabase.\n\nKnown limitations:\n\nIt is not possible to use this command to add the database to a newly added replica,\nbecause the command fails if the database is already part of the Availability Group.\nThis limitation will be removed in a later version.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Adds database(s) to an Availability Group on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net | Andreas Jordan (@JordanOrdix), ordix.de", "CommandName": "Add-DbaAgDatabase", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Add-DbaAgDatabase", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eAdd-DbaAgDatabase -SqlInstance sql2017a -AvailabilityGroup ag1 -Database db1, db2 -Confirm\nAdds db1 and db2 to ag1 on sql2017a. Prompts for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2017a | Out-GridView -Passthru | Add-DbaAgDatabase -AvailabilityGroup ag1\nAdds selected databases from sql2017a to ag1\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbSharePoint -SqlInstance sqlcluster | Add-DbaAgDatabase -AvailabilityGroup SharePoint\nAdds SharePoint databases as found in SharePoint_Config on sqlcluster to ag1 on sqlcluster\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbSharePoint -SqlInstance sqlcluster -ConfigDatabase SharePoint_Config_2019 | Add-DbaAgDatabase -AvailabilityGroup SharePoint\nAdds SharePoint databases as found in SharePoint_Config_2019 on sqlcluster to ag1 on sqlcluster", "Params": [ [ "SqlInstance", "The primary replica of the Availability Group. Server version must be SQL Server version 2012 or higher.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "The name of the Availability Group where the databases will be added.", "", true, "false", "", "" ], [ "Database", "The database(s) to add.", "", true, "false", "", "" ], [ "Secondary", "Not required - the command will figure this out. But use this parameter if secondary replicas listen on a non default port.", "", false, "false", "", "" ], [ "SecondarySqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase, Get-DbaDbSharePoint and more.", "", true, "true (ByValue)", "", "" ], [ "SeedingMode", "Specifies how the secondary replica will be initially seeded.\nAutomatic enables direct seeding. This method will seed the secondary replica over the network. This method does not require you to backup and restore a copy of the primary database on the replica.\nManual uses full and log backup to initially transfer the data to the secondary replica. The command skips this if the database is found in restoring state at the secondary replica.\nIf not specified, the setting from the availability group replica will be used. Otherwise the setting will be updated.", "", false, "false", "", "Automatic,Manual" ], [ "SharedPath", "The network share where the backups will be backed up and restored from.\nEach SQL Server service account must have access to this share.\nNOTE: If a backup / restore is performed, the backups will be left in tact on the network share.", "", false, "false", "", "" ], [ "UseLastBackup", "Use the last full and log backup of the database. A log backup must be the last backup.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Add-DbaAgDatabase [-SqlInstance] \u003cDbaInstanceParameter\u003e [-SqlCredential \u003cPSCredential\u003e] -AvailabilityGroup \u003cString\u003e -Database \u003cString[]\u003e [-Secondary \u003cDbaInstanceParameter[]\u003e] [-SecondarySqlCredential \u003cPSCredential\u003e] [-SeedingMode \u003cString\u003e] [-SharedPath \u003cString\u003e] [-UseLastBackup] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nAdd-DbaAgDatabase [-AvailabilityGroup] \u003cString\u003e [-Secondary \u003cDbaInstanceParameter[]\u003e] [-SecondarySqlCredential \u003cPSCredential\u003e] -InputObject \u003cDatabase[]\u003e [-SeedingMode \u003cString\u003e] [-SharedPath \u003cString\u003e] [-UseLastBackup] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Add-DbaAgListener", "Description": "Adds a listener to an availability group on a SQL Server instance.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Adds a listener to an availability group on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Add-DbaAgListener", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Add-DbaAgListener", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eAdd-DbaAgListener -SqlInstance sql2017 -AvailabilityGroup SharePoint -IPAddress 10.0.20.20\nCreates a listener on 10.0.20.20 port 1433 for the SharePoint availability group on sql2017.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sql2017 -AvailabilityGroup availabilitygroup1 | Add-DbaAgListener -Dhcp\nCreates a listener on port 1433 with a dynamic IP for the group1 availability group on sql2017.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eAdd-DbaAgListener -SqlInstance sql2017 -AvailabilityGroup SharePoint -IPAddress 10.0.20.20,10.1.77.77 -SubnetMask 255.255.252.0\nCreates a multi-subnet listener with 10.0.20.20 and 10.1.77.77, on two /22 subnets, on port 1433 for the SharePoint availability group on sql2017.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the SqlInstance instance using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)", "", false, "false", "", "" ], [ "AvailabilityGroup", "The Availability Group to which a listener will be bestowed upon.", "", false, "false", "", "" ], [ "Name", "The name of the listener. If one is not specified, the Availability Group name will be used.\nNote that Name cannot be used with Multiple Ags.", "", false, "false", "", "" ], [ "IPAddress", "Sets the IP address(es) of the availability group listener.", "", false, "false", "", "" ], [ "SubnetIP", "Sets the Subnet IP address(es) of the availability group listener.", "", false, "false", "", "" ], [ "SubnetMask", "Sets the subnet IP mask(s) of the availability group listener. Defaults to 255.255.255.0.", "", false, "false", "255.255.255.0", "" ], [ "Port", "Sets the port number used to communicate with the availability group. Defaults to 1433.", "", false, "false", "1433", "" ], [ "Dhcp", "Indicates whether the listener uses DHCP.", "", false, "false", "False", "" ], [ "Passthru", "Don\u0027t create the listener, just pass thru an object that can be further customized before creation.", "", false, "false", "False", "" ], [ "InputObject", "Enables piping from Get-DbaAvailabilityGroup", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Add-DbaAgListener [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [[-Name] \u003cString\u003e] [[-IPAddress] \u003cIPAddress[]\u003e] [[-SubnetIP] \u003cIPAddress[]\u003e] [[-SubnetMask] \u003cIPAddress[]\u003e] [[-Port] \u003cInt32\u003e] [-Dhcp] [-Passthru] [[-InputObject] \u003cAvailabilityGroup[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Add-DbaAgReplica", "Description": "Adds a replica to an availability group on one or more SQL Server instances.\n\nAutomatically creates database mirroring endpoints if required.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Adds a replica to an availability group on one or more SQL Server instances.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Add-DbaAgReplica", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Add-DbaAgReplica", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sql2017a -AvailabilityGroup SharePoint | Add-DbaAgReplica -SqlInstance sql2017b\nAdds sql2017b to the SharePoint availability group on sql2017a\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sql2017a -AvailabilityGroup SharePoint | Add-DbaAgReplica -SqlInstance sql2017b -FailoverMode Manual\nAdds sql2017b to the SharePoint availability group on sql2017a with a manual failover mode.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sql2017a -AvailabilityGroup SharePoint | Add-DbaAgReplica -SqlInstance sql2017b -EndpointUrl \u0027TCP://sql2017b.specialnet.local:5022\u0027\nAdds sql2017b to the SharePoint availability group on sql2017a with a custom endpoint URL.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instances using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "The name of the replica. Defaults to the SQL Server instance name.\nThis parameter is only supported if the replica is added to just one instance.", "", false, "false", "", "" ], [ "AvailabilityMode", "Sets the availability mode of the availability group replica. Options are: AsynchronousCommit and SynchronousCommit. SynchronousCommit is default.", "", false, "false", "SynchronousCommit", "AsynchronousCommit,SynchronousCommit" ], [ "FailoverMode", "Sets the failover mode of the availability group replica. Options are Automatic and Manual. Automatic is default.", "", false, "false", "Automatic", "Automatic,Manual,External" ], [ "BackupPriority", "Sets the backup priority availability group replica. Default is 50.", "", false, "false", "50", "" ], [ "ConnectionModeInPrimaryRole", "Specifies the connection intent mode of an Availability Replica in primary role. AllowAllConnections by default.", "", false, "false", "AllowAllConnections", "AllowAllConnections,AllowReadWriteConnections" ], [ "ConnectionModeInSecondaryRole", "Specifies the connection modes of an Availability Replica in secondary role.\r\nOptions include: AllowNoConnections, AllowReadIntentConnectionsOnly, AllowAllConnections\nDefaults to AllowNoConnections.\nThe default can be changed with:\r\nSet-DbatoolsConfig -FullName \u0027AvailabilityGroups.Default.ConnectionModeInSecondaryRole\u0027 -Value \u0027...\u0027 -Passthru | Register-DbatoolsConfig", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027AvailabilityGroups.Default.ConnectionModeInSecondaryRole\u0027 -Fallback \u0027AllowNoConnections\u0027)", "AllowNoConnections,AllowReadIntentConnectionsOnly,AllowAllConnections" ], [ "SeedingMode", "Specifies how the secondary replica will be initially seeded.\nAutomatic enables direct seeding. This method will seed the secondary replica over the network. This method does not require you to backup and restore a copy of the primary database on the replica.\nManual requires you to create a backup of the database on the primary replica and manually restore that backup on the secondary replica.", "", false, "false", "", "Automatic,Manual" ], [ "Endpoint", "By default, this command will attempt to find a DatabaseMirror endpoint. If one does not exist, it will create it.\nIf an endpoint must be created, the name \"hadr_endpoint\" will be used. If an alternative is preferred, use Endpoint.", "", false, "false", "", "" ], [ "EndpointUrl", "By default, the property Fqdn of Get-DbaEndpoint is used as EndpointUrl.\nUse EndpointUrl if a different URL is required due to special network configurations.\r\nEndpointUrl has to be an array of strings in format \u0027TCP://system-address:port\u0027, one entry for every instance.\r\nSee details at: https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/specify-endpoint-url-adding-or-modifying-availability-replica", "", false, "false", "", "" ], [ "Passthru", "Don\u0027t create the replica, just pass thru an object that can be further customized before creation.", "", false, "false", "False", "" ], [ "ReadOnlyRoutingList", "Sets the read only routing ordered list of replica server names to use when redirecting read-only connections through this availability replica.\nThis parameter is only supported if the replica is added to just one instance.", "", false, "false", "", "" ], [ "ReadonlyRoutingConnectionUrl", "Sets the read only routing connection url for the availability replica.\nThis parameter is only supported if the replica is added to just one instance.", "", false, "false", "", "" ], [ "Certificate", "Specifies that the endpoint is to authenticate the connection using the certificate specified by certificate_name to establish identity for authorization.\nThe far endpoint must have a certificate with the public key matching the private key of the specified certificate.", "", false, "false", "", "" ], [ "ConfigureXESession", "Configure the AlwaysOn_health extended events session to start automatically as the SSMS wizard would do.\r\nhttps://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/always-on-extended-events#BKMK_alwayson_health", "", false, "false", "False", "" ], [ "InputObject", "Enables piping from Get-DbaAvailabilityGroup.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Add-DbaAgReplica [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString\u003e] [[-AvailabilityMode] \u003cString\u003e] [[-FailoverMode] \u003cString\u003e] [[-BackupPriority] \u003cInt32\u003e] [[-ConnectionModeInPrimaryRole] \u003cString\u003e] [[-ConnectionModeInSecondaryRole] \u003cString\u003e] [[-SeedingMode] \u003cString\u003e] [[-Endpoint] \u003cString\u003e] [[-EndpointUrl] \u003cString[]\u003e] [-Passthru] [[-ReadOnlyRoutingList] \u003cString[]\u003e] [[-ReadonlyRoutingConnectionUrl] \u003cString\u003e] [[-Certificate] \u003cString\u003e] [-ConfigureXESession] [-InputObject] \u003cAvailabilityGroup\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Add-DbaComputerCertificate", "Description": "Adds a computer certificate from a local or remote computer.", "Tags": "Certificate", "Synopsis": "Adds a computer certificate - useful for older systems.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Add-DbaComputerCertificate", "Availability": "Windows only", "Links": "https://dbatools.io/Add-DbaComputerCertificate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eAdd-DbaComputerCertificate -ComputerName Server1 -Path C:\\temp\\cert.cer\nAdds the local C:\\temp\\cert.cer to the remote server Server1 in LocalMachine\\My (Personal).\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eAdd-DbaComputerCertificate -Path C:\\temp\\cert.cer\nAdds the local C:\\temp\\cert.cer to the local computer\u0027s LocalMachine\\My (Personal) certificate store.", "Params": [ [ "ComputerName", "The target SQL Server instance or instances. Defaults to localhost.", "", false, "false", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to $ComputerName using alternative credentials.", "", false, "false", "", "" ], [ "SecurePassword", "The password for the certificate, if it is password protected.", "Password", false, "false", "", "" ], [ "Certificate", "The target certificate object.", "", false, "true (ByValue)", "", "" ], [ "Path", "The local path to the target certificate object.", "", false, "false", "", "" ], [ "Store", "Certificate store. Default is LocalMachine.", "", false, "false", "LocalMachine", "" ], [ "Folder", "Certificate folder. Default is My (Personal).", "", false, "false", "My", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Add-DbaComputerCertificate [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-SecurePassword] \u003cSecureString\u003e] [[-Certificate] \u003cX509Certificate2[]\u003e] [[-Path] \u003cString\u003e] [[-Store] \u003cString\u003e] [[-Folder] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Add-DbaDbMirrorMonitor", "Description": "Creates a database mirroring monitor job that periodically updates the mirroring status for every mirrored database on the server instance.\n\nBasically executes sp_dbmmonitoraddmonitoring.", "Tags": [ "Mirroring", "Mirror", "HA" ], "Synopsis": "Creates a database mirroring monitor job that periodically updates the mirroring status for every mirrored database on the server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Add-DbaDbMirrorMonitor", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Add-DbaDbMirrorMonitor", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eAdd-DbaDbMirrorMonitor -SqlInstance sql2008, sql2012\nCreates a database mirroring monitor job that periodically updates the mirroring status for every mirrored database on sql2008 and sql2012.", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Add-DbaDbMirrorMonitor [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Add-DbaDbRoleMember", "Description": "The Add-DbaDbRoleMember adds users in a database to a database role or roles for each instance(s) of SQL Server.", "Tags": [ "Role", "Database", "Security", "Login" ], "Synopsis": "Adds a Database User to a database role for each instance(s) of SQL Server.", "Alias": "", "Author": "Ben Miller (@DBAduck)", "CommandName": "Add-DbaDbRoleMember", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Add-DbaDbRoleMember", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eAdd-DbaDbRoleMember -SqlInstance localhost -Database mydb -Role db_owner -User user1\nAdds user1 to the role db_owner in the database mydb on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eAdd-DbaDbRoleMember -SqlInstance localhost, sql2016 -Role SqlAgentOperatorRole -User user1 -Database msdb\nAdds user1 in servers localhost and sql2016 in the msdb database to the SqlAgentOperatorRole\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers = Get-Content C:\\servers.txt\nPS C:\\\u003e $servers | Add-DbaDbRoleMember -Role SqlAgentOperatorRole -User user1 -Database msdb\nAdds user1 to the SqlAgentOperatorROle in the msdb database in every server in C:\\servers.txt\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eAdd-DbaDbRoleMember -SqlInstance localhost -Role \"db_datareader\",\"db_datawriter\" -User user1 -Database DEMODB\nAdds user1 in the database DEMODB on the server localhost to the roles db_datareader and db_datawriter\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$roles = Get-DbaDbRole -SqlInstance localhost -Role \"db_datareader\",\"db_datawriter\" -Database DEMODB\nPS C:\\\u003e $roles | Add-DbaDbRoleMember -User user1\nAdds user1 in the database DEMODB on the server localhost to the roles db_datareader and db_datawriter", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "Role", "The role(s) to process.", "", false, "false", "", "" ], [ "User", "The user(s) to add to role(s) specified.", "", true, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaDbRole or Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Add-DbaDbRoleMember [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Role] \u003cString[]\u003e] [-User] \u003cString[]\u003e [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Add-DbaExtendedProperty", "Description": "Adds an extended property\n\nThis command works out of the box with databases but you can add extended properties from several different types of objects, including:\n\nAggregate\nAssembly\nColumn\nConstraint\nContract\nDatabase\nEvent Notification\nFilegroup\nFunction\nIndex\nLogical File Name\nMessage Type\nParameter\nPartition Function\nPartition Scheme\nProcedure\nQueue\nRemote Service Binding\nRoute\nRule\nSchema\nService\nSynonym\nTable\nTrigger\nType\nView\nXml Schema Collection", "Tags": "extendedproperties", "Synopsis": "Adds an extended property", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Add-DbaExtendedProperty", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Add-DbaExtendedProperty", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eAdd-DbaExtendedProperty -SqlInstance sql2016\nGets all extended properties on all databases\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eAdd-DbaExtendedProperty -SqlInstance Server1 -Database db1\nGets the extended properties for the db1 database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eAdd-DbaExtendedProperty -SqlInstance Server1 -Database db1 -Name version -Value \"1.0.0\"\nSets the version extended property for the db1 database to 1.0.0\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbStoredProcedure -SqlInstance localhost -Database tempdb | Add-DbaExtendedProperty -Name SPVersion -Value 10.2\nCreates an extended property for all stored procedures in the tempdb database named SPVersion with a value of 10.2\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance localhost -Database mydb -Table mytable | Add-DbaExtendedProperty -Name MyExtendedProperty -Value \"This is a test\"\nCreates an extended property named MyExtendedProperty for the mytable table in the mydb, with a value of \"This is a test\"", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Add an extended property to a specific database", "", false, "false", "", "" ], [ "Name", "The name of the extended property", "Property", true, "false", "", "" ], [ "Value", "The value for the extended property", "", true, "false", "", "" ], [ "InputObject", "Enables piping from Get-Dba* commands", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Add-DbaExtendedProperty [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [-Name] \u003cString\u003e [-Value] \u003cString\u003e [[-InputObject] \u003cPSObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Add-DbaPfDataCollectorCounter", "Description": "Adds a Performance Data Collector Counter.", "Tags": "PerfMon", "Synopsis": "Adds a Performance Data Collector Counter.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Add-DbaPfDataCollectorCounter", "Availability": "Windows only", "Links": "https://dbatools.io/Add-DbaPfDataCollectorCounter", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eAdd-DbaPfDataCollectorCounter -ComputerName sql2017 -CollectorSet \u0027System Correlation\u0027 -Collector DataCollector01 -Counter \u0027\\LogicalDisk(*)\\Avg. Disk Queue Length\u0027\nAdds the \u0027\\LogicalDisk(*)\\Avg. Disk Queue Length\u0027 counter within the DataCollector01 collector within the System Correlation collector set on sql2017.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollector | Out-GridView -PassThru | Add-DbaPfDataCollectorCounter -Counter \u0027\\LogicalDisk(*)\\Avg. Disk Queue Length\u0027 -Confirm\nAllows you to select which Data Collector you\u0027d like to add the counter \u0027\\LogicalDisk(*)\\Avg. Disk Queue Length\u0027 on localhost and prompts for confirmation.", "Params": [ [ "ComputerName", "The target computer. Defaults to localhost.", "", false, "false", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to $ComputerName using alternative credentials. To use:\n$cred = Get-Credential, then pass $cred object to the -Credential parameter.", "", false, "false", "", "" ], [ "CollectorSet", "The Collector Set name.", "DataCollectorSet", false, "false", "", "" ], [ "Collector", "The Collector name.", "DataCollector", false, "false", "", "" ], [ "Counter", "The Counter name. This must be in the form of \u0027\\Processor(_Total)\\% Processor Time\u0027.", "Name", true, "true (ByPropertyName)", "", "" ], [ "InputObject", "Accepts the object output by Get-DbaPfDataCollector via the pipeline.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Add-DbaPfDataCollectorCounter [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-CollectorSet] \u003cString[]\u003e] [[-Collector] \u003cString[]\u003e] [-Counter] \u003cObject[]\u003e [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Add-DbaRegServer", "Description": "Adds registered servers to SQL Server Central Management Server (CMS) or Local Server Groups. If you need more flexibility, look into Import-DbaRegServer which\naccepts multiple kinds of input and allows you to add reg servers from different CMSes.", "Tags": [ "RegisteredServer", "CMS" ], "Synopsis": "Adds registered servers to SQL Server Central Management Server (CMS) or Local Server Groups", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Add-DbaRegServer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Add-DbaRegServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eAdd-DbaRegServer -SqlInstance sql2008 -ServerName sql01\nCreates a registered server on sql2008\u0027s CMS which points to the SQL Server, sql01. When scrolling in CMS, the name \"sql01\" will be visible.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eAdd-DbaRegServer -ServerName sql01\nCreates a registered server in Local Server Groups which points to the SQL Server, sql01. When scrolling in Registered Servers, the name \"sql01\" will be visible.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eAdd-DbaRegServer -SqlInstance sql2008 -ServerName sql01 -Name \"The 2008 Clustered Instance\" -Description \"HR\u0027s Dedicated SharePoint instance\"\nCreates a registered server on sql2008\u0027s CMS which points to the SQL Server, sql01. When scrolling in CMS, \"The 2008 Clustered Instance\" will be visible.\r\nClearly this is hard to explain ;)\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eAdd-DbaRegServer -SqlInstance sql2008 -ServerName sql01 -Group hr\\Seattle\nCreates a registered server on sql2008\u0027s CMS which points to the SQL Server, sql01. When scrolling in CMS, the name \"sql01\" will be visible within the Seattle group which is in the hr group.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eConnect-DbaInstance -SqlInstance dockersql1 -SqlCredential sqladmin | Add-DbaRegServer -ServerName mydockerjam\nCreates a registered server called \"mydockerjam\" in Local Server Groups that uses SQL authentication and points to the server dockersql1.", "Params": [ [ "SqlInstance", "The target SQL Server instance if a CMS is used", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "ServerName", "Server Name is the actual SQL instance name (labeled Server Name)", "", false, "false", "", "" ], [ "Name", "Name is basically the nickname in SSMS Registered Server interface (labeled Registered Server Name)", "", false, "false", "$ServerName", "" ], [ "Description", "Adds a description for the registered server", "", false, "false", "", "" ], [ "Group", "Adds the registered server to a specific group.\r\nIf group does not exist it will be created", "", false, "false", "", "" ], [ "ActiveDirectoryTenant", "Active Directory Tenant", "", false, "false", "", "" ], [ "ActiveDirectoryUserId", "Active Directory User id", "", false, "false", "", "" ], [ "ConnectionString", "SQL Server connection string", "", false, "false", "", "" ], [ "OtherParams", "Additional parameters to append to the connection string", "", false, "false", "", "" ], [ "InputObject", "Allows the piping of a registered server group", "", false, "true (ByValue)", "", "" ], [ "ServerObject", "SMO Server Objects (from Connect-DbaInstance)", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Add-DbaRegServer [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-ServerName] \u003cString\u003e] [[-Name] \u003cString\u003e] [[-Description] \u003cString\u003e] [[-Group] \u003cObject\u003e] [[-ActiveDirectoryTenant] \u003cString\u003e] [[-ActiveDirectoryUserId] \u003cString\u003e] [[-ConnectionString] \u003cString\u003e] [[-OtherParams] \u003cString\u003e] [[-InputObject] \u003cServerGroup[]\u003e] [[-ServerObject] \u003cServer[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Add-DbaRegServerGroup", "Description": "Adds registered server groups to SQL Server Central Management Server (CMS). If you need more flexibility, look into Import-DbaRegServer which accepts multiple kinds of input and allows you to add reg servers and groups from different CMS.", "Tags": [ "RegisteredServer", "CMS" ], "Synopsis": "Adds registered server groups to SQL Server Central Management Server (CMS)", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Add-DbaRegServerGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Add-DbaRegServerGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eAdd-DbaRegServerGroup -SqlInstance sql2012 -Name HR\nCreates a registered server group called HR, in the root of sql2012\u0027s CMS\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eAdd-DbaRegServerGroup -SqlInstance sql2012, sql2014 -Name sub-folder -Group HR\nCreates a registered server group on sql2012 and sql2014 called sub-folder within the HR group\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRegServerGroup -SqlInstance sql2012, sql2014 -Group HR | Add-DbaRegServerGroup -Name sub-folder\nCreates a registered server group on sql2012 and sql2014 called sub-folder within the HR group of each server", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "The name of the registered server group.", "", true, "false", "", "" ], [ "Description", "The description for the registered server group", "", false, "false", "", "" ], [ "Group", "The SQL Server Central Management Server group. If no groups are specified, the new group will be created at the root.\r\nYou can pass sub groups using the \u0027\\\u0027 to split the path. Group\\SubGroup will create both folders. Folder \u0027SubGroup\u0027 under \u0027Group\u0027 folder.", "", false, "false", "", "" ], [ "InputObject", "Allows results from Get-DbaRegServerGroup to be piped in", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Add-DbaRegServerGroup [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [-Name] \u003cString\u003e [[-Description] \u003cString\u003e] [[-Group] \u003cString\u003e] [[-InputObject] \u003cServerGroup[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Add-DbaServerRoleMember", "Description": "Adds a login to a server-level role(s) for each instance(s) of SQL Server.", "Tags": [ "Role", "Security", "Login" ], "Synopsis": "Adds a login to a server-level role(s) for each instance(s) of SQL Server.", "Alias": "", "Author": "Shawn Melton (@wsmelton)", "CommandName": "Add-DbaServerRoleMember", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Add-DbaServerRoleMember", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eAdd-DbaServerRoleMember -SqlInstance server1 -Role dbcreator -Login login1\nAdds login1 to the server-level role dbcreator on the instance server1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eAdd-DbaServerRoleMember -SqlInstance server1, sql2016 -ServerRole customrole -Login login1\nAdds login1 in custom, server-level role customrole on the instance server1 and sql2016\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eAdd-DbaServerRoleMember -SqlInstance server1 -ServerRole customrole -Role dbcreator\nAdds custom, server-level role customrole to dbcreator server-level fixed role.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$servers = Get-Content C:\\servers.txt\nPS C:\\\u003e $servers | Add-DbaServerRoleMember -ServerRole sysadmin -Login login1\nAdds login1 to the sysadmin server-level role in every server in C:\\servers.txt\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eAdd-DbaServerRoleMember -SqlInstance localhost -ServerRole \"bulkadmin\",\"dbcreator\" -Login login1\nAdds login1 on the server localhost to the server-level roles bulkadmin and dbcreator\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$roles = Get-DbaServerRole -SqlInstance localhost -ServerRole \"bulkadmin\",\"dbcreator\"\nPS C:\\\u003e $roles | Add-DbaServerRoleMember -Login login1\nAdds login1 on the server localhost to the server-level roles bulkadmin and dbcreator\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003ePS C:\\ $logins = Get-Content C:\\logins.txt\nPS C:\\ $srvLogins = Get-DbaLogin -SqlInstance server1 -Login $logins\r\nPS C:\\ New-DbaServerRole -SqlInstance server1 -ServerRole mycustomrole -Owner sa | Add-DbaServerRoleMember -Login $logins\nAdds all the logins found in C:\\logins.txt to the newly created server-level role mycustomrole on server1.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "ServerRole", "The server-level role(s) to process.", "", false, "true (ByValue)", "", "" ], [ "Login", "The login(s) to add to server-level role(s) specified.", "", false, "false", "", "" ], [ "Role", "The role(s) to add to server-level role(s) specified.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaServerRole or New-DbaServerRole", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Add-DbaServerRoleMember [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-ServerRole] \u003cString[]\u003e] [[-Login] \u003cString[]\u003e] [[-Role] \u003cString[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Backup-DbaComputerCertificate", "Description": "Backs up a computer certificate - useful for older systems and backing up remote certs to local disk.", "Tags": "Certificate", "Synopsis": "Backs up a computer certificate - useful for older systems and backing up remote certs to local disk.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Backup-DbaComputerCertificate", "Availability": "Windows only", "Links": "https://dbatools.io/Backup-DbaComputerCertificate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaComputerCertificate | Backup-DbaComputerCertificate -Path C:\\temp\nBacks up all certs to C:\\temp. Auto-names the files.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaComputerCertificate -Thumbprint 29C469578D6C6211076A09CEE5C5797EEA0C2713 | Backup-DbaComputerCertificate -FilePath C:\\temp\\29C469578D6C6211076A09CEE5C5797EEA0C2713.cer\nBacks up certificate with the thumbprint 29C469578D6C6211076A09CEE5C5797EEA0C2713 to the temp directory.", "Params": [ [ "SecurePassword", "Export using a password", "Password", false, "false", "", "" ], [ "InputObject", "The target certificate object. Accepts input from Get-DbaComputerCertificate.", "", true, "true (ByValue)", "", "" ], [ "Path", "Export to a directory", "", false, "false", "$pwd", "" ], [ "FilePath", "Export to a specific file name", "", false, "false", "", "" ], [ "Type", "Export type. Options include: Authenticode, Cert, Pfx, Pkcs12, Pkcs7, SerializedCert.", "", false, "false", "Cert", "Authenticode,Cert,Pfx,Pkcs12,Pkcs7,SerializedCert" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Backup-DbaComputerCertificate [[-SecurePassword] \u003cSecureString\u003e] [-InputObject] \u003cObject[]\u003e [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [[-Type] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Backup-DbaDatabase", "Description": "Performs a backup of a specified type of 1 or more databases on a single SQL Server Instance. These backups may be Full, Differential or Transaction log backups.", "Tags": [ "DisasterRecovery", "Backup", "Restore" ], "Synopsis": "Backup one or more SQL Server databases from a single SQL Server SqlInstance.", "Alias": "", "Author": "Stuart Moore (@napalmgram), stuart-moore.com", "CommandName": "Backup-DbaDatabase", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Backup-DbaDatabase", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eBackup-DbaDatabase -SqlInstance Server1 -Database HR, Finance\nThis will perform a full database backup on the databases HR and Finance on SQL Server Instance Server1 to Server1 default backup directory.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eBackup-DbaDatabase -SqlInstance sql2016 -Path C:\\temp -Database AdventureWorks2014 -Type Full\nBacks up AdventureWorks2014 to sql2016 C:\\temp folder.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eBackup-DbaDatabase -SqlInstance sql2016 -AzureBaseUrl https://dbatoolsaz.blob.core.windows.net/azbackups/ -AzureCredential dbatoolscred -Type Full -CreateFolder\nPerforms a full backup of all databases on the sql2016 instance to their own containers under the https://dbatoolsaz.blob.core.windows.net/azbackups/ container on Azure blob storage using the sql \r\ncredential \"dbatoolscred\" registered on the sql2016 instance.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eBackup-DbaDatabase -SqlInstance sql2016 -AzureBaseUrl https://dbatoolsaz.blob.core.windows.net/azbackups/ -Type Full\nPerforms a full backup of all databases on the sql2016 instance to the https://dbatoolsaz.blob.core.windows.net/azbackups/ container on Azure blob storage using the Shared Access Signature sql \r\ncredential \"https://dbatoolsaz.blob.core.windows.net/azbackups\" registered on the sql2016 instance.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eBackup-DbaDatabase -SqlInstance Server1\\Prod -Database db1 -Path \\\\filestore\\backups\\servername\\instancename\\dbname\\backuptype -Type Full -ReplaceInName\nPerforms a full backup of db1 into the folder \\\\filestore\\backups\\server1\\prod\\db1\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eBackup-DbaDatabase -SqlInstance Server1\\Prod -Path \\\\filestore\\backups\\servername\\instancename\\dbname\\backuptype -FilePath dbname-backuptype-timestamp.trn -Type Log -ReplaceInName\nPerforms a log backup for every database. For the database db1 this would results in backup files in \\\\filestore\\backups\\server1\\prod\\db1\\Log\\db1-log-31102018.trn\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eBackup-DbaDatabase -SqlInstance Sql2017 -Database master -FilePath NUL\nPerforms a backup of master, but sends the output to the NUL device (ie; throws it away)\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eBackup-DbaDatabase -SqlInstance Sql2016 -Database stripetest -AzureBaseUrl https://az.blob.core.windows.net/sql,https://dbatools.blob.core.windows.net/sql\nPerforms a backup of the database stripetest, striping it across the 2 Azure blob containers at https://az.blob.core.windows.net/sql and https://dbatools.blob.core.windows.net/sql, assuming that \r\nShared Access Signature credentials for both containers exist on the source instance\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eBackup-DbaDatabase -SqlInstance Sql2017 -Database master -EncryptionAlgorithm AES256 -EncryptionCertificate BackupCert\nBacks up the master database using the BackupCert certificate and the AES256 algorithm.", "Params": [ [ "SqlInstance", "The SQL Server instance hosting the databases to be backed up.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "Path", "Path in which to place the backup files. If not specified, the backups will be placed in the default backup location for SqlInstance.\r\nIf multiple paths are specified, the backups will be striped across these locations. This will overwrite the FileCount option.\nIf the path does not exist, Sql Server will attempt to create it. Folders are created by the Sql Instance, and checks will be made for write permissions.\nFile Names with be suffixed with x-of-y to enable identifying striped sets, where y is the number of files in the set and x ranges from 1 to y.", "BackupDirectory", false, "false", "", "" ], [ "FilePath", "The name of the file to backup to. This is only accepted for single database backups.\r\nIf no name is specified then the backup files will be named DatabaseName_yyyyMMddHHmm (i.e. \"Database1_201714022131\") with the appropriate extension.\nIf the same name is used repeatedly, SQL Server will add backups to the same file at an incrementing position.\nSQL Server needs permissions to write to the specified location. Path names are based on the SQL Server (C:\\ is the C drive on the SQL Server, not the machine running the script).\nPassing in NUL as the FilePath will backup to the NUL: device", "BackupFileName", false, "false", "", "" ], [ "IncrementPrefix", "If enables, this will prefix backup files with an incrementing integer (ie; \u00271-\u0027, \u00272-\u0027). Using this has been alleged to improved restore times on some Azure based SQL Database platorms", "", false, "false", "False", "" ], [ "ReplaceInName", "If this switch is set, the following list of strings will be replaced in the FilePath and Path strings:\r\n instancename - will be replaced with the instance Name\r\n servername - will be replaced with the server name\r\n dbname - will be replaced with the database name\r\n timestamp - will be replaced with the timestamp (either the default, or the format provided)\r\n backuptype - will be replaced with Full, Log or Differential as appropriate", "", false, "false", "False", "" ], [ "CopyOnly", "If this switch is enabled, CopyOnly backups will be taken. By default function performs a normal backup, these backups interfere with the restore chain of the database. CopyOnly backups will not \r\ninterfere with the restore chain of the database.\nFor more details please refer to this MSDN article - https://msdn.microsoft.com/en-us/library/ms191495.aspx", "", false, "false", "False", "" ], [ "Type", "The type of SQL Server backup to perform. Accepted values are \"Full\", \"Log\", \"Differential\", \"Diff\", \"Database\"", "", false, "false", "Database", "Full,Log,Differential,Diff,Database" ], [ "InputObject", "Internal parameter", "", true, "true (ByValue)", "", "" ], [ "CreateFolder", "If this switch is enabled, each database will be backed up into a separate folder on each of the paths specified by Path.", "", false, "false", "False", "" ], [ "FileCount", "This is the number of striped copies of the backups you wish to create. This value is overwritten if you specify multiple Backup Directories.", "", false, "false", "0", "" ], [ "CompressBackup", "If this switch is enabled, the function will try to perform a compressed backup if supported by the version and edition of SQL Server. Otherwise, this function will use the server(s) default setting \r\nfor compression.", "", false, "false", "False", "" ], [ "Checksum", "If this switch is enabled, the backup checksum will be calculated.", "", false, "false", "False", "" ], [ "Verify", "If this switch is enabled, the backup will be verified by running a RESTORE VERIFYONLY against the SqlInstance", "", false, "false", "False", "" ], [ "MaxTransferSize", "Sets the size of the unit of transfer. Values must be a multiple of 64kb.", "", false, "false", "0", "" ], [ "BlockSize", "Specifies the block size to use. Must be one of 0.5KB, 1KB, 2KB, 4KB, 8KB, 16KB, 32KB or 64KB. This can be specified in bytes.\r\nRefer to https://msdn.microsoft.com/en-us/library/ms178615.aspx for more detail", "", false, "false", "0", "" ], [ "BufferCount", "Number of I/O buffers to use to perform the operation.\r\nRefer to https://msdn.microsoft.com/en-us/library/ms178615.aspx for more detail", "", false, "false", "0", "" ], [ "AzureBaseUrl", "The URL(s) to the base container of an Azure Storage account to write backups to.\r\nIf specifying the AzureCredential parameter you can only provide 1 value as page blobs do not support multiple URLs\r\nIf using Shared Access keys, you may specify as many URLs as you want, as long as a corresponding credential exists on the source server.\r\nIf specified, the only other parameters than can be used are \"CopyOnly\", \"Type\", \"CompressBackup\", \"Checksum\", \"Verify\", \"AzureCredential\", \"CreateFolder\".", "", false, "false", "", "" ], [ "AzureCredential", "The name of the credential on the SQL instance that can write to the AzureBaseUrl, only needed if using Storage access keys\r\nIf using SAS credentials, the command will look for a credential with a name matching the AzureBaseUrl. As page blobs are used with this option we force the number of files to 1 and ignore any value \r\npassed in for BlockSize or MaxTransferSize", "", false, "false", "", "" ], [ "NoRecovery", "This is passed in to perform a tail log backup if needed", "", false, "false", "False", "" ], [ "BuildPath", "By default this command will not attempt to create missing paths, this switch will change the behaviour so that it will", "", false, "false", "False", "" ], [ "WithFormat", "Formats the media as the first step of the backup operation. NOTE: This will set Initialize and SkipTapeHeader to $true.", "", false, "false", "False", "" ], [ "Initialize", "Initializes the media as part of the backup operation.", "", false, "false", "False", "" ], [ "SkipTapeHeader", "Initializes the media as part of the backup operation.", "", false, "false", "False", "" ], [ "TimeStampFormat", "By default the command timestamps backups using the format yyyyMMddHHmm. Using this parameter this can be overridden. The timestamp format should be defined using the Get-Date formats, illegal \r\nformats will cause an error to be thrown", "", false, "false", "", "" ], [ "IgnoreFileChecks", "This switch stops the function from checking for the validity of paths. This can be useful if SQL Server only has read access to the backup area.\r\nNote, that as we cannot check the path you may well end up with errors.", "", false, "false", "False", "" ], [ "OutputScriptOnly", "Switch causes only the T-SQL script for the backup to be generated. Will not create any paths if they do not exist", "", false, "false", "False", "" ], [ "EncryptionAlgorithm", "Specified the Encryption Algorithm to used. Must be one of \u0027AES128\u0027,\u0027AES192\u0027,\u0027AES256\u0027 or \u0027TRIPLEDES\u0027\r\nMust specify one of EncryptionCertificate or EncryptionKey as well.", "", false, "false", "", "AES128,AES192,AES256,TRIPLEDES" ], [ "EncryptionCertificate", "The name of the certificate to be used to encrypt the backups. The existance of the certificate will be checked, and will not proceed if it does not exist\r\nIs mutually exclusive with the EncryptionKey option", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Backup-DbaDatabase [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-Path \u003cString[]\u003e] [-FilePath \u003cString\u003e] [-IncrementPrefix] [-ReplaceInName] [-CopyOnly] [-Type \u003cString\u003e] [-CreateFolder] [-FileCount \u003cInt32\u003e] [-CompressBackup] [-Checksum] [-Verify] [-MaxTransferSize \u003cInt32\u003e] [-BlockSize \u003cInt32\u003e] [-BufferCount \u003cInt32\u003e] [-AzureBaseUrl \u003cString[]\u003e] [-AzureCredential \u003cString\u003e] [-NoRecovery] [-BuildPath] [-WithFormat] [-Initialize] [-SkipTapeHeader] [-TimeStampFormat \u003cString\u003e] [-IgnoreFileChecks] [-OutputScriptOnly] [-EncryptionAlgorithm \u003cString\u003e] \r\n[-EncryptionCertificate \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nBackup-DbaDatabase -SqlInstance \u003cDbaInstanceParameter\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-Path \u003cString[]\u003e] [-FilePath \u003cString\u003e] [-IncrementPrefix] [-ReplaceInName] [-CopyOnly] [-Type \u003cString\u003e] [-CreateFolder] [-FileCount \u003cInt32\u003e] [-CompressBackup] [-Checksum] [-Verify] [-MaxTransferSize \u003cInt32\u003e] [-BlockSize \u003cInt32\u003e] [-BufferCount \u003cInt32\u003e] [-AzureBaseUrl \u003cString[]\u003e] [-AzureCredential \u003cString\u003e] [-NoRecovery] [-BuildPath] [-WithFormat] [-Initialize] [-SkipTapeHeader] [-TimeStampFormat \u003cString\u003e] [-IgnoreFileChecks] [-OutputScriptOnly] \r\n[-EncryptionAlgorithm \u003cString\u003e] [-EncryptionCertificate \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nBackup-DbaDatabase [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-Path \u003cString[]\u003e] [-FilePath \u003cString\u003e] [-IncrementPrefix] [-ReplaceInName] [-CopyOnly] [-Type \u003cString\u003e] -InputObject \u003cObject[]\u003e [-CreateFolder] [-FileCount \u003cInt32\u003e] [-CompressBackup] [-Checksum] [-Verify] [-MaxTransferSize \u003cInt32\u003e] [-BlockSize \u003cInt32\u003e] [-BufferCount \u003cInt32\u003e] [-AzureBaseUrl \u003cString[]\u003e] [-AzureCredential \u003cString\u003e] [-NoRecovery] [-BuildPath] [-WithFormat] [-Initialize] [-SkipTapeHeader] [-TimeStampFormat \u003cString\u003e] [-IgnoreFileChecks] [-OutputScriptOnly] [-EncryptionAlgorithm \r\n\u003cString\u003e] [-EncryptionCertificate \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Backup-DbaDbCertificate", "Description": "Exports database certificates from SQL Server using SMO and outputs the .cer and .pvk files.", "Tags": [ "Migration", "Certificate" ], "Synopsis": "Exports database certificates from SQL Server using SMO.", "Alias": "", "Author": "Jess Pomfret (@jpomfret)", "CommandName": "Backup-DbaDbCertificate", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Backup-DbaDbCertificate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eBackup-DbaDbCertificate -SqlInstance Server1\nExports all the certificates on the specified SQL Server to the default data path for the instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Backup-DbaDbCertificate -SqlInstance Server1 -SqlCredential $cred\nConnects using sqladmin credential and exports all the certificates on the specified SQL Server to the default data path for the instance.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eBackup-DbaDbCertificate -SqlInstance Server1 -Certificate Certificate1\nExports only the certificate named Certificate1 on the specified SQL Server to the default data path for the instance.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eBackup-DbaDbCertificate -SqlInstance Server1 -Database AdventureWorks\nExports only the certificates for AdventureWorks on the specified SQL Server to the default data path for the instance.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eBackup-DbaDbCertificate -SqlInstance Server1 -ExcludeDatabase AdventureWorks\nExports all certificates except those for AdventureWorks on the specified SQL Server to the default data path for the instance.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eBackup-DbaDbCertificate -SqlInstance Server1 -Path \\\\Server1\\Certificates -EncryptionPassword (ConvertTo-SecureString -force -AsPlainText GoodPass1234!!)\nExports all the certificates and private keys on the specified SQL Server.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$EncryptionPassword = ConvertTo-SecureString -AsPlainText \"GoodPass1234!!\" -force\nPS C:\\\u003e $DecryptionPassword = ConvertTo-SecureString -AsPlainText \"Password4567!!\" -force\r\nPS C:\\\u003e Backup-DbaDbCertificate -SqlInstance Server1 -EncryptionPassword $EncryptionPassword -DecryptionPassword $DecryptionPassword\nExports all the certificates on the specified SQL Server using the supplied DecryptionPassword, since an EncryptionPassword is specified private keys are also exported.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eBackup-DbaDbCertificate -SqlInstance Server1 -Path \\\\Server1\\Certificates\nExports all certificates on the specified SQL Server to the specified path.\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eBackup-DbaDbCertificate -SqlInstance Server1 -Suffix DbaTools\nExports all certificates on the specified SQL Server to the specified path, appends DbaTools to the end of the filenames.\n-------------------------- EXAMPLE 10 --------------------------\nPS C:\\\u003eGet-DbaDbCertificate -SqlInstance sql2016 | Backup-DbaDbCertificate\nExports all certificates found on sql2016 to the default data directory.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Certificate", "Exports certificate that matches the name(s).", "", false, "false", "", "" ], [ "Database", "Exports the encryptor for specific database(s).", "", false, "false", "", "" ], [ "ExcludeDatabase", "Database(s) to skip when exporting encryptors.", "", false, "false", "", "" ], [ "EncryptionPassword", "A string value that specifies the system path to encrypt the private key.", "", false, "false", "", "" ], [ "DecryptionPassword", "Secure string used to decrypt the private key.", "", false, "false", "", "" ], [ "Path", "The path to output the files to. The path is relative to the SQL Server itself. If no path is specified, the default data directory will be used.", "", false, "false", "", "" ], [ "Suffix", "The suffix of the filename of the exported certificate.", "", false, "false", "\"$(Get-Date -format \u0027yyyyMMddHHmmssms\u0027)\"", "" ], [ "InputObject", "Enables piping from Get-DbaDbCertificate", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Backup-DbaDbCertificate [-SqlCredential \u003cPSCredential\u003e] [-EncryptionPassword \u003cSecureString\u003e] [-DecryptionPassword \u003cSecureString\u003e] [-Path \u003cFileInfo\u003e] [-Suffix \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nBackup-DbaDbCertificate -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Certificate \u003cObject[]\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-EncryptionPassword \u003cSecureString\u003e] [-DecryptionPassword \u003cSecureString\u003e] [-Path \u003cFileInfo\u003e] [-Suffix \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nBackup-DbaDbCertificate [-SqlCredential \u003cPSCredential\u003e] [-EncryptionPassword \u003cSecureString\u003e] [-DecryptionPassword \u003cSecureString\u003e] [-Path \u003cFileInfo\u003e] [-Suffix \u003cString\u003e] [-InputObject \u003cCertificate[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Backup-DbaDbMasterKey", "Description": "Backs up specified database master key.", "Tags": [ "Certificate", "Database" ], "Synopsis": "Backs up specified database master key.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Backup-DbaDbMasterKey", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Backup-DbaDbMasterKey", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eBackup-DbaDbMasterKey -SqlInstance server1\\sql2016\n```\r\nComputerName : SERVER1\r\nInstanceName : SQL2016\r\nSqlInstance : SERVER1\\SQL2016\r\nDatabase : master\r\nFilename : E:\\MSSQL13.SQL2016\\MSSQL\\Backup\\server1$sql2016-master-20170614162311.key\r\nStatus : Success\r\n```\nPrompts for export password, then logs into server1\\sql2016 with Windows credentials then backs up all database keys to the default backup directory.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eBackup-DbaDbMasterKey -SqlInstance Server1 -Database db1 -Path \\\\nas\\sqlbackups\\keys\nLogs into sql2016 with Windows credentials then backs up db1\u0027s keys to the \\\\nas\\sqlbackups\\keys directory.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Credential", "Pass a credential object for the password", "", false, "false", "", "" ], [ "Database", "Backup master key from specific database(s).", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server.", "", false, "false", "", "" ], [ "SecurePassword", "The password to encrypt the exported key. This must be a SecureString.", "Password", false, "false", "", "" ], [ "Path", "The directory to export the key. If no path is specified, the default backup directory for the instance will be used.", "", false, "false", "", "" ], [ "InputObject", "Database object piped in from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Backup-DbaDbMasterKey [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-SecurePassword] \u003cSecureString\u003e] [[-Path] \u003cString\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Backup-DbaServiceMasterKey", "Description": "Backs up specified service master key.", "Tags": [ "Certificate", "Database" ], "Synopsis": "Backs up specified service master key.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Backup-DbaServiceMasterKey", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Backup-DbaServiceMasterKey", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eBackup-DbaServiceMasterKey -SqlInstance server1\\sql2016\n```\r\nComputerName : SERVER1\r\nInstanceName : SQL2016\r\nSqlInstance : SERVER1\\SQL2016\r\nFilename : E:\\MSSQL13.SQL2016\\MSSQL\\Backup\\server1$sql2016-SMK-20170614162311.key\r\nStatus : Success\r\n```\nPrompts for export password, then logs into server1\\sql2016 with Windows credentials then backs up the service master key to the default backup directory.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eBackup-DbaServiceMasterKey -SqlInstance Server1 -Path \\\\nas\\sqlbackups\\keys\nLogs into sql2016 with Windows credentials then backs up the service master key to the \\\\nas\\sqlbackups\\keys directory.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "KeyCredential", "Pass a credential object for the password", "", false, "false", "", "" ], [ "SecurePassword", "The password to encrypt the exported key. This must be a SecureString.", "Password", false, "false", "", "" ], [ "Path", "The directory to export the key. If no path is specified, the default backup directory for the instance will be used.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Backup-DbaServiceMasterKey [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-KeyCredential] \u003cPSCredential\u003e] [[-SecurePassword] \u003cSecureString\u003e] [[-Path] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Clear-DbaConnectionPool", "Description": "This command resets (or empties) the connection pool.\n\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": "Connection", "Synopsis": "Resets (or empties) the connection pool.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Clear-DbaConnectionPool", "Availability": "Windows only", "Links": "https://dbatools.io/Clear-DbaConnectionPool", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eClear-DbaConnectionPool\nClears all local connection pools.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eClear-DbaConnectionPool -ComputerName workstation27\nClears all connection pools on workstation27.", "Params": [ [ "ComputerName", "Target computer(s). If no computer name is specified, the local computer is targeted.", "cn,host,Server", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Alternate credential object to use for accessing the target computer(s).", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Clear-DbaConnectionPool [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Clear-DbaLatchStatistics", "Description": "Reset the aggregated statistics - basically just executes DBCC SQLPERF (N\u0027sys.dm_os_latch_stats\u0027, CLEAR)", "Tags": [ "LatchStatistic", "Waits" ], "Synopsis": "Clears Latch Statistics", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Clear-DbaLatchStatistics", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Clear-DbaLatchStatistics", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eClear-DbaLatchStatistics -SqlInstance sql2008, sqlserver2012\nAfter confirmation, clears latch statistics on servers sql2008 and sqlserver2012\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eClear-DbaLatchStatistics -SqlInstance sql2008, sqlserver2012 -Confirm:$false\nClears latch statistics on servers sql2008 and sqlserver2012, without prompting\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027sql2008\u0027,\u0027sqlserver2012\u0027 | Clear-DbaLatchStatistics\nAfter confirmation, clears latch statistics on servers sql2008 and sqlserver2012\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Clear-DbaLatchStatistics -SqlInstance sql2008 -SqlCredential $cred\nConnects using sqladmin credential and clears latch statistics on servers sql2008 and sqlserver2012", "Params": [ [ "SqlInstance", "Allows you to specify a comma separated list of servers to query.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Clear-DbaLatchStatistics [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Clear-DbaPlanCache", "Description": "Checks ad-hoc and prepared plan cache for each database, if over 100 MBs removes from the cache.\n\nThis command automates that process.\n\nReferences: https://www.sqlskills.com/blogs/kimberly/plan-cache-adhoc-workloads-and-clearing-the-single-use-plan-cache-bloat/", "Tags": "Memory", "Synopsis": "Removes ad-hoc and prepared plan caches is single use plans are over defined threshold.", "Alias": "", "Author": "Tracy Boggiano, databasesuperhero.com", "CommandName": "Clear-DbaPlanCache", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Clear-DbaPlanCache", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eClear-DbaPlanCache -SqlInstance sql2017 -Threshold 200\nLogs into the SQL Server instance \"sql2017\" and removes plan caches if over 200 MB.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eClear-DbaPlanCache -SqlInstance sql2017 -SqlCredential sqladmin\nLogs into the SQL instance using the SQL Login \u0027sqladmin\u0027 and then Windows instance as \u0027ad\\sqldba\u0027\r\nand removes if Threshold over 100 MB.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaInstance -ComputerName localhost | Get-DbaPlanCache | Clear-DbaPlanCache -Threshold 200\nScans localhost for instances using the browser service, traverses all instances and gets the plan cache for each, clears them out if they are above 200 MB.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Threshold", "Memory used threshold.", "", false, "false", "100", "" ], [ "InputObject", "Enables results to be piped in from Get-DbaPlanCache.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Clear-DbaPlanCache [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Threshold] \u003cInt32\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Clear-DbaWaitStatistics", "Description": "Reset the aggregated statistics - basically just executes DBCC SQLPERF (N\u0027sys.dm_os_wait_stats\u0027, CLEAR)", "Tags": [ "WaitStatistic", "Waits" ], "Synopsis": "Clears wait statistics", "Alias": "", "Author": "Chrissy LeMaire (@cl)", "CommandName": "Clear-DbaWaitStatistics", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Clear-DbaWaitStatistics", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eClear-DbaWaitStatistics -SqlInstance sql2008, sqlserver2012\nAfter confirmation, clears wait stats on servers sql2008 and sqlserver2012\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eClear-DbaWaitStatistics -SqlInstance sql2008, sqlserver2012 -Confirm:$false\nClears wait stats on servers sql2008 and sqlserver2012, without prompting", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Clear-DbaWaitStatistics [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Connect-DbaInstance", "Description": "This command creates a robust, reusable sql server object.\n\nIt is robust because it initializes properties that do not cause enumeration by default. It also supports both Windows and SQL Server authentication methods, and detects which to use based upon the provided credentials.\n\nBy default, this command also sets the connection\u0027s ApplicationName property 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\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)", "Tags": [ "Connect", "Connection" ], "Synopsis": "Creates a robust, reusable SQL Server object.", "Alias": "cdi", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Connect-DbaInstance", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Connect-DbaInstance", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eConnect-DbaInstance -SqlInstance sql2014\nCreates an SMO Server object that connects using Windows Authentication\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$wincred = Get-Credential ad\\sqladmin\nPS C:\\\u003e Connect-DbaInstance -SqlInstance sql2014 -SqlCredential $wincred\nCreates an SMO Server object that connects using alternative Windows credentials\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$sqlcred = Get-Credential sqladmin\nPS C:\\\u003e $server = Connect-DbaInstance -SqlInstance sql2014 -SqlCredential $sqlcred\nLogin to sql2014 as SQL login sqladmin.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$server = Connect-DbaInstance -SqlInstance sql2014 -ClientName \"my connection\"\nCreates an SMO Server object that connects using Windows Authentication and uses the client name \"my connection\".\r\nSo when you open up profiler or use extended events, you can search for \"my connection\".\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$server = Connect-DbaInstance -SqlInstance sql2014 -AppendConnectionString \"Packet Size=4096;AttachDbFilename=C:\\MyFolder\\MyDataFile.mdf;User Instance=true;\"\nCreates an SMO Server object that connects to sql2014 using Windows Authentication, then it sets the packet size (this can also be done via -PacketSize) and other connection attributes.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$server = Connect-DbaInstance -SqlInstance sql2014 -NetworkProtocol TcpIp -MultiSubnetFailover\nCreates an SMO Server object that connects using Windows Authentication that uses TCP/IP and has MultiSubnetFailover enabled.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$server = Connect-DbaInstance sql2016 -ApplicationIntent ReadOnly\nConnects with ReadOnly ApplicationIntent.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003e$server = Connect-DbaInstance -SqlInstance myserver.database.windows.net -Database mydb -SqlCredential me@mydomain.onmicrosoft.com -DisableException\nPS C:\\\u003e Invoke-DbaQuery -SqlInstance $server -Query \"select 1 as test\"\nLogs into Azure SQL DB using AAD / Azure Active Directory, then performs a sample query.\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003e$server = Connect-DbaInstance -SqlInstance psdbatools.database.windows.net -Database dbatools -DisableException\nPS C:\\\u003e Invoke-DbaQuery -SqlInstance $server -Query \"select 1 as test\"\nLogs into Azure SQL DB using AAD Integrated Auth, then performs a sample query.\n-------------------------- EXAMPLE 10 --------------------------\nPS C:\\\u003e$server = Connect-DbaInstance -SqlInstance \"myserver.public.cust123.database.windows.net,3342\" -Database mydb -SqlCredential me@mydomain.onmicrosoft.com -DisableException\nPS C:\\\u003e Invoke-DbaQuery -SqlInstance $server -Query \"select 1 as test\"\nLogs into Azure SQL Managed instance using AAD / Azure Active Directory, then performs a sample query.\n-------------------------- EXAMPLE 11 --------------------------\nPS C:\\\u003e$server = Connect-DbaInstance -SqlInstance db.mycustomazure.com -Database mydb -AzureDomain mycustomazure.com -DisableException\nPS C:\\\u003e Invoke-DbaQuery -SqlInstance $server -Query \"select 1 as test\"\nIn the event your AzureSqlDb is not on a database.windows.net domain, you can set a custom domain using the AzureDomain parameter.\r\nThis tells Connect-DbaInstance to login to the database using the method that works best with Azure.\n-------------------------- EXAMPLE 12 --------------------------\nPS C:\\\u003e$connstring = \"Data Source=TCP:mydb.database.windows.net,1433;User ID=sqladmin;Password=adfasdf;Connect Timeout=30;\"\nPS C:\\\u003e $server = Connect-DbaInstance -ConnectionString $connstring\r\nPS C:\\\u003e Invoke-DbaQuery -SqlInstance $server -Query \"select 1 as test\"\nLogs into Azure using a preconstructed connstring, then performs a sample query.\r\nConnectionString is an alias of SqlInstance, so you can use -SqlInstance $connstring as well.\n-------------------------- EXAMPLE 13 --------------------------\nPS C:\\\u003e$cred = Get-Credential guid-app-id-here # appid for username, clientsecret for password\nPS C:\\\u003e $server = Connect-DbaInstance -SqlInstance psdbatools.database.windows.net -Database abc -SqCredential $cred -Tenant guidheremaybename\r\nPS C:\\\u003e Invoke-DbaQuery -SqlInstance $server -Query \"select 1 as test\"\nWhen connecting from a non-Azure workstation, logs into Azure using Universal with MFA Support with a username and password, then performs a sample query.\nNote that generating access tokens is not supported on Core, so when using Tenant on Core, we rewrite the connection string with Active Directory Service Principal authentication instead.\n-------------------------- EXAMPLE 14 --------------------------\nPS C:\\\u003e$cred = Get-Credential guid-app-id-here # appid for username, clientsecret for password\nPS C:\\\u003e Set-DbatoolsConfig -FullName azure.tenantid -Value \u0027guidheremaybename\u0027 -Passthru | Register-DbatoolsConfig\r\nPS C:\\\u003e Set-DbatoolsConfig -FullName azure.appid -Value $cred.Username -Passthru | Register-DbatoolsConfig\r\nPS C:\\\u003e Set-DbatoolsConfig -FullName azure.clientsecret -Value $cred.Password -Passthru | Register-DbatoolsConfig # requires securestring\r\nPS C:\\\u003e Set-DbatoolsConfig -FullName sql.connection.database -Value abc -Passthru | Register-DbatoolsConfig\r\nPS C:\\\u003e Connect-DbaInstance -SqlInstance psdbatools.database.windows.net\nPermanently sets some app id config values. To set them temporarily (just for a session), remove -Passthru | Register-DbatoolsConfig\r\nWhen connecting from a non-Azure workstation or an Azure VM without .NET 4.7.2 and higher, logs into Azure using Universal with MFA Support, then performs a sample query.\n-------------------------- EXAMPLE 15 --------------------------\nPS C:\\\u003e$azureCredential = Get-Credential -Message \u0027Azure Credential\u0027\nPS C:\\\u003e $azureAccount = Connect-AzAccount -Credential $azureCredential\r\nPS C:\\\u003e $azureToken = (Get-AzAccessToken -ResourceUrl https://database.windows.net).Token\r\nPS C:\\\u003e $azureInstance = \"YOURSERVER.database.windows.net\"\r\nPS C:\\\u003e $azureDatabase = \"MYDATABASE\"\r\nPS C:\\\u003e $server = Connect-DbaInstance -SqlInstance $azureInstance -Database $azureDatabase -AccessToken $azureToken\r\nPS C:\\\u003e Invoke-DbaQuery -SqlInstance $server -Query \"select 1 as test\"\nConnect to an Azure SQL Database or an Azure SQL Managed Instance with an AccessToken.\r\nNote that the token is valid for only one hour and cannot be renewed automatically.\n-------------------------- EXAMPLE 16 --------------------------\nPS C:\\\u003e$token = (New-DbaAzAccessToken -Type RenewableServicePrincipal -Subtype AzureSqlDb -Tenant $tenantid -Credential $cred).GetAccessToken()\nPS C:\\\u003e Connect-DbaInstance -SqlInstance sample.database.windows.net -Accesstoken $token\nUses dbatools to generate the access token for an Azure SQL Database, then logs in using that AccessToken.\n-------------------------- EXAMPLE 17 --------------------------\nPS C:\\\u003e$server = Connect-DbaInstance -SqlInstance srv1 -DedicatedAdminConnection\nPS C:\\\u003e $dbaProcess = Get-DbaProcess -SqlInstance $server -ExcludeSystemSpids\r\nPS C:\\\u003e $killedProcess = $dbaProcess | Out-GridView -OutputMode Multiple | Stop-DbaProcess\r\nPS C:\\\u003e $server | Disconnect-DbaInstance\nCreates a dedicated admin connection (DAC) to the default instance on server srv1.\r\nReceives all non-system processes from the instance using the DAC.\r\nOpens a grid view to let the user select processes to be stopped.\r\nCloses the connection.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "Connstring,ConnectionString", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Credential object used to connect to the SQL Server Instance as a different user. This can be a Windows or SQL Server account. Windows users are determined by the existence of a backslash, so if you \r\nare intending to use an alternative Windows connection instead of a SQL login, ensure it contains a backslash.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027sql.connection.database\u0027)", "" ], [ "ApplicationIntent", "Declares the application workload type when connecting to a server.\nValid values are \"ReadOnly\" and \"ReadWrite\".", "", false, "false", "", "ReadOnly,ReadWrite" ], [ "AzureUnsupported", "Terminate if Azure is detected but not supported", "", false, "false", "False", "" ], [ "BatchSeparator", "A string to separate groups of SQL statements being executed. By default, this is \"GO\".", "", false, "false", "", "" ], [ "ClientName", "By default, this command sets the client\u0027s ApplicationName property to \"dbatools PowerShell module - dbatools.io\". If you\u0027re doing anything that requires profiling, you can look for this client name. \r\nUsing -ClientName allows you to set your own custom client application name.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027sql.connection.clientname\u0027)", "" ], [ "ConnectTimeout", "The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.\nValid values are integers between 0 and 2147483647.\nWhen opening a connection to a Azure SQL Database, set the connection timeout to 30 seconds.", "", false, "false", "([Sqlcollaborative.Dbatools.Connection.ConnectionHost]::SqlConnectionTimeout)", "" ], [ "EncryptConnection", "If this switch is enabled, SQL Server uses SSL encryption for all data sent between the client and server if the server has a certificate installed.\nFor more information, see Connection String Syntax. https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/connection-string-syntax\nBeginning in .NET Framework 4.5, when TrustServerCertificate is false and Encrypt is true, the server name (or IP address) in a SQL Server SSL certificate must exactly match the server name (or IP \r\naddress) specified in the connection string. Otherwise, the connection attempt will fail. For information about support for certificates whose subject starts with a wildcard character (*), see \r\nAccepted wildcards used by server certificates for server authentication. https://support.microsoft.com/en-us/help/258858/accepted-wildcards-used-by-server-certificates-for-server-authenticati", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027sql.connection.encrypt\u0027)", "" ], [ "FailoverPartner", "The name of the failover partner server where database mirroring is configured.\nIf the value of this key is \"\" (an empty string), then Initial Catalog must be present in the connection string, and its value must not be \"\".\nThe server name can be 128 characters or less.\nIf you specify a failover partner but the failover partner server is not configured for database mirroring and the primary server (specified with the Server keyword) is not available, then the \r\nconnection will fail.\nIf you specify a failover partner and the primary server is not configured for database mirroring, the connection to the primary server (specified with the Server keyword) will succeed if the primary \r\nserver is available.", "", false, "false", "", "" ], [ "LockTimeout", "Sets the time in seconds required for the connection to time out when the current transaction is locked.", "", false, "false", "0", "" ], [ "MaxPoolSize", "Sets the maximum number of connections allowed in the connection pool for this specific connection string.", "", false, "false", "0", "" ], [ "MinPoolSize", "Sets the minimum number of connections allowed in the connection pool for this specific connection string.", "", false, "false", "0", "" ], [ "MinimumVersion", "Terminate if the target SQL Server instance version does not meet version requirements", "", false, "false", "0", "" ], [ "MultipleActiveResultSets", "If this switch is enabled, an application can maintain multiple active result sets (MARS).\nIf this switch is not enabled, an application must process or cancel all result sets from one batch before it can execute any other batch on that connection.", "", false, "false", "False", "" ], [ "MultiSubnetFailover", "If this switch is enabled, and your application is connecting to an AlwaysOn availability group (AG) on different subnets, detection of and connection to the currently active server will be faster. \r\nFor more information about SqlClient support for Always On Availability Groups, see \r\nhttps://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql/sqlclient-support-for-high-availability-disaster-recovery", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027sql.connection.multisubnetfailover\u0027)", "" ], [ "NetworkProtocol", "Explicitly sets the network protocol used to connect to the server.\nValid values are \"TcpIp\",\"NamedPipes\",\"Multiprotocol\",\"AppleTalk\",\"BanyanVines\",\"Via\",\"SharedMemory\" and \"NWLinkIpxSpx\"", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027sql.connection.protocol\u0027)", "TcpIp,NamedPipes,Multiprotocol,AppleTalk,BanyanVines,Via,SharedMemory,NWLinkIpxSpx" ], [ "NonPooledConnection", "If this switch is enabled, a non-pooled connection will be requested.", "", false, "false", "False", "" ], [ "PacketSize", "Sets the size in bytes of the network packets used to communicate with an instance of SQL Server. Must match at server.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027sql.connection.packetsize\u0027)", "" ], [ "PooledConnectionLifetime", "When a connection is returned to the pool, its creation time is compared with the current time and the connection is destroyed if that time span (in seconds) exceeds the value specified by Connection \r\nLifetime. This is useful in clustered configurations to force load balancing between a running server and a server just brought online.\nA value of zero (0) causes pooled connections to have the maximum connection timeout.", "", false, "false", "0", "" ], [ "SqlExecutionModes", "The SqlExecutionModes enumeration contains values that are used to specify whether the commands sent to the referenced connection to the server are executed immediately or saved in a buffer.\nValid values include \"CaptureSql\", \"ExecuteAndCaptureSql\" and \"ExecuteSql\".", "", false, "false", "", "CaptureSql,ExecuteAndCaptureSql,ExecuteSql" ], [ "StatementTimeout", "Sets the number of seconds a statement is given to run before failing with a timeout error.\nThe default is read from the configuration \u0027sql.execution.timeout\u0027 that is currently set to 0 (unlimited).\r\nIf you want to change this to 10 minutes, use: Set-DbatoolsConfig -FullName \u0027sql.execution.timeout\u0027 -Value 600", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027sql.execution.timeout\u0027)", "" ], [ "TrustServerCertificate", "When this switch is enabled, the channel will be encrypted while bypassing walking the certificate chain to validate trust.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027sql.connection.trustcert\u0027)", "" ], [ "WorkstationId", "Sets the name of the workstation connecting to SQL Server.", "", false, "false", "", "" ], [ "AppendConnectionString", "Appends to the current connection string. Note that you cannot pass authentication information using this method. Use -SqlInstance and optionally -SqlCredential to set authentication information.", "", false, "false", "", "" ], [ "SqlConnectionOnly", "Instead of returning a rich SMO server object, this command will only return a SqlConnection object when setting this switch.", "", false, "false", "False", "" ], [ "AzureDomain", "By default, this is set to database.windows.net\nIn the event your AzureSqlDb is not on a database.windows.net domain, you can set a custom domain using the AzureDomain parameter.\r\nThis tells Connect-DbaInstance to login to the database using the method that works best with Azure.", "", false, "false", "database.windows.net", "" ], [ "AuthenticationType", "Not used in the current version.", "", false, "false", "Auto", "Auto,AD Universal with MFA Support" ], [ "Tenant", "The TenantId for an Azure Instance", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027azure.tenantid\u0027)", "" ], [ "Thumbprint", "Not used in the current version.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027azure.certificate.thumbprint\u0027)", "" ], [ "Store", "Not used in the current version.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027azure.certificate.store\u0027)", "CurrentUser,LocalMachine" ], [ "AccessToken", "Connect to an Azure SQL Database or an Azure SQL Managed Instance with an AccessToken, that has to be generated with Get-AzAccessToken.\r\nNote that the token is valid for only one hour and cannot be renewed automatically.", "", false, "false", "", "" ], [ "DedicatedAdminConnection", "Connects using \"ADMIN:\" to create a dedicated admin connection (DAC) as a non-pooled connection.\r\nIf the instance is on a remote server, the remote access has to be enabled via \"Set-DbaSpConfigure -Name RemoteDacConnectionsEnabled -Value $true\" or \"sp_configure \u0027remote admin connections\u0027, 1\".\r\nThe connection will not be closed if the variable holding the Server SMO is going out of scope, so it is very important to call .ConnectionContext.Disconnect() to close the connection. See example.", "", false, "false", "False", "" ], [ "DisableException", "By default in most of our commands, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis command, however, gifts you with \"sea of red\" exceptions, by default, because it is useful for advanced scripting.\nUsing this switch turns our \"nice by default\" feature on which makes errors into pretty warnings.", "", false, "false", "False", "" ] ], "Syntax": "Connect-DbaInstance [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString\u003e] [[-ApplicationIntent] \u003cString\u003e] [-AzureUnsupported] [[-BatchSeparator] \u003cString\u003e] [[-ClientName] \u003cString\u003e] [[-ConnectTimeout] \u003cInt32\u003e] [-EncryptConnection] [[-FailoverPartner] \u003cString\u003e] [[-LockTimeout] \u003cInt32\u003e] [[-MaxPoolSize] \u003cInt32\u003e] [[-MinPoolSize] \u003cInt32\u003e] [[-MinimumVersion] \u003cInt32\u003e] [-MultipleActiveResultSets] [-MultiSubnetFailover] [[-NetworkProtocol] \u003cString\u003e] [-NonPooledConnection] [[-PacketSize] \u003cInt32\u003e] [[-PooledConnectionLifetime] \u003cInt32\u003e] [[-SqlExecutionModes] \r\n\u003cString\u003e] [[-StatementTimeout] \u003cInt32\u003e] [-TrustServerCertificate] [[-WorkstationId] \u003cString\u003e] [[-AppendConnectionString] \u003cString\u003e] [-SqlConnectionOnly] [[-AzureDomain] \u003cString\u003e] [[-AuthenticationType] \u003cString\u003e] [[-Tenant] \u003cString\u003e] [[-Thumbprint] \u003cString\u003e] [[-Store] \u003cString\u003e] [[-AccessToken] \u003cString\u003e] [-DedicatedAdminConnection] [-DisableException] [\u003cCommonParameters\u003e]" }, { "Name": "ConvertTo-DbaDataTable", "Description": "Creates a DataTable based on an object\u0027s properties. This allows you to easily write to SQL Server tables.\n\nThanks to Chad Miller, this is based on his script. https://gallery.technet.microsoft.com/scriptcenter/4208a159-a52e-4b99-83d4-8048468d29dd\n\nIf the attempt to convert to data table fails, try the -Raw parameter for less accurate datatype detection.", "Tags": [ "DataTable", "Table", "Data" ], "Synopsis": "Creates a DataTable for an object.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "ConvertTo-DbaDataTable", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/ConvertTo-DbaDataTable", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-Service | ConvertTo-DbaDataTable\nCreates a DataTable from the output of Get-Service.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eConvertTo-DbaDataTable -InputObject $csv.cheesetypes\nCreates a DataTable from the CSV object $csv.cheesetypes.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$dblist | ConvertTo-DbaDataTable\nCreates a DataTable from the $dblist object passed in via pipeline.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-Process | ConvertTo-DbaDataTable -TimeSpanType TotalSeconds\nCreates a DataTable with the running processes and converts any TimeSpan property to TotalSeconds.", "Params": [ [ "InputObject", "The object to transform into a DataTable.", "", true, "true (ByValue)", "", "" ], [ "TimeSpanType", "Specifies the type to convert TimeSpan objects into. Default is \u0027TotalMilliseconds\u0027. Valid options are: \u0027Ticks\u0027, \u0027TotalDays\u0027, \u0027TotalHours\u0027, \u0027TotalMinutes\u0027, \u0027TotalSeconds\u0027, \u0027TotalMilliseconds\u0027, and \r\n\u0027String\u0027.", "", false, "false", "TotalMilliseconds", "Ticks,TotalDays,TotalHours,TotalMinutes,TotalSeconds,TotalMilliseconds,String" ], [ "SizeType", "Specifies the type to convert DbaSize objects to. Default is \u0027Int64\u0027. Valid options are \u0027Int32\u0027, \u0027Int64\u0027, and \u0027String\u0027.", "", false, "false", "Int64", "Int64,Int32,String" ], [ "IgnoreNull", "If this switch is enabled, objects with null values will be ignored (empty rows will be added by default).", "", false, "false", "False", "" ], [ "Raw", "If this switch is enabled, the DataTable will be created with strings. No attempt will be made to parse/determine data types.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "ConvertTo-DbaDataTable [-InputObject] \u003cPSObject[]\u003e [-TimeSpanType \u003cString\u003e] [-SizeType \u003cString\u003e] [-IgnoreNull] [-Raw] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "ConvertTo-DbaTimeline", "Description": "This function accepts input as pipeline from the following dbatools functions:\nGet-DbaAgentJobHistory\nGet-DbaDbBackupHistory\n(more to come...)\nAnd generates Bootstrap based, HTML file with Google Chart Timeline", "Tags": "Chart", "Synopsis": "Converts InputObject to a html timeline using Google Chart", "Alias": "", "Author": "Marcin Gminski (@marcingminski)", "CommandName": "ConvertTo-DbaTimeline", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/ConvertTo-DbaTimeline", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgentJobHistory -SqlInstance sql-1 -StartDate \u00272018-08-13 00:00\u0027 -EndDate \u00272018-08-13 23:59\u0027 -ExcludeJobSteps | ConvertTo-DbaTimeline | Out-File C:\\temp\\DbaAgentJobHistory.html \r\n-Encoding ASCII\nCreates an output file containing a pretty timeline for all of the agent job history results for sql-1 the whole day of 2018-08-13\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlcm | Get-DbaDbBackupHistory -Since \u00272018-08-13 00:00\u0027 | ConvertTo-DbaTimeline | Out-File C:\\temp\\DbaBackupHistory.html -Encoding ASCII\nCreates an output file containing a pretty timeline for the agent job history since 2018-08-13 for all of the registered servers on sqlcm\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$messageParameters = @{\n\u003e\u003e Subject = \"Backup history for sql2017 and sql2016\"\r\n\u003e\u003e Body = Get-DbaDbBackupHistory -SqlInstance sql2017, sql2016 -Since \u00272018-08-13 00:00\u0027 | ConvertTo-DbaTimeline | Out-String\r\n\u003e\u003e From = \"dba@ad.local\"\r\n\u003e\u003e To = \"dba@ad.local\"\r\n\u003e\u003e SmtpServer = \"smtp.ad.local\"\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e Send-MailMessage @messageParameters -BodyAsHtml\nSends an email to dba@ad.local with the results of Get-DbaDbBackupHistory. Note that viewing these reports may not be supported in all email clients.", "Params": [ [ "InputObject", "Pipe input, must an output from the above functions.", "", true, "true (ByValue)", "", "" ], [ "ExcludeRowLabel", "By default, the Timeline shows SqlInstance and item name (agent job or database) in row labels section of the chart.\r\nWhen this parameter (ExcludeRowLabel) is set to true the row labels will not be shown which will maximise the chart area for better visualisation.\r\nAll relevant details are still available in the tooltip.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "ConvertTo-DbaTimeline [-InputObject] \u003cObject[]\u003e [-ExcludeRowLabel] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "ConvertTo-DbaXESession", "Description": "Uses a slightly modified version of sp_SQLskills_ConvertTraceToExtendedEvents.sql to convert Traces to Extended Events.\n\nT-SQL code by: Jonathan M. Kehayias, SQLskills.com. T-SQL can be found in this module directory and at\nhttps://www.sqlskills.com/blogs/jonathan/converting-sql-trace-to-extended-events-in-sql-server-2012/", "Tags": [ "Trace", "ExtendedEvent" ], "Synopsis": "Uses a slightly modified version of sp_SQLskills_ConvertTraceToExtendedEvents.sql to convert Traces to Extended Events.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "ConvertTo-DbaXESession", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/ConvertTo-DbaXESession", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaTrace -SqlInstance sql2017, sql2012 | Where-Object Id -eq 2 | ConvertTo-DbaXESession -Name \u0027Test\u0027\nConverts Trace with ID 2 to a Session named Test on SQL Server instances named sql2017 and sql2012 and creates the Session on each respective server.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaTrace -SqlInstance sql2014 | Out-GridView -PassThru | ConvertTo-DbaXESession -Name \u0027Test\u0027 | Start-DbaXESession\nConverts selected traces on sql2014 to sessions, creates the session, and starts it.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaTrace -SqlInstance sql2014 | Where-Object Id -eq 1 | ConvertTo-DbaXESession -Name \u0027Test\u0027 -OutputScriptOnly\nConverts trace ID 1 on sql2014 to an Extended Event and outputs the resulting T-SQL.", "Params": [ [ "InputObject", "Specifies a Trace object output by Get-DbaTrace.", "", true, "true (ByValue)", "", "" ], [ "Name", "The name of the Trace to convert. If the name exists, characters will be appended to it.", "", true, "false", "", "" ], [ "OutputScriptOnly", "Outputs the T-SQL script to create the XE session and does not execute it.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "ConvertTo-DbaXESession [-InputObject] \u003cObject[]\u003e [-Name] \u003cString\u003e [-OutputScriptOnly] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaAgentAlert", "Description": "By default, all alerts are copied. The -Alert parameter is auto-populated 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", "Agent" ], "Synopsis": "Copy-DbaAgentAlert migrates alerts from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaAgentAlert", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaAgentAlert", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaAgentAlert -Source sqlserver2014a -Destination sqlcluster\nCopies all alerts from sqlserver2014a to sqlcluster using Windows credentials. If alerts with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaAgentAlert -Source sqlserver2014a -Destination sqlcluster -Alert PSAlert -SourceSqlCredential $cred -Force\nCopies a only the alert named PSAlert from sqlserver2014a to sqlcluster using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster. If an alert with the same name exists on \r\nsqlcluster, it will be dropped and recreated because -Force was used.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaAgentAlert -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\nShows what would happen if the command were executed using force.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Alert", "The alert(s) to process. This list is auto-populated from the server. If unspecified, all alerts will be processed.", "", false, "false", "", "" ], [ "ExcludeAlert", "The alert(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "IncludeDefaults", "Copy SQL Agent defaults such as FailSafeEmailAddress, ForwardingServer, and PagerSubjectTemplate.", "", false, "false", "False", "" ], [ "Force", "If this switch is enabled, the Alert will be dropped and recreated on Destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaAgentAlert [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Alert] \u003cObject[]\u003e] [[-ExcludeAlert] \u003cObject[]\u003e] [-IncludeDefaults] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaAgentJob", "Description": "By default, all jobs are copied. The -Job parameter is auto-populated 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", "Agent", "Job" ], "Synopsis": "Copy-DbaAgentJob migrates jobs from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaAgentJob", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaAgentJob", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaAgentJob -Source sqlserver2014a -Destination sqlcluster\nCopies all jobs from sqlserver2014a to sqlcluster, using Windows credentials. If jobs with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaAgentJob -Source sqlserver2014a -Destination sqlcluster -Job PSJob -SourceSqlCredential $cred -Force\nCopies a single job, the PSJob job from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster. If a job with the same name exists on \r\nsqlcluster, it will be dropped and recreated because -Force was used.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaAgentJob -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\nShows what would happen if the command were executed using force.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance sqlserver2014a | Where-Object Category -eq \"Report Server\" | Copy-DbaAgentJob -Destination sqlserver2014b\nCopies all SSRS jobs (subscriptions) from AlwaysOn Primary SQL instance sqlserver2014a to AlwaysOn Secondary SQL instance sqlserver2014b", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", false, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "The job(s) to process. This list is auto-populated from the server. If unspecified, all jobs will be processed.", "", false, "false", "", "" ], [ "ExcludeJob", "The job(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "DisableOnSource", "If this switch is enabled, the job will be disabled on the source server.", "", false, "false", "False", "" ], [ "DisableOnDestination", "If this switch is enabled, the newly migrated job will be disabled on the destination server.", "", false, "false", "False", "" ], [ "Force", "If this switch is enabled, the Job will be dropped and recreated on Destination.", "", false, "false", "False", "" ], [ "InputObject", "Piped in jobs from Get-DbaAgentJob", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaAgentJob [[-Source] \u003cDbaInstanceParameter\u003e] [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Job] \u003cObject[]\u003e] [[-ExcludeJob] \u003cObject[]\u003e] [-DisableOnSource] [-DisableOnDestination] [-Force] [[-InputObject] \u003cJob[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaAgentJobCategory", "Description": "By default, all SQL Agent categories for Jobs, Operators and Alerts are copied.\n\nThe -OperatorCategories parameter is auto-populated for command-line completion and can be used to copy only specific operator categories.\nThe -AgentCategories parameter is auto-populated for command-line completion and can be used to copy only specific agent categories.\nThe -JobCategories parameter is auto-populated 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", "Agent" ], "Synopsis": "Copy-DbaAgentJobCategory 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", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaAgentJobCategory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaAgentJobCategory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaAgentJobCategory -Source sqlserver2014a -Destination sqlcluster\nCopies all operator categories from sqlserver2014a to sqlcluster using Windows authentication. If operator categories with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaAgentJobCategory -Source sqlserver2014a -Destination sqlcluster -OperatorCategory PSOperator -SourceSqlCredential $cred -Force\nCopies a single operator category, the PSOperator operator category from sqlserver2014a to sqlcluster using SQL credentials to authenticate to sqlserver2014a and Windows credentials for sqlcluster. \r\nIf an operator category with the same name exists on sqlcluster, it will be dropped and recreated because -Force was used.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaAgentJobCategory -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\nShows what would happen if the command were executed using force.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "CategoryType", "Specifies the Category Type to migrate. Valid options are \"Job\", \"Alert\" and \"Operator\". When CategoryType is specified, all categories from the selected type will be migrated. For granular \r\nmigrations, use the three parameters below.", "", false, "false", "", "Job,Alert,Operator" ], [ "JobCategory", "This parameter is auto-populated for command-line completion and can be used to copy only specific job categories.", "", false, "false", "", "" ], [ "AgentCategory", "This parameter is auto-populated for command-line completion and can be used to copy only specific agent categories.", "", false, "false", "", "" ], [ "OperatorCategory", "This parameter is auto-populated for command-line completion and can be used to copy only specific operator categories.", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, the Category will be dropped and recreated on Destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaAgentJobCategory -Source \u003cDbaInstanceParameter\u003e [-SourceSqlCredential \u003cPSCredential\u003e] -Destination \u003cDbaInstanceParameter[]\u003e [-DestinationSqlCredential \u003cPSCredential\u003e] [-JobCategory \u003cString[]\u003e] [-AgentCategory \u003cString[]\u003e] [-OperatorCategory \u003cString[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nCopy-DbaAgentJobCategory -Source \u003cDbaInstanceParameter\u003e [-SourceSqlCredential \u003cPSCredential\u003e] -Destination \u003cDbaInstanceParameter[]\u003e [-DestinationSqlCredential \u003cPSCredential\u003e] [-CategoryType \u003cString[]\u003e] [-JobCategory \u003cString[]\u003e] [-AgentCategory \u003cString[]\u003e] [-OperatorCategory \u003cString[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaAgentOperator", "Description": "By default, all operators are copied. The -Operators parameter is auto-populated 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", "Agent", "Operator" ], "Synopsis": "Copy-DbaAgentOperator migrates operators from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaAgentOperator", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaAgentOperator", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaAgentOperator -Source sqlserver2014a -Destination sqlcluster\nCopies all operators from sqlserver2014a to sqlcluster using Windows credentials. If operators with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaAgentOperator -Source sqlserver2014a -Destination sqlcluster -Operator PSOperator -SourceSqlCredential $cred -Force\nCopies only the PSOperator operator from sqlserver2014a to sqlcluster using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster. If an operator with the same name exists on \r\nsqlcluster, it will be dropped and recreated because -Force was used.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaAgentOperator -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\nShows what would happen if the command were executed using force.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Operator", "The operator(s) to process. This list is auto-populated from the server. If unspecified, all operators will be processed.", "", false, "false", "", "" ], [ "ExcludeOperator", "The operators(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, the Operator will be dropped and recreated on Destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaAgentOperator [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Operator] \u003cObject[]\u003e] [[-ExcludeOperator] \u003cObject[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaAgentProxy", "Description": "By default, all proxy accounts are copied. The -ProxyAccounts parameter is auto-populated 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", "Agent" ], "Synopsis": "Copy-DbaAgentProxy migrates proxy accounts from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaAgentProxy", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaAgentProxy", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaAgentProxy -Source sqlserver2014a -Destination sqlcluster\nCopies all proxy accounts from sqlserver2014a to sqlcluster using Windows credentials. If proxy accounts with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaAgentProxy -Source sqlserver2014a -Destination sqlcluster -ProxyAccount PSProxy -SourceSqlCredential $cred -Force\nCopies only the PSProxy proxy account from sqlserver2014a to sqlcluster using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster. If a proxy account with the same name exists \r\non sqlcluster, it will be dropped and recreated because -Force was used.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaAgentProxy -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\nShows what would happen if the command were executed using force.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "ProxyAccount", "Only migrate specific proxy accounts", "", false, "false", "", "" ], [ "ExcludeProxyAccount", "Migrate all proxy accounts except the ones explicitly excluded", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, the Operator will be dropped and recreated on Destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaAgentProxy [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-ProxyAccount] \u003cString[]\u003e] [[-ExcludeProxyAccount] \u003cString[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaAgentSchedule", "Description": "All shared job schedules are copied.\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", "Agent" ], "Synopsis": "Copy-DbaAgentSchedule migrates shared job schedules from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaAgentSchedule", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaAgentSchedule", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaAgentSchedule -Source sqlserver2014a -Destination sqlcluster\nCopies all shared job schedules from sqlserver2014a to sqlcluster using Windows credentials. If shared job schedules with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaAgentSchedule -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\nShows what would happen if the command were executed using force.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAgentSchedule -SqlInstance sql2016 | Out-GridView -Passthru | Copy-DbaAgentSchedule -Destination sqlcluster\nGets a list of schedule, outputs to a gridview which can be selected from, then copies to SqlInstance", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", false, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Schedule", "Copy only specific schedules. Note that SQL Server allows multiple schedules with the same name. Use Id for more accurate schedule copies.", "", false, "false", "", "" ], [ "Id", "Copy only specific schedule.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaAgentSchedule", "", false, "true (ByValue)", "", "" ], [ "Force", "If this switch is enabled, the Operator will be dropped and recreated on Destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaAgentSchedule [[-Source] \u003cDbaInstanceParameter\u003e] [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Schedule] \u003cString[]\u003e] [[-Id] \u003cInt32[]\u003e] [[-InputObject] \u003cJobSchedule[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaAgentServer", "Description": "A wrapper function that calls the associated Copy command for each of the object types seen in SSMS under SQL Server Agent. This also copies all of the the SQL Agent properties (job history max rows, DBMail profile name, etc.).\n\nYou must have sysadmin access and server version must be SQL Server version 2000 or greater.", "Tags": [ "Migration", "SqlServerAgent", "SqlAgent" ], "Synopsis": "Copy SQL Server Agent from one server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaAgentServer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaAgentServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaAgentServer -Source sqlserver2014a -Destination sqlcluster\nCopies all job server objects from sqlserver2014a to sqlcluster using Windows credentials for authentication. If job objects with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaAgentServer -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred\nCopies all job objects from sqlserver2014a to sqlcluster using SQL credentials to authentication to sqlserver2014a and Windows credentials to authenticate to sqlcluster.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaAgentServer -Source sqlserver2014a -Destination sqlcluster -WhatIf\nShows what would happen if the command were executed.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "DisableJobsOnDestination", "If this switch is enabled, the jobs will be disabled on Destination after copying.", "", false, "false", "False", "" ], [ "DisableJobsOnSource", "If this switch is enabled, the jobs will be disabled on Source after copying.", "", false, "false", "False", "" ], [ "ExcludeServerProperties", "Skips the migration of Agent Server Properties (job history log, service state restart preferences, error log location, etc)", "", false, "false", "False", "" ], [ "Force", "If this switch is enabled, existing objects on Destination with matching names from Source will be dropped, then copied.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaAgentServer [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [-DisableJobsOnDestination] [-DisableJobsOnSource] [-ExcludeServerProperties] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaBackupDevice", "Description": "Backups are migrated using Admin shares. If the destination directory does not exist, SQL Server\u0027s default backup directory will be used.\n\nIf a backup device with same name exists on destination, it will not be dropped and recreated unless -Force is used.", "Tags": [ "Migration", "Backup" ], "Synopsis": "Copies backup devices one by one. Copies both SQL code and the backup file itself.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaBackupDevice", "Availability": "Windows only", "Links": "https://dbatools.io/Copy-DbaBackupDevice", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaBackupDevice -Source sqlserver2014a -Destination sqlcluster\nCopies all server backup devices from sqlserver2014a to sqlcluster using Windows credentials. If backup devices with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaBackupDevice -Source sqlserver2014a -Destination sqlcluster -BackupDevice backup01 -SourceSqlCredential $cred -Force\nCopies only the backup device named backup01 from sqlserver2014a to sqlcluster using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster. If a backup device with the same \r\nname exists on sqlcluster, it will be dropped and recreated because -Force was used.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaBackupDevice -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\nShows what would happen if the command were executed using force.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "BackupDevice", "BackupDevice to be copied. Auto-populated list of devices. If not provided all BackupDevice(s) will be copied.", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, backup device(s) will be dropped and recreated if they already exists on destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaBackupDevice [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-BackupDevice] \u003cObject[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaCredential", "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/", "Tags": [ "WSMan", "Migration" ], "Synopsis": "Copy-DbaCredential migrates SQL Server Credentials from one SQL Server to another while maintaining Credential passwords.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaCredential", "Availability": "Windows only", "Links": "https://dbatools.io/Copy-DbaCredential", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaCredential -Source sqlserver2014a -Destination sqlcluster\nCopies all SQL Server Credentials on sqlserver2014a to sqlcluster. If Credentials exist on destination, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaCredential -Source sqlserver2014a -Destination sqlcluster -Name \"PowerShell Proxy Account\" -Force\nCopies over one SQL Server Credential (PowerShell Proxy Account) from sqlserver to sqlcluster. If the Credential already exists on the destination, it will be dropped and recreated.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Credential", "This command requires access to the Windows OS via PowerShell remoting. Use this credential to connect to Windows using alternative credentials.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "Only include specific names\r\nNote: if spaces exist in the credential name, you will have to type \"\" or \u0027\u0027 around it.", "", false, "false", "", "" ], [ "ExcludeName", "Excluded credential names", "", false, "false", "", "" ], [ "Identity", "Only include specific identities\r\nNote: if spaces exist in the credential identity, you will have to type \"\" or \u0027\u0027 around it.", "CredentialIdentity", false, "false", "", "" ], [ "ExcludeIdentity", "Excluded identities", "ExcludeCredentialIdentity", false, "false", "", "" ], [ "Force", "If this switch is enabled, the Credential will be dropped and recreated if it already exists on Destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaCredential [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString[]\u003e] [[-ExcludeName] \u003cString[]\u003e] [[-Identity] \u003cString[]\u003e] [[-ExcludeIdentity] \u003cString[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaCustomError", "Description": "By default, all custom errors are copied. The -CustomError parameter is auto-populated 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. The us_english version must be created first. If you drop the us_english version, all the other languages will be dropped for that specific ID as well.", "Tags": [ "Migration", "CustomError" ], "Synopsis": "Copy-DbaCustomError migrates custom errors (user defined messages), by the custom error ID, from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaCustomError", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaCustomError", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaCustomError -Source sqlserver2014a -Destination sqlcluster\nCopies all server custom errors from sqlserver2014a to sqlcluster using Windows credentials. If custom errors with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaCustomError -Source sqlserver2014a -SourceSqlCredential $scred -Destination sqlcluster -DestinationSqlCredential $dcred -CustomError 60000 -Force\nCopies only the custom error with ID number 60000 from sqlserver2014a to sqlcluster using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster. If a custom error with the same \r\nname exists on sqlcluster, it will be updated because -Force was used.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaCustomError -Source sqlserver2014a -Destination sqlcluster -ExcludeCustomError 60000 -Force\nCopies all the custom errors found on sqlserver2014a except the custom error with ID number 60000 to sqlcluster. If a custom error with the same name exists on sqlcluster, it will be updated because \r\n-Force was used.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eCopy-DbaCustomError -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\nShows what would happen if the command were executed using force.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "CustomError", "The custom error(s) to process. This list is auto-populated from the server. If unspecified, all custom errors will be processed.", "", false, "false", "", "" ], [ "ExcludeCustomError", "The custom error(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, the custom error will be dropped and recreated if it already exists on Destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaCustomError [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-CustomError] \u003cObject[]\u003e] [[-ExcludeCustomError] \u003cObject[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaDatabase", "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 Server Express Edition.\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\nIf you are experiencing issues with Copy-DbaDatabase, please use Backup-DbaDatabase | Restore-DbaDatabase instead.", "Tags": [ "Migration", "Backup", "Restore" ], "Synopsis": "Migrates SQL Server databases from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaDatabase", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaDatabase", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaDatabase -Source sql2014a -Destination sql2014b -Database TestDB -BackupRestore -SharedPath \\\\fileshare\\sql\\migration\nMigrates a single user database TestDB using Backup and restore from instance sql2014a to sql2014b. Backup files are stored in \\\\fileshare\\sql\\migration.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaDatabase -Source sql2012 -Destination sql2014, sql2016 -DetachAttach -Reattach\nDatabases will be migrated from sql2012 to both sql2014 and sql2016 using the detach/copy files/attach method.The following will be performed: kick all users out of the database, detach all data/log \r\nfiles, move files across the network over an admin share (\\\\SqlSERVER\\M$\\MSSql...), attach file on destination server, reattach at source. If the database files (*.mdf, *.ndf, *.ldf) on *destination* \r\nexist and aren\u0027t in use, they will be overwritten.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaDatabase -Source sql2014a -Destination sqlcluster, sql2016 -BackupRestore -UseLastBackup -Force\nMigrates all user databases to sqlcluster and sql2016 using the last Full, Diff and Log backups from sql204a. If the databases exist on the destinations, they will be dropped prior to attach.\nNote that the backups must exist in a location accessible by all destination servers, such a network share.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eCopy-DbaDatabase -Source sql2014a -Destination sqlcluster -ExcludeDatabase Northwind, pubs -IncludeSupportDbs -Force -BackupRestore -SharedPath \\\\fileshare\\sql\\migration\nMigrates all user databases except for Northwind and pubs by using backup/restore (copy-only). Backup files are stored in \\\\fileshare\\sql\\migration. If the database exists on the destination, it will \r\nbe dropped prior to attach.\nIt also includes the support databases (ReportServer, ReportServerTempDb, SSISDB, distribution).\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eCopy-DbaDatabase -Source sql2014 -Destination managedinstance.cus19c972e4513d6.database.windows.net -DestinationSqlCredential $cred -AllDatabases -BackupRestore -SharedPath \r\nhttps://someblob.blob.core.windows.net/sql\nMigrate all user databases from instance sql2014 to the specified Azure SQL Manage Instance using the blob storage account https://someblob.blob.core.windows.net/sql using a Shared Access Signature \r\n(SAS) credential with a name matching the blob storage account\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eCopy-DbaDatabase -Source sql2014 -Destination managedinstance.cus19c972e4513d6.database.windows.net -DestinationSqlCredential $cred -Database MyDb -NewName AzureDb -WithReplace -BackupRestore \r\n-SharedPath https://someblob.blob.core.windows.net/sql -AzureCredential AzBlobCredential\nMigrates Mydb from instance sql2014 to AzureDb on the specified Azure SQL Manage Instance, replacing the existing AzureDb if it exists, using the blob storage account \r\nhttps://someblob.blob.core.windows.net/sql using the Sql Server Credential AzBlobCredential", "Params": [ [ "Source", "Source SQL Server.", "", false, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You may specify multiple servers.\nNote that when using -BackupRestore with multiple servers, the backup will only be performed once and backups will be deleted at the end (if you didn\u0027t specify -NoBackupCleanup).\nWhen using -DetachAttach with multiple servers, -Reattach must be specified.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Migrates only specified databases. This list is auto-populated from the server for tab completion. Multiple databases may be specified as a collection.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Excludes specified databases when performing -AllDatabases migrations. This list is auto-populated from the Source for tab completion.", "", false, "false", "", "" ], [ "AllDatabases", "If this switch is enabled, all user databases will be migrated. System and support databases will not be migrated. Requires -BackupRestore or -DetachAttach.", "All", false, "false", "False", "" ], [ "BackupRestore", "If this switch is enabled, the copy-only backup and restore method will be used to migrate the database(s). This method requires that you specify -SharedPath in a valid UNC format (\\\\server\\share).\nBackups will be immediately deleted after use unless -NoBackupCleanup is specified.", "", true, "false", "False", "" ], [ "SharedPath", "Specifies the network location for the backup files. The SQL Server service accounts must have read/write permission on this path.\r\nCan be either a full path \u0027c:\\backups\u0027, a UNC path \u0027\\\\server\\backups\u0027 or an Azure storage Account \u0027https://example.blob.core.windows.net/sql/\u0027", "", false, "false", "", "" ], [ "AzureCredential", "The name of the credential on the SQL instance that can write to the AzureBaseUrl, only needed if using Storage access keys\r\nIf using SAS credentials, the command will look for a credential with a name matching the AzureBaseUrl", "", false, "false", "", "" ], [ "WithReplace", "If this switch is enabled, the restore is executed with WITH REPLACE.", "", false, "false", "False", "" ], [ "NoRecovery", "If this switch is enabled, the restore is executed with WITH NORECOVERY. Ideal for staging.", "", false, "false", "False", "" ], [ "NoBackupCleanup", "If this switch is enabled, backups generated by this cmdlet will not be deleted after they are restored. The default behavior is to delete these backups.", "", false, "false", "False", "" ], [ "NumberFiles", "Number of files to split the backup. Default is 3.", "", false, "false", "3", "" ], [ "DetachAttach", "If this switch is enabled, the detach/copy/attach method is used to perform database migrations. No files are deleted on Source. If Destination attachment fails, the Source database will be \r\nreattached. File copies are performed over administrative shares (\\\\server\\x$\\mssql) using BITS. If a database is being mirrored, the mirror will be broken prior to migration.", "", true, "false", "False", "" ], [ "Reattach", "If this switch is enabled, all databases are reattached to Source after DetachAttach migration.", "", false, "false", "False", "" ], [ "SetSourceReadOnly", "If this switch is enabled, all migrated databases are set to ReadOnly on Source prior to detach/attach \u0026 backup/restore.\nIf -Reattach is used, databases are set to read-only after reattaching.", "", false, "false", "False", "" ], [ "ReuseSourceFolderStructure", "If this switch is enabled, databases will be migrated to a data and log directory structure on Destination mirroring that used on Source. By default, the default data and log directories for \r\nDestination will be used when the databases are migrated.\nThe structure on Source will be kept exactly, so consider this if you\u0027re migrating between different versions and use part of Microsoft\u0027s default Sql structure (MSSql12.INSTANCE, etc)\nTo reuse Destination folder structure, use the -WithReplace switch.", "ReuseFolderStructure", false, "false", "False", "" ], [ "IncludeSupportDbs", "If this switch is enabled, ReportServer, ReportServerTempDb, SSISDB, and distribution databases will be copied if they exist on Source. A log file named $SOURCE-$destinstance-$date-Sqls.csv will be \r\nwritten to the current directory.\nUse of this switch requires -BackupRestore or -DetachAttach as well.", "", false, "false", "False", "" ], [ "UseLastBackup", "Use the last full, diff and logs instead of performing backups. Note that the backups must exist in a location accessible by all destination servers, such a network share.", "", false, "false", "False", "" ], [ "Continue", "If specified, will to attempt to restore transaction log backups on top of existing database(s) in Recovering or Standby states. Only usable with -UseLastBackup", "", false, "false", "False", "" ], [ "InputObject", "Enables piped input from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "NoCopyOnly", "If this switch is enabled, backups will be taken without COPY_ONLY. This will break the LSN backup chain, which will interfere with the restore chain of the database.\nBy default this switch is disabled, so backups will be taken with COPY_ONLY. This will preserve the LSN backup chain.\nFor more details please refer to this MSDN article - https://msdn.microsoft.com/en-us/library/ms191495.aspx", "", false, "false", "False", "" ], [ "KeepCDC", "Indicates whether CDC information should be copied as part of the database", "", false, "false", "False", "" ], [ "KeepReplication", "Indicates whether replication configuration should be copied as part of the database copy operation", "", false, "false", "False", "" ], [ "SetSourceOffline", "If this switch is enabled, the Source database will be set to Offline after being copied.", "", false, "false", "False", "" ], [ "NewName", "If a single database is being copied, this will be used to rename the database during the copy process. Any occurrence of the original database name in the physical file names will be replaced with \r\nNewName\r\nIf specified with multiple databases a warning will be raised and the copy stopped\nThis option is mutually exclusive of Prefix", "", false, "false", "", "" ], [ "Prefix", "All copied database names and physical files will be prefixed with this string\nThis option is mutually exclusive of NewName", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, existing databases on Destination with matching names from Source will be dropped.\r\nIf using -DetachReattach, mirrors will be broken and the database(s) dropped from Availability Groups.\r\nIf using -SetSourceReadonly, this will instantly roll back any open transactions that may be stopping the process.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaDatabase [-Source \u003cDbaInstanceParameter\u003e] [-SourceSqlCredential \u003cPSCredential\u003e] -Destination \u003cDbaInstanceParameter[]\u003e [-DestinationSqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-AllDatabases] -BackupRestore [-SharedPath \u003cString\u003e] [-AzureCredential \u003cString\u003e] [-WithReplace] [-NoRecovery] [-NoBackupCleanup] [-NumberFiles \u003cInt32\u003e] [-SetSourceReadOnly] [-ReuseSourceFolderStructure] [-IncludeSupportDbs] [-UseLastBackup] [-Continue] [-InputObject \u003cDatabase[]\u003e] [-NoCopyOnly] [-KeepCDC] [-KeepReplication] [-SetSourceOffline] [-NewName \u003cString\u003e] [-Prefix \r\n\u003cString\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nCopy-DbaDatabase [-Source \u003cDbaInstanceParameter\u003e] [-SourceSqlCredential \u003cPSCredential\u003e] -Destination \u003cDbaInstanceParameter[]\u003e [-DestinationSqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-AllDatabases] [-AzureCredential \u003cString\u003e] -DetachAttach [-Reattach] [-SetSourceReadOnly] [-ReuseSourceFolderStructure] [-IncludeSupportDbs] [-InputObject \u003cDatabase[]\u003e] [-NoCopyOnly] [-SetSourceOffline] [-NewName \u003cString\u003e] [-Prefix \u003cString\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaDataCollector", "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\nThe -CollectionSet parameter is auto-populated for command-line completion and can be used to copy only specific objects.", "Tags": [ "Migration", "DataCollection" ], "Synopsis": "Migrates user SQL Data Collector collection sets. SQL Data Collector configuration is on the agenda, but it\u0027s hard.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaDataCollector", "Availability": "Windows only", "Links": "https://dbatools.io/Copy-DbaDataCollector", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaDataCollector -Source sqlserver2014a -Destination sqlcluster\nCopies all Data Collector Objects and Configurations from sqlserver2014a to sqlcluster, using Windows credentials.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaDataCollector -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred\nCopies all Data Collector Objects and Configurations from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaDataCollector -Source sqlserver2014a -Destination sqlcluster -WhatIf\nShows what would happen if the command were executed.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eCopy-DbaDataCollector -Source sqlserver2014a -Destination sqlcluster -CollectionSet \u0027Server Activity\u0027, \u0027Table Usage Analysis\u0027\nCopies two Collection Sets, Server Activity and Table Usage Analysis, from sqlserver2014a to sqlcluster.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination Sql Server. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "CollectionSet", "The collection set(s) to process - this list is auto-populated from the server. If unspecified, all collection sets will be processed.", "", false, "false", "", "" ], [ "ExcludeCollectionSet", "The collection set(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "NoServerReconfig", "Upcoming parameter to enable server reconfiguration", "", false, "false", "False", "" ], [ "Force", "If collection sets exists on destination server, it will be dropped and recreated.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaDataCollector [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-CollectionSet] \u003cObject[]\u003e] [[-ExcludeCollectionSet] \u003cObject[]\u003e] [-NoServerReconfig] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaDbAssembly", "Description": "By default, all assemblies are copied.\n\nIf the assembly already exists on the destination, it will be skipped unless -Force is used.\n\nThis script does not yet copy dependencies or dependent objects.", "Tags": [ "Migration", "Assembly" ], "Synopsis": "Copy-DbaDbAssembly migrates assemblies from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaDbAssembly", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaDbAssembly", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaDbAssembly -Source sqlserver2014a -Destination sqlcluster\nCopies all assemblies from sqlserver2014a to sqlcluster using Windows credentials. If assemblies with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaDbAssembly -Source sqlserver2014a -Destination sqlcluster -Assembly dbname.assemblyname, dbname3.anotherassembly -SourceSqlCredential $cred -Force\nCopies two assemblies, the dbname.assemblyname and dbname3.anotherassembly from sqlserver2014a to sqlcluster using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster. If an \r\nassembly with the same name exists on sqlcluster, it will be dropped and recreated because -Force was used.\nIn this example, anotherassembly will be copied to the dbname3 database on the server sqlcluster.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaDbAssembly -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\nShows what would happen if the command were executed using force.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Assembly", "The assembly(ies) to process. This list is auto-populated from the server. If unspecified, all assemblies will be processed.", "", false, "false", "", "" ], [ "ExcludeAssembly", "The assembly(ies) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, existing assemblies on Destination with matching names from Source will be dropped.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaDbAssembly [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Assembly] \u003cObject[]\u003e] [[-ExcludeAssembly] \u003cObject[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaDbMail", "Description": "By default, all mail configurations for Profiles, Accounts, Mail Servers and Configs are copied.", "Tags": [ "Migration", "Mail" ], "Synopsis": "Migrates Mail Profiles, Accounts, Mail Servers and Mail Server Configs from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaDbMail", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaDbMail", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaDbMail -Source sqlserver2014a -Destination sqlcluster\nCopies all database mail objects from sqlserver2014a to sqlcluster using Windows credentials. If database mail objects with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaDbMail -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred\nCopies all database mail objects from sqlserver2014a to sqlcluster using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaDbMail -Source sqlserver2014a -Destination sqlcluster -WhatIf\nShows what would happen if the command were executed.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eCopy-DbaDbMail -Source sqlserver2014a -Destination sqlcluster -EnableException\nPerforms execution of function, and will throw a terminating exception if something breaks", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "Type", "Specifies the object type to migrate. Valid options are \u0027ConfigurationValues\u0027, \u0027Profiles\u0027, \u0027Accounts\u0027, and \u0027MailServers\u0027. When Type is specified, all categories from the selected type will be \r\nmigrated.", "", false, "false", "", "ConfigurationValues,Profiles,Accounts,MailServers" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, existing objects on Destination with matching names from Source will be dropped.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaDbMail -Source \u003cDbaInstanceParameter\u003e -Destination \u003cDbaInstanceParameter[]\u003e [-SourceSqlCredential \u003cPSCredential\u003e] [-DestinationSqlCredential \u003cPSCredential\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nCopy-DbaDbMail -Source \u003cDbaInstanceParameter\u003e -Destination \u003cDbaInstanceParameter[]\u003e [-Type \u003cString[]\u003e] [-SourceSqlCredential \u003cPSCredential\u003e] [-DestinationSqlCredential \u003cPSCredential\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaDbQueryStoreOption", "Description": "Copies the configuration of a Query Store enabled database and sets the copied configuration on other databases.", "Tags": "QueryStore", "Synopsis": "Copies the configuration of a Query Store enabled database and sets the copied configuration on other databases.", "Alias": "", "Author": "Enrico van de Laar (@evdlaar) | Tracy Boggiano ( @Tracy Boggiano)", "CommandName": "Copy-DbaDbQueryStoreOption", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaDbQueryStoreOption", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaDbQueryStoreOption -Source ServerA\\SQL -SourceDatabase AdventureWorks -Destination ServerB\\SQL -AllDatabases\nCopy the Query Store configuration of the AdventureWorks database in the ServerA\\SQL instance and apply it on all user databases in the ServerB\\SQL Instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaDbQueryStoreOption -Source ServerA\\SQL -SourceDatabase AdventureWorks -Destination ServerB\\SQL -DestinationDatabase WorldWideTraders\nCopy the Query Store configuration of the AdventureWorks database in the ServerA\\SQL instance and apply it to the WorldWideTraders database in the ServerB\\SQL Instance.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2016 or higher.", "", true, "true (ByValue)", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "SourceDatabase", "Specifies the database to copy the Query Store configuration from.", "", true, "true (ByValue)", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2016 or higher.", "", true, "true (ByValue)", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "DestinationDatabase", "Specifies a list of databases that will receive a copy of the Query Store configuration of the SourceDatabase.", "", false, "false", "", "" ], [ "Exclude", "Specifies a list of databases which will NOT receive a copy of the Query Store configuration.", "", false, "false", "", "" ], [ "AllDatabases", "If this switch is enabled, the Query Store configuration will be copied to all databases on the destination instance.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaDbQueryStoreOption [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-SourceDatabase] \u003cObject\u003e [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-DestinationDatabase] \u003cObject[]\u003e] [[-Exclude] \u003cObject[]\u003e] [-AllDatabases] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaDbTableData", "Description": "Copies data between SQL Server tables using SQL Bulk Copy.\nThe same can be achieved also using Invoke-DbaQuery and Write-DbaDbTableData but it will buffer the contents of that table in memory of the machine running the commands.\nThis function prevents that by streaming a copy of the data in the most speedy and least resource-intensive way.", "Tags": "Migration", "Synopsis": "Copies data between SQL Server tables.", "Alias": "", "Author": "Simone Bizzotto (@niphlod)", "CommandName": "Copy-DbaDbTableData", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaDbTableData", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaDbTableData -SqlInstance sql1 -Destination sql2 -Database dbatools_from -Table dbo.test_table\nCopies all the data from table dbo.test_table (2-part name) in database dbatools_from on sql1 to table test_table in database dbatools_from on sql2.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaDbTableData -SqlInstance sql1 -Destination sql2 -Database dbatools_from -DestinationDatabase dbatools_dest -Table [Schema].[test table]\nCopies all the data from table [Schema].[test table] (2-part name) in database dbatools_from on sql1 to table [Schema].[test table] in database dbatools_dest on sql2\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance sql1 -Database tempdb -Table tb1, tb2 | Copy-DbaDbTableData -DestinationTable tb3\nCopies all data from tables tb1 and tb2 in tempdb on sql1 to tb3 in tempdb on sql1\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance sql1 -Database tempdb -Table tb1, tb2 | Copy-DbaDbTableData -Destination sql2\nCopies data from tb1 and tb2 in tempdb on sql1 to the same table in tempdb on sql2\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eCopy-DbaDbTableData -SqlInstance sql1 -Destination sql2 -Database dbatools_from -Table test_table -KeepIdentity -Truncate\nCopies all the data in table test_table from sql1 to sql2, using the database dbatools_from, keeping identity columns and truncating the destination\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$params = @{\n\u003e\u003e SqlInstance = \u0027sql1\u0027\r\n\u003e\u003e Destination = \u0027sql2\u0027\r\n\u003e\u003e Database = \u0027dbatools_from\u0027\r\n\u003e\u003e DestinationDatabase = \u0027dbatools_dest\u0027\r\n\u003e\u003e Table = \u0027[Schema].[Table]\u0027\r\n\u003e\u003e DestinationTable = \u0027[dbo].[Table.Copy]\u0027\r\n\u003e\u003e KeepIdentity = $true\r\n\u003e\u003e KeepNulls = $true\r\n\u003e\u003e Truncate = $true\r\n\u003e\u003e BatchSize = 10000\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e Copy-DbaDbTableData @params\nCopies all the data from table [Schema].[Table] (2-part name) in database dbatools_from on sql1 to table [dbo].[Table.Copy] in database dbatools_dest on sql2\r\nKeeps identity columns and Nulls, truncates the destination and processes in BatchSize of 10000.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$params = @{\n\u003e\u003e SqlInstance = \u0027server1\u0027\r\n\u003e\u003e Destination = \u0027server1\u0027\r\n\u003e\u003e Database = \u0027AdventureWorks2017\u0027\r\n\u003e\u003e DestinationDatabase = \u0027AdventureWorks2017\u0027\r\n\u003e\u003e Table = \u0027[AdventureWorks2017].[Person].[EmailPromotion]\u0027\r\n\u003e\u003e BatchSize = 10000\r\n\u003e\u003e Query = \"SELECT * FROM [OtherDb].[Person].[Person] where EmailPromotion = 1\"\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e Copy-DbaDbTableData @params\nCopies data returned from the query on server1 into the AdventureWorks2017 on server1, using a 4-part name for the -Table parameter.\r\nSee the -Query param documentation for more details.\r\nCopy is processed in BatchSize of 10000 rows.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eCopy-DbaDbTableData -SqlInstance sql1 -Database tempdb -View [tempdb].[dbo].[vw1] -DestinationTable [SampleDb].[SampleSchema].[SampleTable] -AutoCreateTable\nCopies all data from [tempdb].[dbo].[vw1] (3-part name) view on instance sql1 to an auto-created table [SampleDb].[SampleSchema].[SampleTable] on instance sql1", "Params": [ [ "SqlInstance", "Source SQL Server.You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the source instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination Sql Server. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", false, "false", "", "" ], [ "DestinationSqlCredential", "Login to the destination instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database to copy the table from.", "", false, "false", "", "" ], [ "DestinationDatabase", "The database to copy the table to. If not specified, it is assumed to be the same of Database", "", false, "false", "", "" ], [ "Table", "Specify a table to use as a source. You can specify a 2 or 3 part name.\r\nIf the object has special characters please wrap them in square brackets.\nNote: Cannot specify a view if a table value is provided", "", false, "false", "", "" ], [ "View", "Specify a view to use as a source. You can specify a 2 or 3 part name (see examples).\r\nIf the object has special characters please wrap them in square brackets.\nNote: Cannot specify a table if a view value is provided", "", false, "false", "", "" ], [ "Query", "Define a query to use as a source. Note: 3 or 4 part object names may be used (see examples)\r\nEnsure to select all required columns.\r\nCalculated Columns or columns with default values may be excluded.\nNote: The workflow in the command requires that a valid -Table or -View parameter value be specified.", "", false, "false", "", "" ], [ "AutoCreateTable", "Creates the destination table if it does not already exist, based off of the \"Export...\" script of the source table.", "", false, "false", "False", "" ], [ "BatchSize", "The BatchSize for the import defaults to 50000.", "", false, "false", "50000", "" ], [ "NotifyAfter", "Sets the option to show the notification after so many rows of import. The default is 5000 rows.", "", false, "false", "5000", "" ], [ "DestinationTable", "The table you want to use as destination. If not specified, it is assumed to be the same of Table", "", false, "false", "", "" ], [ "NoTableLock", "If this switch is enabled, a table lock (TABLOCK) will not be placed on the destination table. By default, this operation will lock the destination table while running.", "", false, "false", "False", "" ], [ "CheckConstraints", "If this switch is enabled, the SqlBulkCopy option to process check constraints will be enabled.\nPer Microsoft \"Check constraints while data is being inserted. By default, constraints are not checked.\"", "", false, "false", "False", "" ], [ "FireTriggers", "If this switch is enabled, the SqlBulkCopy option to fire insert triggers will be enabled.\nPer Microsoft \"When specified, cause the server to fire the insert triggers for the rows being inserted into the Database.\"", "", false, "false", "False", "" ], [ "KeepIdentity", "If this switch is enabled, the SqlBulkCopy option to preserve source identity values will be enabled.\nPer Microsoft \"Preserve source identity values. When not specified, identity values are assigned by the destination.\"", "", false, "false", "False", "" ], [ "KeepNulls", "If this switch is enabled, the SqlBulkCopy option to preserve NULL values will be enabled.\nPer Microsoft \"Preserve null values in the destination table regardless of the settings for default values. When not specified, null values are replaced by default values where applicable.\"", "", false, "false", "False", "" ], [ "Truncate", "If this switch is enabled, the destination table will be truncated after prompting for confirmation.", "", false, "false", "False", "" ], [ "BulkCopyTimeout", "Value in seconds for the BulkCopy operations timeout. The default is 5000 seconds.", "", false, "false", "5000", "" ], [ "CommandTimeout", "Gets or sets the wait time (in seconds) before terminating the attempt to execute the reader and bulk copy operation. The default is 0 seconds (no timeout).", "", false, "false", "0", "" ], [ "InputObject", "Enables piping of Table objects from Get-DbaDbTable", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaDbTableData [[-SqlInstance] \u003cDbaInstanceParameter\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Destination] \u003cDbaInstanceParameter[]\u003e] [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString\u003e] [[-DestinationDatabase] \u003cString\u003e] [[-Table] \u003cString[]\u003e] [[-View] \u003cString[]\u003e] [[-Query] \u003cString\u003e] [-AutoCreateTable] [[-BatchSize] \u003cInt32\u003e] [[-NotifyAfter] \u003cInt32\u003e] [[-DestinationTable] \u003cString\u003e] [-NoTableLock] [-CheckConstraints] [-FireTriggers] [-KeepIdentity] [-KeepNulls] [-Truncate] [[-BulkCopyTimeout] \u003cInt32\u003e] [[-CommandTimeout] \u003cInt32\u003e] [[-InputObject] \u003cTableViewBase[]\u003e] \r\n[-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaDbViewData", "Description": "Copies data from a SQL Server view to a table using SQL Bulk Copy.\nWith this function, a streaming copy will be done in the most speedy and least resource-intensive way.", "Tags": "Migration", "Synopsis": "Copies data from a SQL Server view to a table.", "Alias": "", "Author": "Stephen Swan (@jaxnoth)", "CommandName": "Copy-DbaDbViewData", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaDbViewData", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaDbViewData -SqlInstance sql1 -Destination sql2 -Database dbatools_from -View dbo.test_view\nCopies all the data from view dbo.test_view (2-part name) in database dbatools_from on sql1 to view test_view in database dbatools_from on sql2.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaDbViewData -SqlInstance sql1 -Destination sql2 -Database dbatools_from -DestinationDatabase dbatools_dest -DestinationTable [Schema].[test table]\nCopies all the data from view [Schema].[test view] (2-part name) in database dbatools_from on sql1 to table [Schema].[test table] in database dbatools_dest on sql2\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbView -SqlInstance sql1 -Database tempdb -View vw1, vw2 | Copy-DbaDbViewData -DestinationTable tb3\nCopies all data from Views vw1 and vw2 in tempdb on sql1 to tb3 in tempdb on sql1\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbView -SqlInstance sql1 -Database tempdb -View vw1, vw2 | Copy-DbaDbViewData -Destination sql2\nCopies data from tbl1 in tempdb on sql1 to tbl1 in tempdb on sql2\r\nthen\r\nCopies data from tbl2 in tempdb on sql1 to tbl2 in tempdb on sql2\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eCopy-DbaDbViewData -SqlInstance sql1 -Destination sql2 -Database dbatools_from -View test_view -KeepIdentity -Truncate\nCopies all the data in view test_view from sql1 to sql2, using the database dbatools_from, keeping identity columns and truncating the destination\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$params = @{\n\u003e\u003e SqlInstance = \u0027sql1\u0027\r\n\u003e\u003e Destination = \u0027sql2\u0027\r\n\u003e\u003e Database = \u0027dbatools_from\u0027\r\n\u003e\u003e DestinationDatabase = \u0027dbatools_dest\u0027\r\n\u003e\u003e View = \u0027[Schema].[View]\u0027\r\n\u003e\u003e DestinationTable = \u0027[dbo].[View.Copy]\u0027\r\n\u003e\u003e KeepIdentity = $true\r\n\u003e\u003e KeepNulls = $true\r\n\u003e\u003e Truncate = $true\r\n\u003e\u003e BatchSize = 10000\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e Copy-DbaDbViewData @params\nCopies all the data from view [Schema].[View] in database dbatools_from on sql1 to table [dbo].[Table.Copy] in database dbatools_dest on sql2\r\nKeeps identity columns and Nulls, truncates the destination and processes in BatchSize of 10000.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$params = @{\n\u003e\u003e SqlInstance = \u0027server1\u0027\r\n\u003e\u003e Destination = \u0027server1\u0027\r\n\u003e\u003e Database = \u0027AdventureWorks2017\u0027\r\n\u003e\u003e DestinationDatabase = \u0027AdventureWorks2017\u0027\r\n\u003e\u003e View = \u0027[AdventureWorks2017].[Person].[EmailPromotion]\u0027\r\n\u003e\u003e BatchSize = 10000\r\n\u003e\u003e Query = \"SELECT * FROM [OtherDb].[Person].[Person] where EmailPromotion = 1\"\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e Copy-DbaDbViewData @params\nCopies data returned from the query on server1 into the AdventureWorks2017 on server1.\r\nThis query uses a 3-part name to reference the object in the query value, it will try to find the view named \"Person\" in the schema \"Person\" and database \"OtherDb\".\r\nCopy is processed in BatchSize of 10000 rows. See the -Query param documentation for more details.", "Params": [ [ "SqlInstance", "Source SQL Server.You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the source instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination Sql Server. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", false, "false", "", "" ], [ "DestinationSqlCredential", "Login to the destination instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database to copy the table from.", "", false, "false", "", "" ], [ "DestinationDatabase", "The database to copy the table to. If not specified, it is assumed to be the same of Database", "", false, "false", "", "" ], [ "View", "Specify a view to use as a source. You can specify a 2 or 3 part name (see examples).\nIf the object has special characters please wrap them in square brackets.", "", false, "false", "", "" ], [ "Query", "Define a query to use as a source. Note: 3 or 4 part object names may be used (see examples)\r\nEnsure to select all required columns.\r\nCalculated Columns or columns with default values may be excluded.\nNote: The workflow in the command requires that a valid -Table or -View parameter value be specified.", "", false, "false", "", "" ], [ "AutoCreateTable", "Creates the destination table if it does not already exist, based off of the \"Export...\" script of the source table.", "", false, "false", "False", "" ], [ "BatchSize", "The BatchSize for the import defaults to 50000.", "", false, "false", "50000", "" ], [ "NotifyAfter", "Sets the option to show the notification after so many rows of import. The default is 5000 rows.", "", false, "false", "5000", "" ], [ "DestinationTable", "The table you want to use as destination. If not specified, it is assumed to be the same of View", "", false, "false", "", "" ], [ "NoTableLock", "If this switch is enabled, a table lock (TABLOCK) will not be placed on the destination table. By default, this operation will lock the destination table while running.", "", false, "false", "False", "" ], [ "CheckConstraints", "If this switch is enabled, the SqlBulkCopy option to process check constraints will be enabled.\nPer Microsoft \"Check constraints while data is being inserted. By default, constraints are not checked.\"", "", false, "false", "False", "" ], [ "FireTriggers", "If this switch is enabled, the SqlBulkCopy option to fire insert triggers will be enabled.\nPer Microsoft \"When specified, cause the server to fire the insert triggers for the rows being inserted into the Database.\"", "", false, "false", "False", "" ], [ "KeepIdentity", "If this switch is enabled, the SqlBulkCopy option to preserve source identity values will be enabled.\nPer Microsoft \"Preserve source identity values. When not specified, identity values are assigned by the destination.\"", "", false, "false", "False", "" ], [ "KeepNulls", "If this switch is enabled, the SqlBulkCopy option to preserve NULL values will be enabled.\nPer Microsoft \"Preserve null values in the destination table regardless of the settings for default values. When not specified, null values are replaced by default values where applicable.\"", "", false, "false", "False", "" ], [ "Truncate", "If this switch is enabled, the destination table will be truncated after prompting for confirmation.", "", false, "false", "False", "" ], [ "BulkCopyTimeOut", "Value in seconds for the BulkCopy operations timeout. The default is 5000 seconds.", "", false, "false", "5000", "" ], [ "InputObject", "Enables piping of View objects from Get-DbaDbView", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaDbViewData [[-SqlInstance] \u003cDbaInstanceParameter\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Destination] \u003cDbaInstanceParameter[]\u003e] [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString\u003e] [[-DestinationDatabase] \u003cString\u003e] [[-View] \u003cString[]\u003e] [[-Query] \u003cString\u003e] [-AutoCreateTable] [[-BatchSize] \u003cInt32\u003e] [[-NotifyAfter] \u003cInt32\u003e] [[-DestinationTable] \u003cString\u003e] [-NoTableLock] [-CheckConstraints] [-FireTriggers] [-KeepIdentity] [-KeepNulls] [-Truncate] [[-BulkCopyTimeOut] \u003cInt32\u003e] [[-InputObject] \u003cTableViewBase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaEndpoint", "Description": "By default, all endpoints are copied.\n\nIf the endpoint already exists on the destination, it will be skipped unless -Force is used.", "Tags": [ "Migration", "Endpoint" ], "Synopsis": "Copy-DbaEndpoint migrates server endpoints from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaEndpoint", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaEndpoint", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaEndpoint -Source sqlserver2014a -Destination sqlcluster\nCopies all server endpoints from sqlserver2014a to sqlcluster, using Windows credentials. If endpoints with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaEndpoint -Source sqlserver2014a -SourceSqlCredential $cred -Destination sqlcluster -Endpoint tg_noDbDrop -Force\nCopies only the tg_noDbDrop endpoint from sqlserver2014a to sqlcluster using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster. If an endpoint with the same name exists on \r\nsqlcluster, it will be dropped and recreated because -Force was used.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaEndpoint -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\nShows what would happen if the command were executed using force.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Endpoint", "The endpoint(s) to process. This list is auto-populated from the server. If unspecified, all endpoints will be processed.", "", false, "false", "", "" ], [ "ExcludeEndpoint", "The endpoint(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, existing endpoints on Destination with matching names from Source will be dropped.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaEndpoint [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Endpoint] \u003cObject[]\u003e] [[-ExcludeEndpoint] \u003cObject[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaInstanceAudit", "Description": "By default, all audits are copied. The -Audit parameter is auto-populated 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", "Synopsis": "Copy-DbaInstanceAudit migrates server audits from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaInstanceAudit", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaInstanceAudit", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaInstanceAudit -Source sqlserver2014a -Destination sqlcluster\nCopies all server audits from sqlserver2014a to sqlcluster, using Windows credentials. If audits with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaInstanceAudit -Source sqlserver2014a -Destination sqlcluster -Audit tg_noDbDrop -SourceSqlCredential $cred -Force\nCopies a single audit, the tg_noDbDrop audit from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster. If an audit with the same name exists \r\non sqlcluster, it will be dropped and recreated because -Force was used.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaInstanceAudit -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\nShows what would happen if the command were executed using force.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eCopy-DbaInstanceAudit -Source sqlserver-0 -Destination sqlserver-1 -Audit audit1 -Path \u0027C:\\audit1\u0027\nCopies audit audit1 from sqlserver-0 to sqlserver-1. The file path on sqlserver-1 will be set to \u0027C:\\audit1\u0027.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Audit", "The audit(s) to process. Options for this list are auto-populated from the server. If unspecified, all audits will be processed.", "", false, "false", "", "" ], [ "ExcludeAudit", "The audit(s) to exclude. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "Path", "Destination file path. If not specified, the file path of the source will be used (or the default data directory).", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, the audits will be dropped and recreated on Destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaInstanceAudit [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Audit] \u003cObject[]\u003e] [[-ExcludeAudit] \u003cObject[]\u003e] [[-Path] \u003cString\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaInstanceAuditSpecification", "Description": "By default, all audits are copied. The -AuditSpecification parameter is auto-populated 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", "ServerAudit", "AuditSpecification" ], "Synopsis": "Copy-DbaInstanceAuditSpecification migrates server audit specifications from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaInstanceAuditSpecification", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaInstanceAuditSpecification", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaInstanceAuditSpecification -Source sqlserver2014a -Destination sqlcluster\nCopies all server audits from sqlserver2014a to sqlcluster using Windows credentials to connect. If audits with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaInstanceAuditSpecification -Source sqlserver2014a -Destination sqlcluster -AuditSpecification tg_noDbDrop -SourceSqlCredential $cred -Force\nCopies a single audit, the tg_noDbDrop audit from sqlserver2014a to sqlcluster using SQL credentials to connect to sqlserver2014a and Windows credentials to connect to sqlcluster. If an audit \r\nspecification with the same name exists on sqlcluster, it will be dropped and recreated because -Force was used.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaInstanceAuditSpecification -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\nShows what would happen if the command were executed using force.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AuditSpecification", "The Server Audit Specification(s) to process. Options for this list are auto-populated from the server. If unspecified, all Server Audit Specifications will be processed.", "", false, "false", "", "" ], [ "ExcludeAuditSpecification", "The Server Audit Specification(s) to exclude. Options for this list are auto-populated from the server", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, the Audits Specifications will be dropped and recreated on Destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaInstanceAuditSpecification [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-AuditSpecification] \u003cObject[]\u003e] [[-ExcludeAuditSpecification] \u003cObject[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaInstanceTrigger", "Description": "By default, all triggers are copied. The -ServerTrigger parameter is auto-populated 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", "Synopsis": "Copy-DbaInstanceTrigger migrates server triggers from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaInstanceTrigger", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaInstanceTrigger", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaInstanceTrigger -Source sqlserver2014a -Destination sqlcluster\nCopies all server triggers from sqlserver2014a to sqlcluster, using Windows credentials. If triggers with the same name exist on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaInstanceTrigger -Source sqlserver2014a -Destination sqlcluster -ServerTrigger tg_noDbDrop -SourceSqlCredential $cred -Force\nCopies a single trigger, the tg_noDbDrop trigger from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster. If a trigger with the same name \r\nexists on sqlcluster, it will be dropped and recreated because -Force was used.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaInstanceTrigger -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\nShows what would happen if the command were executed using force.", "Params": [ [ "Source", "Source SQL Server.You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination Sql Server. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "ServerTrigger", "The Server Trigger(s) to process - this list is auto-populated from the server. If unspecified, all Server Triggers will be processed.", "", false, "false", "", "" ], [ "ExcludeServerTrigger", "The Server Trigger(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Force", "Drops and recreates the Trigger if it exists", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaInstanceTrigger [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-ServerTrigger] \u003cObject[]\u003e] [[-ExcludeServerTrigger] \u003cObject[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaLinkedServer", "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/", "Tags": [ "WSMan", "Migration", "LinkedServer" ], "Synopsis": "Copy-DbaLinkedServer migrates Linked Servers from one SQL Server to another. Linked Server logins and passwords are migrated as well.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaLinkedServer", "Availability": "Windows only", "Links": "https://dbatools.io/Copy-DbaLinkedServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaLinkedServer -Source sqlserver2014a -Destination sqlcluster\nCopies all SQL Server Linked Servers on sqlserver2014a to sqlcluster. If Linked Server exists on destination, it will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaLinkedServer -Source sqlserver2014a -Destination sqlcluster -LinkedServer SQL2K5,SQL2k -Force\nCopies over two SQL Server Linked Servers (SQL2K and SQL2K2) from sqlserver to sqlcluster. If the credential already exists on the destination, it will be dropped.", "Params": [ [ "Source", "Source SQL Server (2005 and above). You must have sysadmin access to both SQL Server and Windows.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server (2005 and above). You must have sysadmin access to both SQL Server and Windows.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "LinkedServer", "The linked server(s) to process - this list is auto-populated from the server. If unspecified, all linked servers will be processed.", "", false, "false", "", "" ], [ "ExcludeLinkedServer", "The linked server(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "UpgradeSqlClient", "Upgrade any SqlClient Linked Server to the current version", "", false, "false", "False", "" ], [ "ExcludePassword", "Copies the logins but does not access, decrypt or create sensitive information", "", false, "false", "False", "" ], [ "Force", "By default, if a Linked Server exists on the source and destination, the Linked Server is not copied over. Specifying -force will drop and recreate the Linked Server on the Destination server.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaLinkedServer [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-LinkedServer] \u003cObject[]\u003e] [[-ExcludeLinkedServer] \u003cObject[]\u003e] [-UpgradeSqlClient] [-ExcludePassword] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaLogin", "Description": "SQL Server 2000: Migrates logins with SIDs, passwords, server roles and database roles.\n\nSQL Server 2005 \u0026 newer: 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 Server 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.", "Tags": [ "Migration", "Login" ], "Synopsis": "Migrates logins from source to destination SQL Servers. Supports SQL Server versions 2000 and newer.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaLogin", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaLogin", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaLogin -Source sqlserver2014a -Destination sqlcluster -Force\nCopies all logins from Source Destination. If a SQL Login on Source exists on the Destination, the Login on Destination will be dropped and recreated.\nIf active connections are found for a login, the copy of that Login will fail as it cannot be dropped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaLogin -Source sqlserver2014a -Destination sqlcluster -Force -KillActiveConnection\nCopies all logins from Source Destination. If a SQL Login on Source exists on the Destination, the Login on Destination will be dropped and recreated.\nIf any active connections are found they will be killed.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaLogin -Source sqlserver2014a -Destination sqlcluster -ExcludeLogin realcajun -SourceSqlCredential $scred -DestinationSqlCredential $dcred\nCopies all Logins from Source to Destination except for realcajun using SQL Authentication to connect to both instances.\nIf a Login already exists on the destination, it will not be migrated.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eCopy-DbaLogin -Source sqlserver2014a -Destination sqlcluster -Login realcajun, netnerds -force\nCopies ONLY Logins netnerds and realcajun. If Login realcajun or netnerds exists on Destination, the existing Login(s) will be dropped and recreated.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eCopy-DbaLogin -LoginRenameHashtable @{ \"PreviousUser\" = \"newlogin\" } -Source $Sql01 -Destination Localhost -SourceSqlCredential $sqlcred -Login PreviousUser\nCopies PreviousUser as newlogin.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eCopy-DbaLogin -LoginRenameHashtable @{ OldLogin = \"NewLogin\" } -Source Sql01 -Destination Sql01 -Login ORG\\OldLogin -ObjectLevel -NewSid\nClones OldLogin as NewLogin onto the same server, generating a new SID for the login. Also clones object-level permissions.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2016 | Out-GridView -Passthru | Copy-DbaLogin -Destination sql2017\nDisplays all available logins on sql2016 in a grid view, then copies all selected logins to sql2017.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003e$loginSplat = @{\n\u003e\u003e Source = $Sql01\r\n\u003e\u003e Destination = \"Localhost\"\r\n\u003e\u003e SourceSqlCredential = $sqlcred\r\n\u003e\u003e Login = \u0027ReadUserP\u0027, \u0027ReadWriteUserP\u0027, \u0027AdminP\u0027\r\n\u003e\u003e LoginRenameHashtable = @{\r\n\u003e\u003e \"ReadUserP\" = \"ReadUserT\"\r\n\u003e\u003e \"ReadWriteUserP\" = \"ReadWriteUserT\"\r\n\u003e\u003e \"AdminP\" = \"AdminT\"\r\n\u003e\u003e }\r\n\u003e\u003e }\r\nPS C:\\\u003e Copy-DbaLogin @loginSplat\nCopies the three specified logins to \u0027localhost\u0027 and renames them according to the LoginRenameHashTable.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Login", "The login(s) to process. Options for this list are auto-populated from the server. If unspecified, all logins will be processed.", "", false, "false", "", "" ], [ "ExcludeLogin", "The login(s) to exclude. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "ExcludeSystemLogins", "If this switch is enabled, NT SERVICE accounts will be skipped.", "", false, "false", "False", "" ], [ "SyncSaName", "If this switch is enabled, the name of the sa account will be synced between Source and Destination", "", false, "false", "False", "" ], [ "OutFile", "Calls Export-DbaLogin and exports all logins to a T-SQL formatted file. This does not perform a copy, so no destination is required.", "", true, "false", "", "" ], [ "InputObject", "Takes the parameters required from a Login object that has been piped into the command", "", false, "true (ByValue)", "", "" ], [ "LoginRenameHashtable", "Pass a hash table into this parameter to create logins under different names based on hashtable mapping.", "", false, "false", "", "" ], [ "KillActiveConnection", "A login cannot be dropped when it has active connections on the instance. If this switch is enabled, all active connections and sessions on Destination will be killed.", "", false, "false", "False", "" ], [ "NewSid", "Ignore sids from the source login objects to generate new sids on the destination server. Useful when copying login onto the same server", "", false, "false", "False", "" ], [ "Force", "If this switch is enabled, the Login(s) will be dropped and recreated on Destination. Logins that own Agent jobs cannot be dropped at this time.", "", false, "false", "False", "" ], [ "ObjectLevel", "Include object-level permissions for each user associated with copied login.", "", false, "false", "False", "" ], [ "ExcludePermissionSync", "Skips permission syncs", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaLogin [-SourceSqlCredential \u003cPSCredential\u003e] [-DestinationSqlCredential \u003cPSCredential\u003e] [-Login \u003cObject[]\u003e] [-ExcludeLogin \u003cObject[]\u003e] [-ExcludeSystemLogins] [-LoginRenameHashtable \u003cHashtable\u003e] [-KillActiveConnection] [-NewSid] [-Force] [-ObjectLevel] [-ExcludePermissionSync] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nCopy-DbaLogin -Source \u003cDbaInstanceParameter\u003e [-SourceSqlCredential \u003cPSCredential\u003e] -Destination \u003cDbaInstanceParameter[]\u003e [-DestinationSqlCredential \u003cPSCredential\u003e] [-Login \u003cObject[]\u003e] [-ExcludeLogin \u003cObject[]\u003e] [-ExcludeSystemLogins] [-SyncSaName] [-LoginRenameHashtable \u003cHashtable\u003e] [-KillActiveConnection] [-NewSid] [-Force] [-ObjectLevel] [-ExcludePermissionSync] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nCopy-DbaLogin -Source \u003cDbaInstanceParameter\u003e [-SourceSqlCredential \u003cPSCredential\u003e] [-DestinationSqlCredential \u003cPSCredential\u003e] [-Login \u003cObject[]\u003e] [-ExcludeLogin \u003cObject[]\u003e] [-ExcludeSystemLogins] -OutFile \u003cString\u003e [-LoginRenameHashtable \u003cHashtable\u003e] [-KillActiveConnection] [-NewSid] [-Force] [-ObjectLevel] [-ExcludePermissionSync] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nCopy-DbaLogin [-SourceSqlCredential \u003cPSCredential\u003e] -Destination \u003cDbaInstanceParameter[]\u003e [-DestinationSqlCredential \u003cPSCredential\u003e] [-Login \u003cObject[]\u003e] [-ExcludeLogin \u003cObject[]\u003e] [-ExcludeSystemLogins] [-InputObject \u003cObject[]\u003e] [-LoginRenameHashtable \u003cHashtable\u003e] [-KillActiveConnection] [-NewSid] [-Force] [-ObjectLevel] [-ExcludePermissionSync] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nCopy-DbaLogin [-SourceSqlCredential \u003cPSCredential\u003e] [-DestinationSqlCredential \u003cPSCredential\u003e] [-Login \u003cObject[]\u003e] [-ExcludeLogin \u003cObject[]\u003e] [-ExcludeSystemLogins] [-SyncSaName] [-LoginRenameHashtable \u003cHashtable\u003e] [-KillActiveConnection] [-NewSid] [-Force] [-ObjectLevel] [-ExcludePermissionSync] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaPolicyManagement", "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\nThe -Policy and -Condition parameters are auto-populated for command-line completion and can be used to copy only specific objects.", "Tags": "Migration", "Synopsis": "Migrates SQL Policy Based Management Objects, including both policies and conditions.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaPolicyManagement", "Availability": "Windows only", "Links": "https://dbatools.io/Copy-DbaPolicyManagement", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaPolicyManagement -Source sqlserver2014a -Destination sqlcluster\nCopies all policies and conditions from sqlserver2014a to sqlcluster, using Windows credentials.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaPolicyManagement -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred\nCopies all policies and conditions from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaPolicyManagement -Source sqlserver2014a -Destination sqlcluster -WhatIf\nShows what would happen if the command were executed.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eCopy-DbaPolicyManagement -Source sqlserver2014a -Destination sqlcluster -Policy \u0027xp_cmdshell must be disabled\u0027\nCopies only one policy, \u0027xp_cmdshell must be disabled\u0027 from sqlserver2014a to sqlcluster. No conditions are migrated.", "Params": [ [ "Source", "Source SQL Server.You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination Sql Server. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Policy", "The policy(ies) to process - this list is auto-populated from the server. If unspecified, all policies will be processed.", "", false, "false", "", "" ], [ "ExcludePolicy", "The policy(ies) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Condition", "The condition(s) to process - this list is auto-populated from the server. If unspecified, all conditions will be processed.", "", false, "false", "", "" ], [ "ExcludeCondition", "The condition(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Force", "If policies exists on destination server, it will be dropped and recreated.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaPolicyManagement [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Policy] \u003cObject[]\u003e] [[-ExcludePolicy] \u003cObject[]\u003e] [[-Condition] \u003cObject[]\u003e] [[-ExcludeCondition] \u003cObject[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaRegServer", "Description": "Copy-DbaRegServer copies all groups, subgroups, and server instances from one SQL Server to another.", "Tags": "Migration", "Synopsis": "Migrates SQL Server Central Management groups and server instances from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaRegServer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaRegServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaRegServer -Source sqlserver2014a -Destination sqlcluster\nAll groups, subgroups, and server instances are copied from sqlserver2014a CMS to sqlcluster CMS.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaRegServer -Source sqlserver2014a -Destination sqlcluster -Group Group1,Group3\nTop-level groups Group1 and Group3 along with their subgroups and server instances are copied from sqlserver to sqlcluster.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaRegServer -Source sqlserver2014a -Destination sqlcluster -Group Group1,Group3 -SwitchServerName -SourceSqlCredential $SourceSqlCredential -DestinationSqlCredential \r\n$DestinationSqlCredential\nTop-level groups Group1 and Group3 along with their subgroups and server instances are copied from sqlserver to sqlcluster. When adding sql instances to sqlcluster, if the server name of the \r\nmigrating instance is \"sqlcluster\", it will be switched to \"sqlserver\".\nIf SwitchServerName is not specified, \"sqlcluster\" will be skipped.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Group", "This is an auto-populated array that contains your Central Management Server top-level groups on Source. You can specify one, many or none.\nIf Group is not specified, all groups in your Central Management Server will be copied.", "CMSGroup", false, "false", "", "" ], [ "SwitchServerName", "If this switch is enabled, all instance names will be changed from Source to Destination.\nCentral Management Server does not allow you to add a shared registered server with the same name as the Configuration Server.", "", false, "false", "False", "" ], [ "Force", "If this switch is enabled, group(s) will be dropped and recreated if they already exists on destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaRegServer [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Group] \u003cString[]\u003e] [-SwitchServerName] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaResourceGovernor", "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\nThe -ResourcePool parameter is auto-populated for command-line completion and can be used to copy only specific objects.", "Tags": [ "Migration", "ResourceGovernor" ], "Synopsis": "Migrates Resource Pools", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaResourceGovernor", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaResourceGovernor", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaResourceGovernor -Source sqlserver2014a -Destination sqlcluster\nCopies all all non-system resource pools from sqlserver2014a to sqlcluster using Windows credentials to connect to the SQL Server instances..\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaResourceGovernor -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred\nCopies all all non-system resource pools from sqlserver2014a to sqlcluster using SQL credentials to connect to sqlserver2014a and Windows credentials to connect to sqlcluster.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaResourceGovernor -Source sqlserver2014a -Destination sqlcluster -WhatIf\nShows what would happen if the command were executed.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2008 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "ResourcePool", "Specifies the resource pool(s) to process. Options for this list are auto-populated from the server. If unspecified, all resource pools will be processed.", "", false, "false", "", "" ], [ "ExcludeResourcePool", "Specifies the resource pool(s) to exclude. Options for this list are auto-populated from the server", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, the policies will be dropped and recreated on Destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaResourceGovernor [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-ResourcePool] \u003cObject[]\u003e] [[-ExcludeResourcePool] \u003cObject[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaSpConfigure", "Description": "By default, all configuration values are copied. The -ConfigName parameter is auto-populated for command-line completion and can be used to copy only specific configs.", "Tags": [ "Migration", "Configure", "SpConfigure" ], "Synopsis": "Copy-DbaSpConfigure migrates configuration values from one SQL Server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaSpConfigure", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaSpConfigure", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaSpConfigure -Source sqlserver2014a -Destination sqlcluster\nCopies all sp_configure settings from sqlserver2014a to sqlcluster\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaSpConfigure -Source sqlserver2014a -Destination sqlcluster -ConfigName DefaultBackupCompression, IsSqlClrEnabled -SourceSqlCredential $cred\nCopies the values for IsSqlClrEnabled and DefaultBackupCompression from sqlserver2014a to sqlcluster using SQL credentials to authenticate to sqlserver2014a and Windows credentials to authenticate to \r\nsqlcluster.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaSpConfigure -Source sqlserver2014a -Destination sqlcluster -ExcludeConfigName DefaultBackupCompression, IsSqlClrEnabled\nCopies all configs except for IsSqlClrEnabled and DefaultBackupCompression, from sqlserver2014a to sqlcluster.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eCopy-DbaSpConfigure -Source sqlserver2014a -Destination sqlcluster -WhatIf\nShows what would happen if the command were executed.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "ConfigName", "Specifies the configuration setting to process. Options for this list are auto-populated from the server. If unspecified, all ConfigNames will be processed.", "", false, "false", "", "" ], [ "ExcludeConfigName", "Specifies the configuration settings to exclude. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaSpConfigure [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-ConfigName] \u003cObject[]\u003e] [[-ExcludeConfigName] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaStartupProcedure", "Description": "By default, all procedures found flagged as startup procedures are copied and then set as a startup procedure on the destination instance. The -Procedure parameter is auto-populated for command-line completion and can be used to copy only specific startup procedures.\n\nIf the procedure already exists on the destination, it will be skipped unless -Force is used.", "Tags": [ "Migration", "Procedure", "Startup", "StartupProcedure" ], "Synopsis": "Copy-DbaStartupProcedure migrates startup procedures (user defined procedures within master database) from one SQL Server to another.", "Alias": "", "Author": "Shawn Melton (@wsmelton), http://wsmelton.github.io", "CommandName": "Copy-DbaStartupProcedure", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaStartupProcedure", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaStartupProcedure -Source sqlserver2014a -Destination sqlcluster\nCopies all startup procedures from sqlserver2014a to sqlcluster using Windows credentials. If procedure(s) with the same name exists in the master database on sqlcluster, they will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaStartupProcedure -Source sqlserver2014a -SourceSqlCredential $scred -Destination sqlcluster -DestinationSqlCredential $dcred -Procedure logstartup -Force\nCopies only the startup procedure, logstartup, from sqlserver2014a to sqlcluster using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster. If the procedure already exists on \r\nsqlcluster, it will be updated because -Force was used.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaStartupProcedure -Source sqlserver2014a -Destination sqlcluster -ExcludeProcedure logstartup -Force\nCopies all the startup procedures found on sqlserver2014a except logstartup to sqlcluster. If a startup procedure with the same name exists on sqlcluster, it will be updated because -Force was used.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eCopy-DbaStartupProcedure -Source sqlserver2014a -Destination sqlcluster -WhatIf -Force\nShows what would happen if the command were executed using force.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Procedure", "The startup procedure(s) to process. This list is auto-populated from the server. If unspecified, all startup procedures will be processed.", "", false, "false", "", "" ], [ "ExcludeProcedure", "The startup procedure(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, the custom error will be dropped and recreated if it already exists on Destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaStartupProcedure [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Procedure] \u003cString[]\u003e] [[-ExcludeProcedure] \u003cString[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaSysDbUserObject", "Description": "Imports all user objects found in source SQL Server\u0027s master, msdb and model databases to the destination. This is useful because many DBAs 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", "SystemDatabase", "UserObject" ], "Synopsis": "Imports all user objects found in source SQL Server\u0027s master, msdb and model databases to the destination.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaSysDbUserObject", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaSysDbUserObject", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaSysDbUserObject -Source sqlserver2014a -Destination sqlcluster\nCopies user objects found in system databases master, msdb and model from sqlserver2014a instance to the sqlcluster instance.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Force", "Drop destination objects first. Has no effect if you use Classic. This doesn\u0027t work really well, honestly.", "", false, "false", "False", "" ], [ "Classic", "Perform the migration the old way", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaSysDbUserObject [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [-Force] [-Classic] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaXESession", "Description": "Migrates SQL Extended Event Sessions except the two default sessions, AlwaysOn_health and system_health.\n\nBy default, all non-system Extended Events are migrated.", "Tags": [ "Migration", "ExtendedEvent", "XEvent" ], "Synopsis": "Migrates SQL Extended Event Sessions except the two default sessions, AlwaysOn_health and system_health.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaXESession", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaXESession", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaXESession -Source sqlserver2014a -Destination sqlcluster\nCopies all Extended Event sessions from sqlserver2014a to sqlcluster using Windows credentials.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaXESession -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred\nCopies all Extended Event sessions from sqlserver2014a to sqlcluster using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eCopy-DbaXESession -Source sqlserver2014a -Destination sqlcluster -WhatIf\nShows what would happen if the command were executed.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eCopy-DbaXESession -Source sqlserver2014a -Destination sqlcluster -XeSession CheckQueries, MonitorUserDefinedException\nCopies only the Extended Events named CheckQueries and MonitorUserDefinedException from sqlserver2014a to sqlcluster.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "XeSession", "The Extended Event Session(s) to process. This list is auto-populated from the server. If unspecified, all Extended Event Sessions will be processed.", "", false, "false", "", "" ], [ "ExcludeXeSession", "The Extended Event Session(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, existing Extended Events sessions on Destination with matching names from Source will be dropped.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Copy-DbaXESession [-Source] \u003cDbaInstanceParameter\u003e [-Destination] \u003cDbaInstanceParameter[]\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-XeSession] \u003cObject[]\u003e] [[-ExcludeXeSession] \u003cObject[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Copy-DbaXESessionTemplate", "Description": "Copies non-Microsoft templates from the dbatools template repository (\\bin\\xetemplates\\) to $home\\Documents\\SQL Server Management Studio\\Templates\\XEventTemplates.\n\nUseful for when you want to use the SSMS GUI.", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Copies non-Microsoft templates from the dbatools template repository (\\bin\\xetemplates\\) to $home\\Documents\\SQL Server Management Studio\\Templates\\XEventTemplates.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Copy-DbaXESessionTemplate", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Copy-DbaXESessionTemplate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eCopy-DbaXESessionTemplate\nCopies non-Microsoft templates from the dbatools template repository (\\bin\\xetemplates\\) to $home\\Documents\\SQL Server Management Studio\\Templates\\XEventTemplates.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eCopy-DbaXESessionTemplate -Path C:\\temp\\xetemplates\nCopies your templates from C:\\temp\\xetemplates to $home\\Documents\\SQL Server Management Studio\\Templates\\XEventTemplates.", "Params": [ [ "Path", "The path to the template directory. Defaults to the dbatools template repository (\\bin\\xetemplates\\).", "", false, "false", "\"$script:PSModuleRoot\\bin\\xetemplates\"", "" ], [ "Destination", "Path to the Destination directory, defaults to $home\\Documents\\SQL Server Management Studio\\Templates\\XEventTemplates.", "", false, "false", "\"$home\\Documents\\SQL Server Management Studio\\Templates\\XEventTemplates\"", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Copy-DbaXESessionTemplate [[-Path] \u003cString[]\u003e] [[-Destination] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Disable-DbaAgHadr", "Description": "In order to build an AG a cluster has to be built and then the Hadr enabled for the SQL Server\nservice. This function disables that feature for the SQL Server service.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Disables the Hadr service setting on the specified SQL Server.", "Alias": "", "Author": "Shawn Melton (@wsmelton), http://wsmelton.github.io", "CommandName": "Disable-DbaAgHadr", "Availability": "Windows only", "Links": "https://dbatools.io/Disable-DbaAgHadr", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eDisable-DbaAgHadr -SqlInstance sql2016\nSets Hadr service to disabled for the instance sql2016 but changes will not be applied until the next time the server restarts.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eDisable-DbaAgHadr -SqlInstance sql2016 -Force\nSets Hadr service to disabled for the instance sql2016, and restart the service to apply the change.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eDisable-DbaAgHadr -SqlInstance sql2012\\dev1 -Force\nSets Hadr service to disabled for the instance dev1 on sq2012, and restart the service to apply the change.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "Credential", "Credential object used to connect to the Windows server as a different user", "", false, "false", "", "" ], [ "Force", "Will restart SQL Server and SQL Server Agent service to apply the change.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Disable-DbaAgHadr [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-Credential] \u003cPSCredential\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Disable-DbaFilestream", "Description": "Connects to the specified SQL Server instances, and sets the status of the FileStream feature to the required value\n\nTo perform the action, the SQL Server instance must be restarted. By default we will prompt for confirmation for this action, this can be overridden with the -Force switch", "Tags": "Filestream", "Synopsis": "Sets the status of FileStream on specified SQL Server instances both at the server level and the instance level", "Alias": "", "Author": "Stuart Moore ( @napalmgram ) | Chrissy LeMaire ( @cl )", "CommandName": "Disable-DbaFilestream", "Availability": "Windows only", "Links": "https://dbatools.io/Disable-DbaFilestream", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eDisable-DbaFilestream -SqlInstance server1\\instance2\nPrompts for confirmation. Disables filestream on the service and instance levels.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eDisable-DbaFilestream -SqlInstance server1\\instance2 -Confirm:$false\nDoes not prompt for confirmation. Disables filestream on the service and instance levels.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaFilestream -SqlInstance server1\\instance2, server5\\instance5, prod\\hr | Where-Object InstanceAccessLevel -gt 0 | Disable-DbaFilestream -Force\nUsing this pipeline you can scan a range of SQL instances and disable filestream on only those on which it\u0027s enabled.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Defaults to localhost.", "", true, "true (ByPropertyName)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "true (ByPropertyName)", "", "" ], [ "Credential", "Login to the target server using alternative credentials.", "", false, "true (ByPropertyName)", "", "" ], [ "Force", "Restart SQL Instance after changes. Use this parameter with care as it overrides whatif.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command runs. The command is not run unless Force is specified.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the command.", "cf", false, "false", "", "" ] ], "Syntax": "Disable-DbaFilestream [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Disable-DbaForceNetworkEncryption", "Description": "Disables Force Encryption for a SQL Server instance. Note that this requires access to the Windows Server, not the SQL instance itself.\n\nThis setting is found in Configuration Manager.", "Tags": "Certificate", "Synopsis": "Disables Force Encryption for a SQL Server instance", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Disable-DbaForceNetworkEncryption", "Availability": "Windows only", "Links": "https://dbatools.io/Disable-DbaForceNetworkEncryption", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eDisable-DbaForceNetworkEncryption\nDisables Force Encryption on the default (MSSQLSERVER) instance on localhost - requires (and checks for) RunAs admin.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eDisable-DbaForceNetworkEncryption -SqlInstance sql01\\SQL2008R2SP2\nDisables Force Network Encryption for the SQL2008R2SP2 on sql01. Uses Windows Credentials to both login and modify the registry.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eDisable-DbaForceNetworkEncryption -SqlInstance sql01\\SQL2008R2SP2 -WhatIf\nShows what would happen if the command were executed.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Defaults to localhost.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the computer (not SQL Server instance) using alternative Windows credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Disable-DbaForceNetworkEncryption [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Disable-DbaHideInstance", "Description": "Disables the Hide Instance setting of the SQL Server network configuration.\n\nThis requires access to the Windows Server and not the SQL Server instance. The setting is found in SQL Server Configuration Manager under the properties of SQL Server Network Configuration \u003e Protocols for \"InstanceName\".", "Tags": [ "Instance", "Security" ], "Synopsis": "Disables the Hide Instance setting of the SQL Server network configuration.", "Alias": "", "Author": "Gareth Newman (@gazeranco), ifexists.blog", "CommandName": "Disable-DbaHideInstance", "Availability": "Windows only", "Links": "https://dbatools.io/Disable-DbaHideInstance", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eDisable-DbaHideInstance\nDisables Hide Instance of SQL Engine on the default (MSSQLSERVER) instance on localhost. Requires (and checks for) RunAs admin.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eDisable-DbaHideInstance -SqlInstance sql01\\SQL2008R2SP2\nDisables Hide Instance of SQL Engine for the SQL2008R2SP2 on sql01. Uses Windows Credentials to both connect and modify the registry.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eDisable-DbaHideInstance -SqlInstance sql01\\SQL2008R2SP2 -WhatIf\nShows what would happen if the command were executed.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the computer (not SQL Server instance) using alternative Windows credentials", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Disable-DbaHideInstance [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Disable-DbaStartupProcedure", "Description": "Used to revoke the designation of one or more stored procedures to automatically execute when the SQL Server service is started.\nEquivalent to running the system stored procedure sp_procoption with @OptionValue = off\nReturns the SMO StoredProcedure object for procedures affected.", "Tags": [ "Procedure", "Startup", "StartupProcedure" ], "Synopsis": "Disables the automatic execution of procedure(s) that are set to execute automatically each time the SQL Server service is started", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Disable-DbaStartupProcedure", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Disable-DbaStartupProcedure", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eDisable-DbaStartupProcedure -SqlInstance SqlBox1\\Instance2 -StartupProcedure \u0027[dbo].[StartUpProc1]\u0027\nAttempts to clear the automatic execution of the procedure \u0027[dbo].[StartUpProc1]\u0027 in the master database of SqlBox1\\Instance2 when the instance is started.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Disable-DbaStartupProcedure -SqlInstance winserver\\sqlexpress, sql2016 -SqlCredential $cred -StartupProcedure \u0027[dbo].[StartUpProc1]\u0027\nAttempts to clear the automatic execution of the procedure \u0027[dbo].[StartUpProc1]\u0027 in the master database of winserver\\sqlexpress and sql2016 when the instance is started. Connects using sqladmin \r\ncredential\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaStartupProcedure -SqlInstance sql2016 | Disable-DbaStartupProcedure\nGet all startup procedures for the sql2016 instance and disables them by piping to Disable-DbaStartupProcedure", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "StartupProcedure", "The Procedure(s) to process.", "", false, "false", "", "" ], [ "InputObject", "Piped objects from Get-DbaStartup", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Disable-DbaStartupProcedure [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-StartupProcedure] \u003cString[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Disable-DbaTraceFlag", "Description": "The function will disable a Trace Flag that is currently running globally on the SQL Server instance(s) listed.\nThese are not persisted after a restart, use Set-DbaStartupParameter to set them to persist after restarts.", "Tags": [ "TraceFlag", "DBCC" ], "Synopsis": "Disable a Global Trace Flag that is currently running", "Alias": "", "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com", "CommandName": "Disable-DbaTraceFlag", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Disable-DbaTraceFlag", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eDisable-DbaTraceFlag -SqlInstance sql2016 -TraceFlag 3226\nDisable the globally running trace flag 3226 on SQL Server instance sql2016", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "TraceFlag", "Trace flag number to enable globally", "", true, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Disable-DbaTraceFlag [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-TraceFlag] \u003cInt32[]\u003e [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Disconnect-DbaInstance", "Description": "Disconnects or closes a connection to a SQL Server instance\n\nTo clear all of your connection pools, use Clear-DbaConnectionPool", "Tags": "Connection", "Synopsis": "Disconnects or closes a connection to a SQL Server instance", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Disconnect-DbaInstance", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Disconnect-DbaInstance", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaConnectedInstance | Disconnect-DbaInstance\nDisconnects all connected instances\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaConnectedInstance | Out-GridView -Passthru | Disconnect-DbaInstance\nDisconnects selected SQL Server instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$server = Connect-DbaInstance -SqlInstance sql01\nPS C:\\\u003e $server | Disconnect-DbaInstance\nDisconnects the $server connection", "Params": [ [ "InputObject", "The server object to disconnect from, usually piped in from Get-DbaConnectedInstance", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Disconnect-DbaInstance [[-InputObject] \u003cPSObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Dismount-DbaDatabase", "Description": "This command detaches one or more SQL Server databases. If necessary, -Force can be used to break mirrors and remove databases from availability groups prior to detaching.", "Tags": "Database", "Synopsis": "Detach a SQL Server Database.", "Alias": "Detach-DbaDatabase", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Dismount-DbaDatabase", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Dismount-DbaDatabase", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eDetach-DbaDatabase -SqlInstance sql2016b -Database SharePoint_Config, WSS_Logging\nDetaches SharePoint_Config and WSS_Logging from sql2016b\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2016b -Database \u0027PerformancePoint Service Application_10032db0fa0041df8f913f558a5dc0d4\u0027 | Detach-DbaDatabase -Force\nDetaches \u0027PerformancePoint Service Application_10032db0fa0041df8f913f558a5dc0d4\u0027 from sql2016b. Since Force was specified, if the database is part of mirror, the mirror will be broken prior to \r\ndetaching.\nIf the database is part of an Availability Group, it will first be dropped prior to detachment.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2016b -Database WSS_Logging | Detach-DbaDatabase -Force -WhatIf\nShows what would happen if the command were to execute (without actually executing the detach/break/remove commands).", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to detach.", "", true, "false", "", "" ], [ "InputObject", "A collection of databases (such as returned by Get-DbaDatabase), to be detached.", "", true, "true (ByValue)", "", "" ], [ "UpdateStatistics", "If this switch is enabled, statistics for the database will be updated prior to detaching it.", "", false, "false", "False", "" ], [ "Force", "If this switch is enabled and the database is part of a mirror, the mirror will be broken. If the database is part of an Availability Group, it will be removed from the AG.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Dismount-DbaDatabase [-SqlCredential \u003cPSCredential\u003e] [-UpdateStatistics] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nDismount-DbaDatabase -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] -Database \u003cString[]\u003e [-UpdateStatistics] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nDismount-DbaDatabase [-SqlCredential \u003cPSCredential\u003e] -InputObject \u003cDatabase[]\u003e [-UpdateStatistics] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Enable-DbaAgHadr", "Description": "In order to build an AG a cluster has to be built and then the Hadr enabled for the SQL Server\nservice. This function enables that feature for the SQL Server service.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Enables the Hadr service setting on the specified SQL Server.", "Alias": "", "Author": "Shawn Melton (@wsmelton), http://wsmelton.github.io", "CommandName": "Enable-DbaAgHadr", "Availability": "Windows only", "Links": "https://dbatools.io/Enable-DbaAgHadr", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eEnable-DbaAgHadr -SqlInstance sql2016\nSets Hadr service to enabled for the instance sql2016 but changes will not be applied until the next time the server restarts.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eEnable-DbaAgHadr -SqlInstance sql2016 -Force\nSets Hadr service to enabled for the instance sql2016, and restart the service to apply the change.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eEnable-DbaAgHadr -SqlInstance sql2012\\dev1 -Force\nSets Hadr service to disabled for the instance dev1 on sq2012, and restart the service to apply the change.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "Credential", "Credential object used to connect to the Windows server as a different user", "", false, "false", "", "" ], [ "Force", "Will restart SQL Server and SQL Server Agent service to apply the change.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Enable-DbaAgHadr [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-Credential] \u003cPSCredential\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Enable-DbaFilestream", "Description": "Connects to the specified SQL Server instances, and Enables the FileStream feature to the required value\n\nTo perform the action, the SQL Server instance must be restarted. By default we will prompt for confirmation for this action, this can be overridden with the -Force switch", "Tags": "Filestream", "Synopsis": "Enables FileStream on specified SQL Server instances", "Alias": "", "Author": "Stuart Moore ( @napalmgram ) | Chrissy LeMaire ( @cl )", "CommandName": "Enable-DbaFilestream", "Availability": "Windows only", "Links": "https://dbatools.io/Enable-DbaFilestream", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eEnable-DbaFilestream -SqlInstance server1\\instance2 -FileStreamLevel TSql\nPS C:\\\u003e Enable-DbaFilestream -SqlInstance server1\\instance2 -FileStreamLevel 1\nThese commands are functionally equivalent, both will set Filestream level on server1\\instance2 to T-Sql Only\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaFilestream -SqlInstance server1\\instance2, server5\\instance5, prod\\hr | Where-Object InstanceAccessLevel -eq 0 | Enable-DbaFilestream -FileStreamLevel TSqlIoStreamingRemoteClient -Force\nUsing this pipeline you can scan a range of SQL instances and enable filestream on only those on which it\u0027s disabled.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Defaults to localhost.", "", true, "true (ByPropertyName)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "true (ByPropertyName)", "", "" ], [ "Credential", "Login to the target server using alternative credentials.", "", false, "true (ByPropertyName)", "", "" ], [ "FileStreamLevel", "The level to of FileStream to be enabled:\r\n1 or TSql - T-Sql Access Only\r\n2 or TSqlIoStreaming - T-Sql and Win32 access enabled\r\n3 or TSqlIoStreamingRemoteClient T-Sql, Win32 and Remote access enabled", "", false, "false", "1", "TSql,TSqlIoStreaming,TSqlIoStreamingRemoteClient,1,2,3" ], [ "ShareName", "Specifies the Windows file share name to be used for storing the FILESTREAM data.", "", false, "false", "", "" ], [ "Force", "Restart SQL Instance after changes. Use this parameter with care as it overrides whatif.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command runs. The command is not run unless Force is specified.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the command.", "cf", false, "false", "", "" ] ], "Syntax": "Enable-DbaFilestream [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [[-FileStreamLevel] \u003cString\u003e] [[-ShareName] \u003cString\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Enable-DbaForceNetworkEncryption", "Description": "Enables Force Encryption for a SQL Server instance. Note that this requires access to the Windows Server, not the SQL instance itself.\n\nThis setting is found in Configuration Manager.", "Tags": [ "Certificate", "Encryption" ], "Synopsis": "Enables Force Encryption for a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Enable-DbaForceNetworkEncryption", "Availability": "Windows only", "Links": "https://dbatools.io/Enable-DbaForceNetworkEncryption", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eEnable-DbaForceNetworkEncryption\nEnables Force Encryption on the default (MSSQLSERVER) instance on localhost. Requires (and checks for) RunAs admin.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eEnable-DbaForceNetworkEncryption -SqlInstance sql01\\SQL2008R2SP2\nEnables Force Network Encryption for the SQL2008R2SP2 on sql01. Uses Windows Credentials to both connect and modify the registry.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eEnable-DbaForceNetworkEncryption -SqlInstance sql01\\SQL2008R2SP2 -WhatIf\nShows what would happen if the command were executed.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the computer (not SQL Server instance) using alternative Windows credentials", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Enable-DbaForceNetworkEncryption [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Enable-DbaHideInstance", "Description": "Enables the Hide Instance setting of the SQL Server network configuration.\n\nThis setting requires access to the Windows Server and not the SQL Server instance. The setting is found in SQL Server Configuration Manager under the properties of SQL Server Network Configuration \u003e Protocols for \"InstanceName\".", "Tags": [ "Instance", "Security" ], "Synopsis": "Enables the Hide Instance setting of the SQL Server network configuration.", "Alias": "", "Author": "Gareth Newman (@gazeranco), ifexists.blog", "CommandName": "Enable-DbaHideInstance", "Availability": "Windows only", "Links": "https://dbatools.io/Enable-DbaHideInstance", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eEnable-DbaHideInstance\nEnables Hide Instance of SQL Engine on the default (MSSQLSERVER) instance on localhost. Requires (and checks for) RunAs admin.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eEnable-DbaHideInstance -SqlInstance sql01\\SQL2008R2SP2\nEnables Hide Instance of SQL Engine for the SQL2008R2SP2 on sql01. Uses Windows Credentials to both connect and modify the registry.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eEnable-DbaHideInstance -SqlInstance sql01\\SQL2008R2SP2 -WhatIf\nShows what would happen if the command were executed.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the computer (not SQL Server instance) using alternative Windows credentials", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Enable-DbaHideInstance [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Enable-DbaStartupProcedure", "Description": "Used to designate one or more stored procedures to automatically execute when the SQL Server service is started.\nEquivalent to running the system stored procedure sp_procoption with @OptionValue = on\nReturns the SMO StoredProcedure object for procedures affected.", "Tags": [ "Procedure", "Startup", "StartupProcedure" ], "Synopsis": "Sets a procedure to execute automatically each time the SQL Server service is started", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Enable-DbaStartupProcedure", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Enable-DbaStartupProcedure", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eEnable-DbaStartupProcedure -SqlInstance SqlBox1\\Instance2 -StartupProcedure \u0027[dbo].[StartUpProc1]\u0027\nAttempts to set the procedure \u0027[dbo].[StartUpProc1]\u0027 in the master database of SqlBox1\\Instance2 for automatic execution when the instance is started.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Enable-DbaStartupProcedure -SqlInstance winserver\\sqlexpress, sql2016 -SqlCredential $cred -StartupProcedure \u0027[dbo].[StartUpProc1]\u0027\nAttempts to set the procedure \u0027[dbo].[StartUpProc1]\u0027 in the master database of winserver\\sqlexpress and sql2016 for automatic execution when the instance is started. Connects using sqladmin credential", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "StartupProcedure", "The Procedure(s) to process.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Enable-DbaStartupProcedure [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-StartupProcedure] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Enable-DbaTraceFlag", "Description": "The function will set one or multiple trace flags on the SQL Server instance(s) listed.\nThese are not persisted after a restart, use Set-DbaStartupParameter to set them to persist after restarts.", "Tags": [ "TraceFlag", "DBCC" ], "Synopsis": "Enable Global Trace Flag(s)", "Alias": "", "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com", "CommandName": "Enable-DbaTraceFlag", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Enable-DbaTraceFlag", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eEnable-DbaTraceFlag -SqlInstance sql2016 -TraceFlag 3226\nEnable the trace flag 3226 on SQL Server instance sql2016\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eEnable-DbaTraceFlag -SqlInstance sql2016 -TraceFlag 1117, 1118\nEnable multiple trace flags on SQL Server instance sql2016", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "TraceFlag", "Trace flag number(s) to enable globally", "", true, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Enable-DbaTraceFlag [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-TraceFlag] \u003cInt32[]\u003e [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Expand-DbaDbLogFile", "Description": "As you may already know, having a transaction log file with too many Virtual Log Files (VLFs) can hurt your database performance in many ways.\n\nExample:\nToo many VLFs can cause transaction log backups to slow down and can also slow down database recovery and, in extreme cases, even impact insert/update/delete performance.\n\nReferences:\nhttp://www.sqlskills.com/blogs/kimberly/transaction-log-vlfs-too-many-or-too-few/\nhttp://blogs.msdn.com/b/saponsqlserver/archive/2012/02/22/too-many-virtual-log-files-vlfs-can-cause-slow-database-recovery.aspx\nhttp://www.brentozar.com/blitz/high-virtual-log-file-vlf-count/\n\nIn 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\nNote: In SQL Server 2014 this algorithm has changed (http://www.sqlskills.com/blogs/paul/important-change-vlf-creation-algorithm-sql-server-2014/)\n\nAttention:\nWe are growing in MB instead of GB because of known issue prior to SQL 2012:\nMore detail here:\nhttp://www.sqlskills.com/BLOGS/PAUL/post/Bug-log-file-growth-broken-for-multiples-of-4GB.aspx\nand\nhttp://connect.microsoft.com/SqlInstance/feedback/details/481594/log-growth-not-working-properly-with-specific-growth-sizes-vlfs-also-not-created-appropriately\nor\nhttps://connect.microsoft.com/SqlInstance/feedback/details/357502/transaction-log-file-size-will-not-grow-exactly-4gb-when-filegrowth-4gb\n\nUnderstanding related problems:\nhttp://www.sqlskills.com/blogs/kimberly/transaction-log-vlfs-too-many-or-too-few/\nhttp://blogs.msdn.com/b/saponsqlserver/archive/2012/02/22/too-many-virtual-log-files-vlfs-can-cause-slow-database-recovery.aspx\nhttp://www.brentozar.com/blitz/high-virtual-log-file-vlf-count/\n\nKnown bug before SQL Server 2012\nhttp://www.sqlskills.com/BLOGS/PAUL/post/Bug-log-file-growth-broken-for-multiples-of-4GB.aspx\nhttp://connect.microsoft.com/SqlInstance/feedback/details/481594/log-growth-not-working-properly-with-specific-growth-sizes-vlfs-also-not-created-appropriately\nhttps://connect.microsoft.com/SqlInstance/feedback/details/357502/transaction-log-file-size-will-not-grow-exactly-4gb-when-filegrowth-4gb\n\nHow it works?\nThe transaction log will grow in chunks until it reaches the desired size.\nExample: If you have a log file with 8192MB and you say that the target size is 81920MB (80GB) it will grow in chunks of 8192MB until it reaches 81920MB. 8192 -\u003e 16384 -\u003e 24576 ... 73728 -\u003e 81920", "Tags": [ "Storage", "Backup" ], "Synopsis": "This command will help you to automatically grow your transaction log file in a responsible way (preventing the generation of too many VLFs).", "Alias": "", "Author": "Claudio Silva (@ClaudioESSilva)", "CommandName": "Expand-DbaDbLogFile", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Expand-DbaDbLogFile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExpand-DbaDbLogFile -SqlInstance sqlcluster -Database db1 -TargetLogSize 50000\nGrows the transaction log for database db1 on sqlcluster to 50000 MB and calculates the increment size.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eExpand-DbaDbLogFile -SqlInstance sqlcluster -Database db1, db2 -TargetLogSize 10000 -IncrementSize 200\nGrows the transaction logs for databases db1 and db2 on sqlcluster to 1000MB and sets the growth increment to 200MB.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eExpand-DbaDbLogFile -SqlInstance sqlcluster -Database db1 -TargetLogSize 10000 -LogFileId 9\nGrows the transaction log file with FileId 9 of the db1 database on sqlcluster instance to 10000MB.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eExpand-DbaDbLogFile -SqlInstance sqlcluster -Database (Get-Content D:\\DBs.txt) -TargetLogSize 50000\nGrows the transaction log of the databases specified in the file \u0027D:\\DBs.txt\u0027 on sqlcluster instance to 50000MB.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eExpand-DbaDbLogFile -SqlInstance SqlInstance -Database db1,db2 -TargetLogSize 100 -IncrementSize 10 -ShrinkLogFile -ShrinkSize 10 -BackupDirectory R:\\MSSQL\\Backup\nGrows the transaction logs for databases db1 and db2 on SQL server SQLInstance to 100MB, sets the incremental growth to 10MB, shrinks the transaction log to 10MB and uses the directory \r\nR:\\MSSQL\\Backup for the required backups.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "TargetLogSize", "Specifies the target size of the transaction log file in megabytes.", "", true, "false", "0", "" ], [ "IncrementSize", "Specifies the amount the transaction log should grow in megabytes. If this value differs from the suggested value based on your TargetLogSize, you will be prompted to confirm your choice.\nThis value will be calculated if not specified.", "", false, "false", "-1", "" ], [ "LogFileId", "Specifies the file number(s) of additional transaction log files to grow.\nIf this value is not specified, only the first transaction log file will be processed.", "", false, "false", "-1", "" ], [ "ShrinkLogFile", "If this switch is enabled, your transaction log files will be shrunk.", "", true, "false", "False", "" ], [ "ShrinkSize", "Specifies the target size of the transaction log file for the shrink operation in megabytes.", "", true, "false", "0", "" ], [ "BackupDirectory", "Specifies the location of your backups. Backups must be performed to shrink the transaction log.\nIf this value is not specified, the SQL Server instance\u0027s default backup directory will be used.", "", false, "false", "", "" ], [ "ExcludeDiskSpaceValidation", "If this switch is enabled, the validation for enough disk space using Get-DbaDiskSpace command will be skipped.\r\nThis can be useful when you know that you have enough space to grow your TLog but you don\u0027t have PowerShell Remoting enabled to validate it.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Expand-DbaDbLogFile [-SqlInstance] \u003cDbaInstanceParameter\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-TargetLogSize] \u003cInt32\u003e [[-IncrementSize] \u003cInt32\u003e] [[-LogFileId] \u003cInt32\u003e] [-ExcludeDiskSpaceValidation] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nExpand-DbaDbLogFile [-SqlInstance] \u003cDbaInstanceParameter\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-TargetLogSize] \u003cInt32\u003e [[-IncrementSize] \u003cInt32\u003e] [[-LogFileId] \u003cInt32\u003e] [-ShrinkLogFile] [-ShrinkSize] \u003cInt32\u003e [[-BackupDirectory] \u003cString\u003e] [-ExcludeDiskSpaceValidation] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaCredential", "Description": "Exports credentials INCLUDING PASSWORDS, unless specified otherwise, to sql file.\n\nRequires remote Windows access if exporting the password.", "Tags": "Credential", "Synopsis": "Exports credentials INCLUDING PASSWORDS, unless specified otherwise, to sql file.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Export-DbaCredential", "Availability": "Windows only", "Links": "https://dbatools.io/Export-DbaCredential", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaCredential -SqlInstance sql2017 -Path C:\\temp\\cred.sql\nExports credentials, including passwords, from sql2017 to the file C:\\temp\\cred.sql", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "Identity", "The credentials to export. If unspecified, all credentials will be exported.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Credential", "Login to the target OS using alternative credentials. Accepts credential objects (Get-Credential)", "", false, "false", "", "" ], [ "Path", "The path to the directory that will contain the exported sql file.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "The specific path to a file which will contain the output.", "OutFile,FileName", false, "false", "", "" ], [ "ExcludePassword", "Exports the SQL credential without any sensitive information.", "", false, "false", "False", "" ], [ "Append", "Append to Path", "", false, "false", "False", "" ], [ "InputObject", "Allow credentials to be piped in from Get-DbaCredential", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaCredential [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-Identity] \u003cString[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [-ExcludePassword] [-Append] [[-InputObject] \u003cCredential[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaDacPackage", "Description": "Using SQLPackage, export a dacpac from an instance of SQL Server.\n\nNote - Extract from SQL Server is notoriously flaky - for example if you have three part references to external databases it will not work.\n\nFor help with the extract action parameters and properties, refer to https://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx", "Tags": [ "Migration", "Database", "Dacpac" ], "Synopsis": "Exports a dacpac from a server.", "Alias": "", "Author": "Richie lee (@richiebzzzt)", "CommandName": "Export-DbaDacPackage", "Availability": "Windows only", "Links": "https://dbatools.io/Export-DbaDacPackage", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaDacPackage -SqlInstance sql2016 -Database SharePoint_Config -FilePath C:\\SharePoint_Config.dacpac\nExports the dacpac for SharePoint_Config on sql2016 to C:\\SharePoint_Config.dacpac\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$options = New-DbaDacOption -Type Dacpac -Action Export\nPS C:\\\u003e $options.ExtractAllTableData = $true\r\nPS C:\\\u003e $options.CommandTimeout = 0\r\nPS C:\\\u003e Export-DbaDacPackage -SqlInstance sql2016 -Database DB1 -DacOption $options\nUses DacOption object to set the CommandTimeout to 0 then extracts the dacpac for DB1 on sql2016 to C:\\Users\\username\\Documents\\DbatoolsExport\\sql2016-DB1-20201227140759-dacpackage.dacpac including \r\nall table data. As noted the generated filename will contain the server name, database name, and the current timestamp in the \"%Y%m%d%H%M%S\" format.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eExport-DbaDacPackage -SqlInstance sql2016 -AllUserDatabases -ExcludeDatabase \"DBMaintenance\",\"DBMonitoring\" -Path \"C:\\temp\"\nExports dacpac packages for all USER databases, excluding \"DBMaintenance\" \u0026 \"DBMonitoring\", on sql2016 and saves them to C:\\temp. The generated filename(s) will contain the server name, database \r\nname, and the current timestamp in the \"%Y%m%d%H%M%S\" format.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$moreparams = \"/OverwriteFiles:$true /Quiet:$true\"\nPS C:\\\u003e Export-DbaDacPackage -SqlInstance sql2016 -Database SharePoint_Config -Path C:\\temp -ExtendedParameters $moreparams\nUsing extended parameters to over-write the files and performs the extraction in quiet mode to C:\\temp\\sql2016-SharePoint_Config-20201227140759-dacpackage.dacpac. Uses command line instead of SMO \r\nbehind the scenes. As noted the generated filename will contain the server name, database name, and the current timestamp in the \"%Y%m%d%H%M%S\" format.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nOnly SQL authentication is supported. When not specified, uses Trusted Authentication.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "AllUserDatabases", "Run command against all user databases", "", false, "false", "False", "" ], [ "Path", "Specifies the directory where the file or files will be exported.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file.", "OutFile,FileName", false, "false", "", "" ], [ "DacOption", "Export options for a corresponding export type. Can be created by New-DbaDacOption -Type Dacpac | Bacpac", "ExtractOptions,ExportOptions,DacExtractOptions,DacExportOptions,Options,Option", false, "false", "", "" ], [ "ExtendedParameters", "Optional parameters used to extract the DACPAC. More information can be found at\r\nhttps://msdn.microsoft.com/en-us/library/hh550080.aspx", "", false, "false", "", "" ], [ "ExtendedProperties", "Optional properties used to extract the DACPAC. More information can be found at\r\nhttps://msdn.microsoft.com/en-us/library/hh550080.aspx", "", false, "false", "", "" ], [ "Type", "Selecting the type of the export: Dacpac (default) or Bacpac.", "", false, "false", "Dacpac", "Dacpac,Bacpac" ], [ "Table", "List of the tables to include into the export. Should be provided as an array of strings: dbo.Table1, Table2, Schema1.Table3.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaDacPackage -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-AllUserDatabases] [-Path \u003cString\u003e] [-FilePath \u003cString\u003e] [-DacOption \u003cObject\u003e] [-Type \u003cString\u003e] [-Table \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]\nExport-DbaDacPackage -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-AllUserDatabases] [-Path \u003cString\u003e] [-FilePath \u003cString\u003e] [-ExtendedParameters \u003cString\u003e] [-ExtendedProperties \u003cString\u003e] [-Type \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaDbRole", "Description": "Exports database roles to a T-SQL file. Export includes Role creation, object permissions and Schema ownership.\n\nThis command is based off of John Eisbrener\u0027s post \"Fully Script out a MSSQL Database Role\"\nReference: https://dbaeyes.wordpress.com/2013/04/19/fully-script-out-a-mssql-database-role/", "Tags": [ "Export", "Role" ], "Synopsis": "Exports database roles to a T-SQL file. Export includes Role creation, object permissions and Schema ownership.", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Export-DbaDbRole", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbaDbRole", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaDbRole -SqlInstance sql2005 -Path C:\\temp\nExports all the Database Roles for SQL Server \"sql2005\" and writes them to the file \"C:\\temp\\sql2005-logins.sql\"\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eExport-DbaDbRole -SqlInstance sqlserver2014a -ExcludeRole realcajun -SqlCredential $scred -Path C:\\temp\\roles.sql -Append\nAuthenticates to sqlserver2014a using SQL Authentication. Exports all roles except for realcajun to C:\\temp\\roles.sql, and appends to the file if it exists. If not, the file will be created.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eExport-DbaDbRole -SqlInstance sqlserver2014a -Role realcajun,netnerds -Path C:\\temp\\roles.sql\nExports ONLY roles netnerds and realcajun FROM sqlserver2014a to the file C:\\temp\\roles.sql\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eExport-DbaDbRole -SqlInstance sqlserver2014a -Role realcajun,netnerds -Database HR, Accounting\nExports ONLY roles netnerds and realcajun FROM sqlserver2014a with the permissions on databases HR and Accounting\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqlserver2014a -Database HR, Accounting | Export-DbaDbRole\nExports ONLY roles FROM sqlserver2014a with permissions on databases HR and Accounting\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eSet-DbatoolsConfig -FullName formatting.batchseparator -Value $null\nPS C:\\\u003e Export-DbaDbRole -SqlInstance sqlserver2008 -Role realcajun,netnerds -Path C:\\temp\\roles.sql\nSets the BatchSeparator configuration to null, removing the default \"GO\" value.\r\nExports ONLY roles netnerds and realcajun FROM sqlserver2008 server, to the C:\\temp\\roles.sql file, without the \"GO\" batch separator.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eExport-DbaDbRole -SqlInstance sqlserver2008 -Role realcajun,netnerds -Path C:\\temp\\roles.sql -BatchSeparator $null\nExports ONLY roles netnerds and realcajun FROM sqlserver2008 server, to the C:\\temp\\roles.sql file, without the \"GO\" batch separator.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqlserver2008 | Export-DbaDbRole -Role realcajun\nExports role realcajun for all databases on sqlserver2008\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eGet-DbaDbRole -SqlInstance sqlserver2008 -ExcludeFixedRole | Export-DbaDbRole\nExports all roles from all databases on sqlserver2008, excludes all roles marked as as FixedRole", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. SQL Server 2005 and above supported.\r\nAny databases in CompatibilityLevel 80 or lower will be skipped", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase and Get-DbaLogin.", "", false, "true (ByValue)", "", "" ], [ "ScriptingOptionsObject", "An SMO Scripting Object that can be used to customize the output - see New-DbaScriptingOption", "", false, "false", "", "" ], [ "Database", "The database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "Role", "The Role(s) to process. If unspecified, all Roles will be processed.", "", false, "false", "", "" ], [ "ExcludeRole", "The Role(s) to exclude.", "", false, "false", "", "" ], [ "ExcludeFixedRole", "Excludes all members of fixed roles.", "", false, "false", "False", "" ], [ "IncludeRoleMember", "Include scripting of role members in script", "", false, "false", "False", "" ], [ "Path", "Specifies the directory where the file or files will be exported.\r\nWill default to Path.DbatoolsExport Configuration entry", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file. If left blank then filename based on Instance name, Database name and date is created.\r\nIf more than one database or instance is input then this parameter should normally be blank.", "OutFile,FileName", false, "false", "", "" ], [ "Passthru", "Output script to console only", "", false, "false", "False", "" ], [ "BatchSeparator", "Batch separator for scripting output. Uses the value from configuration Formatting.BatchSeparator by default. This is normally \"GO\"", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Formatting.BatchSeparator\u0027)", "" ], [ "NoClobber", "If this switch is enabled, a file already existing at the path specified by Path will not be overwritten. This takes precedence over Append switch", "", false, "false", "False", "" ], [ "Append", "If this switch is enabled, content will be appended to a file already existing at the path specified by FilePath. If the file does not exist, it will be created.", "", false, "false", "False", "" ], [ "NoPrefix", "Do not include a Prefix", "", false, "false", "False", "" ], [ "Encoding", "Specifies the file encoding. The default is UTF8.\nValid values are:\r\n-- ASCII: Uses the encoding for the ASCII (7-bit) character set.\r\n-- BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order.\r\n-- Byte: Encodes a set of characters into a sequence of bytes.\r\n-- String: Uses the encoding type for a string.\r\n-- Unicode: Encodes in UTF-16 format using the little-endian byte order.\r\n-- UTF7: Encodes in UTF-7 format.\r\n-- UTF8: Encodes in UTF-8 format.\r\n-- Unknown: The encoding type is unknown or invalid. The data can be treated as binary.", "", false, "false", "UTF8", "ASCII,BigEndianUnicode,Byte,String,Unicode,UTF7,UTF8,Unknown" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaDbRole [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-InputObject] \u003cObject[]\u003e] [[-ScriptingOptionsObject] \u003cScriptingOptions\u003e] [[-Database] \u003cObject[]\u003e] [[-Role] \u003cObject[]\u003e] [[-ExcludeRole] \u003cObject[]\u003e] [-ExcludeFixedRole] [-IncludeRoleMember] [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [-Passthru] [[-BatchSeparator] \u003cString\u003e] [-NoClobber] [-Append] [-NoPrefix] [[-Encoding] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaDbTableData", "Description": "Exports data from tables", "Tags": [ "Migration", "Backup", "Export" ], "Synopsis": "Exports data from tables", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Export-DbaDbTableData", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbaDbTableData", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance sql2017 -Database AdventureWorks2014 -Table EmployeePayHistory | Export-DbaDbTableData\nExports data from EmployeePayHistory in AdventureWorks2014 in sql2017\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance sql2017 -Database AdventureWorks2014 -Table EmployeePayHistory | Export-DbaDbTableData -Path C:\\temp\\export.sql -Append\nExports data from EmployeePayHistory in AdventureWorks2014 in sql2017 using a trusted connection - Will append the output to the file C:\\temp\\export.sql if it already exists\r\nScript does not include Batch Separator and will not compile\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance sql2016 -Database MyDatabase -Table \u0027dbo.Table1\u0027, \u0027dbo.Table2\u0027 -SqlCredential sqladmin | Export-DbaDbTableData -Path C:\\temp\\export.sql\nExports only data from \u0027dbo.Table1\u0027 and \u0027dbo.Table2\u0027 in MyDatabase to C:\\temp\\export.sql and uses the SQL login \"sqladmin\" to login to sql2016", "Params": [ [ "InputObject", "Pipeline input from Get-DbaDbTable", "", true, "true (ByValue)", "", "" ], [ "Path", "Specifies the directory where the file or files will be exported.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file.", "OutFile,FileName", false, "false", "", "" ], [ "Encoding", "Specifies the file encoding. The default is UTF8.\nValid values are:\r\n - ASCII: Uses the encoding for the ASCII (7-bit) character set.\r\n - BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order.\r\n - Byte: Encodes a set of characters into a sequence of bytes.\r\n - String: Uses the encoding type for a string.\r\n - Unicode: Encodes in UTF-16 format using the little-endian byte order.\r\n - UTF7: Encodes in UTF-7 format.\r\n - UTF8: Encodes in UTF-8 format.\r\n - Unknown: The encoding type is unknown or invalid. The data can be treated as binary.", "", false, "false", "UTF8", "ASCII,BigEndianUnicode,Byte,String,Unicode,UTF7,UTF8,Unknown" ], [ "BatchSeparator", "Specifies the Batch Separator to use. Default is None", "", false, "false", "", "" ], [ "NoPrefix", "Do not include a Prefix", "", false, "false", "False", "" ], [ "Passthru", "Output script to console", "", false, "false", "False", "" ], [ "NoClobber", "Do not overwrite file", "", false, "false", "False", "" ], [ "Append", "Append to file", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command", "cf", false, "false", "", "" ] ], "Syntax": "Export-DbaDbTableData [-InputObject] \u003cTable[]\u003e [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [[-Encoding] \u003cString\u003e] [[-BatchSeparator] \u003cString\u003e] [-NoPrefix] [-Passthru] [-NoClobber] [-Append] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaDiagnosticQuery", "Description": "The default output format of Invoke-DbaDiagnosticQuery is a custom object. It can also output to CSV and Excel.\nHowever, CSV output can generate a lot of files and Excel output depends on the ImportExcel module by Doug Finke (https://github.com/dfinke/ImportExcel)\nExport-DbaDiagnosticQuery can be used to convert from the default export type to the other available export types.", "Tags": [ "Community", "GlennBerry" ], "Synopsis": "Export-DbaDiagnosticQuery can convert output generated by Invoke-DbaDiagnosticQuery to CSV or Excel", "Alias": "", "Author": "Andre Kamman (@AndreKamman), http://clouddba.io", "CommandName": "Export-DbaDiagnosticQuery", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbaDiagnosticQuery", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDiagnosticQuery -SqlInstance sql2016 | Export-DbaDiagnosticQuery -Path c:\\temp\nConverts output from Invoke-DbaDiagnosticQuery to multiple CSV files\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$output = Invoke-DbaDiagnosticQuery -SqlInstance sql2016\nPS C:\\\u003e Export-DbaDiagnosticQuery -InputObject $output -ConvertTo Excel\nConverts output from Invoke-DbaDiagnosticQuery to Excel worksheet(s) in the Documents folder", "Params": [ [ "InputObject", "Specifies the objects to convert", "", true, "true (ByValue)", "", "" ], [ "ConvertTo", "Specifies the output type. Valid choices are Excel and CSV. CSV is the default.", "", false, "false", "Csv", "Excel,Csv" ], [ "Path", "Specifies the path to the output files.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "Suffix", "Suffix for the filename. It\u0027s datetime by default.", "", false, "false", "\"$(Get-Date -format \u0027yyyyMMddHHmmssms\u0027)\"", "" ], [ "NoPlanExport", "Use this switch to suppress exporting of .sqlplan files", "", false, "false", "False", "" ], [ "NoQueryExport", "Use this switch to suppress exporting of .sql files", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaDiagnosticQuery [-InputObject] \u003cObject[]\u003e [[-ConvertTo] \u003cString\u003e] [[-Path] \u003cFileInfo\u003e] [[-Suffix] \u003cString\u003e] [-NoPlanExport] [-NoQueryExport] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaExecutionPlan", "Description": "Exports execution plans to disk. Can pipe from Get-DbaExecutionPlan\n\nThanks to\nhttps://www.simple-talk.com/sql/t-sql-programming/dmvs-for-query-plan-metadata/\nand\nhttp://www.scarydba.com/2017/02/13/export-plans-cache-sqlplan-file/\nfor the idea and query.", "Tags": [ "Performance", "ExecutionPlan" ], "Synopsis": "Exports execution plans to disk.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Export-DbaExecutionPlan", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbaExecutionPlan", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaExecutionPlan -SqlInstance sqlserver2014a -Path C:\\Temp\nExports all execution plans for sqlserver2014a. Files saved in to C:\\Temp\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eExport-DbaExecutionPlan -SqlInstance sqlserver2014a -Database db1, db2 -SinceLastExecution \u00272016-07-01 10:47:00\u0027 -Path C:\\Temp\nExports all execution plans for databases db1 and db2 on sqlserver2014a since July 1, 2016 at 10:47 AM. Files saved in to C:\\Temp\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaExecutionPlan -SqlInstance sqlserver2014a | Export-DbaExecutionPlan -Path C:\\Temp\nGets all execution plans for sqlserver2014a. Using Pipeline exports them all to C:\\Temp\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaExecutionPlan -SqlInstance sqlserver2014a | Export-DbaExecutionPlan -Path C:\\Temp -WhatIf\nGets all execution plans for sqlserver2014a. Then shows what would happen if the results where piped to Export-DbaExecutionPlan", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Path", "The directory where all of the sqlxml files will be exported", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "SinceCreation", "Datetime object used to narrow the results to a date", "", false, "false", "", "" ], [ "SinceLastExecution", "Datetime object used to narrow the results to a date", "", false, "false", "", "" ], [ "InputObject", "Internal parameter", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Export-DbaExecutionPlan [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nExport-DbaExecutionPlan -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-Path \u003cString\u003e] [-SinceCreation \u003cDateTime\u003e] [-SinceLastExecution \u003cDateTime\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nExport-DbaExecutionPlan [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-Path \u003cString\u003e] -InputObject \u003cObject[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaInstance", "Description": "Export-DbaInstance consolidates most of the export scripts in dbatools into one command.\n\nThis is useful when you\u0027re looking to Export entire instances. It less flexible than using the underlying functions.\nThink of it as an easy button. Unless an -Exclude is specified, it exports:\n\nAll database \u0027restore from backup\u0027 scripts. Note: if a database does not have a backup the \u0027restore from backup\u0027 script won\u0027t be generated.\nAll logins.\nAll database mail objects.\nAll credentials.\nAll objects within the Job Server (SQL Agent).\nAll linked servers.\nAll groups and servers within Central Management Server.\nAll SQL Server configuration objects (everything in sp_configure).\nAll user objects in system databases.\nAll system triggers.\nAll system backup devices.\nAll Audits.\nAll Endpoints.\nAll Extended Events.\nAll Policy Management objects.\nAll Resource Governor objects.\nAll Server Audit Specifications.\nAll Custom Errors (User Defined Messages).\nAll Server Roles.\nAll Availability Groups.\nAll OLEDB Providers.\n\nThe exported files are written to a folder with a naming convention of \"machinename$instance-yyyyMMddHHmmss\".\n\nThis command supports the following use cases related to the output files:\n\n1. Export files to a new timestamped folder. This is the default behavior and results in a simple historical archive within the local filesystem.\n2. Export files to an existing folder and overwrite pre-existing files. This can be accomplished using the -Force parameter.\nThis results in a single folder location with the latest exported files. These files can then be checked into a source control system if needed.", "Tags": "Export", "Synopsis": "Exports SQL Server *ALL* database restore scripts, logins, database mail profiles/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 -Exclude parameters and use the other functions available within the dbatools module.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Export-DbaInstance", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbaInstance", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaInstance -SqlInstance sqlserver\\instance\nAll databases, logins, job objects and sp_configure options will be exported from sqlserver\\instance to an automatically generated folder name in Documents. For example, \r\n%userprofile%\\Documents\\DbatoolsExport\\sqldev1$sqlcluster-20201108140000\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eExport-DbaInstance -SqlInstance sqlcluster -Exclude Databases, Logins -Path C:\\dr\\sqlcluster\nExports everything but logins and database restore scripts to a folder such as C:\\dr\\sqlcluster\\sqldev1$sqlcluster-20201108140000\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eExport-DbaInstance -SqlInstance sqlcluster -Path C:\\servers\\ -NoPrefix\nExports everything to a folder such as C:\\servers\\sqldev1$sqlcluster-20201108140000 but scripts will not include prefix information.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eExport-DbaInstance -SqlInstance sqlcluster -Path C:\\servers\\ -Force\nExports everything to a folder such as C:\\servers\\sqldev1$sqlcluster and will overwrite/refresh existing files in that folder. Note: when the -Force param is used the generated folder name will not \r\ninclude a timestamp. This supports the use case of running Export-DbaInstance on a schedule and writing to the same dir each time.", "Params": [ [ "SqlInstance", "The target SQL Server instances", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Credential", "Alternative Windows credentials for exporting Linked Servers and Credentials. Accepts credential objects (Get-Credential)", "", false, "false", "", "" ], [ "Path", "Specifies the directory where the file or files will be exported.", "FilePath", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "NoRecovery", "If this switch is used, databases will be left in the No Recovery state to enable further backups to be added.", "", false, "false", "False", "" ], [ "AzureCredential", "Optional AzureCredential to connect to blob storage holding the backups", "", false, "false", "", "" ], [ "IncludeDbMasterKey", "Exports the db master key then logs into the server to copy it to the $Path", "", false, "false", "False", "" ], [ "Exclude", "Exclude one or more objects to export\nDatabases\r\nLogins\r\nAgentServer\r\nCredentials\r\nLinkedServers\r\nSpConfigure\r\nCentralManagementServer\r\nDatabaseMail\r\nSysDbUserObjects\r\nSystemTriggers\r\nBackupDevices\r\nAudits\r\nEndpoints\r\nExtendedEvents\r\nPolicyManagement\r\nResourceGovernor\r\nServerAuditSpecifications\r\nCustomErrors\r\nServerRoles\r\nAvailabilityGroups\r\nReplicationSettings\r\nOleDbProvider", "", false, "false", "", "AgentServer,Audits,AvailabilityGroups,BackupDevices,CentralManagementServer,Credentials,CustomErrors,DatabaseMail,Databases,Endpoints,ExtendedEvents,LinkedServers,Logins,PolicyManagement,ReplicationSettings,ResourceGovernor,ServerAuditSpecifications,ServerRoles,SpConfigure,SysDbUserObjects,SystemTriggers,OleDbProvider" ], [ "BatchSeparator", "Batch separator for scripting output. \"GO\" by default based on (Get-DbatoolsConfigValue -FullName \u0027formatting.batchseparator\u0027).", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027formatting.batchseparator\u0027)", "" ], [ "ScriptingOption", "Add scripting options to scripting output for all objects except Registered Servers and Extended Events.", "", false, "false", "", "" ], [ "NoPrefix", "If this switch is used, the scripts will not include prefix information containing creator and datetime.", "", false, "false", "False", "" ], [ "ExcludePassword", "If this switch is used, the scripts will not include passwords for Credentials, LinkedServers or Logins.", "", false, "false", "False", "" ], [ "Force", "Overwrite files in the location specified by -Path. Note: The Server Name is used when creating the folder structure.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaInstance [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [[-Path] \u003cString\u003e] [-NoRecovery] [[-AzureCredential] \u003cString\u003e] [-IncludeDbMasterKey] [[-Exclude] \u003cString[]\u003e] [[-BatchSeparator] \u003cString\u003e] [[-ScriptingOption] \u003cScriptingOptions\u003e] [-NoPrefix] [-ExcludePassword] [-Force] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaLinkedServer", "Description": "Exports linked servers INCLUDING PASSWORDS, unless specified otherwise, to sql file.\n\nRequires remote Windows access if exporting the password.", "Tags": "LinkedServer", "Synopsis": "Exports linked servers INCLUDING PASSWORDS, unless specified otherwise, to sql file.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Export-DbaLinkedServer", "Availability": "Windows only", "Links": "https://dbatools.io/Export-DbaLinkedServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaLinkedServer -SqlInstance sql2017 -Path C:\\temp\\ls.sql\nExports the linked servers, including passwords, from sql2017 to the file C:\\temp\\ls.sql\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eExport-DbaLinkedServer -SqlInstance sql2017 -Path C:\\temp\\ls.sql -ExcludePassword\nExports the linked servers, without passwords, from sql2017 to the file C:\\temp\\ls.sql", "Params": [ [ "SqlInstance", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2005 or higher.", "", true, "true (ByValue)", "", "" ], [ "LinkedServer", "The linked server(s) to export. If unspecified, all linked servers will be processed.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Credential", "Login to the target OS using alternative linked servers. Accepts credential objects (Get-Credential)", "", false, "false", "", "" ], [ "Path", "Specifies the directory where the file or files will be exported.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file.", "OutFile,FileName", false, "false", "", "" ], [ "ExcludePassword", "Exports the linked server without any sensitive information.", "", false, "false", "False", "" ], [ "Append", "Append to Path", "", false, "false", "False", "" ], [ "InputObject", "Allow credentials to be piped in from Get-DbaLinkedServer", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaLinkedServer [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-LinkedServer] \u003cString[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [-ExcludePassword] [-Append] [[-InputObject] \u003cLinkedServer[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaLogin", "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.", "Tags": [ "Export", "Login" ], "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.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Export-DbaLogin", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbaLogin", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaLogin -SqlInstance sql2005 -Path C:\\temp\\sql2005-logins.sql\nExports the logins for SQL Server \"sql2005\" and writes them to the file \"C:\\temp\\sql2005-logins.sql\"\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eExport-DbaLogin -SqlInstance sqlserver2014a -ExcludeLogin realcajun -SqlCredential $scred -Path C:\\temp\\logins.sql -Append\nAuthenticates to sqlserver2014a using SQL Authentication. Exports all logins except for realcajun to C:\\temp\\logins.sql, and appends to the file if it exists. If not, the file will be created.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eExport-DbaLogin -SqlInstance sqlserver2014a -Login realcajun, netnerds -Path C:\\temp\\logins.sql\nExports ONLY logins netnerds and realcajun FROM sqlserver2014a to the file C:\\temp\\logins.sql\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eExport-DbaLogin -SqlInstance sqlserver2014a -Login realcajun, netnerds -Database HR, Accounting\nExports ONLY logins netnerds and realcajun FROM sqlserver2014a with the permissions on databases HR and Accounting\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqlserver2014a -Database HR, Accounting | Export-DbaLogin\nExports ONLY logins FROM sqlserver2014a with permissions on databases HR and Accounting\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eSet-DbatoolsConfig -FullName formatting.batchseparator -Value $null\nPS C:\\\u003e Export-DbaLogin -SqlInstance sqlserver2008 -Login realcajun, netnerds -Path C:\\temp\\login.sql\nExports ONLY logins netnerds and realcajun FROM sqlserver2008 server, to the C:\\temp\\login.sql file without the \u0027GO\u0027 batch separator.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eExport-DbaLogin -SqlInstance sqlserver2008 -Login realcajun -Path C:\\temp\\users.sql -DestinationVersion SQLServer2016\nExports login realcajun from sqlserver2008 to the file C:\\temp\\users.sql with syntax to run on SQL Server 2016\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqlserver2008 -Login realcajun | Export-DbaLogin\nExports login realcajun from sqlserver2008\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sqlserver2008, sqlserver2012 | Where-Object { $_.IsDisabled -eq $false } | Export-DbaLogin\nExports all enabled logins from sqlserver2008 and sqlserver2008", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. SQL Server 2000 and above supported.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase, Get-DbaLogin and more.", "", false, "true (ByValue)", "", "" ], [ "Login", "The login(s) to process. Options for this list are auto-populated from the server. If unspecified, all logins will be processed.", "", false, "false", "", "" ], [ "ExcludeLogin", "The login(s) to exclude. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeJobs", "If this switch is enabled, Agent job ownership will not be exported.", "", false, "false", "False", "" ], [ "ExcludeDatabase", "If this switch is enabled, mappings for databases will not be exported.", "ExcludeDatabases", false, "false", "False", "" ], [ "ExcludePassword", "If this switch is enabled, hashed passwords will not be exported.", "", false, "false", "False", "" ], [ "DefaultDatabase", "If this switch is enabled, all logins will be scripted with specified default database,\r\nthat could help to successfully import logins on server that is missing default database for login.", "", false, "false", "", "" ], [ "Path", "Specifies the directory where the file or files will be exported.\r\nWill default to Path.DbatoolsExport Configuration entry", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file. If left blank then filename based on Instance name and date is created.\r\nIf more than one instance is input then this parameter should be blank.", "OutFile,FileName", false, "false", "", "" ], [ "Encoding", "Specifies the file encoding. The default is UTF8.\nValid values are:\r\n-- ASCII: Uses the encoding for the ASCII (7-bit) character set.\r\n-- BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order.\r\n-- Byte: Encodes a set of characters into a sequence of bytes.\r\n-- String: Uses the encoding type for a string.\r\n-- Unicode: Encodes in UTF-16 format using the little-endian byte order.\r\n-- UTF7: Encodes in UTF-7 format.\r\n-- UTF8: Encodes in UTF-8 format.\r\n-- Unknown: The encoding type is unknown or invalid. The data can be treated as binary.", "", false, "false", "UTF8", "ASCII,BigEndianUnicode,Byte,String,Unicode,UTF7,UTF8,Unknown" ], [ "NoClobber", "If this switch is enabled, a file already existing at the path specified by Path will not be overwritten.", "NoOverwrite", false, "false", "False", "" ], [ "Append", "If this switch is enabled, content will be appended to a file already existing at the path specified by Path. If the file does not exist, it will be created.", "", false, "false", "False", "" ], [ "BatchSeparator", "Batch separator for scripting output. Uses the value from configuration Formatting.BatchSeparator by default. This is normally \"GO\"", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Formatting.BatchSeparator\u0027)", "" ], [ "DestinationVersion", "To say to which version the script should be generated. If not specified will use instance major version.", "", false, "false", "", "SQLServer2000,SQLServer2005,SQLServer2008/2008R2,SQLServer2012,SQLServer2014,SQLServer2016,SQLServer2017,SQLServer2019" ], [ "NoPrefix", "Do not include a Prefix", "", false, "false", "False", "" ], [ "Passthru", "Output script to console", "", false, "false", "False", "" ], [ "ObjectLevel", "Include object-level permissions for each user associated with copied login.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Export-DbaLogin [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-InputObject] \u003cObject[]\u003e] [[-Login] \u003cObject[]\u003e] [[-ExcludeLogin] \u003cObject[]\u003e] [[-Database] \u003cObject[]\u003e] [-ExcludeJobs] [-ExcludeDatabase] [-ExcludePassword] [[-DefaultDatabase] \u003cString\u003e] [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [[-Encoding] \u003cString\u003e] [-NoClobber] [-Append] [[-BatchSeparator] \u003cString\u003e] [[-DestinationVersion] \u003cString\u003e] [-NoPrefix] [-Passthru] [-ObjectLevel] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaPfDataCollectorSetTemplate", "Description": "Exports a Data Collector Set XML Template from Get-DbaPfDataCollectorSet. Exports to \"$home\\Documents\\Performance Monitor Templates\" by default.", "Tags": [ "Performance", "DataCollector" ], "Synopsis": "Exports a new Data Collector Set XML Template.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Export-DbaPfDataCollectorSetTemplate", "Availability": "Windows only", "Links": "https://dbatools.io/Export-DbaPfDataCollectorSetTemplate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaPfDataCollectorSetTemplate -ComputerName sql2017 -Path C:\\temp\\pf\nExports all data collector sets from to the C:\\temp\\pf folder.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSet ComputerName sql2017 -CollectorSet \u0027System Correlation\u0027 | Export-DbaPfDataCollectorSetTemplate -Path C:\\temp\nExports the \u0027System Correlation\u0027 data collector set from sql2017 to C:\\temp.", "Params": [ [ "ComputerName", "The target computer. Defaults to localhost.", "", false, "false", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to $ComputerName using alternative credentials. To use:\n$cred = Get-Credential, then pass $cred object to the -Credential parameter.", "", false, "false", "", "" ], [ "CollectorSet", "The name of the collector set(s) to export.", "DataCollectorSet", false, "false", "", "" ], [ "Path", "Specifies the directory where the file or files will be exported.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file.", "OutFile,FileName", false, "false", "", "" ], [ "InputObject", "Accepts the object output by Get-DbaPfDataCollectorSetTemplate via the pipeline.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaPfDataCollectorSetTemplate [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-CollectorSet] \u003cString[]\u003e] [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaRegServer", "Description": "Exports registered servers and registered server groups to file", "Tags": [ "RegisteredServer", "CMS" ], "Synopsis": "Exports registered servers and registered server groups to file", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Export-DbaRegServer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbaRegServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaRegServer -SqlInstance sql2008\nExports all Registered Server and Registered Server Groups on sql2008 to an automatically generated file name in the current directory\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sql2008, sql2012 | Export-DbaRegServer\nExports all registered servers on sql2008 and sql2012. Warning - each one will have its own individual file. Consider piping groups.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRegServerGroup -SqlInstance sql2008, sql2012 | Export-DbaRegServer\nExports all registered servers on sql2008 and sql2012, organized by group.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaRegServer, Get-DbaRegServerGroup, CSVs and other objects.\nIf importing from CSV or other object, a column named ServerName is required. Optional columns include Name, Description and Group.", "", false, "true (ByValue)", "", "" ], [ "Path", "Specifies the directory where the file or files will be exported.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file. The file must end with .xml or .regsrvr", "OutFile,FileName", false, "false", "", "" ], [ "CredentialPersistenceType", "Used to specify how the login and passwords are persisted. Valid values include None, PersistLoginName and PersistLoginNameAndPassword.", "", false, "false", "None", "None,PersistLoginName,PersistLoginNameAndPassword" ], [ "Group", "Specifies one or more groups to include.", "", false, "false", "", "" ], [ "ExcludeGroup", "Specifies one or more groups to exclude.", "", false, "false", "", "" ], [ "Overwrite", "Specifies to overwrite the output file (FilePath) if it already exists.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaRegServer [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-InputObject] \u003cObject[]\u003e] [[-Path] \u003cString\u003e] [[-FilePath] \u003cFileInfo\u003e] [[-CredentialPersistenceType] \u003cString\u003e] [[-Group] \u003cObject[]\u003e] [[-ExcludeGroup] \u003cObject[]\u003e] [-Overwrite] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaRepServerSetting", "Description": "Exports replication server settings to file.\n\nAll replication commands need SQL Server Management Studio installed and are therefore currently not supported.\nHave a look at this issue to get more information: https://github.com/sqlcollaborative/dbatools/issues/7428", "Tags": "Replication", "Synopsis": "Exports replication server settings to file.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Export-DbaRepServerSetting", "Availability": "Windows only", "Links": "https://dbatools.io/Export-DbaRepServerSetting", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaRepServerSetting -SqlInstance sql2017 -Path C:\\temp\\replication.sql\nExports the replication settings on sql2017 to the file C:\\temp\\replication.sql\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRepServer -SqlInstance sql2017 | Export-DbaRepServerSettings -Path C:\\temp\\replication.sql\nExports the replication settings on sql2017 to the file C:\\temp\\replication.sql", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Path", "Specifies the directory where the file or files will be exported.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file.", "OutFile,FileName", false, "false", "", "" ], [ "ScriptOption", "Not real sure how to use this yet", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaRepServer", "", false, "true (ByValue)", "", "" ], [ "Encoding", "Specifies the file encoding. The default is UTF8.\nValid values are:\r\n-- ASCII: Uses the encoding for the ASCII (7-bit) character set.\r\n-- BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order.\r\n-- Byte: Encodes a set of characters into a sequence of bytes.\r\n-- String: Uses the encoding type for a string.\r\n-- Unicode: Encodes in UTF-16 format using the little-endian byte order.\r\n-- UTF7: Encodes in UTF-7 format.\r\n-- UTF8: Encodes in UTF-8 format.\r\n-- Unknown: The encoding type is unknown or invalid. The data can be treated as binary.", "", false, "false", "UTF8", "ASCII,BigEndianUnicode,Byte,String,Unicode,UTF7,UTF8,Unknown" ], [ "Passthru", "Output script to console", "", false, "false", "False", "" ], [ "NoClobber", "Do not overwrite file", "", false, "false", "False", "" ], [ "Append", "Append to file", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaRepServerSetting [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [[-ScriptOption] \u003cObject[]\u003e] [[-InputObject] \u003cObject[]\u003e] [[-Encoding] \u003cString\u003e] [-Passthru] [-NoClobber] [-Append] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaScript", "Description": "Exports scripts from SQL Management Objects", "Tags": [ "Migration", "Backup", "Export" ], "Synopsis": "Exports scripts from SQL Management Objects (SMO)", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Export-DbaScript", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbaScript", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance sql2016 | Export-DbaScript\nExports all jobs on the SQL Server sql2016 instance using a trusted connection - automatically determines filename based on the Path.DbatoolsExport configuration setting, current time and server name.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance sql2016 | Export-DbaScript -FilePath C:\\temp\\export.sql -Append\nExports all jobs on the SQL Server sql2016 instance using a trusted connection - Will append the output to the file C:\\temp\\export.sql if it already exists\r\nInclusion of Batch Separator in script depends on the configuration s not include Batch Separator and will not compile\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance sql2016 -Database MyDatabase -Table \u0027dbo.Table1\u0027, \u0027dbo.Table2\u0027 -SqlCredential sqladmin | Export-DbaScript -FilePath C:\\temp\\export.sql\nExports only script for \u0027dbo.Table1\u0027 and \u0027dbo.Table2\u0027 in MyDatabase to C:temp\\export.sql and uses the SQL login \"sqladmin\" to login to sql2016\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance sql2016 -Job syspolicy_purge_history, \u0027Hourly Log Backups\u0027 -SqlCredential sqladmin | Export-DbaScript -FilePath C:\\temp\\export.sql -NoPrefix\nExports only syspolicy_purge_history and \u0027Hourly Log Backups\u0027 to C:temp\\export.sql and uses the SQL login \"sqladmin\" to login to sql2016\r\nSuppress the output of a Prefix\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$options = New-DbaScriptingOption\nPS C:\\\u003e $options.ScriptSchema = $true\r\nPS C:\\\u003e $options.IncludeDatabaseContext = $true\r\nPS C:\\\u003e $options.IncludeHeaders = $false\r\nPS C:\\\u003e $Options.NoCommandTerminator = $false\r\nPS C:\\\u003e $Options.ScriptBatchTerminator = $true\r\nPS C:\\\u003e $Options.AnsiFile = $true\r\nPS C:\\\u003e Get-DbaAgentJob -SqlInstance sql2016 -Job syspolicy_purge_history, \u0027Hourly Log Backups\u0027 -SqlCredential sqladmin | Export-DbaScript -FilePath C:\\temp\\export.sql -ScriptingOptionsObject $options\nExports only syspolicy_purge_history and \u0027Hourly Log Backups\u0027 to C:temp\\export.sql and uses the SQL login \"sqladmin\" to login to sql2016\r\nUses Scripting options to ensure Batch Terminator is set\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance sql2014 | Export-DbaScript -Passthru | ForEach-Object { $_.Replace(\u0027sql2014\u0027,\u0027sql2016\u0027) } | Set-Content -Path C:\\temp\\export.sql\nExports jobs and replaces all instances of the servername \"sql2014\" with \"sql2016\" then writes to C:\\temp\\export.sql\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$options = New-DbaScriptingOption\nPS C:\\\u003e $options.ScriptSchema = $true\r\nPS C:\\\u003e $options.IncludeDatabaseContext = $true\r\nPS C:\\\u003e $options.IncludeHeaders = $false\r\nPS C:\\\u003e $Options.NoCommandTerminator = $false\r\nPS C:\\\u003e $Options.ScriptBatchTerminator = $true\r\nPS C:\\\u003e $Options.AnsiFile = $true\r\nPS C:\\\u003e $Databases = Get-DbaDatabase -SqlInstance sql2016 -ExcludeDatabase master, model, msdb, tempdb\r\nPS C:\\\u003e foreach ($db in $Databases) {\r\n\u003e\u003e Export-DbaScript -InputObject $db -FilePath C:\\temp\\export.sql -Append -Encoding UTF8 -ScriptingOptionsObject $options -NoPrefix\r\n\u003e\u003e }\nExports Script for each database on sql2016 excluding system databases\r\nUses Scripting options to ensure Batch Terminator is set\r\nWill append the output to the file C:\\temp\\export.sql if it already exists", "Params": [ [ "InputObject", "A SQL Management Object such as the one returned from Get-DbaLogin", "", true, "true (ByValue)", "", "" ], [ "ScriptingOptionsObject", "An SMO Scripting Object that can be used to customize the output - see New-DbaScriptingOption\r\nOptions set in the ScriptingOptionsObject may override other parameter values", "ScriptingOptionObject", false, "false", "", "" ], [ "Path", "Specifies the directory where the file or files will be exported.\r\nWill default to Path.DbatoolsExport Configuration entry", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file.", "OutFile,FileName", false, "false", "", "" ], [ "Encoding", "Specifies the file encoding. The default is UTF8.\nValid values are:\r\n-- ASCII: Uses the encoding for the ASCII (7-bit) character set.\r\n-- BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order.\r\n-- Byte: Encodes a set of characters into a sequence of bytes.\r\n-- String: Uses the encoding type for a string.\r\n-- Unicode: Encodes in UTF-16 format using the little-endian byte order.\r\n-- UTF7: Encodes in UTF-7 format.\r\n-- UTF8: Encodes in UTF-8 format.\r\n-- Unknown: The encoding type is unknown or invalid. The data can be treated as binary.", "", false, "false", "UTF8", "ASCII,BigEndianUnicode,Byte,String,Unicode,UTF7,UTF8,Unknown" ], [ "BatchSeparator", "Specifies the Batch Separator to use. Uses the value from configuration Formatting.BatchSeparator by default. This is normally \"GO\"", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Formatting.BatchSeparator\u0027)", "" ], [ "NoPrefix", "Do not include a Prefix", "", false, "false", "False", "" ], [ "Passthru", "Output script to console", "", false, "false", "False", "" ], [ "NoClobber", "Do not overwrite file", "", false, "false", "False", "" ], [ "Append", "Append to file", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command", "cf", false, "false", "", "" ] ], "Syntax": "Export-DbaScript [-InputObject] \u003cObject[]\u003e [[-ScriptingOptionsObject] \u003cScriptingOptions\u003e] [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [[-Encoding] \u003cString\u003e] [[-BatchSeparator] \u003cString\u003e] [-NoPrefix] [-Passthru] [-NoClobber] [-Append] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaServerRole", "Description": "Exports Server roles to a T-SQL file. Export includes Role creation, object permissions and Role Members\n\nApplies mostly to SQL Server 2012 or Higher when user defined Server roles were added but can be used on earlier versions to get role members.\nThis command is an extension of John Eisbrener\u0027s post \"Fully Script out a MSSQL Database Role\"\nReference: https://dbaeyes.wordpress.com/2013/04/19/fully-script-out-a-mssql-database-role/", "Tags": [ "Export", "Role" ], "Synopsis": "Exports server roles to a T-SQL file. Export includes Role creation, object permissions and Schema ownership.", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Export-DbaServerRole", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbaServerRole", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaServerRole -SqlInstance sql2005\nExports the Server Roles for SQL Server \"sql2005\" and writes them to the path defined in the ConfigValue \u0027Path.DbatoolsExport\u0027 using a a default name pattern of ServerName-YYYYMMDDhhmmss-serverrole. \r\nUses BatchSeparator defined by Config \u0027Formatting.BatchSeparator\u0027\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eExport-DbaServerRole -SqlInstance sql2005 -Path C:\\temp\nExports the Server Roles for SQL Server \"sql2005\" and writes them to the path \"C:\\temp\" using a a default name pattern of ServerName-YYYYMMDDhhmmss-serverrole. Uses BatchSeparator defined by Config \r\n\u0027Formatting.BatchSeparator\u0027\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eExport-DbaServerRole -SqlInstance sqlserver2014a -FilePath C:\\temp\\ServerRoles.sql\nExports the Server Roles for SQL Server sqlserver2014a to the file C:\\temp\\ServerRoles.sql. Overwrites file if exists\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eExport-DbaServerRole -SqlInstance sqlserver2014a -ServerRole SchemaReader -Passthru\nExports ONLY ServerRole SchemaReader FROM sqlserver2014a and writes script to console\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eExport-DbaServerRole -SqlInstance sqlserver2008 -ExcludeFixedRole -ExcludeServerRole Public -IncludeRoleMember -FilePath C:\\temp\\ServerRoles.sql -Append -BatchSeparator \u0027\u0027\nExports server roles from sqlserver2008, excludes all roles marked as as FixedRole and Public role. Includes RoleMembers and writes to file C:\\temp\\ServerRoles.sql, appending to file if it exits. \r\nDoes not include a BatchSeparator\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaServerRole -SqlInstance sqlserver2012, sqlserver2014 | Export-DbaServerRole\nExports server roles from sqlserver2012, sqlserver2014 and writes them to the path defined in the ConfigValue \u0027Path.DbatoolsExport\u0027 using a a default name pattern of \r\nServerName-YYYYMMDDhhmmss-serverrole\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaServerRole -SqlInstance sqlserver2016 -ExcludeFixedRole -ExcludeServerRole Public | Export-DbaServerRole -IncludeRoleMember\nExports server roles from sqlserver2016, excludes all roles marked as as FixedRole and Public role. Includes RoleMembers", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. SQL Server 2000 and above supported.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaServerRole", "", false, "true (ByValue)", "", "" ], [ "ScriptingOptionsObject", "An SMO Scripting Object that can be used to customize the output - see New-DbaScriptingOption", "", false, "false", "", "" ], [ "ServerRole", "Server-Level role(s) to filter results to that role only.", "", false, "false", "", "" ], [ "ExcludeServerRole", "Server-Level role(s) to exclude from results.", "", false, "false", "", "" ], [ "ExcludeFixedRole", "Filter the fixed server-level roles. As only SQL Server 2012 or higher supports creation of server-level roles will eliminate all output for earlier versions.", "", false, "false", "False", "" ], [ "IncludeRoleMember", "Include scripting of role members in script", "", false, "false", "False", "" ], [ "Path", "Specifies the directory where the file or files will be exported.\r\nWill default to Path.DbatoolsExport Configuration entry", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file. If left blank then filename based on Instance name, Database name and date is created.\r\nIf more than one database or instance is input then this parameter should normally be blank.", "OutFile,FileName", false, "false", "", "" ], [ "Passthru", "Output script to console only", "", false, "false", "False", "" ], [ "BatchSeparator", "Batch separator for scripting output. Uses the value from configuration Formatting.BatchSeparator by default. This is normally \"GO\"", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Formatting.BatchSeparator\u0027)", "" ], [ "NoClobber", "If this switch is enabled, a file already existing at the path specified by Path will not be overwritten. This takes precedence over Append switch", "", false, "false", "False", "" ], [ "Append", "If this switch is enabled, content will be appended to a file already existing at the path specified by FilePath. If the file does not exist, it will be created.", "", false, "false", "False", "" ], [ "NoPrefix", "Do not include a Prefix", "", false, "false", "False", "" ], [ "Encoding", "Specifies the file encoding. The default is UTF8.\nValid values are:\r\n-- ASCII: Uses the encoding for the ASCII (7-bit) character set.\r\n-- BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order.\r\n-- Byte: Encodes a set of characters into a sequence of bytes.\r\n-- String: Uses the encoding type for a string.\r\n-- Unicode: Encodes in UTF-16 format using the little-endian byte order.\r\n-- UTF7: Encodes in UTF-7 format.\r\n-- UTF8: Encodes in UTF-8 format.\r\n-- Unknown: The encoding type is unknown or invalid. The data can be treated as binary.", "", false, "false", "UTF8", "ASCII,BigEndianUnicode,Byte,String,Unicode,UTF7,UTF8,Unknown" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaServerRole [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-InputObject] \u003cObject[]\u003e] [[-ScriptingOptionsObject] \u003cScriptingOptions\u003e] [[-ServerRole] \u003cString[]\u003e] [[-ExcludeServerRole] \u003cString[]\u003e] [-ExcludeFixedRole] [-IncludeRoleMember] [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [-Passthru] [[-BatchSeparator] \u003cString\u003e] [-NoClobber] [-Append] [-NoPrefix] [[-Encoding] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaSpConfigure", "Description": "Exports advanced sp_configure global configuration options to sql file.", "Tags": [ "SpConfig", "Configure", "Configuration" ], "Synopsis": "Exports advanced sp_configure global configuration options to sql file.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Export-DbaSpConfigure", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbaSpConfigure", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaSpConfigure -SqlInstance sourceserver\nExports the SPConfigure settings on sourceserver. As no Path was defined outputs to My Documents folder with default name format of Servername-MMDDYYYYhhmmss-sp_configure.sql\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eExport-DbaSpConfigure -SqlInstance sourceserver -Path C:\\temp\nExports the SPConfigure settings on sourceserver to the directory C:\\temp using the default name format\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Export-DbaSpConfigure -SqlInstance sourceserver -SqlCredential $cred -Path C:\\temp\\sp_configure.sql\nExports the SPConfigure settings on sourceserver to the file C:\\temp\\sp_configure.sql. Uses SQL Authentication to connect. Will require SysAdmin rights if needs to set \u0027show advanced options\u0027\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e\u0027Server1\u0027, \u0027Server2\u0027 | Export-DbaSpConfigure -Path C:\\temp\\configure.sql\nExports the SPConfigure settings for Server1 and Server2 using pipeline. As more than 1 Server adds prefix of Servername and date to the file name and saves to file like \r\nC:\\temp\\Servername-MMDDYYYYhhmmss-configure.sql", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input.\r\nYou must have sysadmin access if needs to set \u0027show advanced options\u0027 to 1 and server version must be SQL Server version 2005 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Path", "Specifies the directory where the file or files will be exported.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file.", "OutFile,FileName", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaSpConfigure [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaSysDbUserObject", "Description": "Exports all user objects found in source SQL Server\u0027s master, msdb and model databases to the FilePath.", "Tags": [ "Export", "Object", "SystemDatabase" ], "Synopsis": "Exports all user objects found in source SQL Server\u0027s master, msdb and model databases to the FilePath.", "Alias": "", "Author": "Jess Pomfret (@jpomfret)", "CommandName": "Export-DbaSysDbUserObject", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbaSysDbUserObject", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaSysDbUserObject -SqlInstance server1\nExports any user objects that are in the system database to the default location.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.\r\nThis can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials.\r\nWindows and SQL Authentication supported. Accepts credential objects (Get-Credential)", "", false, "false", "", "" ], [ "IncludeDependencies", "Specifies whether dependent objects are also scripted out.", "", false, "false", "False", "" ], [ "BatchSeparator", "Batch separator for scripting output. \"GO\" by default.", "", false, "false", "GO", "" ], [ "Path", "Specifies the directory where the file or files will be exported.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file.", "", false, "false", "", "" ], [ "NoPrefix", "If this switch is used, the scripts will not include prefix information containing creator and datetime.", "", false, "false", "False", "" ], [ "ScriptingOptionsObject", "Add scripting options to scripting output.", "", false, "false", "", "" ], [ "NoClobber", "Do not overwrite file.", "", false, "false", "False", "" ], [ "PassThru", "Output script to console.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaSysDbUserObject [-SqlInstance] \u003cDbaInstanceParameter\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-IncludeDependencies] [[-BatchSeparator] \u003cString\u003e] [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [-NoPrefix] [[-ScriptingOptionsObject] \u003cScriptingOptions\u003e] [-NoClobber] [-PassThru] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbatoolsConfig", "Description": "Exports configuration items to a Json file.", "Tags": "Module", "Synopsis": "Exports configuration items to a Json file.", "Alias": "", "Author": "Friedrich Weinmann (@FredWeinmann)", "CommandName": "Export-DbatoolsConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbatoolsConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbatoolsConfig | Export-DbatoolsConfig -OutPath \u0027~/export.json\u0027\nExports all current settings to json.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eExport-DbatoolsConfig -Module message -OutPath \u0027~/export.json\u0027 -SkipUnchanged\nExports all settings of the module \u0027message\u0027 that are no longer the original default values to json.", "Params": [ [ "FullName", "Select the configuration objects to export by filtering by their full name.", "", true, "false", "", "" ], [ "Module", "Select the configuration objects to export by filtering by their module name.", "", true, "false", "", "" ], [ "Name", "Select the configuration objects to export by filtering by their name.", "", false, "false", "*", "" ], [ "Config", "The configuration object(s) to export.\r\nReturned by Get-DbatoolsConfig.", "", true, "true (ByValue)", "", "" ], [ "ModuleName", "Exports all configuration pertinent to a module to a predefined path.\r\nExported configuration items include all settings marked as \u0027ModuleExport\u0027 that have been changed from the default value.", "", true, "false", "", "" ], [ "ModuleVersion", "The configuration version of the module-settings to write.", "", false, "false", "1", "" ], [ "Scope", "Which predefined path to write module specific settings to.\r\nOnly file scopes are considered.\r\nBy default it writes to the suer profile.", "", false, "false", "FileUserShared", "" ], [ "OutPath", "The path (filename included) to export to.\r\nWill fail if the folder does not exist, will overwrite the file if it exists.", "", true, "false", "", "" ], [ "SkipUnchanged", "If set, configuration objects whose value was not changed from its original value will not be exported.\r\n(Note: Settings that were updated with the same value as the original default will still be considered changed)", "", false, "false", "False", "" ], [ "EnableException", "This parameters disables user-friendly warnings and enables the throwing of exceptions.\r\nThis is less user friendly, but allows catching exceptions in calling scripts.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbatoolsConfig -FullName \u003cString\u003e [-OutPath] \u003cString\u003e [-SkipUnchanged] [-EnableException] [\u003cCommonParameters\u003e]\nExport-DbatoolsConfig -Module \u003cString\u003e [[-Name] \u003cString\u003e] [-OutPath] \u003cString\u003e [-SkipUnchanged] [-EnableException] [\u003cCommonParameters\u003e]\nExport-DbatoolsConfig -Config \u003cConfig[]\u003e [-OutPath] \u003cString\u003e [-SkipUnchanged] [-EnableException] [\u003cCommonParameters\u003e]\nExport-DbatoolsConfig -ModuleName \u003cString\u003e [-ModuleVersion \u003cInt32\u003e] [-Scope {UserDefault | UserMandatory | SystemDefault | SystemMandatory | FileUserLocal | FileUserShared | FileSystem}] [-SkipUnchanged] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaUser", "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.", "Tags": [ "User", "Export" ], "Synopsis": "Exports users creation and its permissions to a T-SQL file or host.", "Alias": "", "Author": "Claudio Silva (@ClaudioESSilva)", "CommandName": "Export-DbaUser", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbaUser", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaUser -SqlInstance sql2005 -FilePath C:\\temp\\sql2005-users.sql\nExports SQL for the users in server \"sql2005\" and writes them to the file \"C:\\temp\\sql2005-users.sql\"\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eExport-DbaUser -SqlInstance sqlserver2014a $scred -FilePath C:\\temp\\users.sql -Append\nAuthenticates to sqlserver2014a using SQL Authentication. Exports all users to C:\\temp\\users.sql, and appends to the file if it exists. If not, the file will be created.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eExport-DbaUser -SqlInstance sqlserver2014a -User User1, User2 -FilePath C:\\temp\\users.sql\nExports ONLY users User1 and User2 from sqlserver2014a to the file C:\\temp\\users.sql\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eExport-DbaUser -SqlInstance sqlserver2014a -User User1, User2 -Path C:\\temp\nExports ONLY users User1 and User2 from sqlserver2014a to the folder C:\\temp. One file per user will be generated\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eExport-DbaUser -SqlInstance sqlserver2008 -User User1 -FilePath C:\\temp\\users.sql -DestinationVersion SQLServer2016\nExports user User1 from sqlserver2008 to the file C:\\temp\\users.sql with syntax to run on SQL Server 2016\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eExport-DbaUser -SqlInstance sqlserver2008 -Database db1,db2 -FilePath C:\\temp\\users.sql\nExports ONLY users from db1 and db2 database on sqlserver2008 server, to the C:\\temp\\users.sql file.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$options = New-DbaScriptingOption\nPS C:\\\u003e $options.ScriptDrops = $false\r\nPS C:\\\u003e $options.WithDependencies = $true\r\nPS C:\\\u003e Export-DbaUser -SqlInstance sqlserver2008 -Database db1,db2 -FilePath C:\\temp\\users.sql -ScriptingOptionsObject $options\nExports ONLY users from db1 and db2 database on sqlserver2008 server, to the C:\\temp\\users.sql file.\r\nIt will not script drops but will script dependencies.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eExport-DbaUser -SqlInstance sqlserver2008 -Database db1,db2 -FilePath C:\\temp\\users.sql -ExcludeGoBatchSeparator\nExports ONLY users from db1 and db2 database on sqlserver2008 server, to the C:\\temp\\users.sql file without the \u0027GO\u0027 batch separator.\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eExport-DbaUser -SqlInstance sqlserver2008 -Database db1 -User user1 -Template -PassThru\nExports user1 from database db1, replacing loginname and username with {templateLogin} and {templateUser} correspondingly.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. SQL Server 2000 and above supported.", "", false, "true (ByValue)", "", "" ], [ "InputObject", "Allows database objects to be piped in from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all InputObject will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "User", "Export only the specified database user(s). If not specified will export all users from the database(s)", "", false, "false", "", "" ], [ "DestinationVersion", "To say to which version the script should be generated. If not specified will use database compatibility level", "", false, "false", "", "SQLServer2000,SQLServer2005,SQLServer2008/2008R2,SQLServer2012,SQLServer2014,SQLServer2016,SQLServer2017,SQLServer2019" ], [ "Path", "Specifies the directory where the file or files will be exported.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file.", "OutFile,FileName", false, "false", "", "" ], [ "Encoding", "Specifies the file encoding. The default is UTF8.\nValid values are:\r\n-- ASCII: Uses the encoding for the ASCII (7-bit) character set.\r\n-- BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order.\r\n-- Byte: Encodes a set of characters into a sequence of bytes.\r\n-- String: Uses the encoding type for a string.\r\n-- Unicode: Encodes in UTF-16 format using the little-endian byte order.\r\n-- UTF7: Encodes in UTF-7 format.\r\n-- UTF8: Encodes in UTF-8 format.\r\n-- Unknown: The encoding type is unknown or invalid. The data can be treated as binary.", "", false, "false", "UTF8", "ASCII,BigEndianUnicode,Byte,String,Unicode,UTF7,UTF8,Unknown" ], [ "NoClobber", "Do not overwrite file", "NoOverwrite", false, "false", "False", "" ], [ "Append", "Append to file", "", false, "false", "False", "" ], [ "Passthru", "Output script to console, useful with | clip", "", false, "false", "False", "" ], [ "Template", "Script user as a templated string that contains tokens {templateUser} and {templateLogin} instead of username and login", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "ScriptingOptionsObject", "A Microsoft.SqlServer.Management.Smo.ScriptingOptions object with the options that you want to use to generate the t-sql script.\r\nYou can use the NEw-DbaScriptingOption to generate it.", "", false, "false", "", "" ], [ "ExcludeGoBatchSeparator", "If specified, will NOT script the \u0027GO\u0027 batch separator.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaUser [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-User] \u003cString[]\u003e] [[-DestinationVersion] \u003cString\u003e] [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [[-Encoding] \u003cString\u003e] [-NoClobber] [-Append] [-Passthru] [-Template] [-EnableException] [[-ScriptingOptionsObject] \u003cScriptingOptions\u003e] [-ExcludeGoBatchSeparator] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaXECsv", "Description": "Exports Extended Events to a CSV file.", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Exports Extended Events to a CSV file.", "Alias": "", "Author": "Gianluca Sartori (@spaghettidba)", "CommandName": "Export-DbaXECsv", "Availability": "Windows only", "Links": "https://dbatools.io/Export-DbaXECsv", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-ChildItem -Path C:\\temp\\sample.xel | Export-DbaXECsv -Path c:\\temp\\sample.csv\nWrites Extended Events data to the file \"C:\\temp\\events.csv\".\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance sql2014 -Session deadlocks | Export-DbaXECsv -Path c:\\temp\\events.csv\nWrites Extended Events data to the file \"C:\\temp\\events.csv\".", "Params": [ [ "InputObject", "Allows Piping", "FullName", true, "true (ByValue)", "", "" ], [ "Path", "Specifies the directory where the file or files will be exported.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file.", "OutFile,FileName", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaXECsv [-InputObject] \u003cObject[]\u003e [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaXESession", "Description": "Exports script to create Extended Events Session to sql file or console.", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Exports Extended Events creation script to a T-SQL file or console.", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Export-DbaXESession", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbaXESession", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaXESession -SqlInstance sourceserver -Passthru\nExports a script to create all Extended Events Sessions on sourceserver to the console\r\nWill include prefix information containing creator and datetime. and uses the default value for BatchSeparator value from configuration Formatting.BatchSeparator\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eExport-DbaXESession -SqlInstance sourceserver\nExports a script to create all Extended Events Sessions on sourceserver. As no Path was defined - automatically determines filename based on the Path.DbatoolsExport configuration setting, current \r\ntime and server name like Servername-YYYYMMDDhhmmss-sp_configure.sql\r\nWill include prefix information containing creator and datetime. and uses the default value for BatchSeparator value from configuration Formatting.BatchSeparator\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eExport-DbaXESession -SqlInstance sourceserver -FilePath C:\\temp\nExports a script to create all Extended Events Sessions on sourceserver to the directory C:\\temp using the default name format of Servername-YYYYMMDDhhmmss-sp_configure.sql\r\nWill include prefix information containing creator and datetime. and uses the default value for BatchSeparator value from configuration Formatting.BatchSeparator\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Export-DbaXESession -SqlInstance sourceserver -SqlCredential $cred -FilePath C:\\temp\\EEvents.sql -BatchSeparator \"\" -NoPrefix -NoClobber\nExports a script to create all Extended Events Sessions on sourceserver to the file C:\\temp\\EEvents.sql.\r\nWill exclude prefix information containing creator and datetime and does not include a BatchSeparator\r\nWill not overwrite file if it already exists\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e\u0027Server1\u0027, \u0027Server2\u0027 | Export-DbaXESession -FilePath \u0027C:\\Temp\\EE.sql\u0027 -Append\nExports a script to create all Extended Events Sessions for Server1 and Server2 using pipeline.\r\nWrites to a single file using the Append switch\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance Server1, Server2 -Session system_health | Export-DbaXESession -Path \u0027C:\\Temp\u0027\nExports a script to create the System_Health Extended Events Sessions for Server1 and Server2 using pipeline.\r\nWrite to the directory C:\\temp using the default name format of Servername-YYYYMMDDhhmmss-sp_configure.sql\r\nWill include prefix information containing creator and datetime. and uses the default value for BatchSeparator value from configuration Formatting.BatchSeparator", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input.\r\nServer version must be SQL Server version 2008 or higher.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "InputObject", "A SQL Management Object - Microsoft.SqlServer.Management.XEvent.Session such as the one returned from Get-DbaSession", "", false, "true (ByValue)", "", "" ], [ "Session", "The Extended Event Session(s) to process. If unspecified, all Extended Event Sessions will be processed. This is ignored if An input object from Get-DbaSession is specified", "", false, "false", "", "" ], [ "Path", "Specifies the directory where the file or files will be exported.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FilePath", "Specifies the full file path of the output file.\r\nIf FilePath is specified and more than one Server is in input then -Append parameter is required to avoid overwriting data", "OutFile,FileName", false, "false", "", "" ], [ "Encoding", "Specifies the file encoding. The default is UTF8.\nValid values are:\r\n-- ASCII: Uses the encoding for the ASCII (7-bit) character set.\r\n-- BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order.\r\n-- Byte: Encodes a set of characters into a sequence of bytes.\r\n-- String: Uses the encoding type for a string.\r\n-- Unicode: Encodes in UTF-16 format using the little-endian byte order.\r\n-- UTF7: Encodes in UTF-7 format.\r\n-- UTF8: Encodes in UTF-8 format.\r\n-- Unknown: The encoding type is unknown or invalid. The data can be treated as binary.", "", false, "false", "UTF8", "ASCII,BigEndianUnicode,Byte,String,Unicode,UTF7,UTF8,Unknown" ], [ "Passthru", "Output script to console", "", false, "false", "False", "" ], [ "BatchSeparator", "Batch separator for scripting output. Uses the value from configuration Formatting.BatchSeparator by default. This is normally \"GO\"", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Formatting.BatchSeparator\u0027)", "" ], [ "NoPrefix", "If this switch is used, the scripts will not include prefix information containing creator and datetime.", "", false, "false", "False", "" ], [ "NoClobber", "Do not overwrite file. Only required if FilePath is specified", "", false, "false", "False", "" ], [ "Append", "Append to file. Only required if FilePath is specified", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaXESession [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-InputObject] \u003cSession[]\u003e] [[-Session] \u003cString[]\u003e] [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [[-Encoding] \u003cString\u003e] [-Passthru] [[-BatchSeparator] \u003cString\u003e] [-NoPrefix] [-NoClobber] [-Append] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Export-DbaXESessionTemplate", "Description": "Exports an XESession XML Template either from the Target SQL Server or XE Session(s) output by Get-DbaXESession. Exports to \"$home\\Documents\\SQL Server Management Studio\\Templates\\XEventTemplates\" by default", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Exports an XESession XML Template using XE Session(s) output by Get-DbaXESession", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Export-DbaXESessionTemplate", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Export-DbaXESessionTemplate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eExport-DbaXESessionTemplate -SqlInstance sql2017 -Path C:\\temp\\xe\nExports an XESession XML Template for all Extended Event Sessions on sql2017 to the C:\\temp\\xe folder.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance sql2017 -Session system_health | Export-DbaXESessionTemplate -Path C:\\temp\\xe\nGets the system_health Extended Events Session from sql2017 and then exports as an XESession XML Template to C:\\temp\\xe", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Session", "The Name of the session(s) to export.", "", false, "false", "", "" ], [ "Path", "Specifies the directory where the file or files will be exported.", "", false, "false", "\"$home\\Documents\\SQL Server Management Studio\\Templates\\XEventTemplates\"", "" ], [ "FilePath", "Specifies the full file path of the output file.", "OutFile,FileName", false, "false", "", "" ], [ "InputObject", "Specifies an XE Session output by Get-DbaXESession.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Export-DbaXESessionTemplate [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Session] \u003cObject[]\u003e] [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [[-InputObject] \u003cSession[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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": [ "Agent", "Job" ], "Synopsis": "Find-DbaAgentJob finds agent jobs that fit certain search filters.", "Alias": "", "Author": "Stephen Bennett (https://sqlnotesfromtheunderground.wordpress.com/)", "CommandName": "Find-DbaAgentJob", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaAgentJob", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaAgentJob -SqlInstance Dev01 -JobName *backup*\nReturns all agent job(s) that have backup in the name\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaAgentJob -SqlInstance Dev01, Dev02 -JobName Mybackup\nReturns all agent job(s) that are named exactly Mybackup\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaAgentJob -SqlInstance Dev01 -LastUsed 10\nReturns all agent job(s) that have not ran in 10 days\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eFind-DbaAgentJob -SqlInstance Dev01 -IsDisabled -IsNoEmailNotification -IsNotScheduled\nReturns all agent job(s) that are either disabled, have no email notification or don\u0027t have a schedule. returned with detail\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$servers | Find-DbaAgentJob -IsFailed | Start-DbaAgentJob\nFinds all failed job then starts them. Consider using a -WhatIf at the end of Start-DbaAgentJob to see what it\u0027ll do first\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eFind-DbaAgentJob -SqlInstance Dev01 -LastUsed 10 -Exclude \"Yearly - RollUp Workload\", \"SMS - Notification\"\nReturns all agent jobs that have not ran in the last 10 days ignoring jobs \"Yearly - RollUp Workload\" and \"SMS - Notification\"\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eFind-DbaAgentJob -SqlInstance Dev01 -Category \"REPL-Distribution\", \"REPL-Snapshot\" | Format-Table -AutoSize -Wrap\nReturns all job/s on Dev01 that are in either category \"REPL-Distribution\" or \"REPL-Snapshot\"\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eFind-DbaAgentJob -SqlInstance Dev01, Dev02 -IsFailed -Since \u00272016-07-01 10:47:00\u0027\nReturns all agent job(s) on Dev01 and Dev02 that have failed since July of 2016 (and still have history in msdb)\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance CMSServer -Group Production | Find-DbaAgentJob -Disabled -IsNotScheduled | Format-Table -AutoSize -Wrap\nQueries CMS server to return all SQL instances in the Production folder and then list out all agent jobs that have either been disabled or have no schedule.\n-------------------------- EXAMPLE 10 --------------------------\nPS C:\\\u003e$Instances = \u0027SQL2017N5\u0027,\u0027SQL2019N5\u0027,\u0027SQL2019N20\u0027,\u0027SQL2019N21\u0027,\u0027SQL2019N22\u0027\nFind-DbaAgentJob -SqlInstance $Instances -JobName *backup* -IsNotScheduled\nReturns all agent job(s) wiht backup in the name, that don\u0027t have a schedule on \u0027SQL2017N5\u0027,\u0027SQL2019N5\u0027,\u0027SQL2019N20\u0027,\u0027SQL2019N21\u0027,\u0027SQL2019N22\u0027", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "JobName", "Filter agent jobs to only the name(s) you list.\r\nSupports regular expression (e.g. MyJob*) being passed in.", "Name", false, "false", "", "" ], [ "ExcludeJobName", "Allows you to enter an array of agent job names to ignore", "", false, "false", "", "" ], [ "StepName", "Filter based on StepName.\r\nSupports regular expression (e.g. MyJob*) being passed in.", "", false, "false", "", "" ], [ "LastUsed", "Find all jobs that haven\u0027t ran in the INT number of previous day(s)", "", false, "false", "0", "" ], [ "IsDisabled", "Find all jobs that are disabled", "Disabled", false, "false", "False", "" ], [ "IsFailed", "Find all jobs that have failed", "Failed", false, "false", "False", "" ], [ "IsNotScheduled", "Find all jobs with no schedule assigned", "NoSchedule", false, "false", "False", "" ], [ "IsNoEmailNotification", "Find all jobs without email notification configured", "NoEmailNotification", false, "false", "False", "" ], [ "Category", "Filter based on agent job categories", "", false, "false", "", "" ], [ "Owner", "Filter based on owner of the job/s", "", false, "false", "", "" ], [ "Since", "Datetime object used to narrow the results to a date", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Find-DbaAgentJob [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-JobName] \u003cString[]\u003e] [[-ExcludeJobName] \u003cString[]\u003e] [[-StepName] \u003cString[]\u003e] [[-LastUsed] \u003cInt32\u003e] [-IsDisabled] [-IsFailed] [-IsNotScheduled] [-IsNoEmailNotification] [[-Category] \u003cString[]\u003e] [[-Owner] \u003cString\u003e] [[-Since] \u003cDateTime\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Find-DbaBackup", "Description": "Provides all of the same functionality for finding SQL backups to remove 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 backups have been archived to your archive location before removal.", "Tags": "Backup", "Synopsis": "Finds SQL Server backups on disk.", "Alias": "", "Author": "Chris Sommer (@cjsommer), www.cjsommer.com", "CommandName": "Find-DbaBackup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaBackup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaBackup -Path \u0027C:\\MSSQL\\SQL Backup\\\u0027 -BackupFileExtension trn -RetentionPeriod 48h\nSearches for all trn files in C:\\MSSQL\\SQL Backup\\ and all subdirectories that are more than 48 hours old will be included.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaBackup -Path \u0027C:\\MSSQL\\Backup\\\u0027 -BackupFileExtension bak -RetentionPeriod 7d -CheckArchiveBit\nSearches for all bak files in C:\\MSSQL\\Backup\\ and all subdirectories that are more than 7 days old will be included, but only if the files have been backed up to another location as verified by \r\nchecking the Archive bit.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaBackup -Path \u0027\\\\SQL2014\\Backup\\\u0027 -BackupFileExtension bak -RetentionPeriod 24h | Remove-Item -Verbose\nSearches for all bak files in \\\\SQL2014\\Backup\\ and all subdirectories that are more than 24 hours old and deletes only those files with verbose message.", "Params": [ [ "Path", "Specifies the name of the base level folder to search for backup files.", "BackupFolder", true, "false", "", "" ], [ "BackupFileExtension", "Specifies the filename extension of the backup files you wish to find (typically \u0027bak\u0027, \u0027trn\u0027 or \u0027log\u0027). Do not include the period.", "", true, "false", "", "" ], [ "RetentionPeriod", "Specifies the retention period for backup files. Correct format is ##U.\n## is the retention value and must be an integer value\r\nU signifies the units where the valid units are:\r\nh = hours\r\nd = days\r\nw = weeks\r\nm = months\nFormatting Examples:\r\n\u002748h\u0027 = 48 hours\r\n\u00277d\u0027 = 7 days\r\n\u00274w\u0027 = 4 weeks\r\n\u00271m\u0027 = 1 month", "", true, "false", "", "" ], [ "CheckArchiveBit", "If this switch is enabled, the filesystem Archive bit is checked.\r\nIf this bit is set (which translates to \"it has not been backed up to another location yet\"), the file won\u0027t be included.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Find-DbaBackup [-Path] \u003cString\u003e [-BackupFileExtension] \u003cString\u003e [-RetentionPeriod] \u003cString\u003e [-CheckArchiveBit] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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": [ "Module", "Find" ], "Synopsis": "Finds dbatools commands searching through the inline help text", "Alias": "", "Author": "Simone Bizzotto (@niphlod)", "CommandName": "Find-DbaCommand", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaCommand", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaCommand \"snapshot\"\nFor lazy typers: finds all commands searching the entire help for \"snapshot\"\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaCommand -Pattern \"snapshot\"\nFor rigorous typers: finds all commands searching the entire help for \"snapshot\"\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaCommand -Tag Job\nFinds all commands tagged with \"Job\"\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eFind-DbaCommand -Tag Job,Owner\nFinds all commands tagged with BOTH \"Job\" and \"Owner\"\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eFind-DbaCommand -Author Chrissy\nFinds every command whose author contains our beloved \"Chrissy\"\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eFind-DbaCommand -Author Chrissy -Tag AG\nFinds every command whose author contains our beloved \"Chrissy\" and it tagged as \"AG\"\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eFind-DbaCommand -Pattern snapshot -Rebuild\nFinds all commands searching the entire help for \"snapshot\", rebuilding the index (good for developers)", "Params": [ [ "Pattern", "Searches help for all commands in dbatools for the specified pattern and displays all results", "", false, "false", "", "" ], [ "Tag", "Finds all commands tagged with this auto-populated tag", "", false, "false", "", "" ], [ "Author", "Finds all commands tagged with this author", "", false, "false", "", "" ], [ "MinimumVersion", "Finds all commands tagged with this auto-populated minimum version", "", false, "false", "", "" ], [ "MaximumVersion", "Finds all commands tagged with this auto-populated maximum version", "", false, "false", "", "" ], [ "Rebuild", "Rebuilds the index", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Displays what would happen if the command is run", "wi", false, "false", "", "" ], [ "Confirm", "Confirms overwrite of index", "cf", false, "false", "", "" ] ], "Syntax": "Find-DbaCommand [[-Pattern] \u003cString\u003e] [[-Tag] \u003cString[]\u003e] [[-Author] \u003cString\u003e] [[-MinimumVersion] \u003cString\u003e] [[-MaximumVersion] \u003cString\u003e] [-Rebuild] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "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": "Database", "Synopsis": "Find database/s on multiple servers that match criteria you input", "Alias": "", "Author": "Stephen Bennett, https://sqlnotesfromtheunderground.wordpress.com/", "CommandName": "Find-DbaDatabase", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaDatabase", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaDatabase -SqlInstance \"DEV01\", \"DEV02\", \"UAT01\", \"UAT02\", \"PROD01\", \"PROD02\" -Pattern Report\nReturns all database from the SqlInstances that have a database with Report in the name\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaDatabase -SqlInstance \"DEV01\", \"DEV02\", \"UAT01\", \"UAT02\", \"PROD01\", \"PROD02\" -Pattern TestDB -Exact | Select-Object *\nReturns all database from the SqlInstances that have a database named TestDB with a detailed output.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaDatabase -SqlInstance \"DEV01\", \"DEV02\", \"UAT01\", \"UAT02\", \"PROD01\", \"PROD02\" -Property ServiceBrokerGuid -Pattern \u0027-faeb-495a-9898-f25a782835f5\u0027 | Select-Object *\nReturns all database from the SqlInstances that have the same Service Broker GUID with a detailed output", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Property", "What you would like to search on. Either Database Name, Owner, or Service Broker GUID. Database name is the default.", "", false, "false", "Name", "Name,ServiceBrokerGuid,Owner" ], [ "Pattern", "Value that is searched for. This is a regular expression match but you can just use a plain ol string like \u0027dbareports\u0027", "", true, "false", "", "" ], [ "Exact", "Search for an exact match instead of a pattern", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Find-DbaDatabase [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Property] \u003cString\u003e] [-Pattern] \u003cString\u003e [-Exact] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Find-DbaDbDisabledIndex", "Description": "This command will help you to find disabled indexes on a database or a list of databases.", "Tags": "Index", "Synopsis": "Find Disabled indexes", "Alias": "", "Author": "Jason Squires, sqlnotnull.com", "CommandName": "Find-DbaDbDisabledIndex", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaDbDisabledIndex", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaDbDisabledIndex -SqlInstance sql2005\nGenerates the SQL statements to drop the selected disabled indexes on server \"sql2005\".\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaDbDisabledIndex -SqlInstance sqlserver2016 -SqlCredential $cred\nGenerates the SQL statements to drop the selected disabled indexes on server \"sqlserver2016\", using SQL Authentication to connect to the database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaDbDisabledIndex -SqlInstance sqlserver2016 -Database db1, db2\nGenerates the SQL Statement to drop selected indexes in databases db1 \u0026 db2 on server \"sqlserver2016\".\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eFind-DbaDbDisabledIndex -SqlInstance sqlserver2016\nGenerates the SQL statements to drop selected indexes on all user databases.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "NoClobber", "If this switch is enabled, the output file will not be overwritten.", "", false, "false", "False", "" ], [ "Append", "If this switch is enabled, content will be appended to the output file.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Find-DbaDbDisabledIndex [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-NoClobber] [-Append] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Find-DbaDbDuplicateIndex", "Description": "This command will help you to find duplicate and overlapping indexes on a database or a list of databases.\n\nOn SQL Server 2008 and higher, the IsFiltered property will also be checked\n\nOnly supports CLUSTERED and NONCLUSTERED indexes.\n\nOutput:\nTableName\nIndexName\nKeyColumns\nIncludedColumns\nIndexSizeMB\nIndexType\nCompressionDescription (When 2008+)\n[RowCount]\nIsDisabled\nIsFiltered (When 2008+)", "Tags": "Index", "Synopsis": "Find duplicate and overlapping indexes.", "Alias": "", "Author": "Claudio Silva (@ClaudioESSilva)", "CommandName": "Find-DbaDbDuplicateIndex", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaDbDuplicateIndex", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaDbDuplicateIndex -SqlInstance sql2005\nReturns duplicate indexes found on sql2005\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaDbDuplicateIndex -SqlInstance sql2017 -SqlCredential sqladmin\nFinds exact duplicate indexes on all user databases present on sql2017, using SQL authentication.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaDbDuplicateIndex -SqlInstance sql2017 -Database db1, db2\nFinds exact duplicate indexes on the db1 and db2 databases.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eFind-DbaDbDuplicateIndex -SqlInstance sql2017 -IncludeOverlapping\nFinds both duplicate and overlapping indexes on all user databases.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "IncludeOverlapping", "If this switch is enabled, indexes which are partially duplicated will be returned.\nExample: If the first key column is the same between two indexes, but one has included columns and the other not, this will be shown.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Find-DbaDbDuplicateIndex [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [-IncludeOverlapping] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Find-DbaDbGrowthEvent", "Description": "Finds any database AutoGrow events in the Default Trace.\n\nThe following events are included:\n92 - Data File Auto Grow\n93 - Log File Auto Grow\n94 - Data File Auto Shrink\n95 - Log File Auto Shrink", "Tags": [ "AutoGrow", "Growth", "Database" ], "Synopsis": "Finds any database AutoGrow events in the Default Trace.", "Alias": "", "Author": "Aaron Nelson", "CommandName": "Find-DbaDbGrowthEvent", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaDbGrowthEvent", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaDbGrowthEvent -SqlInstance localhost\nReturns any database AutoGrow events in the Default Trace with UTC time for the instance for every database on the localhost instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaDbGrowthEvent -SqlInstance localhost -UseLocalTime\nReturns any database AutoGrow events in the Default Trace with the local time of the instance for every database on the localhost instance.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaDbGrowthEvent -SqlInstance ServerA\\SQL2016, ServerA\\SQL2014\nReturns any database AutoGrow events in the Default Traces for every database on ServerA\\sql2016 \u0026 ServerA\\SQL2014.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eFind-DbaDbGrowthEvent -SqlInstance ServerA\\SQL2016 | Format-Table -AutoSize -Wrap\nReturns any database AutoGrow events in the Default Trace for every database on the ServerA\\SQL2016 instance in a table format.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eFind-DbaDbGrowthEvent -SqlInstance ServerA\\SQL2016 -EventType Shrink\nReturns any database Auto Shrink events in the Default Trace for every database on the ServerA\\SQL2016 instance.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eFind-DbaDbGrowthEvent -SqlInstance ServerA\\SQL2016 -EventType Growth -FileType Data\nReturns any database Auto Growth events on data files in the Default Trace for every database on the ServerA\\SQL2016 instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "EventType", "Provide a filter on growth event type to filter the results.\nAllowed values: Growth, Shrink", "", false, "false", "", "Growth,Shrink" ], [ "FileType", "Provide a filter on file type to filter the results.\nAllowed values: Data, Log", "", false, "false", "", "Data,Log" ], [ "UseLocalTime", "Return the local time of the instance instead of converting to UTC.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Find-DbaDbGrowthEvent [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-EventType] \u003cString\u003e] [[-FileType] \u003cString\u003e] [-UseLocalTime] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Find-DbaDbUnusedIndex", "Description": "This command will help you to find Unused indexes on a database or a list of databases\n\nFor now only supported for CLUSTERED and NONCLUSTERED indexes", "Tags": "Index", "Synopsis": "Find unused indexes", "Alias": "", "Author": "Aaron Nelson (@SQLvariant), SQLvariant.com", "CommandName": "Find-DbaDbUnusedIndex", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaDbUnusedIndex", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaDbUnusedIndex -SqlInstance sql2016 -Database db1, db2\nFinds unused indexes on db1 and db2 on sql2016\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaDbUnusedIndex -SqlInstance sql2016 -SqlCredential $cred\nFinds unused indexes on db1 and db2 on sql2016 using SQL Authentication to connect to the server\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2016 | Find-DbaDbUnusedIndex\nFinds unused indexes on all databases on sql2016\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2019 | Find-DbaDbUnusedIndex -Seeks 10 -Scans 100 -Lookups 1000\nFinds \u0027unused\u0027 indexes with user_seeks \u003c 10, user_scans \u003c 100, and user_lookups \u003c 1000 on all databases on sql2019.\r\nNote that these additional parameters provide flexibility to define what is considered an \u0027unused\u0027 index.", "Params": [ [ "SqlInstance", "The SQL Server you want to check for unused indexes.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "IgnoreUptime", "Less than 7 days uptime can mean that analysis of unused indexes is unreliable, and normally no results will be returned. By setting this option results will be returned even if the Instance has been \r\nrunning for less than 7 days.", "", false, "false", "False", "" ], [ "Seeks", "Specify a custom threshold for user seeks. The default for this parameter is 1.\r\nThe valid values are between 1 and 1000000 to provide flexibility on the definition of \u0027unused\u0027 indexes.\r\nNote: The resulting WHERE clause uses the AND operator:\r\nuser_seeks \u003c $Seeks\r\nAND user_scans \u003c $Scans\r\nAND user_lookups \u003c $Lookups", "", false, "false", "1", "" ], [ "Scans", "Specify a custom threshold for user scans. The default for this parameter is 1.\r\nThe valid values are between 1 and 1000000 to provide flexibility on the definition of \u0027unused\u0027 indexes.\r\nNote: The resulting WHERE clause uses the AND operator:\r\nuser_seeks \u003c $Seeks\r\nAND user_scans \u003c $Scans\r\nAND user_lookups \u003c $Lookups", "", false, "false", "1", "" ], [ "Lookups", "Specify a custom threshold for user lookups. The default for this parameter is 1.\r\nThe valid values are between 1 and 1000000 to provide flexibility on the definition of \u0027unused\u0027 indexes.\r\nNote: The resulting WHERE clause uses the AND operator:\r\nuser_seeks \u003c $Seeks\r\nAND user_scans \u003c $Scans\r\nAND user_lookups \u003c $Lookups", "", false, "false", "1", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Find-DbaDbUnusedIndex [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-IgnoreUptime] [[-Seeks] \u003cInt32\u003e] [[-Scans] \u003cInt32\u003e] [[-Lookups] \u003cInt32\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Find-DbaInstance", "Description": "This function searches for SQL Server Instances.\n\nIt supports a variety of scans for this purpose which can be separated in two categories:\n- Discovery\n- Scan\n\nDiscovery:\nThis is where it compiles a list of computers / addresses to check.\nIt supports several methods of generating such lists (including Active Directory lookup or IP Ranges), but also supports specifying a list of computers to check.\n- For details on discovery, see the documentation on the \u0027-DiscoveryType\u0027 parameter\n- For details on explicitly providing a list, see the documentation on the \u0027-ComputerName\u0027 parameter\n\nScan:\nOnce a list of computers has been provided, this command will execute a variety of actions to determine any instances present for each of them.\nThis is described in more detail in the documentation on the \u0027-ScanType\u0027 parameter.\nAdditional parameters allow more granular control over individual scans (e.g. Credentials to use).\n\nNote on logging and auditing:\nThe Discovery phase is un-problematic since it is non-intrusive, however during the scan phase, all targeted computers may be accessed repeatedly.\nThis may cause issues with security teams, due to many logon events and possibly failed authentication.\nThis action constitutes a network scan, which may be illegal depending on the nation you are in and whether you own the network you scan.\nIf you are unsure whether you may use this command in your environment, check the detailed description on the \u0027-ScanType\u0027 parameter and contact your IT security team for advice.", "Tags": [ "Instance", "Connect", "SqlServer" ], "Synopsis": "Search for SQL Server Instances.", "Alias": "", "Author": "Scott Sutherland, 2018 NetSPI | Friedrich Weinmann (@FredWeinmann)", "CommandName": "Find-DbaInstance", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaInstance", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaInstance -DiscoveryType Domain, DataSourceEnumeration\nPerforms a network search for SQL Instances by:\r\n- Looking up the Service Principal Names of computers in Active Directory\r\n- Using the UDP broadcast based auto-discovery of SSMS\r\nAfter that it will extensively scan all hosts thus discovered for instances.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaInstance -DiscoveryType All\nPerforms a network search for SQL Instances, using all discovery protocols:\r\n- Active directory search for Service Principal Names\r\n- SQL Instance Enumeration (same as SSMS does)\r\n- All IPAddresses in the current computer\u0027s subnets of all connected network interfaces\r\nNote: This scan will take a long time, due to including the IP Scan\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-ADComputer -Filter \"*\" | Find-DbaInstance\nScans all computers in the domain for SQL Instances, using a deep probe:\r\n- Tries resolving the name in DNS\r\n- Tries pinging the computer\r\n- Tries listing all SQL Services using CIM/WMI\r\n- Tries discovering all instances via the browser service\r\n- Tries connecting to the default TCP Port (1433)\r\n- Tries connecting to the TCP port of each discovered instance\r\n- Tries to establish a SQL connection to the server using default windows credentials\r\n- Tries looking up the Service Principal Names for each instance\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-Content .\\servers.txt | Find-DbaInstance -SqlCredential $cred -ScanType Browser, SqlConnect\nReads all servers from the servers.txt file (one server per line),\r\nthen scans each of them for instances using the browser service\r\nand finally attempts to connect to each instance found using the specified credentials.\r\nthen scans each of them for instances using the browser service and SqlService\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eFind-DbaInstance -ComputerName localhost | Get-DbaDatabase | Format-Table -Wrap\nScans localhost for instances using the browser service, traverses all instances for all databases and displays all information in a formatted table.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$databases = Find-DbaInstance -ComputerName localhost | Get-DbaDatabase\nPS C:\\\u003e $results = $databases | Select-Object SqlInstance, Name, Status, RecoveryModel, SizeMB, Compatibility, Owner, LastFullBackup, LastDiffBackup, LastLogBackup\r\nPS C:\\\u003e $results | Format-Table -Wrap\nScans localhost for instances using the browser service, traverses all instances for all databases and displays a subset of the important information in a formatted table.\nUsing this method regularly is not recommended. Use Get-DbaService or Get-DbaRegServer instead.", "Params": [ [ "ComputerName", "The computer to scan. Can be a variety of input types, including text or the output of Get-ADComputer.\r\nAny extra instance information (such as connection strings or live sql server connections) beyond the computername will be discarded.", "", true, "true (ByValue)", "", "" ], [ "DiscoveryType", "The mechanisms to be used to discover instances.\r\nSupports any combination of:\r\n- Service Principal Name lookup (\u0027DomainSPN\u0027; from Active Directory)\r\n- SQL Instance Enumeration (\u0027DataSourceEnumeration\u0027; same as SSMS uses)\r\n- IP Address range (\u0027IPRange\u0027; all IP Addresses will be scanned)\r\n- Domain Server lookup (\u0027DomainServer\u0027; from Active Directory)\nSPN Lookup:\r\nThe function tries to connect active directory to look up all computers with registered SQL Instances.\r\nNot all instances need to be registered properly, making this not 100% reliable.\r\nBy default, your nearest Domain Controller is contacted for this scan.\r\nHowever it is possible to explicitly state the DC to contact using its DistinguishedName and the \u0027-DomainController\u0027 parameter.\r\nIf credentials were specified using the \u0027-Credential\u0027 parameter, those same credentials are used to perform this lookup, allowing the scan of other domains.\nSQL Instance Enumeration:\r\nThis uses the default UDP Broadcast based instance enumeration used by SSMS to detect instances.\r\nNote that the result from this is not used in the actual scan, but only to compile a list of computers to scan.\r\nTo enable the same results for the scan, ensure that the \u0027Browser\u0027 scan is enabled.\nIP Address range:\r\nThis \u0027Discovery\u0027 uses a range of IPAddresses and simply passes them on to be tested.\r\nSee the \u0027Description\u0027 part of help on security issues of network scanning.\r\nBy default, it will enumerate all ethernet network adapters on the local computer and scan the entire subnet they are on.\r\nBy using the \u0027-IpAddress\u0027 parameter, custom network ranges can be specified.\nDomain Server:\r\nThis will discover every single computer in Active Directory that is a Windows Server and enabled.\r\nBy default, your nearest Domain Controller is contacted for this scan.\r\nHowever it is possible to explicitly state the DC to contact using its DistinguishedName and the \u0027-DomainController\u0027 parameter.\r\nIf credentials were specified using the \u0027-Credential\u0027 parameter, those same credentials are used to perform this lookup, allowing the scan of other domains.", "", true, "false", "", "" ], [ "Credential", "The credentials to use on windows network connection.\r\nThese credentials are used for:\r\n- Contact to domain controllers for SPN lookups (only if explicit Domain Controller is specified)\r\n- CIM/WMI contact to the scanned computers during the scan phase (see the \u0027-ScanType\u0027 parameter documentation on affected scans).", "", false, "false", "", "" ], [ "SqlCredential", "The credentials used to connect to SqlInstances to during the scan phase.\r\nSee the \u0027-ScanType\u0027 parameter documentation on affected scans.", "", false, "false", "", "" ], [ "ScanType", "The scans are the individual methods used to retrieve information about the scanned computer and any potentially installed instances.\r\nThis parameter is optional, by default all scans except for establishing an actual SQL connection are performed.\r\nScans can be specified in any arbitrary combination, however at least one instance detecting scan needs to be specified in order for data to be returned.\nScans:\r\n Browser\r\n- Tries discovering all instances via the browser service\r\n- This scan detects instances.\nSQLService\r\n- Tries listing all SQL Services using CIM/WMI\r\n- This scan uses credentials specified in the \u0027-Credential\u0027 parameter if any.\r\n- This scan detects instances.\r\n- Success in this scan guarantees high confidence (See parameter \u0027-MinimumConfidence\u0027 for details).\nSPN\r\n- Tries looking up the Service Principal Names for each instance\r\n- Will use the nearest Domain Controller by default\r\n- Target a specific domain controller using the \u0027-DomainController\u0027 parameter\r\n- If using the \u0027-DomainController\u0027 parameter, use the \u0027-Credential\u0027 parameter to specify the credentials used to connect\nTCPPort\r\n- Tries connecting to the TCP Ports.\r\n- By default, port 1433 is connected to.\r\n- The parameter \u0027-TCPPort\u0027 can be used to provide a list of port numbers to scan.\r\n- This scan detects possible instances. Since other services might bind to a given port, this is not the most reliable test.\r\n- This scan is also used to validate found SPNs if both scans are used in combination\nDNSResolve\r\n- Tries resolving the computername in DNS\nPing\r\n- Tries pinging the computer. Failure will NOT terminate scans.\nSqlConnect\r\n- Tries to establish a SQL connection to the server\r\n- Uses windows credentials by default\r\n- Specify custom credentials using the \u0027-SqlCredential\u0027 parameter\r\n- This scan is not used by default\r\n- Success in this scan guarantees high confidence (See parameter \u0027-MinimumConfidence\u0027 for details).\nAll\r\n- All of the above", "", false, "false", "Default", "Default,SQLService,Browser,TCPPort,All,SPN,Ping,SqlConnect,DNSResolve" ], [ "IpAddress", "This parameter can be used to override the defaults for the IPRange discovery.\r\nThis parameter accepts a list of strings supporting any combination of:\r\n- Plain IP Addresses (e.g.: \"10.1.1.1\")\r\n- IP Address Ranges (e.g.: \"10.1.1.1-10.1.1.5\")\r\n- IP Address \u0026 Subnet Mask (e.g.: \"10.1.1.1/255.255.255.0\")\r\n- IP Address \u0026 Subnet Length: (e.g.: \"10.1.1.1/24)\r\nOverlapping addresses will not result in duplicate scans.", "", false, "false", "", "" ], [ "DomainController", "The domain controller to contact for SPN lookups / searches.\r\nUses the credentials from the \u0027-Credential\u0027 parameter if specified.", "", false, "false", "", "" ], [ "TCPPort", "The ports to scan in the TCP Port Scan method.\r\nDefaults to 1433.", "", false, "false", "1433", "" ], [ "MinimumConfidence", "This command tries to discover instances, which isn\u0027t always a sure thing.\r\nDepending on the number and type of scans completed, we have different levels of confidence in our results.\r\nBy default, we will return anything that we have at least a low confidence of being an instance.\r\nThese are the confidence levels we support and how they are determined:\r\n- High: Established SQL Connection (including rejection for bad credentials) or service scan.\r\n- Medium: Browser reply or a combination of TCPConnect _and_ SPN test.\r\n- Low: Either TCPConnect _or_ SPN\r\n- None: Computer existence could be verified, but no sign of an SQL Instance", "", false, "false", "Low", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Find-DbaInstance [-Credential \u003cPSCredential\u003e] [-SqlCredential \u003cPSCredential\u003e] [-ScanType {TCPPort | SqlConnect | SqlService | DNSResolve | SPN | Browser | Ping | Default | All}] [-DomainController \u003cString\u003e] [-TCPPort \u003cInt32[]\u003e] [-MinimumConfidence {None | Low | Medium | High}] [-EnableException] [\u003cCommonParameters\u003e]\nFind-DbaInstance -ComputerName \u003cDbaInstanceParameter[]\u003e [-Credential \u003cPSCredential\u003e] [-SqlCredential \u003cPSCredential\u003e] [-ScanType {TCPPort | SqlConnect | SqlService | DNSResolve | SPN | Browser | Ping | Default | All}] [-DomainController \u003cString\u003e] [-TCPPort \u003cInt32[]\u003e] [-MinimumConfidence {None | Low | Medium | High}] [-EnableException] [\u003cCommonParameters\u003e]\nFind-DbaInstance -DiscoveryType {IPRange | DomainSPN | Domain | DataSourceEnumeration | DomainServer | All} [-Credential \u003cPSCredential\u003e] [-SqlCredential \u003cPSCredential\u003e] [-ScanType {TCPPort | SqlConnect | SqlService | DNSResolve | SPN | Browser | Ping | Default | All}] [-IpAddress \u003cString[]\u003e] [-DomainController \u003cString\u003e] [-TCPPort \u003cInt32[]\u003e] [-MinimumConfidence {None | Low | Medium | High}] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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", "Tags": [ "Login", "Group", "Security" ], "Synopsis": "Finds Logins in Active Directory groups that have logins on the SQL Instance.", "Alias": "", "Author": "Stephen Bennett, https://sqlnotesfromtheunderground.wordpress.com/ | Simone Bizzotto (@niphlod)", "CommandName": "Find-DbaLoginInGroup", "Availability": "Windows only", "Links": "https://dbatools.io/Find-DbaLoginInGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaLoginInGroup -SqlInstance DEV01 -Login \"MyDomain\\Stephen.Bennett\"\nReturns all active directory groups with logins on Sql Instance DEV01 that contain the AD user Stephen.Bennett.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaLoginInGroup -SqlInstance DEV01\nReturns all active directory users within all windows AD groups that have logins on the instance.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaLoginInGroup -SqlInstance DEV01 | Where-Object Login -like \u0027*stephen*\u0027\nReturns all active directory users within all windows AD groups that have logins on the instance whose login contains \"stephen\"", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "PSCredential object to connect under. If not specified, current Windows login will be used.", "", false, "false", "", "" ], [ "Login", "Find all AD Groups used on the instance that an individual login is a member of.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Find-DbaLoginInGroup [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Login] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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\nYou can specify additional filetypes using the -FileType parameter, and additional paths to search using the -Path parameter.", "Tags": [ "Orphan", "Database", "DatabaseFile" ], "Synopsis": "Find-DbaOrphanedFile finds orphaned database files. Orphaned database files are files not associated with any attached database.", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Find-DbaOrphanedFile", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaOrphanedFile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaOrphanedFile -SqlInstance sqlserver2014a\nConnects to sqlserver2014a, authenticating with Windows credentials, and searches for orphaned files. Returns server name, local filename, and unc path to file.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaOrphanedFile -SqlInstance sqlserver2014a -SqlCredential $cred\nConnects to sqlserver2014a, authenticating with SQL Server authentication, and searches for orphaned files. Returns server name, local filename, and unc path to file.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaOrphanedFile -SqlInstance sql2014 -Path \u0027E:\\Dir1\u0027, \u0027E:\\Dir2\u0027\nFinds the orphaned files in \"E:\\Dir1\" and \"E:Dir2\" in addition to the default directories.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eFind-DbaOrphanedFile -SqlInstance sql2014 -Path \u0027E:\\Dir1\u0027 -Recurse\nFinds the orphaned files in \"E:\\Dir1\" and any of its subdirectories in addition to the default directories.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eFind-DbaOrphanedFile -SqlInstance sql2014 -LocalOnly\nReturns only the local file paths for orphaned files.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eFind-DbaOrphanedFile -SqlInstance sql2014 -RemoteOnly\nReturns only the remote file path for orphaned files.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eFind-DbaOrphanedFile -SqlInstance sql2014, sql2016 -FileType fsf, mld\nFinds the orphaned ending with \".fsf\" and \".mld\" in addition to the default filetypes \".mdf\", \".ldf\", \".ndf\" for both the servers sql2014 and sql2016.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Path", "Specifies one or more directories to search in addition to the default data and log directories.", "", false, "false", "", "" ], [ "FileType", "Specifies file extensions other than mdf, ldf and ndf to search for. Do not include the dot (\".\") when specifying the extension.", "", false, "false", "", "" ], [ "LocalOnly", "If this switch is enabled, only local filenames will be returned. Using this switch with multiple servers is not recommended since it does not return the associated server name.", "", false, "false", "False", "" ], [ "RemoteOnly", "If this switch is enabled, only remote filenames will be returned.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "Recurse", "If this switch is enabled, the command will search subdirectories of the Path parameter.", "", false, "false", "False", "" ] ], "Syntax": "Find-DbaOrphanedFile -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Path \u003cString[]\u003e] [-FileType \u003cString[]\u003e] [-LocalOnly] [-EnableException] [-Recurse] [\u003cCommonParameters\u003e]\nFind-DbaOrphanedFile -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Path \u003cString[]\u003e] [-FileType \u003cString[]\u003e] [-RemoteOnly] [-EnableException] [-Recurse] [\u003cCommonParameters\u003e]" }, { "Name": "Find-DbaSimilarTable", "Description": "This function can either run against specific databases or all databases searching all/specific tables and views including in system databases.\nTypically one would use this to find for example archive version(s) of a table whose structures are similar.\nThis can also be used to find tables/views that are very similar to a given table/view structure to see where a table/view might be used.\n\nMore information can be found here: https://sqljana.wordpress.com/2017/03/31/sql-server-find-tables-with-similar-table-structure/", "Tags": "Table", "Synopsis": "Returns all tables/views that are similar in structure by comparing the column names of matching and matched tables/views", "Alias": "", "Author": "Jana Sattainathan (@SQLJana), http://sqljana.wordpress.com", "CommandName": "Find-DbaSimilarTable", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaSimilarTable", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaSimilarTable -SqlInstance DEV01\nSearches all user database tables and views for each, returns all tables or views with their matching tables/views and match percent\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaSimilarTable -SqlInstance DEV01 -Database AdventureWorks\nSearches AdventureWorks database and lists tables/views and their corresponding matching tables/views with match percent\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaSimilarTable -SqlInstance DEV01 -Database AdventureWorks -SchemaName HumanResource\nSearches AdventureWorks database and lists tables/views in the HumanResource schema with their corresponding matching tables/views with match percent\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eFind-DbaSimilarTable -SqlInstance DEV01 -Database AdventureWorks -SchemaName HumanResource -Table Employee\nSearches AdventureWorks database and lists tables/views in the HumanResource schema and table Employee with its corresponding matching tables/views with match percent\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eFind-DbaSimilarTable -SqlInstance DEV01 -Database AdventureWorks -MatchPercentThreshold 60\nSearches AdventureWorks database and lists all tables/views with its corresponding matching tables/views with match percent greater than or equal to 60", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "SchemaName", "If you are looking in a specific schema whose table structures is to be used as reference structure, provide the name of the schema.\r\nIf no schema is provided, looks at all schemas", "", false, "false", "", "" ], [ "TableName", "If you are looking in a specific table whose structure is to be used as reference structure, provide the name of the table.\r\nIf no table is provided, looks at all tables\r\nIf the table name exists in multiple schemas, all of them would qualify", "", false, "false", "", "" ], [ "ExcludeViews", "By default, views are included. You can exclude them by setting this switch to $false\r\nThis excludes views in both matching and matched list", "", false, "false", "False", "" ], [ "IncludeSystemDatabases", "By default system databases are ignored but you can include them within the search using this parameter", "", false, "false", "False", "" ], [ "MatchPercentThreshold", "The minimum percentage of column names that should match between the matching and matched objects.\r\nEntries with no matches are eliminated", "", false, "false", "0", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Find-DbaSimilarTable [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-SchemaName] \u003cString\u003e] [[-TableName] \u003cString\u003e] [-ExcludeViews] [-IncludeSystemDatabases] [[-MatchPercentThreshold] \u003cInt32\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Find-DbaStoredProcedure", "Description": "This function can either run against specific databases or all databases searching all user or user and system stored procedures.", "Tags": [ "StoredProcedure", "Proc" ], "Synopsis": "Returns all stored procedures that contain a specific case-insensitive string or regex pattern.", "Alias": "", "Author": "Stephen Bennett, https://sqlnotesfromtheunderground.wordpress.com/", "CommandName": "Find-DbaStoredProcedure", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaStoredProcedure", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaStoredProcedure -SqlInstance DEV01 -Pattern whatever\nSearches all user databases stored procedures for \"whatever\" in the text body\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaStoredProcedure -SqlInstance sql2016 -Pattern \u0027\\w+@\\w+\\.\\w+\u0027\nSearches all databases for all stored procedures that contain a valid email pattern in the text body\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaStoredProcedure -SqlInstance DEV01 -Database MyDB -Pattern \u0027some string\u0027 -Verbose\nSearches in \"mydb\" database stored procedures for \"some string\" in the text body\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eFind-DbaStoredProcedure -SqlInstance sql2016 -Database MyDB -Pattern RUNTIME -IncludeSystemObjects\nSearches in \"mydb\" database stored procedures for \"runtime\" in the text body", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Pattern", "String pattern that you want to search for in the stored procedure text body", "", true, "false", "", "" ], [ "IncludeSystemObjects", "By default, system stored procedures are ignored but you can include them within the search using this parameter.\nWarning - this will likely make it super slow if you run it on all databases.", "", false, "false", "False", "" ], [ "IncludeSystemDatabases", "By default system databases are ignored but you can include them within the search using this parameter", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Find-DbaStoredProcedure [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-Pattern] \u003cString\u003e [-IncludeSystemObjects] [-IncludeSystemDatabases] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Find-DbaTrigger", "Description": "This function search on Instance, Database and Object level.\nIf you specify one or more databases, search on Server level will not be preformed.", "Tags": "Trigger", "Synopsis": "Returns all triggers that contain a specific case-insensitive string or regex pattern.", "Alias": "", "Author": "Claudio Silva (@ClaudioESSilva)", "CommandName": "Find-DbaTrigger", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaTrigger", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaTrigger -SqlInstance DEV01 -Pattern whatever\nSearches all user databases triggers for \"whatever\" in the text body\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaTrigger -SqlInstance sql2016 -Pattern \u0027\\w+@\\w+\\.\\w+\u0027\nSearches all databases for all triggers that contain a valid email pattern in the text body\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaTrigger -SqlInstance DEV01 -Database MyDB -Pattern \u0027some string\u0027 -Verbose\nSearches in \"mydb\" database triggers for \"some string\" in the text body\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eFind-DbaTrigger -SqlInstance sql2016 -Database MyDB -Pattern RUNTIME -IncludeSystemObjects\nSearches in \"mydb\" database triggers for \"runtime\" in the text body", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Pattern", "String pattern that you want to search for in the trigger text body", "", true, "false", "", "" ], [ "TriggerLevel", "Allows specify the trigger level that you want to search. By default is All (Server, Database, Object).", "", false, "false", "All", "All,Server,Database,Object" ], [ "IncludeSystemObjects", "By default, system triggers are ignored but you can include them within the search using this parameter.\nWarning - this will likely make it super slow if you run it on all databases.", "", false, "false", "False", "" ], [ "IncludeSystemDatabases", "By default system databases are ignored but you can include them within the search using this parameter", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Find-DbaTrigger [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-Pattern] \u003cString\u003e [[-TriggerLevel] \u003cString\u003e] [-IncludeSystemObjects] [-IncludeSystemDatabases] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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)\nDatabase Owner\nAgent Job Owner\nUsed in Credential\nUSed in Proxy\nSQL Agent Steps using a Proxy\nEndpoints\nServer Roles\nDatabase Schemas\nDatabase Roles\nDatabase Assembles\nDatabase Synonyms", "Tags": "Object", "Synopsis": "Searches SQL Server to find user-owned objects (i.e. not dbo or sa) or for any object owned by a specific user specified by the Pattern parameter.", "Alias": "", "Author": "Stephen Bennett, https://sqlnotesfromtheunderground.wordpress.com/", "CommandName": "Find-DbaUserObject", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaUserObject", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaUserObject -SqlInstance DEV01 -Pattern ad\\stephen\nSearches user objects for owner ad\\stephen\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaUserObject -SqlInstance DEV01 -Verbose\nShows all user owned (non-sa, non-dbo) objects and verbose output", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Pattern", "The regex pattern that the command will search for", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Find-DbaUserObject [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Pattern] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Find-DbaView", "Description": "This function can either run against specific databases or all databases searching all user or user and system views.", "Tags": "View", "Synopsis": "Returns all views that contain a specific case-insensitive string or regex pattern.", "Alias": "", "Author": "Claudio Silva (@ClaudioESSilva)", "CommandName": "Find-DbaView", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Find-DbaView", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eFind-DbaView -SqlInstance DEV01 -Pattern whatever\nSearches all user databases views for \"whatever\" in the text body\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eFind-DbaView -SqlInstance sql2016 -Pattern \u0027\\w+@\\w+\\.\\w+\u0027\nSearches all databases for all views that contain a valid email pattern in the text body\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaView -SqlInstance DEV01 -Database MyDB -Pattern \u0027some string\u0027 -Verbose\nSearches in \"mydb\" database views for \"some string\" in the text body\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eFind-DbaView -SqlInstance sql2016 -Database MyDB -Pattern RUNTIME -IncludeSystemObjects\nSearches in \"mydb\" database views for \"runtime\" in the text body", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Pattern", "String pattern that you want to search for in the view text body", "", true, "false", "", "" ], [ "IncludeSystemObjects", "By default, system views are ignored but you can include them within the search using this parameter.\nWarning - this will likely make it super slow if you run it on all databases.", "", false, "false", "False", "" ], [ "IncludeSystemDatabases", "By default system databases are ignored but you can include them within the search using this parameter", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Find-DbaView [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-Pattern] \u003cString\u003e [-IncludeSystemObjects] [-IncludeSystemDatabases] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Format-DbaBackupInformation", "Description": "Performs various mapping on Backup History, ready restoring\nOptions include changing restore paths, backup paths, database name and many others", "Tags": [ "DisasterRecovery", "Backup", "Restore" ], "Synopsis": "Transforms the data in a dbatools BackupHistory object for a restore", "Alias": "", "Author": "Stuart Moore (@napalmgram), stuart-moore.com", "CommandName": "Format-DbaBackupInformation", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Format-DbaBackupInformation", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$History | Format-DbaBackupInformation -ReplaceDatabaseName NewDb\nChanges as database name references to NewDb, both in the database name and any restore paths. Note, this will fail if the BackupHistory object contains backups for more than 1 database\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$History | Format-DbaBackupInformation -ReplaceDatabaseName @{\u0027OldB\u0027=\u0027NewDb\u0027;\u0027ProdHr\u0027=\u0027DevHr\u0027}\nWill change all occurrences of original database name in the backup history (names and restore paths) using the mapping in the hashtable.\r\nIn this example any occurrence of OldDb will be replaced with NewDb and ProdHr with DevPR\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$History | Format-DbaBackupInformation -DataFileDirectory \u0027D:\\DataFiles\\\u0027 -LogFileDirectory \u0027E:\\LogFiles\\\nThis example with change the restore path for all data files (everything that is not a log file) to d:\\datafiles\r\nAnd all Transaction Log files will be restored to E:\\Logfiles\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$History | Format-DbaBackupInformation -RebaseBackupFolder f:\\backups\nThis example changes the location that SQL Server will look for the backups. This is useful if you\u0027ve moved the backups to a different location", "Params": [ [ "BackupHistory", "A dbatools backupHistory object, normally this will have been created using Select-DbaBackupInformation", "", true, "true (ByValue)", "", "" ], [ "ReplaceDatabaseName", "If a single value is provided, this will be replaced do all occurrences a database name\r\nIf a Hashtable is passed in, each database name mention will be replaced as specified. If a database\u0027s name does not appear it will not be replace\r\nDatabaseName will also be replaced where it occurs in the file paths of data and log files.\r\nPlease note, that this won\u0027t change the Logical Names of data files, that has to be done with a separate Alter DB call", "", false, "false", "", "" ], [ "ReplaceDbNameInFile", "If set, will replace the old database name with the new name if it occurs in the file name", "", false, "false", "False", "" ], [ "DataFileDirectory", "This will move ALL restored files to this location during the restore", "", false, "false", "", "" ], [ "LogFileDirectory", "This will move all log files to this location, overriding DataFileDirectory", "", false, "false", "", "" ], [ "DestinationFileStreamDirectory", "This move the FileStream folder and contents to the new location, overriding DataFileDirectory", "", false, "false", "", "" ], [ "DatabaseNamePrefix", "This string will be prefixed to all restored database\u0027s name", "", false, "false", "", "" ], [ "DatabaseFilePrefix", "A string that will be prefixed to every file restored", "", false, "false", "", "" ], [ "DatabaseFileSuffix", "A string that will be suffixed to every file restored", "", false, "false", "", "" ], [ "RebaseBackupFolder", "Use this to rebase where your backups are stored.", "", false, "false", "", "" ], [ "Continue", "Indicates that this is a continuing restore", "", false, "false", "False", "" ], [ "FileMapping", "A hashtable that can be used to move specific files to a location.\r\n`$FileMapping = @{\u0027DataFile1\u0027=\u0027c:\\restoredfiles\\Datafile1.mdf\u0027;\u0027DataFile3\u0027=\u0027d:\\DataFile3.mdf\u0027}`\r\nAnd files not specified in the mapping will be restored to their original location\r\nThis Parameter is exclusive with DestinationDataDirectory\r\nIf specified, this will override any other file renaming/relocation options.", "", false, "false", "", "" ], [ "PathSep", "By default is Windows\u0027s style (`\\`) but you can pass also, e.g., `/` for Unix\u0027s style paths", "", false, "false", "\\", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Format-DbaBackupInformation [-BackupHistory] \u003cObject[]\u003e [[-ReplaceDatabaseName] \u003cObject\u003e] [-ReplaceDbNameInFile] [[-DataFileDirectory] \u003cString\u003e] [[-LogFileDirectory] \u003cString\u003e] [[-DestinationFileStreamDirectory] \u003cString\u003e] [[-DatabaseNamePrefix] \u003cString\u003e] [[-DatabaseFilePrefix] \u003cString\u003e] [[-DatabaseFileSuffix] \u003cString\u003e] [[-RebaseBackupFolder] \u003cString\u003e] [-Continue] [[-FileMapping] \u003cHashtable\u003e] [[-PathSep] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgBackupHistory", "Description": "Returns backup history details for some or all databases on a SQL Server Availability Group.\n\nYou can even get detailed information (including file path) for latest full, differential and log files.\nFor detailed examples of the various parameters see the documentation of Get-DbaDbBackupHistory.\n\nReference: http://www.sqlhub.com/2011/07/find-your-backup-history-in-sql-server.html", "Tags": [ "DisasterRecovery", "Backup" ], "Synopsis": "Returns backup history details for databases on a SQL Server Availability Group.", "Alias": "", "Author": "Chrissy LeMaire (@cl) | Stuart Moore (@napalmgram), Andreas Jordan", "CommandName": "Get-DbaAgBackupHistory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgBackupHistory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgBackupHistory -SqlInstance AgListener -AvailabilityGroup AgTest1\nReturns information for all database backups still in msdb history on all replicas of availability group AgTest1 using the listener AgListener to determine all replicas.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgBackupHistory -SqlInstance Replica1, Replica2, Replica3 -AvailabilityGroup AgTest1\nReturns information for all database backups still in msdb history on the given replicas of availability group AgTest1.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAgBackupHistory -SqlInstance \u0027Replica1:14331\u0027, \u0027Replica2:14332\u0027, \u0027Replica3:14333\u0027 -AvailabilityGroup AgTest1\nReturns information for all database backups still in msdb history on the given replicas of availability group AgTest1 using custom ports.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$ListOfReplicas | Get-DbaAgBackupHistory -AvailabilityGroup AgTest1\nReturns information for all database backups still in msdb history on the replicas in $ListOfReplicas of availability group AgTest1.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$serverWithAllAgs = Connect-DbaInstance -SqlInstance MyServer\nPS C:\\\u003e $allAgResults = foreach ( $ag in $serverWithAllAgs.AvailabilityGroups ) {\r\n\u003e\u003e Get-DbaAgBackupHistory -SqlInstance $ag.AvailabilityReplicas.Name -AvailabilityGroup $ag.Name\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e $allAgResults | Format-Table\nReturns information for all database backups on all replicas for all availability groups on SQL instance MyServer.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.\nIf you pass in one availability group listener, all replicas are automatically determined and queried.\r\nIf you pass in a list of individual replicas, they will be queried. This enables you to use custom ports for the replicas.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Credential object used to connect to the SQL Server instance as a different user. This can be a Windows or SQL Server account. Windows users are determined by the existence of a backslash, so if you \r\nare intending to use an alternative Windows connection instead of a SQL login, ensure it contains a backslash.", "", false, "false", "", "" ], [ "AvailabilityGroup", "Specify the availability group to process.", "", true, "false", "", "" ], [ "Database", "Specifies one or more database(s) to process. If unspecified, all databases of the availability group will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies one or more database(s) to exclude from processing.", "", false, "false", "", "" ], [ "IncludeCopyOnly", "By default Get-DbaAgBackupHistory will ignore backups taken with the CopyOnly option. This switch will include them.", "", false, "false", "False", "" ], [ "Force", "If this switch is enabled, a large amount of information is returned, similar to what SQL Server itself returns.", "", false, "false", "False", "" ], [ "Since", "Specifies a DateTime object to use as the starting point for the search for backups.", "", false, "false", "(Get-Date \u002701/01/1970\u0027)", "" ], [ "RecoveryFork", "Specifies the Recovery Fork you want backup history for", "", false, "false", "", "" ], [ "Last", "If this switch is enabled, the most recent full chain of full, diff and log backup sets is returned.", "", false, "false", "False", "" ], [ "LastFull", "If this switch is enabled, the most recent full backup set is returned.", "", false, "false", "False", "" ], [ "LastDiff", "If this switch is enabled, the most recent differential backup set is returned.", "", false, "false", "False", "" ], [ "LastLog", "If this switch is enabled, the most recent log backup is returned.", "", false, "false", "False", "" ], [ "DeviceType", "Specifies a filter for backup sets based on DeviceType. Valid options are \u0027Disk\u0027,\u0027Permanent Disk Device\u0027, \u0027Tape\u0027, \u0027Permanent Tape Device\u0027,\u0027Pipe\u0027,\u0027Permanent Pipe Device\u0027,\u0027Virtual Device\u0027,\u0027URL\u0027, in \r\naddition to custom integers for your own DeviceType.", "", false, "false", "", "" ], [ "Raw", "If this switch is enabled, one object per backup file is returned. Otherwise, media sets (striped backups across multiple files) will be grouped into a single return object.", "", false, "false", "False", "" ], [ "LastLsn", "Specifies a minimum LSN to use in filtering backup history. Only backups with an LSN greater than this value will be returned, which helps speed the retrieval process.", "", false, "false", "", "" ], [ "IncludeMirror", "By default mirrors of backups are not returned, this switch will cause them to be returned", "", false, "false", "False", "" ], [ "Type", "Specifies one or more types of backups to return. Valid options are \u0027Full\u0027, \u0027Log\u0027, \u0027Differential\u0027, \u0027File\u0027, \u0027Differential File\u0027, \u0027Partial Full\u0027, and \u0027Partial Differential\u0027. Otherwise, all types of \r\nbackups will be returned unless one of the -Last* switches is enabled.", "", false, "false", "", "Full,Log,Differential,File,Differential File,Partial Full,Partial Differential" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgBackupHistory -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] -AvailabilityGroup \u003cString\u003e [-Database \u003cString[]\u003e] [-ExcludeDatabase \u003cString[]\u003e] [-IncludeCopyOnly] [-Since \u003cDateTime\u003e] [-RecoveryFork \u003cString\u003e] [-Last] [-LastFull] [-LastDiff] [-LastLog] [-DeviceType \u003cString[]\u003e] [-Raw] [-LastLsn \u003cBigInteger\u003e] [-IncludeMirror] [-Type \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]\nGet-DbaAgBackupHistory -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] -AvailabilityGroup \u003cString\u003e [-Database \u003cString[]\u003e] [-ExcludeDatabase \u003cString[]\u003e] [-IncludeCopyOnly] [-Force] [-Since \u003cDateTime\u003e] [-RecoveryFork \u003cString\u003e] [-Last] [-LastFull] [-LastDiff] [-LastLog] [-DeviceType \u003cString[]\u003e] [-Raw] [-LastLsn \u003cBigInteger\u003e] [-IncludeMirror] [-Type \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgDatabase", "Description": "Gets availability group databases from one or more SQL Server instances.\n\nDefault view provides most common set of properties for information on the database in an availability group.\n\nInformation returned on the database will be specific to that replica, whether it is primary or a secondary.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Gets availability group databases from one or more SQL Server instances.", "Alias": "", "Author": "Shawn Melton (@wsmelton), https://wsmelton.github.io", "CommandName": "Get-DbaAgDatabase", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgDatabase", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgDatabase -SqlInstance sql2017a\nReturns all the databases in each availability group found on sql2017a\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgDatabase -SqlInstance sql2017a -AvailabilityGroup AG101\nReturns all the databases in the availability group AG101 on sql2017a\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sqlcluster -AvailabilityGroup SharePoint -Database Sharepoint_Config | Get-DbaAgDatabase\nReturns the database Sharepoint_Config found in the availability group SharePoint on server sqlcluster", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "Specify the availability groups to query.", "", false, "false", "", "" ], [ "Database", "Specify the database or databases to return. This list is auto-populated from the server for tab completion. Multiple databases can be specified. If none are specified all databases will be processed.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaAvailabilityGroup.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgDatabase [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [[-Database] \u003cString[]\u003e] [[-InputObject] \u003cAvailabilityGroup[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgentAlert", "Description": "This function returns SQL Agent alerts.", "Tags": [ "Agent", "SMO" ], "Synopsis": "Returns SQL Agent alerts on a SQL Server Agent.", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDBAKlaas)", "CommandName": "Get-DbaAgentAlert", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgentAlert", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgentAlert -SqlInstance ServerA,ServerB\\instanceB\nReturns all SQL Agent alerts on serverA and serverB\\instanceB\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgentAlert -SqlInstance ServerA,ServerB\\instanceB -Alert MyAlert*\nReturns SQL Agent alert on serverA and serverB\\instanceB whose names match \u0027MyAlert*\u0027\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027serverA\u0027,\u0027serverB\\instanceB\u0027 | Get-DbaAgentAlert\nReturns all SQL Agent alerts on serverA and serverB\\instanceB", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Alert", "The name of the alerts to return. If null, will get all alerts from the server. Note - this parameter accepts wildcards.", "", false, "false", "", "" ], [ "ExcludeAlert", "The name of the alerts to exclude. If not provided, no alerts will be excluded. Note - this parameter accepts wildcards.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgentAlert [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Alert] \u003cString[]\u003e] [[-ExcludeAlert] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgentAlertCategory", "Description": "Get-DbaAgentAlertCategory makes it possible to retrieve the alert categories.", "Tags": [ "Agent", "Alert", "AlertCategory" ], "Synopsis": "Get-DbaAgentAlertCategory retrieves the alert categories.", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaAgentAlertCategory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgentAlertCategory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgentAlertCategory -SqlInstance sql1\nReturn all the agent alert categories.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgentAlertCategory -SqlInstance sql1 -Category \u0027Severity Alert\u0027\nReturn all the agent alert categories that have the name \u0027Severity Alert\u0027.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Category", "The name of the category to filter out. If no category is used all categories will be returned.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgentAlertCategory [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Category] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgentJob", "Description": "The Get-DbaAgentJob returns connected SMO object for SQL Agent Job information for each instance(s) of SQL Server.", "Tags": [ "Job", "Agent" ], "Synopsis": "Gets SQL Agent Job information for each instance(s) of SQL Server.", "Alias": "", "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com", "CommandName": "Get-DbaAgentJob", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgentJob", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance localhost\nReturns all SQL Agent Jobs on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance localhost, sql2016\nReturns all SQl Agent Jobs for the local and sql2016 SQL Server instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance localhost -Job BackupData, BackupDiff\nReturns all SQL Agent Jobs named BackupData and BackupDiff from the local SQL Server instance.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance localhost -ExcludeJob BackupDiff\nReturns all SQl Agent Jobs for the local SQL Server instances, except the BackupDiff Job.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance localhost -ExcludeDisabledJobs\nReturns all SQl Agent Jobs for the local SQL Server instances, excluding the disabled jobs.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$servers | Get-DbaAgentJob | Out-GridView -PassThru | Start-DbaAgentJob -WhatIf\nFind all of your Jobs from SQL Server instances in the $servers collection, select the jobs you want to start then see jobs would start if you ran Start-DbaAgentJob\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance sqlserver2014a | Where-Object Category -eq \"Report Server\" | Export-DbaScript -Path \"C:\\temp\\sqlserver2014a_SSRSJobs.sql\"\nExports all SSRS jobs from SQL instance sqlserver2014a to a file.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance sqlserver2014a -Database msdb\nFinds all jobs on sqlserver2014a that T-SQL job steps associated with msdb database", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "The job(s) to process - this list is auto-populated from the server. If unspecified, all jobs will be processed.", "", false, "false", "", "" ], [ "ExcludeJob", "The job(s) to exclude - this list is auto-populated from the server.", "", false, "false", "", "" ], [ "Database", "Return jobs with T-SQL job steps associated with specific databases", "", false, "false", "", "" ], [ "Category", "Return jobs associated with specific category", "", false, "false", "", "" ], [ "ExcludeCategory", "Categories to exclude - jobs associated with these categories will not be returned.", "", false, "false", "", "" ], [ "ExcludeDisabledJobs", "Switch will exclude disabled jobs from the output.", "", false, "false", "False", "" ], [ "IncludeExecution", "Include Execution details if the job is currently running", "", false, "false", "False", "" ], [ "Type", "The type of job: MultiServer or Local. Defaults to both MultiServer and Local.", "", false, "false", "@(\"MultiServer\", \"Local\")", "MultiServer,Local" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgentJob [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Job] \u003cString[]\u003e] [[-ExcludeJob] \u003cString[]\u003e] [[-Database] \u003cString[]\u003e] [[-Category] \u003cString[]\u003e] [[-ExcludeCategory] \u003cString[]\u003e] [-ExcludeDisabledJobs] [-IncludeExecution] [[-Type] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgentJobCategory", "Description": "Get-DbaAgentJobCategory makes it possible to retrieve the job categories.", "Tags": [ "Agent", "Job", "JobCategory" ], "Synopsis": "Get-DbaAgentJobCategory retrieves the job categories.", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Get-DbaAgentJobCategory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgentJobCategory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgentJobCategory -SqlInstance sql1\nReturn all the job categories.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgentJobCategory -SqlInstance sql1 -Category \u0027Log Shipping\u0027\nReturn all the job categories that have the name \u0027Log Shipping\u0027.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAgentJobCategory -SqlInstance sstad-pc -CategoryType MultiServerJob\nReturn all the job categories that have a type MultiServerJob.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Category", "The name of the category to filter out. If no category is used all categories will be returned.", "", false, "false", "", "" ], [ "CategoryType", "The type of category. This can be \"LocalJob\", \"MultiServerJob\" or \"None\".\r\nIf no category is used all categories types will be returned.", "", false, "false", "", "LocalJob,MultiServerJob,None" ], [ "Force", "The force parameter will ignore some errors in the parameters and assume defaults.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgentJobCategory [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Category] \u003cString[]\u003e] [[-CategoryType] \u003cString\u003e] [-Force] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgentJobHistory", "Description": "Get-DbaAgentJobHistory returns all information on the executions still available on each instance(s) of SQL Server submitted.\nThe cleanup of SQL Agent history determines how many records are kept.\n\nhttps://msdn.microsoft.com/en-us/library/ms201680.aspx\nhttps://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.agent.jobhistoryfilter(v=sql.120).aspx", "Tags": [ "Job", "Agent" ], "Synopsis": "Gets execution history of SQL Agent Job on instance(s) of SQL Server.", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDbaKlaas) | Simone Bizzotto (@niphold)", "CommandName": "Get-DbaAgentJobHistory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgentJobHistory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgentJobHistory -SqlInstance localhost\nReturns all SQL Agent Job execution results on the local default SQL Server instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgentJobHistory -SqlInstance localhost, sql2016\nReturns all SQL Agent Job execution results for the local and sql2016 SQL Server instances.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\\Inst2K17\u0027 | Get-DbaAgentJobHistory\nReturns all SQL Agent Job execution results for sql1 and sql2\\Inst2K17.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaAgentJobHistory -SqlInstance sql2\\Inst2K17 | Select-Object *\nReturns all properties for all SQl Agent Job execution results on sql2\\Inst2K17.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaAgentJobHistory -SqlInstance sql2\\Inst2K17 -Job \u0027Output File Cleanup\u0027\nReturns all properties for all SQl Agent Job execution results of the \u0027Output File Cleanup\u0027 job on sql2\\Inst2K17.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaAgentJobHistory -SqlInstance sql2\\Inst2K17 -Job \u0027Output File Cleanup\u0027 -WithOutputFile\nReturns all properties for all SQl Agent Job execution results of the \u0027Output File Cleanup\u0027 job on sql2\\Inst2K17,\r\nwith additional properties that show the output filename path\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaAgentJobHistory -SqlInstance sql2\\Inst2K17 -ExcludeJobSteps\nReturns the SQL Agent Job execution results for the whole jobs on sql2\\Inst2K17, leaving out job step execution results.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eGet-DbaAgentJobHistory -SqlInstance sql2\\Inst2K17 -StartDate \u00272017-05-22\u0027 -EndDate \u00272017-05-23 12:30:00\u0027\nReturns the SQL Agent Job execution results between 2017/05/22 00:00:00 and 2017/05/23 12:30:00 on sql2\\Inst2K17.\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance sql2016 | Where-Object Name -Match backup | Get-DbaAgentJobHistory\nGets all jobs with the name that match the regex pattern \"backup\" and then gets the job history from those. You can also use -Like *backup* in this example.\n-------------------------- EXAMPLE 10 --------------------------\nPS C:\\\u003eGet-DbaAgentJobHistory -SqlInstance sql2016 -OutcomeType Failed\nReturns only the failed SQL Agent Job execution results for the sql2016 SQL Server instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "The name of the job from which the history is wanted. If unspecified, all jobs will be processed.", "", false, "false", "", "" ], [ "ExcludeJob", "The job(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "StartDate", "The DateTime starting from which the history is wanted. If unspecified, all available records will be processed.", "", false, "false", "1900-01-01", "" ], [ "EndDate", "The DateTime before which the history is wanted. If unspecified, all available records will be processed.", "", false, "false", "$(Get-Date)", "" ], [ "OutcomeType", "The CompletionResult to filter the history for. Valid values are: Failed, Succeeded, Retry, Cancelled, InProgress, Unknown", "", false, "false", "", "Failed,Succeeded,Retry,Cancelled,InProgress,Unknown" ], [ "ExcludeJobSteps", "Use this switch to discard all job steps, and return only the job totals", "", false, "false", "False", "" ], [ "WithOutputFile", "Use this switch to retrieve the output file (only if you want step details). Bonus points, we handle the quirks\r\nof SQL Agent tokens to the best of our knowledge (https://technet.microsoft.com/it-it/library/ms175575(v=sql.110).aspx)", "", false, "false", "False", "" ], [ "JobCollection", "An array of SMO jobs", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgentJobHistory [-SqlCredential \u003cPSCredential\u003e] [-Job \u003cObject[]\u003e] [-ExcludeJob \u003cObject[]\u003e] [-StartDate \u003cDateTime\u003e] [-EndDate \u003cDateTime\u003e] [-OutcomeType {Failed | Succeeded | Retry | Cancelled | InProgress | Unknown}] [-ExcludeJobSteps] [-WithOutputFile] [-EnableException] [\u003cCommonParameters\u003e]\nGet-DbaAgentJobHistory -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Job \u003cObject[]\u003e] [-ExcludeJob \u003cObject[]\u003e] [-StartDate \u003cDateTime\u003e] [-EndDate \u003cDateTime\u003e] [-OutcomeType {Failed | Succeeded | Retry | Cancelled | InProgress | Unknown}] [-ExcludeJobSteps] [-WithOutputFile] [-EnableException] [\u003cCommonParameters\u003e]\nGet-DbaAgentJobHistory [-SqlCredential \u003cPSCredential\u003e] [-Job \u003cObject[]\u003e] [-ExcludeJob \u003cObject[]\u003e] [-StartDate \u003cDateTime\u003e] [-EndDate \u003cDateTime\u003e] [-OutcomeType {Failed | Succeeded | Retry | Cancelled | InProgress | Unknown}] [-ExcludeJobSteps] [-WithOutputFile] -JobCollection \u003cJob\u003e [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgentJobOutputFile", "Description": "This function returns for one or more SQL Instances the output file value for each step of one or many agent job with the Job Names\nprovided dynamically. It will not return anything if there is no Output File", "Tags": [ "Agent", "Job" ], "Synopsis": "Returns the Output File for each step of one or many agent job with the Job Names provided dynamically if\nrequired for one or more SQL Instances", "Alias": "", "Author": "Rob Sewell (https://sqldbawithabeard.com) | Simone Bizzotto (@niphold)", "CommandName": "Get-DbaAgentJobOutputFile", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgentJobOutputFile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgentJobOutputFile -SqlInstance SERVERNAME -Job \u0027The Agent Job\u0027\nThis will return the configured paths to the output files for each of the job step of the The Agent Job Job\r\non the SERVERNAME instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgentJobOutputFile -SqlInstance SERVERNAME\nThis will return the configured paths to the output files for each of the job step of all the Agent Jobs\r\non the SERVERNAME instance\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAgentJobOutputFile -SqlInstance SERVERNAME,SERVERNAME2 -Job \u0027The Agent Job\u0027\nThis will return the configured paths to the output files for each of the job step of the The Agent Job Job\r\non the SERVERNAME instance and SERVERNAME2\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$Servers = \u0027SERVER\u0027,\u0027SERVER\\INSTANCE1\u0027\nGet-DbaAgentJobOutputFile -SqlInstance $Servers -Job \u0027The Agent Job\u0027 -OpenFile\nThis will return the configured paths to the output files for each of the job step of the The Agent Job Job\r\non the SERVER instance and the SERVER\\INSTANCE1 and open the files if they are available\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaAgentJobOutputFile -SqlInstance SERVERNAME | Out-GridView\nThis will return the configured paths to the output files for each of the job step of all the Agent Jobs\r\non the SERVERNAME instance and Pipe them to Out-GridView\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e(Get-DbaAgentJobOutputFile -SqlInstance SERVERNAME | Out-GridView -PassThru).FileName | Invoke-Item\nThis will return the configured paths to the output files for each of the job step of all the Agent Jobs\r\non the SERVERNAME instance and Pipe them to Out-GridView and enable you to choose the output\r\nfile and open it\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaAgentJobOutputFile -SqlInstance SERVERNAME -Verbose\nThis will return the configured paths to the output files for each of the job step of all the Agent Jobs\r\non the SERVERNAME instance and also show the job steps without an output file", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue, ByPropertyName)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance. be it Windows or SQL Server. Windows users are determined by the existence of a backslash, so if you are intending to use an alternative Windows \r\nconnection instead of a SQL login, ensure it contains a backslash.", "", false, "true (ByPropertyName)", "", "" ], [ "Job", "The job(s) to process - this list is auto-populated from the server. If unspecified, all jobs will be processed.", "", false, "false", "", "" ], [ "ExcludeJob", "The job(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgentJobOutputFile [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Job \u003cObject[]\u003e] [-ExcludeJob \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgentJobStep", "Description": "The Get-DbaAgentJobStep returns connected SMO object for SQL Agent Job Step for each instance(s) of SQL Server.", "Tags": [ "Job", "Agent" ], "Synopsis": "Gets SQL Agent Job Step information for each instance(s) of SQL Server.", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDbaKlaas), http://powerdba.eu", "CommandName": "Get-DbaAgentJobStep", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgentJobStep", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgentJobStep -SqlInstance localhost\nReturns all SQL Agent Job Steps on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgentJobStep -SqlInstance localhost, sql2016\nReturns all SQL Agent Job Steps for the local and sql2016 SQL Server instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAgentJobStep -SqlInstance localhost -Job BackupData, BackupDiff\nReturns all SQL Agent Job Steps for the jobs named BackupData and BackupDiff from the local SQL Server instance.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaAgentJobStep -SqlInstance localhost -ExcludeJob BackupDiff\nReturns all SQL Agent Job Steps for the local SQL Server instances, except for the BackupDiff Job.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaAgentJobStep -SqlInstance localhost -ExcludeDisabledJobs\nReturns all SQL Agent Job Steps for the local SQL Server instances, excluding the disabled jobs.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$servers | Get-DbaAgentJobStep\nFind all of your Job Steps from SQL Server instances in the $servers collection", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "The job(s) to process - this list is auto-populated from the server. If unspecified, all jobs will be processed.", "", false, "false", "", "" ], [ "ExcludeJob", "The job(s) to exclude - this list is auto-populated from the server.", "", false, "false", "", "" ], [ "ExcludeDisabledJobs", "Switch will exclude disabled jobs from the output.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgentJobStep [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Job] \u003cObject[]\u003e] [[-ExcludeJob] \u003cObject[]\u003e] [-ExcludeDisabledJobs] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgentLog", "Description": "Gets the \"SQL Agent Error Log\" of an instance. Returns all 10 error logs by default.", "Tags": "Logging", "Synopsis": "Gets the \"SQL Agent Error Log\" of an instance", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaAgentLog", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgentLog", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgentLog -SqlInstance sql01\\sharepoint\nReturns the entire error log for the SQL Agent on sql01\\sharepoint\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgentLog -SqlInstance sql01\\sharepoint -LogNumber 3, 6\nReturns log numbers 3 and 6 for the SQL Agent on sql01\\sharepoint\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers = \"sql2014\",\"sql2016\", \"sqlcluster\\sharepoint\"\nPS C:\\\u003e $servers | Get-DbaAgentLog -LogNumber 0\nReturns the most recent SQL Agent error logs for \"sql2014\",\"sql2016\" and \"sqlcluster\\sharepoint\"", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "LogNumber", "An Int32 value that specifies the index number of the error log required. Error logs are listed 0 through 9 where 0 is the current error log and 9 is the oldest.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgentLog [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-LogNumber] \u003cInt32[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgentOperator", "Description": "This function returns SQL Agent operators.", "Tags": [ "Agent", "Operator" ], "Synopsis": "Returns all SQL Agent operators on a SQL Server Agent.", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDBAKlaas)", "CommandName": "Get-DbaAgentOperator", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgentOperator", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgentOperator -SqlInstance ServerA,ServerB\\instanceB\nReturns any SQL Agent operators on serverA and serverB\\instanceB\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027ServerA\u0027,\u0027ServerB\\instanceB\u0027 | Get-DbaAgentOperator\nReturns all SQL Agent operators on serverA and serverB\\instanceB\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAgentOperator -SqlInstance ServerA -Operator Dba1,Dba2\nReturns only the SQL Agent Operators Dba1 and Dba2 on ServerA.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaAgentOperator -SqlInstance ServerA,ServerB -ExcludeOperator Dba3\nReturns all the SQL Agent operators on ServerA and ServerB, except the Dba3 operator.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Operator", "The operator(s) to process - this list is auto-populated from the server. If unspecified, all operators will be processed.", "", false, "false", "", "" ], [ "ExcludeOperator", "The operator(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgentOperator [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Operator] \u003cObject[]\u003e] [[-ExcludeOperator] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgentProxy", "Description": "This function returns SQL Agent proxies.", "Tags": [ "Agent", "SMO" ], "Synopsis": "Returns all SQL Agent proxies on a SQL Server Agent.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaAgentProxy", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgentProxy", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgentProxy -SqlInstance ServerA,ServerB\\instanceB\nReturns all SQL Agent proxies on serverA and serverB\\instanceB\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027serverA\u0027,\u0027serverB\\instanceB\u0027 | Get-DbaAgentProxy\nReturns all SQL Agent proxies on serverA and serverB\\instanceB", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Proxy", "The proxy to process - this list is auto-populated from the server. If unspecified, all proxies will be processed.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgentProxy [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Proxy] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgentSchedule", "Description": "This function returns SQL Agent Shared Schedules.", "Tags": [ "Agent", "Schedule" ], "Synopsis": "Returns all SQL Agent Shared Schedules on a SQL Server Agent.", "Alias": "", "Author": "Chris McKeown (@devopsfu), http://www.devopsfu.com", "CommandName": "Get-DbaAgentSchedule", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgentSchedule", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgentSchedule -SqlInstance localhost\nReturns all SQL Agent Shared Schedules on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgentSchedule -SqlInstance localhost, sql2016\nReturns all SQL Agent Shared Schedules for the local and sql2016 SQL Server instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAgentSchedule -SqlInstance localhost, sql2016 -Id 3\nReturns the SQL Agent Shared Schedules with the Id of 3\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaAgentSchedule -SqlInstance localhost, sql2016 -ScheduleUid \u0027bf57fa7e-7720-4936-85a0-87d279db7eb7\u0027\nReturns the SQL Agent Shared Schedules with the UID\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaAgentSchedule -SqlInstance sql2016 -Schedule \"Maintenance10min\",\"Maintenance60min\"\nReturns the \"Maintenance10min\" \u0026 \"Maintenance60min\" schedules from the sql2016 SQL Server instance", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Schedule", "Parameter to filter the schedules returned", "", false, "false", "", "" ], [ "ScheduleUid", "The unique identifier of the schedule", "", false, "false", "", "" ], [ "Id", "Parameter to filter the schedules returned", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgentSchedule [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Schedule] \u003cString[]\u003e] [[-ScheduleUid] \u003cString[]\u003e] [[-Id] \u003cInt32[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgentServer", "Description": "The Get-DbaAgentServer returns connected SMO object for SQL Agent Server information for each instance(s) of SQL Server.", "Tags": [ "Job", "Agent" ], "Synopsis": "Gets SQL Agent Server information for each instance(s) of SQL Server.", "Alias": "", "Author": "Cláudio Silva (@claudioessilva), https://claudioessilva.eu", "CommandName": "Get-DbaAgentServer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgentServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgentServer -SqlInstance localhost\nReturns SQL Agent Server on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgentServer -SqlInstance localhost, sql2016\nReturns SQL Agent Servers for the localhost and sql2016 SQL Server instances", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgentServer [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgHadr", "Description": "Gets the Hadr setting, from the service level, and returns true or false for the specified SQL Server instance.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Gets the Hadr service setting on the specified SQL Server instance.", "Alias": "", "Author": "Shawn Melton (@wsmelton), http://wsmelton.github.io", "CommandName": "Get-DbaAgHadr", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgHadr", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgHadr -SqlInstance sql2016\nReturns a status of the Hadr setting for sql2016 SQL Server instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgHadr [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgListener", "Description": "Returns availability group listeners.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Returns availability group listeners.", "Alias": "", "Author": "Viorel Ciucu (@viorelciucu)", "CommandName": "Get-DbaAgListener", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgListener", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgListener -SqlInstance sql2017a\nReturns all listeners found on sql2017a\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgListener -SqlInstance sql2017a -AvailabilityGroup AG-a\nReturns all listeners found on sql2017a on sql2017a for the availability group AG-a\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sql2017a -AvailabilityGroup OPP | Get-DbaAgListener\nReturns all listeners found on sql2017a on sql2017a for the availability group OPP", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "Specify the availability groups to query.", "", false, "false", "", "" ], [ "Listener", "Return only specific listeners.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaAvailabilityGroup.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgListener [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [[-Listener] \u003cString[]\u003e] [[-InputObject] \u003cAvailabilityGroup[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAgReplica", "Description": "Returns the availability group replica object found on the server.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Returns the availability group replica object found on the server.", "Alias": "", "Author": "Shawn Melton (@wsmelton) | Chrissy LeMaire (@cl)", "CommandName": "Get-DbaAgReplica", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAgReplica", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAgReplica -SqlInstance sql2017a\nReturns basic information on all the availability group replicas found on sql2017a\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgReplica -SqlInstance sql2017a -AvailabilityGroup SharePoint\nShows basic information on the replicas found on availability group SharePoint on sql2017a\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAgReplica -SqlInstance sql2017a | Select-Object *\nReturns full object properties on all availability group replicas found on sql2017a", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "Specify the availability groups to query.", "", false, "false", "", "" ], [ "Replica", "Return only specific replicas.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaAvailabilityGroup.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAgReplica [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [[-Replica] \u003cString[]\u003e] [[-InputObject] \u003cAvailabilityGroup[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAvailabilityGroup", "Description": "Returns availability group objects from a SQL Server instance.\n\nDefault view provides most common set of properties for information on the Availability Group(s).", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Returns availability group objects from a SQL Server instance.", "Alias": "", "Author": "Shawn Melton (@wsmelton) | Chrissy LeMaire (@cl)", "CommandName": "Get-DbaAvailabilityGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAvailabilityGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sqlserver2014a\nReturns basic information on all the Availability Group(s) found on sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sqlserver2014a -AvailabilityGroup AG-a\nShows basic information on the Availability Group AG-a on sqlserver2014a.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sqlserver2014a | Select-Object *\nReturns full object properties on all Availability Group(s) on sqlserver2014a.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sqlserver2014a | Select-Object -ExpandProperty PrimaryReplicaServerName\nReturns the SQL Server instancename of the primary replica as a string\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sqlserver2014a -AvailabilityGroup AG-a -IsPrimary\nReturns true/false if the server, sqlserver2014a, is the primary replica for AG-a Availability Group.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2012 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "Return only specific availability groups.", "", false, "false", "", "" ], [ "IsPrimary", "If this switch is enabled, a boolean indicating whether SqlInstance is the Primary replica in the AG is returned.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAvailabilityGroup [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [-IsPrimary] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaAvailableCollation", "Description": "The Get-DbaAvailableCollation function returns the list of collations available on each SQL Server.\nOnly the connect permission is required to get this information.", "Tags": [ "Collation", "Configuration" ], "Synopsis": "Function to get available collations for a given SQL Server", "Alias": "", "Author": "Bryan Hamby (@galador)", "CommandName": "Get-DbaAvailableCollation", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaAvailableCollation", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAvailableCollation -SqlInstance sql2016\nGets all the collations from server sql2016 using NT authentication", "Params": [ [ "SqlInstance", "TThe target SQL Server instance or instances. Only connect permission is required.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaAvailableCollation [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaBackupDevice", "Description": "The Get-DbaBackupDevice command gets SQL Backup Device information for each instance(s) of SQL Server.", "Tags": "Backup", "Synopsis": "Gets SQL Backup Device information for each instance(s) of SQL Server.", "Alias": "", "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com", "CommandName": "Get-DbaBackupDevice", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaBackupDevice", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaBackupDevice -SqlInstance localhost\nReturns all Backup Devices on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaBackupDevice -SqlInstance localhost, sql2016\nReturns all Backup Devices for the local and sql2016 SQL Server instances", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaBackupDevice [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaBackupInformation", "Description": "Upon being 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\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\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": "Scan backup files and creates a set, compatible with Restore-DbaDatabase", "Alias": "", "Author": "Chrissy LeMaire (@cl) | Stuart Moore (@napalmgram)", "CommandName": "Get-DbaBackupInformation", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaBackupInformation", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaBackupInformation -SqlInstance Server1 -Path c:\\backups\\ -DirectoryRecurse\nWill use the Server1 instance to recursively read all backup files under c:\\backups, and return a dbatools BackupHistory object\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaBackupInformation -SqlInstance Server1 -Path c:\\backups\\ -DirectoryRecurse -ExportPath c:\\store\\BackupHistory.xml\nPS C:\\\u003e robocopy c:\\store\\ \\\\remoteMachine\\C$\\store\\ BackupHistory.xml\r\nPS C:\\\u003e Get-DbaBackupInformation -Import -Path c:\\store\\BackupHistory.xml | Restore-DbaDatabase -SqlInstance Server2 -TrustDbBackupHistory\nThis example creates backup history output from server1 and copies the file to the remote machine in order to preserve backup history. It is then used to restore the databases onto server2.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaBackupInformation -SqlInstance Server1 -Path c:\\backups\\ -DirectoryRecurse -ExportPath C:\\store\\BackupHistory.xml -PassThru | Restore-DbaDatabase -SqlInstance Server2 \r\n-TrustDbBackupHistory\nIn this example we gather backup information, export it to an xml file, and then pass it on through to Restore-DbaDatabase.\r\nThis allows us to repeat the restore without having to scan all the backup files again\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-ChildItem c:\\backups\\ -recurse -files | Where-Object {$_.extension -in (\u0027.bak\u0027,\u0027.trn\u0027) -and $_.LastWriteTime -gt (get-date).AddMonths(-1)} | Get-DbaBackupInformation -SqlInstance Server1 \r\n-ExportPath C:\\backupHistory.xml\nThis lets you keep a record of all backup history from the last month on hand to speed up refreshes\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$Backups = Get-DbaBackupInformation -SqlInstance Server1 -Path \\\\network\\backups\nPS C:\\\u003e $Backups += Get-DbaBackupInformation -SqlInstance Server2 -NoXpDirTree -Path c:\\backups\nScan the unc folder \\\\network\\backups with Server1, and then scan the C:\\backups folder on\r\nServer2 not using xp_dirtree, adding the results to the first set.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$Backups = Get-DbaBackupInformation -SqlInstance Server1 -Path \\\\network\\backups -MaintenanceSolution\nWhen MaintenanceSolution is indicated we know we are dealing with the output from Ola Hallengren backup scripts. So we make sure that a FULL folder exists in the first level of Path, if not we \r\nshortcut scanning all the files as we have nothing to work with\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$Backups = Get-DbaBackupInformation -SqlInstance Server1 -Path \\\\network\\backups -MaintenanceSolution -IgnoreLogBackup\nAs we know we are dealing with an Ola Hallengren style backup folder from the MaintenanceSolution switch, when IgnoreLogBackup is also included we can ignore the LOG folder to skip any scanning of \r\nlog backups. Note this also means they WON\u0027T be restored", "Params": [ [ "Path", "Path to SQL Server backup files.\nPaths passed in as strings will be scanned using the desired method, default is a non recursive folder scan\r\nAccepts multiple paths separated by \u0027,\u0027\nOr it can consist of FileInfo objects, such as the output of Get-ChildItem or Get-Item. This allows you to work with\r\nyour own file structures as needed", "", true, "true (ByValue)", "", "" ], [ "SqlInstance", "The SQL Server instance to be used to read the headers of the backup files", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "DatabaseName", "An array of Database Names to filter by. If empty all databases are returned.", "", false, "false", "", "" ], [ "SourceInstance", "If provided only backup originating from this destination will be returned. This SQL instance will not be connected to or involved in this work", "", false, "false", "", "" ], [ "NoXpDirTree", "If specified, this switch will cause the files to be parsed as local files to the SQL Server Instance provided. Errors may be observed when the SQL Server Instance cannot access the files being \r\nparsed.", "", false, "false", "False", "" ], [ "NoXpDirRecurse", "If specified, this switch changes xp_dirtree behavior to not recurse the folder structure.", "", false, "false", "False", "" ], [ "DirectoryRecurse", "If specified the provided path/directory will be traversed (only applies if not using XpDirTree)", "", false, "false", "False", "" ], [ "EnableException", "Replaces user friendly yellow warnings with bloody red exceptions of doom!\r\nUse this if you want the function to throw terminating errors you want to catch.", "", false, "false", "False", "" ], [ "MaintenanceSolution", "This switch tells the function that the folder is the root of a Ola Hallengren backup folder", "", false, "false", "False", "" ], [ "IgnoreLogBackup", "This switch only works with the MaintenanceSolution switch. With an Ola Hallengren style backup we can be sure that the LOG folder contains only log backups and skip it.\r\nFor all other scenarios we need to read the file headers to be sure.", "", false, "false", "False", "" ], [ "IgnoreDiffBackup", "This switch only works with the MaintenanceSolution switch. With an Ola Hallengren style backup we can be sure that the DIFF folder contains only differential backups and skip it.\r\nFor all other scenarios we need to read the file headers to be sure.", "", false, "false", "False", "" ], [ "ExportPath", "If specified the output will export via CliXml format to the specified file. This allows you to store the backup history object for later usage, or move it between computers", "", false, "false", "", "" ], [ "AzureCredential", "The name of the SQL Server credential to be used if restoring from an Azure hosted backup", "", false, "false", "", "" ], [ "Import", "When specified along with a path the command will import a previously exported BackupHistory object from an xml file.", "", false, "false", "False", "" ], [ "Anonymise", "If specified we will output the results with ComputerName, InstanceName, Database, UserName, Paths, and Logical and Physical Names hashed out\r\nThis options is mainly for use if we need you to submit details for fault finding to the dbatools team", "Anonymize", false, "false", "False", "" ], [ "NoClobber", "If specified will stop Export from overwriting an existing file, the default is to overwrite", "", false, "false", "False", "" ], [ "PassThru", "When data is exported the cmdlet will return no other output, this switch means it will also return the normal output which can be then piped into another command", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaBackupInformation -Path \u003cObject[]\u003e -SqlInstance \u003cDbaInstanceParameter\u003e [-SqlCredential \u003cPSCredential\u003e] [-DatabaseName \u003cString[]\u003e] [-SourceInstance \u003cString[]\u003e] [-NoXpDirTree] [-NoXpDirRecurse] [-DirectoryRecurse] [-EnableException] [-MaintenanceSolution] [-IgnoreLogBackup] [-IgnoreDiffBackup] [-ExportPath \u003cString\u003e] [-AzureCredential \u003cString\u003e] [-Anonymise] [-NoClobber] [-PassThru] [\u003cCommonParameters\u003e]\nGet-DbaBackupInformation -Path \u003cObject[]\u003e [-DatabaseName \u003cString[]\u003e] [-SourceInstance \u003cString[]\u003e] [-EnableException] [-MaintenanceSolution] [-IgnoreLogBackup] [-IgnoreDiffBackup] [-ExportPath \u003cString\u003e] [-AzureCredential \u003cString\u003e] [-Import] [-Anonymise] [-NoClobber] [-PassThru] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaBuild", "Description": "Returns info about the specific build of a SQL instance, including the SP, the CU and the reference KB, wherever possible.\nIt also includes End Of Support dates as specified on Microsoft Life Cycle Policy", "Tags": "SqlBuild", "Synopsis": "Returns SQL Server Build infos on a SQL instance", "Alias": "Get-DbaBuildReference", "Author": "Simone Bizzotto (@niphold) | Friedrich Weinmann (@FredWeinmann)", "CommandName": "Get-DbaBuild", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaBuild", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaBuild -Build \"12.00.4502\"\nReturns information about a build identified by \"12.00.4502\" (which is SQL 2014 with SP1 and CU11)\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaBuild -Build \"12.00.4502\" -Update\nReturns information about a build trying to fetch the most up to date index online. When the online version is newer, the local one gets overwritten\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaBuild -Build \"12.0.4502\",\"10.50.4260\"\nReturns information builds identified by these versions strings\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlserver2014a | Get-DbaBuild\nIntegrate with other cmdlets to have builds checked for all your registered servers on sqlserver2014a", "Params": [ [ "Build", "Instead of connecting to a real instance, pass a string identifying the build to get the info back.", "", false, "false", "", "" ], [ "Kb", "Get a KB information based on its number. Supported format: KBXXXXXX, or simply XXXXXX.", "", false, "false", "", "" ], [ "MajorVersion", "Get a KB information based on SQL Server version. Can be refined further by -ServicePack and -CumulativeUpdate parameters.\r\nExamples: SQL2008 | 2008R2 | 2016", "", false, "false", "", "" ], [ "ServicePack", "Get a KB information based on SQL Server Service Pack version. Can be refined further by -CumulativeUpdate parameter.\r\nExamples: SP0 | 2 | RTM", "SP", false, "false", "RTM", "" ], [ "CumulativeUpdate", "Get a KB information based on SQL Server Cumulative Update version.\r\n Examples: CU0 | CU13 | CU0", "CU", false, "false", "", "" ], [ "SqlInstance", "Target any number of instances, in order to return their build state.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Update", "Adding this switch will look online for the most up to date reference, optionally replacing the local one.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaBuild [[-Build] \u003cVersion[]\u003e] [[-Kb] \u003cString[]\u003e] [[-MajorVersion] \u003cString\u003e] [[-ServicePack] \u003cString\u003e] [[-CumulativeUpdate] \u003cString\u003e] [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [-Update] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaClientAlias", "Description": "Gets SQL Server alias by reading HKLM:\\SOFTWARE\\Microsoft\\MSSQLServer\\Client", "Tags": [ "Server", "Management" ], "Synopsis": "Gets any SQL Server alias for the specified server(s)", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaClientAlias", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaClientAlias", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaClientAlias\nGets all SQL Server client aliases on the local computer\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaClientAlias -ComputerName workstationx\nGets all SQL Server client aliases on Workstationx\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaClientAlias -ComputerName workstationx -Credential ad\\sqldba\nLogs into workstationx as ad\\sqldba then retrieves all SQL Server client aliases on Workstationx\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e\u0027Server1\u0027, \u0027Server2\u0027 | Get-DbaClientAlias\nGets all SQL Server client aliases on Server1 and Server2", "Params": [ [ "ComputerName", "The target computer where the alias has been created", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to remote computers using alternative credentials", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaClientAlias [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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": [ "Server", "Management" ], "Synopsis": "Gets the SQL Server related client protocols on a computer.", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDBAKlaas)", "CommandName": "Get-DbaClientProtocol", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaClientProtocol", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaClientProtocol -ComputerName sqlserver2014a\nGets the SQL Server related client protocols on computer sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\u0027,\u0027sql3\u0027 | Get-DbaClientProtocol\nGets the SQL Server related client protocols on computers sql1, sql2 and sql3.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaClientProtocol -ComputerName sql1,sql2 | Out-GridView\nGets the SQL Server related client protocols on computers sql1 and sql2, and shows them in a grid view.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e(Get-DbaClientProtocol -ComputerName sql2 | Where-Object { $_.DisplayName -eq \u0027Named Pipes\u0027 }).Disable()\nDisables the VIA ClientNetworkProtocol on computer sql2.\r\nIf successful, return code 0 is shown.", "Params": [ [ "ComputerName", "The target SQL Server instance or instances.", "cn,host,Server", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Credential object used to connect to the computer as a different user.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaClientProtocol [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaCmConnection", "Description": "Retrieves windows management connections from the cache", "Tags": [ "ComputerManagement", "CIM" ], "Synopsis": "Retrieves windows management connections from the cache", "Alias": "", "Author": "Friedrich Weinmann (@FredWeinmann)", "CommandName": "Get-DbaCmConnection", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaCmConnection", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaCmConnection\nList all cached connections.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaCmConnection sql2014\nList the cached connection - if any - to the server sql2014.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaCmConnection -UserName \"*charles*\"\nList all cached connection that use a username containing \"charles\" as default or override credentials.", "Params": [ [ "ComputerName", "The computername to ComputerName for.", "Filter", false, "true (ByValue)", "*", "" ], [ "UserName", "Username on credentials to look for. Will not find connections using the default windows credentials.", "", false, "false", "*", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaCmConnection [[-ComputerName] \u003cString[]\u003e] [[-UserName] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaCmObject", "Description": "This function centralizes all requests for information retrieved from Get-WmiObject or Get-CimInstance.\nIt uses different protocols as available in this order:\n- Cim over WinRM\n- Cim over DCOM\n- Wmi\n- Wmi over PowerShell Remoting\nIt remembers channels that didn\u0027t work and will henceforth avoid them. It remembers invalid credentials and will avoid reusing them.\nMuch of its behavior can be configured using Test-DbaCmConnection.", "Tags": [ "ComputerManagement", "CIM" ], "Synopsis": "Retrieves Wmi/Cim-Style information from computers.", "Alias": "", "Author": "Friedrich Weinmann (@FredWeinmann)", "CommandName": "Get-DbaCmObject", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaCmObject", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaCmObject win32_OperatingSystem\nRetrieves the common operating system information from the local computer.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaCmObject -Computername \"sql2014\" -ClassName Win32_OperatingSystem -Credential $cred -DoNotUse CimRM\nRetrieves the common operating system information from the server sql2014.\r\nIt will use the Credentials stored in $cred to connect, unless they are known to not work, in which case they will default to windows credentials (unless another default has been set).", "Params": [ [ "ClassName", "The name of the class to retrieve.", "Class", true, "false", "", "" ], [ "Query", "The Wmi/Cim query to run against the server.", "", true, "false", "", "" ], [ "ComputerName", "The computer(s) to connect to. Defaults to localhost.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Credentials to use. Invalid credentials will be stored in a credentials cache and not be reused.", "", false, "false", "", "" ], [ "Namespace", "The namespace of the class to use.", "", false, "false", "root\\cimv2", "" ], [ "DoNotUse", "Connection Protocols that should not be used.", "", false, "false", "None", "" ], [ "Force", "Overrides some checks that might otherwise halt execution as a precaution\r\n- Ignores timeout on bad connections", "", false, "false", "False", "" ], [ "SilentlyContinue", "Use in conjunction with the -EnableException switch.\r\nBy default, Get-DbaCmObject will throw a terminating exception when connecting to a target is impossible in exception enabled mode.\r\nSetting this switch will cause it write a non-terminating exception and continue with the next computer.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaCmObject [-ClassName] \u003cString\u003e [-ComputerName \u003cDbaCmConnectionParameter[]\u003e] [-Credential \u003cPSCredential\u003e] [-Namespace \u003cString\u003e] [-DoNotUse {None | CimRM | CimDCOM | Wmi | PowerShellRemoting}] [-Force] [-SilentlyContinue] [-EnableException] [\u003cCommonParameters\u003e]\nGet-DbaCmObject -Query \u003cString\u003e [-ComputerName \u003cDbaCmConnectionParameter[]\u003e] [-Credential \u003cPSCredential\u003e] [-Namespace \u003cString\u003e] [-DoNotUse {None | CimRM | CimDCOM | Wmi | PowerShellRemoting}] [-Force] [-SilentlyContinue] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaComputerCertificate", "Description": "Gets computer certificates on localhost that are candidates for using with SQL Server\u0027s network encryption", "Tags": "Certificate", "Synopsis": "Simplifies finding computer certificates that are candidates for using with SQL Server\u0027s network encryption", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaComputerCertificate", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaComputerCertificate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaComputerCertificate\nGets computer certificates on localhost that are candidates for using with SQL Server\u0027s network encryption\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaComputerCertificate -ComputerName sql2016\nGets computer certificates on sql2016 that are candidates for using with SQL Server\u0027s network encryption\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaComputerCertificate -ComputerName sql2016 -Thumbprint 8123472E32AB412ED4288888B83811DB8F504DED, 04BFF8B3679BB01A986E097868D8D494D70A46D6\nGets computer certificates on sql2016 that match thumbprints 8123472E32AB412ED4288888B83811DB8F504DED or 04BFF8B3679BB01A986E097868D8D494D70A46D6", "Params": [ [ "ComputerName", "The target SQL Server instance or instances. Defaults to localhost. If target is a cluster, you must specify the distinct nodes.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to $ComputerName using alternative credentials.", "", false, "false", "", "" ], [ "Store", "Certificate store - defaults to LocalMachine", "", false, "false", "LocalMachine", "" ], [ "Folder", "Certificate folder - defaults to My (Personal)", "", false, "false", "My", "" ], [ "Type", "The type of certificates to return. All or Service. Default is Service since this is SQL specific.", "", false, "false", "Service", "All,Service" ], [ "Path", "The path to a certificate - basically changes the path into a certificate object", "", false, "false", "", "" ], [ "Thumbprint", "Return certificate based on thumbprint", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaComputerCertificate [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-Store] \u003cString[]\u003e] [[-Folder] \u003cString[]\u003e] [[-Type] \u003cString\u003e] [[-Path] \u003cString\u003e] [[-Thumbprint] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaComputerSystem", "Description": "Gets computer system information from the server and returns as an object.", "Tags": [ "Server", "Management" ], "Synopsis": "Gets computer system information from the server.", "Alias": "", "Author": "Shawn Melton (@wsmelton), https://wsmelton.github.io", "CommandName": "Get-DbaComputerSystem", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaComputerSystem", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaComputerSystem\nReturns information about the local computer\u0027s computer system\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaComputerSystem -ComputerName sql2016\nReturns information about the sql2016\u0027s computer system\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaComputerSystem -ComputerName sql2016 -IncludeAws\nReturns information about the sql2016\u0027s computer system and includes additional properties around the EC2 instance.", "Params": [ [ "ComputerName", "Target computer(s). If no computer name is specified, the local computer is targeted", "cn,host,Server", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Alternate credential object to use for accessing the target computer(s).", "", false, "false", "", "" ], [ "IncludeAws", "If computer is hosted in AWS Infrastructure as a Service (IaaS), additional information will be included.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaComputerSystem [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-IncludeAws] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaConnectedInstance", "Description": "Get a list of all connected instances", "Tags": "Connection", "Synopsis": "Get a list of all connected instances", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaConnectedInstance", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaConnectedInstance", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaConnectedInstance\nGets all connected SQL Server instances\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaConnectedInstance | Select *\nGets all connected SQL Server instances and shows the associated connectionstrings as well", "Params": [ ], "Syntax": "Get-DbaConnectedInstance [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaConnection", "Description": "Returns a bunch of information from dm_exec_connections which, according to Microsoft:\n\"Returns information about the connections established to this instance of SQL Server and the details of each connection. Returns server wide connection information for SQL Server. Returns current database connection information for SQL Database.\"", "Tags": "Connection", "Synopsis": "Returns a bunch of information from dm_exec_connections.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaConnection", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaConnection", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaConnection -SqlInstance sql2016, sql2017\nReturns client connection information from sql2016 and sql2017", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server(s) must be SQL Server 2005 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "Credential,Cred", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaConnection [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaCpuRingBuffer", "Description": "This command is based off of Glen Berry\u0027s diagnostic query for average CPU\n\nThe sys.dm_os_ring_buffers stores the average CPU utilization history\nby the current instance of SQL Server, plus the summed average CPU utilization\nby all other processes on your machine are captured in one minute increments\nfor the past 256 minutes.\n\nReference: https://www.sqlskills.com/blogs/glenn/sql-server-diagnostic-information-queries-detailed-day-16//", "Tags": "CPU", "Synopsis": "Collects CPU data from sys.dm_os_ring_buffers. Works on SQL Server 2005 and above.", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaCpuRingBuffer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaCpuRingBuffer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaCpuRingBuffer -SqlInstance sql2008, sqlserver2012\nGets CPU Statistics from sys.dm_os_ring_buffers for servers sql2008 and sqlserver2012 for last 60 minutes.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaCpuRingBuffer -SqlInstance sql2008 -CollectionMinutes 240\nGets CPU Statistics from sys.dm_os_ring_buffers for server sql2008 for last 240 minutes\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$output = Get-DbaCpuRingBuffer -SqlInstance sql2008 -CollectionMinutes 240 | Select-Object * | ConvertTo-DbaDataTable\nGets CPU Statistics from sys.dm_os_ring_buffers for server sql2008 for last 240 minutes into a Data Table.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e\u0027sql2008\u0027,\u0027sql2012\u0027 | Get-DbaCpuRingBuffer\nGets CPU Statistics from sys.dm_os_ring_buffers for servers sql2008 and sqlserver2012\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Get-DbaCpuRingBuffer -SqlInstance sql2008 -SqlCredential $cred\nConnects using sqladmin credential and returns CPU Statistics from sys.dm_os_ring_buffers from sql2008", "Params": [ [ "SqlInstance", "Allows you to specify a comma separated list of servers to query.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance. To use:\r\n$cred = Get-Credential, this pass this $cred to the param.\nWindows Authentication will be used if DestinationSqlCredential is not specified. To connect as a different Windows user, run PowerShell as that user.", "", false, "false", "", "" ], [ "CollectionMinutes", "Allows you to specify a Collection Period in Minutes. Default is 60 minutes", "", false, "false", "60", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaCpuRingBuffer [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-CollectionMinutes] \u003cInt32\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaCpuUsage", "Description": "\"If there are a lot of processes running on your instance and the CPU is very high,\nthen it\u0027s hard to find the exact process eating up your CPU using just the SQL Server\ntools. One way to correlate the data between what is running within SQL Server and at\nthe Windows level is to use SPID and KPID values to get the exact process.\"\n\nThis command automates that process.\n\nReferences: https://www.mssqltips.com/sqlservertip/2454/how-to-find-out-how-much-cpu-a-sql-server-process-is-really-using/\n\nNote: This command returns results from all SQL instances on the destination server but the process\ncolumn is specific to -SqlInstance passed.", "Tags": "CPU", "Synopsis": "Provides detailed CPU usage information about a SQL Server\u0027s process", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaCpuUsage", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaCpuUsage", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaCpuUsage -SqlInstance sql2017\nLogs into the SQL Server instance \"sql2017\" and also the Computer itself (via WMI) to gather information\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$usage = Get-DbaCpuUsage -SqlInstance sql2017\nPS C:\\\u003e $usage.Process\nExplores the processes (from Get-DbaProcess) associated with the usage results\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaCpuUsage -SqlInstance sql2017 -SqlCredential sqladmin -Credential ad\\sqldba\nLogs into the SQL instance using the SQL Login \u0027sqladmin\u0027 and then Windows instance as \u0027ad\\sqldba\u0027", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Credential", "Allows you to login to the Windows Server using alternative credentials.", "", false, "false", "", "" ], [ "Threshold", "CPU threshold.", "", false, "false", "0", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaCpuUsage [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [[-Threshold] \u003cInt32\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaCredential", "Description": "The Get-DbaCredential command gets SQL Credential information for each instance(s) of SQL Server.", "Tags": "Credential", "Synopsis": "Gets SQL Credential information for each instance(s) of SQL Server.", "Alias": "", "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com", "CommandName": "Get-DbaCredential", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaCredential", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaCredential -SqlInstance localhost\nReturns all SQL Credentials on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaCredential -SqlInstance localhost, sql2016 -Name \u0027PowerShell Proxy\u0027\nReturns the SQL Credentials named \u0027PowerShell Proxy\u0027 for the local and sql2016 SQL Server instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaCredential -SqlInstance localhost, sql2016 -Identity ad\\powershell\nReturns the SQL Credentials for the account \u0027ad\\powershell\u0027 on the local and sql2016 SQL Server instances", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "Only include specific names\r\nNote: if spaces exist in the credential name, you will have to type \"\" or \u0027\u0027 around it.", "", false, "false", "", "" ], [ "ExcludeName", "Excluded credential names", "", false, "false", "", "" ], [ "Identity", "Only include specific identities\r\nNote: if spaces exist in the credential identity, you will have to type \"\" or \u0027\u0027 around it.", "CredentialIdentity", false, "false", "", "" ], [ "ExcludeIdentity", "Excluded identities", "ExcludeCredentialIdentity", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaCredential [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString[]\u003e] [[-ExcludeName] \u003cString[]\u003e] [[-Identity] \u003cString[]\u003e] [[-ExcludeIdentity] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaCustomError", "Description": "The Get-DbaCustomError command gets SQL Custom Error Message information for each instance(s) of SQL Server.", "Tags": [ "Error", "CustomError" ], "Synopsis": "Gets SQL Custom Error Message information for each instance(s) of SQL Server.", "Alias": "", "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com", "CommandName": "Get-DbaCustomError", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaCustomError", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaCustomError -SqlInstance localhost\nReturns all Custom Error Message(s) on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaCustomError -SqlInstance localhost, sql2016\nReturns all Custom Error Message(s) for the local and sql2016 SQL Server instances", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaCustomError [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDatabase", "Description": "The Get-DbaDatabase command gets SQL database information for each database that is present on the target instance(s) of\nSQL Server. If the name of the database is provided, the command will return only the specific database information.", "Tags": "Database", "Synopsis": "Gets SQL Database information for each database that is present on the target instance(s) of SQL Server.", "Alias": "", "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com | Klaas Vandenberghe (@PowerDbaKlaas) | Simone Bizzotto ( @niphlod )", "CommandName": "Get-DbaDatabase", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDatabase", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance localhost\nReturns all databases on the local default SQL Server instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance localhost -ExcludeUser\nReturns only the system databases on the local default SQL Server instance.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance localhost -ExcludeSystem\nReturns only the user databases on the local default SQL Server instance.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e\u0027localhost\u0027,\u0027sql2016\u0027 | Get-DbaDatabase\nReturns databases on multiple instances piped into the function.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance SQL1\\SQLExpress -RecoveryModel full,Simple\nReturns only the user databases in Full or Simple recovery model from SQL Server instance SQL1\\SQLExpress.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance SQL1\\SQLExpress -Status Normal\nReturns only the user databases with status \u0027normal\u0027 from SQL Server instance SQL1\\SQLExpress.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance SQL1\\SQLExpress -IncludeLastUsed\nReturns the databases from SQL Server instance SQL1\\SQLExpress and includes the last used information\r\nfrom the sys.dm_db_index_usage_stats DMV.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance SQL1\\SQLExpress,SQL2 -ExcludeDatabase model,master\nReturns all databases except master and model from SQL Server instances SQL1\\SQLExpress and SQL2.\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance SQL1\\SQLExpress,SQL2 -Encrypted\nReturns only databases using TDE from SQL Server instances SQL1\\SQLExpress and SQL2.\n-------------------------- EXAMPLE 10 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance SQL1\\SQLExpress,SQL2 -Access ReadOnly\nReturns only read only databases from SQL Server instances SQL1\\SQLExpress and SQL2.\n-------------------------- EXAMPLE 11 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance SQL2,SQL3 -Database OneDB,OtherDB\nReturns databases \u0027OneDb\u0027 and \u0027OtherDB\u0027 from SQL Server instances SQL2 and SQL3 if databases by those names exist on those instances.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies one or more database(s) to process. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies one or more database(s) to exclude from processing.", "", false, "false", "", "" ], [ "ExcludeUser", "If this switch is enabled, only databases which are not User databases will be processed.\nThis parameter cannot be used with -ExcludeSystem.", "SystemDbOnly,NoUserDb,ExcludeAllUserDb", false, "false", "False", "" ], [ "ExcludeSystem", "If this switch is enabled, only databases which are not System databases will be processed.\nThis parameter cannot be used with -ExcludeUser.", "UserDbOnly,NoSystemDb,ExcludeAllSystemDb", false, "false", "False", "" ], [ "Owner", "Specifies one or more database owners. Only databases owned by the listed owner(s) will be returned.", "", false, "false", "", "" ], [ "Encrypted", "If this switch is enabled, only databases which have Transparent Data Encryption (TDE) enabled will be returned.", "", false, "false", "False", "" ], [ "Status", "Specifies one or more database statuses to filter on. Only databases in the status(es) listed will be returned. Valid options for this parameter are \u0027Emergency\u0027, \u0027Normal\u0027, \u0027Offline\u0027, \u0027Recovering\u0027, \r\n\u0027Restoring\u0027, \u0027Standby\u0027, and \u0027Suspect\u0027.", "", false, "false", "@(\u0027EmergencyMode\u0027, \u0027Normal\u0027, \u0027Offline\u0027, \u0027Recovering\u0027, \u0027Restoring\u0027, \u0027Standby\u0027, \u0027Suspect\u0027)", "EmergencyMode,Normal,Offline,Recovering,Restoring,Standby,Suspect" ], [ "Access", "Filters databases returned by their access type. Valid options for this parameter are \u0027ReadOnly\u0027 and \u0027ReadWrite\u0027. If omitted, no filtering is performed.", "", false, "false", "", "ReadOnly,ReadWrite" ], [ "RecoveryModel", "Filters databases returned by their recovery model. Valid options for this parameter are \u0027Full\u0027, \u0027Simple\u0027, and \u0027BulkLogged\u0027.", "", false, "false", "@(\u0027Full\u0027, \u0027Simple\u0027, \u0027BulkLogged\u0027)", "Full,Simple,BulkLogged" ], [ "NoFullBackup", "If this switch is enabled, only databases without a full backup recorded by SQL Server will be returned. This will also indicate which of these databases only have CopyOnly full backups.", "", false, "false", "False", "" ], [ "NoFullBackupSince", "Only databases which haven\u0027t had a full backup since the specified DateTime will be returned.", "", false, "false", "", "" ], [ "NoLogBackup", "If this switch is enabled, only databases without a log backup recorded by SQL Server will be returned. This will also indicate which of these databases only have CopyOnly log backups.", "", false, "false", "False", "" ], [ "NoLogBackupSince", "Only databases which haven\u0027t had a log backup since the specified DateTime will be returned.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "IncludeLastUsed", "If this switch is enabled, the last used read \u0026 write times for each database will be returned. This data is retrieved from sys.dm_db_index_usage_stats which is reset when SQL Server is restarted.", "", false, "false", "False", "" ], [ "OnlyAccessible", "If this switch is enabled, only accessible databases are returned (huge speedup in SMO enumeration)", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDatabase [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [-ExcludeUser] [-ExcludeSystem] [[-Owner] \u003cString[]\u003e] [-Encrypted] [[-Status] \u003cString[]\u003e] [[-Access] \u003cString\u003e] [[-RecoveryModel] \u003cString[]\u003e] [-NoFullBackup] [[-NoFullBackupSince] \u003cDateTime\u003e] [-NoLogBackup] [[-NoLogBackupSince] \u003cDateTime\u003e] [-EnableException] [-IncludeLastUsed] [-OnlyAccessible] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbAssembly", "Description": "The Get-DbaDbAssembly command gets SQL Database Assembly information for each instance(s) of SQL Server.", "Tags": [ "Assembly", "Database" ], "Synopsis": "Gets SQL Database Assembly information for each instance(s) of SQL Server.", "Alias": "", "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com", "CommandName": "Get-DbaDbAssembly", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbAssembly", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbAssembly -SqlInstance localhost\nReturns all Database Assembly on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbAssembly -SqlInstance localhost, sql2016\nReturns all Database Assembly for the local and sql2016 SQL Server instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbAssembly -SqlInstance Server1 -Database MyDb -Name MyTechCo.Houids.SQLCLR\nWill fetch details for the MyTechCo.Houids.SQLCLR assembly in the MyDb Database on the Server1 instance", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specify a Database to be checked for assembly. If not specified, all databases in the specified Instance(s) will be checked", "", false, "false", "", "" ], [ "Name", "Specify an Assembly to be fetched. If not specified all Assemblies will be returned", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong, we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbAssembly [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-Name] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbAsymmetricKey", "Description": "Gets database Asymmetric Key", "Tags": "AsymmetricKey", "Synopsis": "Gets database Asymmetric Key", "Alias": "", "Author": "Stuart Moore (@napalmgram), stuart-moore.com", "CommandName": "Get-DbaDbAsymmetricKey", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbAsymmetricKey", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbAsymmetricKey -SqlInstance sql2016\nGets all Asymmetric Keys\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbAsymmetricKey -SqlInstance Server1 -Database db1\nGets the Asymmetric Keys for the db1 database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbAsymmetricKey -SqlInstance Server1 -Database db1 -Name key1\nGets the key1 Asymmetric Key within the db1 database", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Get Asymmetric Keys from specific database", "", false, "false", "", "" ], [ "ExcludeDatabase", "Database(s) to ignore when retrieving Asymmetric Keys", "", false, "false", "", "" ], [ "Name", "Get specific Asymmetric Key by name", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbAsymmetricKey [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-Name] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbBackupHistory", "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\nBackups taken with the CopyOnly option will NOT be returned, unless the IncludeCopyOnly switch is present.\n\nReference: http://www.sqlhub.com/2011/07/find-your-backup-history-in-sql-server.html", "Tags": [ "DisasterRecovery", "Backup" ], "Synopsis": "Returns backup history details for databases on a SQL Server.", "Alias": "", "Author": "Chrissy LeMaire (@cl) | Stuart Moore (@napalmgram)", "CommandName": "Get-DbaDbBackupHistory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbBackupHistory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbBackupHistory -SqlInstance SqlInstance2014a\nReturns server name, database, username, backup type, date for all database backups still in msdb history on SqlInstance2014a. This may return many rows; consider using filters that are included in \r\nother examples.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nGet-DbaDbBackupHistory -SqlInstance SqlInstance2014a -SqlCredential $cred\nDoes the same as above but connect to SqlInstance2014a as SQL user \"sqladmin\"\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbBackupHistory -SqlInstance SqlInstance2014a -Database db1, db2 -Since \u00272016-07-01 10:47:00\u0027\nReturns backup information only for databases db1 and db2 on SqlInstance2014a since July 1, 2016 at 10:47 AM.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbBackupHistory -SqlInstance sql2014 -Database AdventureWorks2014, pubs -Force | Format-Table\nReturns information only for AdventureWorks2014 and pubs and formats the results as a table.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDbBackupHistory -SqlInstance sql2014 -Database AdventureWorks2014 -Last\nReturns information about the most recent full, differential and log backups for AdventureWorks2014 on sql2014.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaDbBackupHistory -SqlInstance sql2014 -Database AdventureWorks2014 -Last -DeviceType Disk\nReturns information about the most recent full, differential and log backups for AdventureWorks2014 on sql2014, but only for backups to disk.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaDbBackupHistory -SqlInstance sql2014 -Database AdventureWorks2014 -Last -DeviceType 148,107\nReturns information about the most recent full, differential and log backups for AdventureWorks2014 on sql2014, but only for backups with device_type 148 and 107.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eGet-DbaDbBackupHistory -SqlInstance sql2014 -Database AdventureWorks2014 -LastFull\nReturns information about the most recent full backup for AdventureWorks2014 on sql2014.\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eGet-DbaDbBackupHistory -SqlInstance sql2014 -Database AdventureWorks2014 -Type Full\nReturns information about all Full backups for AdventureWorks2014 on sql2014.\n-------------------------- EXAMPLE 10 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sql2016 | Get-DbaDbBackupHistory\nReturns database backup information for every database on every server listed in the Central Management Server on sql2016.\n-------------------------- EXAMPLE 11 --------------------------\nPS C:\\\u003eGet-DbaDbBackupHistory -SqlInstance SqlInstance2014a, sql2016 -Force\nReturns detailed backup history for all databases on SqlInstance2014a and sql2016.\n-------------------------- EXAMPLE 12 --------------------------\nPS C:\\\u003eGet-DbaDbBackupHistory -SqlInstance sql2016 -Database db1 -RecoveryFork 38e5e84a-3557-4643-a5d5-eed607bef9c6 -Last\nIf db1 has multiple recovery forks, specifying the RecoveryFork GUID will restrict the search to that fork.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Credential object used to connect to the SQL Server instance as a different user. This can be a Windows or SQL Server account. Windows users are determined by the existence of a backslash, so if you \r\nare intending to use an alternative Windows connection instead of a SQL login, ensure it contains a backslash.", "", false, "false", "", "" ], [ "Database", "Specifies one or more database(s) to process. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies one or more database(s) to exclude from processing.", "", false, "false", "", "" ], [ "IncludeCopyOnly", "By default Get-DbaDbBackupHistory will ignore backups taken with the CopyOnly option. This switch will include them.", "", false, "false", "False", "" ], [ "Force", "If this switch is enabled, a large amount of information is returned, similar to what SQL Server itself returns.", "", false, "false", "False", "" ], [ "Since", "Specifies a DateTime object to use as the starting point for the search for backups.", "", false, "false", "(Get-Date \u002701/01/1970\u0027)", "" ], [ "RecoveryFork", "Specifies the Recovery Fork you want backup history for.", "", false, "false", "", "" ], [ "Last", "If this switch is enabled, the most recent full chain of full, diff and log backup sets is returned.", "", false, "false", "False", "" ], [ "LastFull", "If this switch is enabled, the most recent full backup set is returned.", "", false, "false", "False", "" ], [ "LastDiff", "If this switch is enabled, the most recent differential backup set is returned.", "", false, "false", "False", "" ], [ "LastLog", "If this switch is enabled, the most recent log backup is returned.", "", false, "false", "False", "" ], [ "DeviceType", "Specifies a filter for backup sets based on DeviceType. Valid options are \u0027Disk\u0027,\u0027Permanent Disk Device\u0027, \u0027Tape\u0027, \u0027Permanent Tape Device\u0027,\u0027Pipe\u0027,\u0027Permanent Pipe Device\u0027,\u0027Virtual Device\u0027,\u0027URL\u0027, in \r\naddition to custom integers for your own DeviceType.", "", false, "false", "", "" ], [ "Raw", "If this switch is enabled, one object per backup file is returned. Otherwise, media sets (striped backups across multiple files) will be grouped into a single return object.", "", false, "false", "False", "" ], [ "LastLsn", "Specifies a minimum LSN to use in filtering backup history. Only backups with an LSN greater than this value will be returned, which helps speed the retrieval process.", "", false, "false", "", "" ], [ "IncludeMirror", "By default mirrors of backups are not returned, this switch will cause them to be returned.", "", false, "false", "False", "" ], [ "Type", "Specifies one or more types of backups to return. Valid options are \u0027Full\u0027, \u0027Log\u0027, \u0027Differential\u0027, \u0027File\u0027, \u0027Differential File\u0027, \u0027Partial Full\u0027, and \u0027Partial Differential\u0027. Otherwise, all types of \r\nbackups will be returned unless one of the -Last* switches is enabled.", "", false, "false", "", "Full,Log,Differential,File,Differential File,Partial Full,Partial Differential" ], [ "AgCheck", "Deprecated. The functionality to also get the history from all replicas if SqlInstance is part on an availability group has been moved to Get-DbaAgBackupHistory.", "", false, "false", "False", "" ], [ "IgnoreDiffBackup", "When this switch is enabled, Differential backups will be ignored.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbBackupHistory -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-IncludeCopyOnly] [-Since \u003cDateTime\u003e] [-RecoveryFork \u003cString\u003e] [-Last] [-LastFull] [-LastDiff] [-LastLog] [-DeviceType \u003cString[]\u003e] [-Raw] [-LastLsn \u003cBigInteger\u003e] [-IncludeMirror] [-Type \u003cString[]\u003e] [-AgCheck] [-IgnoreDiffBackup] [-EnableException] [\u003cCommonParameters\u003e]\nGet-DbaDbBackupHistory -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-IncludeCopyOnly] [-Force] [-Since \u003cDateTime\u003e] [-RecoveryFork \u003cString\u003e] [-Last] [-LastFull] [-LastDiff] [-LastLog] [-DeviceType \u003cString[]\u003e] [-Raw] [-LastLsn \u003cBigInteger\u003e] [-IncludeMirror] [-Type \u003cString[]\u003e] [-AgCheck] [-IgnoreDiffBackup] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbccHelp", "Description": "Returns the results of DBCC HELP\n\nRead more:\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-help-transact-sql", "Tags": "DBCC", "Synopsis": "Execution of Database Console Command DBCC HELP", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaDbccHelp", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbccHelp", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbccHelp -SqlInstance SQLInstance -Statement FREESYSTEMCACHE -Verbose | Format-List\nRuns the command DBCC HELP(FREESYSTEMCACHE) WITH NO_INFOMSGS against the SQL Server instance SQLInstance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbccHelp -SqlInstance LensmanSB -Statement WritePage -IncludeUndocumented | Format-List\nSets TraeFlag 2588 on for session and then runs the command DBCC HELP(WritePage) WITH NO_INFOMSGS against the SQL Server instance SQLInstance", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Statement", "Is the name of the DBCC command for which to receive syntax information.\r\nProvide only the part of the DBCC command that follows DBCC,\r\n for example, CHECKDB instead of DBCC CHECKDB.", "", false, "false", "", "" ], [ "IncludeUndocumented", "Allows getting help for undocumented DBCC commands. Requires Traceflag 2588\r\nThis only works for SQL Server 2005 or Higher", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbccHelp [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Statement] \u003cString\u003e] [-IncludeUndocumented] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbccMemoryStatus", "Description": "This command is used to run the DBCC MEMORYSTATUS comand and collect results in a single usable recordset\n\nReference:\n - https://blogs.msdn.microsoft.com/timchapman/2012/08/16/how-to-parse-dbcc-memorystatus-via-powershell/\n - https://support.microsoft.com/en-us/help/907877/how-to-use-the-dbcc-memorystatus-command-to-monitor-memory-usage-on-sq", "Tags": [ "DBCC", "Memory" ], "Synopsis": "Gets the results of DBCC MEMORYSTATUS. Works on SQL Server 2000-2019.", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaDbccMemoryStatus", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbccMemoryStatus", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbccMemoryStatus -SqlInstance sqlcluster, sqlserver2012\nGet output of DBCC MEMORYSTATUS for instances \"sqlcluster\" and \"sqlserver2012\". Returns results in a single recordset.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlcluster | Get-DbaDbccMemoryStatus\nGet output of DBCC MEMORYSTATUS for all servers in Server Central Management Server", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbccMemoryStatus [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbccProcCache", "Description": "Returns the results of DBCC PROCCACHE\n\nRead more:\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-proccache-transact-sql", "Tags": "DBCC", "Synopsis": "Execution of Database Console Command DBCC PROCCACHE", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaDbccProcCache", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbccProcCache", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbccProcCache -SqlInstance Server1\nGet results of DBCC PROCCACHE for Instance Server1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbccProcCache\nGet results of DBCC PROCCACHE for Instances Sql1 and Sql2/sqlexpress\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Get-DbaDbccProcCache -SqlInstance Server1 -SqlCredential $cred\nConnects using sqladmin credential and gets results of DBCC PROCCACHE for Instance Server1", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbccProcCache [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbccSessionBuffer", "Description": "Returns the results of DBCC INPUTBUFFER or DBCC OUTPUTBUFFER for input sessions\n\nRead more:\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-inputbuffer-transact-sql\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-outputbuffer-transact-sql", "Tags": "DBCC", "Synopsis": "Gets result of Database Console Command DBCC INPUTBUFFER or DBCC OUTPUTBUFFER", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaDbccSessionBuffer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbccSessionBuffer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbccSessionBuffer -SqlInstance Server1 -Operation InputBuffer -SessionId 51\nGet results of DBCC INPUTBUFFER(51) for Instance Server1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbccSessionBuffer -SqlInstance Server1 -Operation OutputBuffer -SessionId 51, 52\nGet results of DBCC OUTPUTBUFFER for SessionId\u0027s 51 and 52 for Instance Server1\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbccSessionBuffer -SqlInstance Server1 -Operation InputBuffer -SessionId 51 -RequestId 0\nGet results of DBCC INPUTBUFFER(51,0) for Instance Server1\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbccSessionBuffer -SqlInstance Server1 -Operation OutputBuffer -SessionId 51 -RequestId 0\nGet results of DBCC OUTPUTBUFFER(51,0) for Instance Server1\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbccSessionBuffer -Operation InputBuffer -All\nGet results of DBCC INPUTBUFFER for all user sessions for the instances Sql1 and Sql2/sqlexpress\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbccSessionBuffer -Operation OutputBuffer -All\nGet results of DBCC OUTPUTBUFFER for all user sessions for the instances Sql1 and Sql2/sqlexpress\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Get-DbaDbccSessionBuffer -SqlInstance Server1 -SqlCredential $cred -Operation InputBuffer -SessionId 51 -RequestId 0\nConnects using sqladmin credential and gets results of DBCC INPUTBUFFER(51,0) for Instance Server1\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Get-DbaDbccSessionBuffer -SqlInstance Server1 -SqlCredential $cred -Operation OutputBuffer -SessionId 51 -RequestId 0\nConnects using sqladmin credential and gets results of DBCC OUTPUTBUFFER(51,0) for Instance Server1", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Operation", "DBCC Operation to execute - either InputBuffer or OutputBuffer", "", false, "false", "InputBuffer", "InputBuffer,OutputBuffer" ], [ "SessionId", "The Session ID(s) to use to get current input or output buffer.", "", false, "false", "", "" ], [ "RequestId", "Is the exact request (batch) to search for within the current session\r\nThe following query returns request_id:\nSELECT request_id\r\nFROM sys.dm_exec_requests\r\nWHERE session_id = @@spid;", "", false, "false", "0", "" ], [ "All", "If this switch is enabled, results for all User Sessions will be retreived\r\nThis overides any values for SessionId or RequestId", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbccSessionBuffer [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Operation] \u003cString\u003e] [[-SessionId] \u003cInt32[]\u003e] [[-RequestId] \u003cInt32\u003e] [-All] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbccStatistic", "Description": "Executes the command DBCC SHOW_STATISTICS against defined objects and returns results\n\nReclaims space from dropped variable-length columns in tables or indexed views\n\nRead more:\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-cleantable-transact-sql", "Tags": [ "DBCC", "Statistics" ], "Synopsis": "Execution of Database Console Command DBCC SHOW_STATISTICS", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaDbccStatistic", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbccStatistic", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbccStatistic -SqlInstance SQLServer2017\nWill run the statement SHOW_STATISTICS WITH STAT_HEADER against all Statistics on all User Tables or views for every accessible database on instance SQLServer2017. Connects using Windows \r\nAuthentication.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbccStatistic -SqlInstance SQLServer2017 -Database MyDb -Option DensityVector\nWill run the statement SHOW_STATISTICS WITH DENSITY_VECTOR against all Statistics on all User Tables or views for database MyDb on instance SQLServer2017. Connects using Windows Authentication.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Get-DbaDbccStatistic -SqlInstance SQLServer2017 -SqlCredential $cred -Database MyDb -Object UserTable -Option Histogram\nWill run the statement SHOW_STATISTICS WITH HISTOGRAM against all Statistics on table UserTable for database MyDb on instance SQLServer2017. Connects using sqladmin credential.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbccStatistic -SqlInstance SQLServer2017 -Database MyDb -Object \u0027dbo.UserTable\u0027 -Target MyStatistic -Option StatsStream\nRuns the statement SHOW_STATISTICS(\u0027dbo.UserTable\u0027, \u0027MyStatistic\u0027) WITH STATS_STREAM against database MyDb on instances Sql1 and Sql2/sqlexpress. Connects using Windows Authentication.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "Object", "The table or indexed view for which to display statistics information.\r\nAny two part object name should be formatted as \u0027Schema.ObjectName\u0027", "", false, "false", "", "" ], [ "Target", "Name of the index, statistics, or column for which to display statistics information.\r\nTarget can be enclosed in brackets, single quotes, double quotes, or no quotes", "", false, "false", "", "" ], [ "Option", "Used to limit the result sets returned by the statement to the specified option.\r\nOptions are \u0027StatHeader\u0027, \u0027DensityVector\u0027, \u0027Histogram\u0027, \u0027StatsStream\u0027\r\nDefault of StatHeader", "", false, "false", "StatHeader", "StatHeader,DensityVector,Histogram,StatsStream" ], [ "NoInformationalMessages", "Suppresses all informational messages.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbccStatistic [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Object] \u003cString\u003e] [[-Target] \u003cString\u003e] [[-Option] \u003cString\u003e] [-NoInformationalMessages] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbccUserOption", "Description": "Returns the results of DBCC USEROPTIONS\n\nRead more:\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-useroptions-transact-sql", "Tags": "DBCC", "Synopsis": "Execution of Database Console Command DBCC USEROPTIONS", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaDbccUserOption", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbccUserOption", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbccUserOption -SqlInstance Server1\nGet results of DBCC USEROPTIONS for Instance Server1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbccUserOption\nGet results of DBCC USEROPTIONS for Instances Sql1 and Sql2/sqlexpress\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Get-DbaDbccUserOption -SqlInstance Server1 -SqlCredential $cred\nConnects using sqladmin credential and gets results of DBCC USEROPTIONS for Instance Server1\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbccUserOption -SqlInstance Server1 -Option ansi_nulls, ansi_warnings, datefirst\nGets results of DBCC USEROPTIONS for Instance Server1. Only display results for the options ansi_nulls, ansi_warnings, datefirst", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Option", "Return only specific options. Returns all results if not specified.\r\nAccepts any values in set \u0027ansi_null_dflt_on\u0027, \u0027ansi_nulls\u0027, \u0027ansi_padding\u0027, \u0027ansi_warnings\u0027, \u0027arithabort\u0027, \u0027concat_null_yields_null\u0027, \u0027datefirst\u0027, \u0027dateformat\u0027, \u0027isolation level\u0027, \u0027language\u0027, \r\n\u0027lock_timeout\u0027, \u0027quoted_identifier\u0027, \u0027textsize\u0027", "", false, "false", "", "ansi_null_dflt_on,ansi_nulls,ansi_padding,ansi_warnings,arithabort,concat_null_yields_null,datefirst,dateformat,isolation level,language,lock_timeout,quoted_identifier,textsize" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbccUserOption [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Option] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbCertificate", "Description": "Gets database certificates", "Tags": "Certificate", "Synopsis": "Gets database certificates", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbCertificate", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbCertificate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbCertificate -SqlInstance sql2016\nGets all certificates\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbCertificate -SqlInstance Server1 -Database db1\nGets the certificate for the db1 database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbCertificate -SqlInstance Server1 -Database db1 -Certificate cert1\nGets the cert1 certificate within the db1 database\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbCertificate -SqlInstance Server1 -Database db1 -Subject \u0027Availability Group Cert\u0027\nGets the certificate within the db1 database that has the subject \u0027Availability Group Cert\u0027", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Get certificate from specific database", "", false, "false", "", "" ], [ "ExcludeDatabase", "Database(s) to ignore when retrieving certificates", "", false, "false", "", "" ], [ "Certificate", "Get specific certificate by name", "", false, "false", "", "" ], [ "Subject", "sometimes it\u0027s text, other times cert", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbCertificate [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-Certificate] \u003cObject[]\u003e] [[-Subject] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbCheckConstraint", "Description": "Gets database Checks constraints.", "Tags": "Database", "Synopsis": "Gets database Check constraints.", "Alias": "", "Author": "Claudio Silva (@ClaudioESSilva), https://claudioessilva.eu", "CommandName": "Get-DbaDbCheckConstraint", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbCheckConstraint", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbCheckConstraint -SqlInstance sql2016\nGets all database check constraints.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbCheckConstraint -SqlInstance Server1 -Database db1\nGets the check constraints for the db1 database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbCheckConstraint -SqlInstance Server1 -ExcludeDatabase db1\nGets the check constraints for all databases except db1.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbCheckConstraint -SqlInstance Server1 -ExcludeSystemTable\nGets the check constraints for all databases that are not system objects.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbCheckConstraint\nGets the check constraints for the databases on Sql1 and Sql2/sqlexpress.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "To get Checks from specific database(s)", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto populated from the server", "", false, "false", "", "" ], [ "ExcludeSystemTable", "This switch removes all system objects from the table collection", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbCheckConstraint [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-ExcludeSystemTable] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbCompatibility", "Description": "Get the current database compatibility level for all databases on a server or list of databases passed in to the function.", "Tags": [ "Compatibility", "Database" ], "Synopsis": "Displays the compatibility level for SQL Server databases.", "Alias": "", "Author": "Garry Bargsley, http://blog.garrybargsley.com/", "CommandName": "Get-DbaDbCompatibility", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbCompatibility", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbCompatibility -SqlInstance localhost\\sql2017\nDisplays database compatibility level for all user databases on server localhost\\sql2017\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbCompatibility -SqlInstance localhost\\sql2017 -Database Test\nDisplays database compatibility level for database Test on server localhost\\sql2017", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "SqlLogin to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance..", "", false, "false", "", "" ], [ "Database", "The database or databases to process. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "InputObject", "A collection of databases (such as returned by Get-DbaDatabase)", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbCompatibility [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbCompression", "Description": "This function gets the current size and compression for all objects in the specified database(s), if no database is specified it will return all objects in all user databases.", "Tags": [ "Compression", "Table", "Database" ], "Synopsis": "Gets tables and indexes size and current compression settings.", "Alias": "", "Author": "Jess Pomfret (@jpomfret), jesspomfret.com", "CommandName": "Get-DbaDbCompression", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbCompression", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbCompression -SqlInstance localhost\nReturns objects size and current compression level for all user databases.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbCompression -SqlInstance localhost -Database TestDatabase\nReturns objects size and current compression level for objects within the TestDatabase database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbCompression -SqlInstance localhost -ExcludeDatabase TestDatabases\nReturns objects size and current compression level for objects in all databases except the TestDatabase database.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbCompression -SqlInstance localhost -ExcludeDatabase TestDatabases -Table table1, table2\nReturns objects size and current compression level for table1 and table2 in all databases except the TestDatabase database.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto populated from the server.", "", false, "false", "", "" ], [ "Table", "The table(s) to process. If unspecified, all tables will be processed.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbCompression [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-Table] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbDbccOpenTran", "Description": "Executes the command DBCC OPENTRAN against the requested databases\n\nDisplays information about the oldest active transaction and\nthe oldest distributed and nondistributed replicated transactions, if any,\nwithin the transaction log of the specified database\n\nRead more:\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-opentran-transact-sql", "Tags": "DBCC", "Synopsis": "Execution of Database Console Command DBCC OPENTRAN", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaDbDbccOpenTran", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbDbccOpenTran", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbDbccOpenTran -SqlInstance SQLServer2017\nConnects to instance SqlServer2017 using Windows Authentication and runs the command DBCC OPENTRAN WITH TABLERESULTS, NO_INFOMSGS against each database.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbDbccOpenTran -SqlInstance SQLServer2017 -Database CurrentDB\nConnects to instance SqlServer2017 using Windows Authentication and runs the command DBCC OPENTRAN(CurrentDB) WITH TABLERESULTS, NO_INFOMSGS against the CurrentDB database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e \u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbDbccOpenTran -SqlCredential $cred\nConnects to instances Sql1 and Sql2/sqlexpress using sqladmin credential and runs the command DBCC OPENTRAN WITH TABLERESULTS, NO_INFOMSGS against each database.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. If unspecified, all databases will be processed.\r\nThe Name or Id of a database can be specified\r\nDatabase names must comply with the rules for identifiers.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbDbccOpenTran [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbDetachedFileInfo", "Description": "Gathers the following information from detached database files: database name, SQL Server version (compatibility level), collation, and file structure.\n\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 compatibility 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": [ "Database", "Detach" ], "Synopsis": "Get detailed information about detached SQL Server database files.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbDetachedFileInfo", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbDetachedFileInfo", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbDetachedFileInfo -SqlInstance sql2016 -Path M:\\Archive\\mydb.mdf\nReturns information about the detached database file M:\\Archive\\mydb.mdf using the SQL Server instance sql2016. The M drive is relative to the SQL Server instance.", "Params": [ [ "SqlInstance", "Source SQL Server. This instance must be online and is required to parse the information contained with in the detached database file.\nThis function will not attach the database file, it will only use SQL Server to read its contents.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Path", "Specifies the path to the MDF file to be read. This path must be readable by the SQL Server service account. Ideally, the MDF will be located on the SQL Server itself, or on a network share to which \r\nthe SQL Server service account has access.", "Mdf,FilePath,FullName", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbDetachedFileInfo [-SqlInstance] \u003cDbaInstanceParameter\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Path] \u003cString[]\u003e [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbEncryption", "Description": "Shows if a database has Transparent Data Encryption (TDE), any certificates, asymmetric keys or symmetric keys with details for each.", "Tags": [ "Encryption", "Database" ], "Synopsis": "Returns a summary of encryption used on databases passed to it.", "Alias": "", "Author": "Stephen Bennett, https://sqlnotesfromtheunderground.wordpress.com/", "CommandName": "Get-DbaDbEncryption", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbEncryption", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbEncryption -SqlInstance DEV01\nList all encryption found on the instance by database\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbEncryption -SqlInstance DEV01 -Database MyDB\nList all encryption found for the MyDB database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbEncryption -SqlInstance DEV01 -ExcludeDatabase MyDB\nList all encryption found for all databases except MyDB.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbEncryption -SqlInstance DEV01 -IncludeSystemDBs\nList all encryption found for all databases including the system databases.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server.", "", false, "false", "", "" ], [ "IncludeSystemDBs", "Switch parameter that when used will display system database information.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbEncryption [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-IncludeSystemDBs] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbExtentDiff", "Description": "This is only an implementation of the script created by Paul S. Randal to find what percentage of a database has changed since the last full backup.\nhttps://www.sqlskills.com/blogs/paul/new-script-how-much-of-the-database-has-changed-since-the-last-full-backup/", "Tags": [ "Backup", "Database" ], "Synopsis": "What percentage of a database has changed since the last full backup", "Alias": "", "Author": "Viorel Ciucu, cviorel.com", "CommandName": "Get-DbaDbExtentDiff", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbExtentDiff", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbExtentDiff -SqlInstance SQL2016 -Database DBA\nGet the changes for the DBA database.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$Cred = Get-Credential sqladmin\nPS C:\\\u003e Get-DbaDbExtentDiff -SqlInstance SQL2017N1, SQL2017N2, SQL2016 -Database DB01 -SqlCredential $Cred\nGet the changes for the DB01 database on multiple servers.", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbExtentDiff [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbFeatureUsage", "Description": "Shows features that are enabled in the database but not supported on all editions of SQL Server.\n\nBasically checks for Enterprise feature usage.\n\nThis feature must be removed before the database can be migrated to all available editions of SQL Server.", "Tags": "Deprecated", "Synopsis": "Shows features that are enabled in the database but not supported on all editions of SQL Server. Basically checks for Enterprise feature usage.", "Alias": "", "Author": "Brandon Abshire, netnerds.net", "CommandName": "Get-DbaDbFeatureUsage", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbFeatureUsage", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2008 -Database testdb, db2 | Get-DbaDbFeatureUsage\nShows features that are enabled in the testdb and db2 databases but\r\nnot supported on the all the editions of SQL Server.", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "InputObject", "A collection of databases (such as returned by Get-DbaDatabase), to be tested.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbFeatureUsage [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbFile", "Description": "Returns detailed information about database files. Does not use SMO - SMO causes enumeration and this command avoids that.", "Tags": "Database", "Synopsis": "Returns detailed information about database files.", "Alias": "", "Author": "Stuart Moore (@napalmgram), stuart-moore.com", "CommandName": "Get-DbaDbFile", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbFile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbFile -SqlInstance sql2016\nWill return an object containing all file groups and their contained files for every database on the sql2016 SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbFile -SqlInstance sql2016 -Database Impromptu\nWill return an object containing all file groups and their contained files for the Impromptu Database on the sql2016 SQL Server instance\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbFile -SqlInstance sql2016 -Database Impromptu, Trading\nWill return an object containing all file groups and their contained files for the Impromptu and Trading databases on the sql2016 SQL Server instance\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2016 -Database Impromptu, Trading | Get-DbaDbFile\nWill accept piped input from Get-DbaDatabase and return an object containing all file groups and their contained files for the Impromptu and Trading databases on the sql2016 SQL Server instance\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDbFile -SqlInstance sql2016 -Database AdventureWorks2017 -FileGroup Index\nReturn any files that are in the Index filegroup of the AdventureWorks2017 database.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "FileGroup", "Filter results to only files within this certain filegroup.", "", false, "false", "", "" ], [ "InputObject", "A piped collection of database objects", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbFile [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-FileGroup] \u003cObject[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbFileGroup", "Description": "Shows information around filegroups.", "Tags": [ "Database", "FileGroup" ], "Synopsis": "Returns a summary of information on filegroups", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaDbFileGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbFileGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbFileGroup -SqlInstance sql2016\nReturn all FileGroups for all databases on instance sql2016\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbFileGroup -SqlInstance sql2016 -Database MyDB\nReturn all FileGroups for database MyDB on instance sql2016\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbFileGroup -SqlInstance sql2016 -FileGroup Primary\nReturns information on filegroup called Primary if it exists in any database on the server sql2016\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e\u0027localhost\u0027,\u0027localhost\\namedinstance\u0027 | Get-DbaDbFileGroup\nReturns information on all FileGroups for all databases on instances \u0027localhost\u0027,\u0027localhost\\namedinstance\u0027\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e\u0027localhost\u0027,\u0027localhost\\namedinstance\u0027 | Get-DbaDbFileGroup\nReturns information on all FileGroups for all databases on instances \u0027localhost\u0027,\u0027localhost\\namedinstance\u0027\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance SQL1\\SQLExpress,SQL2 -ExcludeDatabase model,master | Get-DbaDbFileGroup\nReturns information on all FileGroups for all databases except model and master on instances SQL1\\SQLExpress,SQL2", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "InputObject", "Database object piped in from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "FileGroup", "Define a specific FileGroup you would like to query.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbFileGroup [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [[-FileGroup] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbFileGrowth", "Description": "Gets database growth and growth type", "Tags": "Database", "Synopsis": "Gets database growth and growth type", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbFileGrowth", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbFileGrowth", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbFileGrowth -SqlInstance sql2017, sql2016, sql2012\nGets all database file growths on sql2017, sql2016, sql2012\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbFileGrowth -SqlInstance sql2017, sql2016, sql2012 -Database pubs\nGets the database file growth info for pubs on sql2017, sql2016, sql2012\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2016 -Database test | Get-DbaDbFileGrowth\nGets the test database file growth information on sql2016", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The name of the target databases", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbFileGrowth [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbFileMapping", "Description": "Provides an easy way to build the FileMapping Hashtable for Restore-DbaDatabase from an existing database", "Tags": "Database", "Synopsis": "Provides an easy way to build the FileMapping Hashtable for Restore-DbaDatabase from an existing database", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net | Andreas Jordan (@JordanOrdix), ordix.de", "CommandName": "Get-DbaDbFileMapping", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbFileMapping", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$filemap = Get-DbaDbFileMapping -SqlInstance sql2016 -Database test\nPS C:\\\u003e Get-ChildItem \\\\nas\\db\\backups\\test | Restore-DbaDatabase -SqlInstance sql2019 -Database test -FileMapping $filemap.FileMapping\nRestores test to sql2019 using the file structure built from the existing database on sql2016", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "InputObject", "Database object piped in from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbFileMapping [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbForeignKey", "Description": "Gets database Foreign Keys.", "Tags": [ "Database", "ForeignKey", "Table" ], "Synopsis": "Gets database Foreign Keys.", "Alias": "", "Author": "Claudio Silva (@ClaudioESSilva), https://claudioessilva.eu", "CommandName": "Get-DbaDbForeignKey", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbForeignKey", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbForeignKey -SqlInstance sql2016\nGets all database Foreign Keys.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbForeignKey -SqlInstance Server1 -Database db1\nGets the Foreign Keys for the db1 database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbForeignKey -SqlInstance Server1 -ExcludeDatabase db1\nGets the Foreign Keys for all databases except db1.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbForeignKey -SqlInstance Server1 -ExcludeSystemTable\nGets the Foreign Keys from all tables that are not system objects from all databases.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbForeignKey\nGets the Foreign Keys for the databases on Sql1 and Sql2/sqlexpress.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "To get Foreign Keys from specific database(s)", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto populated from the server", "", false, "false", "", "" ], [ "ExcludeSystemTable", "This switch removes all system objects from the tables collection", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbForeignKey [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-ExcludeSystemTable] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbIdentity", "Description": "Use the command DBCC CHECKIDENT with NORESEED option to checks the current identity value of a table and return results\n\nRead more:\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-checkident-transact-sql", "Tags": "DBCC", "Synopsis": "Checks the current identity value via DBCC CHECKIDENT with NORESEED optuin", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaDbIdentity", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbIdentity", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbIdentity -SqlInstance SQLServer2017 -Database AdventureWorks2014 -Table \u0027Production.ScrapReason\u0027\nConnects to AdventureWorks2014 on instance SqlServer2017 using Windows Authentication and runs the command DBCC CHECKIDENT(\u0027Production.ScrapReason\u0027, NORESEED) to return the current identity value.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e \u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbIdentity -SqlCredential $cred -Database AdventureWorks2014 -Table \u0027Production.ScrapReason\u0027\nConnects to AdventureWorks2014 on instances Sql1 and Sql2/sqlexpress using sqladmin credential and runs the command DBCC CHECKIDENT(\u0027Production.ScrapReason\u0027, NORESEED) to return the current identity \r\nvalue.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$query = \"Select Quotename(Schema_Name(t.schema_id)) +\u0027.\u0027 + QuoteName(t.name) as TableName from sys.columns c INNER JOIN sys.tables t on t.object_id = c.object_id WHERE is_identity = 1 and \r\nis_memory_optimized = 0\"\nPS C:\\\u003e $IdentityTables = Invoke-DbaQuery -SqlInstance SQLServer2017 -Database AdventureWorks2014 -Query $query -As SingleValue\r\nPS C:\\\u003e Get-DbaDbIdentity -SqlInstance SQLServer2017 -Database AdventureWorks2014 -Table $IdentityTables\nChecks the current identity value for all non memory optimized tables with an Identity in the AdventureWorks2014 database on the SQLServer2017 instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "Table", "The table(s) for which to check the current identity value.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the cmdlet runs. The cmdlet is not run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the cmdlet.", "cf", false, "false", "", "" ] ], "Syntax": "Get-DbaDbIdentity [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Table] \u003cString[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbLogShipError", "Description": "When your log shipping fails it\u0027s sometimes hard to see why is fails.\nUsing this function you\u0027ll be able to find out what went wrong in a short amount of time.", "Tags": "LogShipping", "Synopsis": "Get-DbaDbLogShipError returns all the log shipping errors that occurred", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Get-DbaDbLogShipError", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbLogShipError", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbLogShipError -SqlInstance sql1\nGet all the log shipping errors that occurred\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbLogShipError -SqlInstance sql1 -Action Backup\nGet the errors that have something to do with the backup of the databases\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbLogShipError -SqlInstance sql1 -Secondary\nGet the errors that occurred on the secondary instance.\r\nThis will return the copy of the restore actions because those only occur on the secondary instance\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbLogShipError -SqlInstance sql1 -DateTimeFrom \"01/05/2018\"\nGet the errors that have occurred from \"01/05/2018\". This can also be of format \"yyyy-MM-dd\"\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDbLogShipError -SqlInstance sql1 -Secondary -DateTimeFrom \"01/05/2018\" -DateTimeTo \"2018-01-07\"\nGet the errors that have occurred between \"01/05/2018\" and \"01/07/2018\".\r\nSee that is doesn\u0027t matter how the date is represented.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Allows you to filter the results to only return the databases you\u0027re interested in. This can be one or more values separated by commas.\r\nThis is not a wildcard and should be the exact database name. See examples for more info.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Allows you to filter the results to only return the databases you\u0027re not interested in. This can be one or more values separated by commas.\r\nThis is not a wildcard and should be the exact database name.", "", false, "false", "", "" ], [ "Action", "Filter to get the log shipping action that has occurred like Backup, Copy, Restore.\r\nBy default all the actions are returned.", "", false, "false", "", "Backup,Copy,Restore" ], [ "DateTimeFrom", "Filter the results based on the date starting from datetime X", "", false, "false", "", "" ], [ "DateTimeTo", "Filter the results based on the date ending with datetime X", "", false, "false", "", "" ], [ "Primary", "Allows to filter the results to only return values that apply to the primary instance.", "", false, "false", "False", "" ], [ "Secondary", "Allows to filter the results to only return values that apply to the secondary instance.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbLogShipError [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-Action] \u003cString[]\u003e] [[-DateTimeFrom] \u003cDateTime\u003e] [[-DateTimeTo] \u003cDateTime\u003e] [-Primary] [-Secondary] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbLogSpace", "Description": "Returns transaction log size and space used for each database on the SQL Server instance(s).\n\nThis can be used to monitor how much of your allocated transaction log space is in use, and whether it is nearing the point where it will need to grow.", "Tags": [ "Database", "Space" ], "Synopsis": "Gets information on the database transaction log usage for each instance(s) of SQL Server.", "Alias": "", "Author": "Jess Pomfret, JessPomfret.com", "CommandName": "Get-DbaDbLogSpace", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbLogSpace", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbLogSpace -SqlInstance Server1\nReturns the transaction log usage information for all databases on Server1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbLogSpace -SqlInstance Server1 -Database Database1, Database2\nReturns the transaction log usage information for both Database1 and Database 2 on Server1\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbLogSpace -SqlInstance Server1 -ExcludeDatabase Database3\nReturns the transaction log usage information for all databases on Server1, except Database3\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbLogSpace -SqlInstance Server1 -ExcludeSystemDatabase\nReturns the transaction log usage information for all databases on Server1, except the system databases\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaRegisteredServer -SqlInstance cmsServer | Get-DbaDbLogSpace -Database Database1\nReturns the transaction log usage information for Database1 for a group of servers from SQL Server Central Management Server (CMS).", "Params": [ [ "SqlInstance", "SQL Server name or SMO object representing the SQL Server to connect to. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server.", "", false, "false", "", "" ], [ "ExcludeSystemDatabase", "Allows you to suppress output on system databases.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbLogSpace [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [-ExcludeSystemDatabase] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbMail", "Description": "Gets the database mail from SQL Server", "Tags": [ "DatabaseMail", "DBMail", "Mail" ], "Synopsis": "Gets the database mail from SQL Server", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbMail", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbMail", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbMail -SqlInstance sql01\\sharepoint\nReturns the db mail server object on sql01\\sharepoint\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbMail -SqlInstance sql01\\sharepoint | Select-Object *\nReturns the db mail server object on sql01\\sharepoint then return a bunch more columns\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers = \"sql2014\",\"sql2016\", \"sqlcluster\\sharepoint\"\nPS C:\\\u003e $servers | Get-DbaDbMail\nReturns the db mail server object for \"sql2014\",\"sql2016\" and \"sqlcluster\\sharepoint\"", "Params": [ [ "SqlInstance", "TThe target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbMail [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbMailAccount", "Description": "Gets database mail accounts from SQL Server", "Tags": [ "DatabaseMail", "DbMail", "Mail" ], "Synopsis": "Gets database mail accounts from SQL Server", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbMailAccount", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbMailAccount", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbMailAccount -SqlInstance sql01\\sharepoint\nReturns Database Mail accounts on sql01\\sharepoint\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbMailAccount -SqlInstance sql01\\sharepoint -Account \u0027The DBA Team\u0027\nReturns The DBA Team Database Mail account from sql01\\sharepoint\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbMailAccount -SqlInstance sql01\\sharepoint | Select-Object *\nReturns the Database Mail accounts on sql01\\sharepoint then return a bunch more columns\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$servers = \"sql2014\",\"sql2016\", \"sqlcluster\\sharepoint\"\nPS C:\\\u003e $servers | Get-DbaDbMail | Get-DbaDbMailAccount\nReturns the Database Mail accounts for \"sql2014\",\"sql2016\" and \"sqlcluster\\sharepoint\"", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Account", "Specifies one or more account(s) to get. If unspecified, all accounts will be returned.", "", false, "false", "", "" ], [ "ExcludeAccount", "Specifies one or more account(s) to exclude.", "", false, "false", "", "" ], [ "InputObject", "Accepts pipeline input from Get-DbaDbMail", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbMailAccount [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Account] \u003cString[]\u003e] [[-ExcludeAccount] \u003cString[]\u003e] [[-InputObject] \u003cSqlMail[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbMailConfig", "Description": "Gets database mail configs from SQL Server", "Tags": [ "DatabaseMail", "DBMail", "Mail" ], "Synopsis": "Gets database mail configs from SQL Server", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbMailConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbMailConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbMailConfig -SqlInstance sql01\\sharepoint\nReturns DBMail configs on sql01\\sharepoint\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbMailConfig -SqlInstance sql01\\sharepoint -Name ProhibitedExtensions\nReturns the ProhibitedExtensions configuration on sql01\\sharepoint\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbMailConfig -SqlInstance sql01\\sharepoint | Select-Object *\nReturns the DBMail configs on sql01\\sharepoint then return a bunch more columns\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$servers = \"sql2014\",\"sql2016\", \"sqlcluster\\sharepoint\"\nPS C:\\\u003e $servers | Get-DbaDbMail | Get-DbaDbMailConfig\nReturns the DBMail configs for \"sql2014\",\"sql2016\" and \"sqlcluster\\sharepoint\"", "Params": [ [ "SqlInstance", "TThe target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "Specifies one or more config(s) to get. If unspecified, all configs will be returned.", "Config,ConfigName", false, "false", "", "" ], [ "InputObject", "Accepts pipeline input from Get-DbaDbMail", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbMailConfig [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString[]\u003e] [[-InputObject] \u003cSqlMail[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbMailHistory", "Description": "Gets the history of mail sent from a SQL instance", "Tags": [ "DatabaseMail", "DBMail", "Mail" ], "Synopsis": "Gets the history of mail sent from a SQL instance", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbMailHistory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbMailHistory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbMailHistory -SqlInstance sql01\\sharepoint\nReturns the entire DBMail history on sql01\\sharepoint\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbMailHistory -SqlInstance sql01\\sharepoint | Select-Object *\nReturns the entire DBMail history on sql01\\sharepoint then return a bunch more columns\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers = \"sql2014\",\"sql2016\", \"sqlcluster\\sharepoint\"\nPS C:\\\u003e $servers | Get-DbaDbMailHistory\nReturns the all DBMail history for \"sql2014\",\"sql2016\" and \"sqlcluster\\sharepoint\"", "Params": [ [ "SqlInstance", "TThe target SQL Server instance or instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Since", "Datetime object used to narrow the results to the send request date", "", false, "false", "", "" ], [ "Status", "Narrow the results by status. Valid values include Unsent, Sent, Failed and Retrying", "", false, "false", "", "Unsent,Sent,Failed,Retrying" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbMailHistory [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Since] \u003cDateTime\u003e] [[-Status] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbMailLog", "Description": "Gets the DBMail log from a SQL instance", "Tags": [ "DatabaseMail", "DBMail", "Mail" ], "Synopsis": "Gets the DBMail log from a SQL instance", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbMailLog", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbMailLog", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbMailLog -SqlInstance sql01\\sharepoint\nReturns the entire DBMail log on sql01\\sharepoint\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbMailLog -SqlInstance sql01\\sharepoint | Select-Object *\nReturns the entire DBMail log on sql01\\sharepoint, includes all returned information.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers = \"sql2014\",\"sql2016\", \"sqlcluster\\sharepoint\"\nPS C:\\\u003e $servers | Get-DbaDbMailLog -Type Error, Information\nReturns only the Error and Information DBMail log for \"sql2014\",\"sql2016\" and \"sqlcluster\\sharepoint\"", "Params": [ [ "SqlInstance", "TThe target SQL Server instance or instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Since", "Datetime object used to narrow the results to the send request date", "", false, "false", "", "" ], [ "Type", "Narrow the results by type. Valid values include Error, Warning, Success, Information, Internal", "", false, "false", "", "Error,Warning,Success,Information,Internal" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbMailLog [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Since] \u003cDateTime\u003e] [[-Type] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbMailProfile", "Description": "Gets database mail profiles from SQL Server", "Tags": [ "DatabaseMail", "DBMail", "Mail" ], "Synopsis": "Gets database mail profiles from SQL Server", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbMailProfile", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbMailProfile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbMailProfile -SqlInstance sql01\\sharepoint\nReturns DBMail profiles on sql01\\sharepoint\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbMailProfile -SqlInstance sql01\\sharepoint -Profile \u0027The DBA Team\u0027\nReturns The DBA Team DBMail profile from sql01\\sharepoint\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbMailProfile -SqlInstance sql01\\sharepoint | Select-Object *\nReturns the DBMail profiles on sql01\\sharepoint then return a bunch more columns\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$servers = \"sql2014\",\"sql2016\", \"sqlcluster\\sharepoint\"\nPS C:\\\u003e $servers | Get-DbaDbMail | Get-DbaDbMailProfile\nReturns the DBMail profiles for \"sql2014\",\"sql2016\" and \"sqlcluster\\sharepoint\"", "Params": [ [ "SqlInstance", "TThe target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Profile", "Specifies one or more profile(s) to get. If unspecified, all profiles will be returned.", "", false, "false", "", "" ], [ "ExcludeProfile", "Specifies one or more profile(s) to exclude.", "", false, "false", "", "" ], [ "InputObject", "Accepts pipeline input from Get-DbaDbMail", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbMailProfile [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Profile] \u003cString[]\u003e] [[-ExcludeProfile] \u003cString[]\u003e] [[-InputObject] \u003cSqlMail[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbMailServer", "Description": "Gets database mail servers from SQL Server", "Tags": [ "DatabaseMail", "DBMail", "Mail" ], "Synopsis": "Gets database mail servers from SQL Server", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbMailServer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbMailServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbMailServer -SqlInstance sql01\\sharepoint\nReturns all DBMail servers on sql01\\sharepoint\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbMailServer -SqlInstance sql01\\sharepoint -Server DbaTeam\nReturns The DBA Team DBMail server from sql01\\sharepoint\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbMailServer -SqlInstance sql01\\sharepoint | Select-Object *\nReturns the DBMail servers on sql01\\sharepoint then return a bunch more columns\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$servers = \"sql2014\",\"sql2016\", \"sqlcluster\\sharepoint\"\nPS C:\\\u003e $servers | Get-DbaDbMail | Get-DbaDbMailServer\nReturns the DBMail servers for \"sql2014\",\"sql2016\" and \"sqlcluster\\sharepoint\"", "Params": [ [ "SqlInstance", "TThe target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Server", "Specifies one or more server(s) to get. If unspecified, all servers will be returned.", "Name", false, "false", "", "" ], [ "Account", "Get only the mail server associated with specific accounts", "", false, "false", "", "" ], [ "InputObject", "Accepts pipeline input from Get-DbaDbMail", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbMailServer [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Server] \u003cString[]\u003e] [[-Account] \u003cString[]\u003e] [[-InputObject] \u003cSqlMail[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbMasterKey", "Description": "Gets specified database master key", "Tags": [ "Certificate", "Database" ], "Synopsis": "Gets specified database master key", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbMasterKey", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbMasterKey", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbMasterKey -SqlInstance sql2016\nGets all master database keys\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbMasterKey -SqlInstance Server1 -Database db1\nGets the master key for the db1 database", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Get master key from specific database", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "InputObject", "Database object piped in from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbMasterKey [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbMemoryUsage", "Description": "This command can be utilized to determine which databases on a given instance are consuming buffer pool memory.\n\nThis command is based on query provided by Aaron Bertrand.\nReference: https://www.mssqltips.com/sqlservertip/2393/determine-sql-server-memory-use-by-database-and-object/", "Tags": [ "Memory", "Database" ], "Synopsis": "Determine buffer pool usage by database.", "Alias": "", "Author": "Shawn Melton (@wsmelton), https://wsmelton.github.io", "CommandName": "Get-DbaDbMemoryUsage", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbMemoryUsage", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbMemoryUsage -SqlInstance sqlserver2014a\nReturns the buffer pool consumption for all user databases\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbMemoryUsage -SqlInstance sqlserver2014a -IncludeSystemDb\nReturns the buffer pool consumption for all user databases and system databases\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbMemoryUsage -SqlInstance sql1 -IncludeSystemDb -Database tempdb\nReturns the buffer pool consumption for tempdb database only\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbMemoryUsage -SqlInstance sql2 -IncludeSystemDb -Exclude \u0027master\u0027,\u0027model\u0027,\u0027msdb\u0027,\u0027ResourceDb\u0027\nReturns the buffer pool consumption for all user databases and tempdb database", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance..", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "true (ByPropertyName)", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude.", "", false, "false", "", "" ], [ "IncludeSystemDb", "Switch to have the output include system database memory consumption.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbMemoryUsage [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-IncludeSystemDb] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbMirror", "Description": "Gets properties of database mirrors and mirror witnesses.", "Tags": [ "Mirroring", "Mirror", "HA" ], "Synopsis": "Gets properties of database mirrors and mirror witnesses.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbMirror", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbMirror", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbMirror -SqlInstance localhost\nGets properties of database mirrors and mirror witnesses on localhost\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbMirror -SqlInstance localhost, sql2016\nGets properties of database mirrors and mirror witnesses on localhost and sql2016 SQL Server instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbMirror -SqlInstance localhost, sql2016 -Database mymirror\nGets properties of database mirrors and mirror witnesses on localhost and sql2016 SQL Server instances for databases named mymirror", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The name of the target databases", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbMirror [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbMirrorMonitor", "Description": "Returns status rows for a monitored database from the status table in which database mirroring monitoring history is stored and allows you to choose whether the procedure obtains the latest status beforehand.\n\nBasically executes sp_dbmmonitorresults.", "Tags": [ "Mirroring", "Mirror", "HA" ], "Synopsis": "Returns status rows for a monitored database from the status table in which database mirroring monitoring history is stored and allows you to choose whether the procedure obtains the latest status beforehand.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbMirrorMonitor", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbMirrorMonitor", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbMirrorMonitor -SqlInstance sql2008, sql2012\nReturns last two hours\u0027 worth of status rows for a monitored database from the status table on sql2008 and sql2012.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbMirrorMonitor -SqlInstance sql2005 -LimitResults LastDay -Update\nUpdates monitor stats then returns the last 24 hours worth of status rows for a monitored database from the status table on sql2008 and sql2012.", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database.", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "Update", "Updates the status for the database by calling sp_dbmmonitorupdate before computing the results.\r\nHowever, if the status table has been updated within the previous 15 seconds, or the user is not a member of the sysadmin fixed server role, the command runs without updating the status.", "", false, "false", "False", "" ], [ "LimitResults", "Limit results. Defaults to last two hours.\nOptions include:\r\nLastRow\r\nLastTwoHours\r\nLastFourHours\r\nLastEightHours\r\nLastDay\r\nLastTwoDays\r\nLast100Rows\r\nLast500Rows\r\nLast1000Rows\r\nLast1000000Rows", "", false, "false", "LastTwoHours", "LastRow,LastTwoHours,LastFourHours,LastEightHours,LastDay,LastTwoDays,Last100Rows,Last500Rows,Last1000Rows,Last1000000Rows" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbMirrorMonitor [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-Update] [[-LimitResults] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbObjectTrigger", "Description": "Get all existing triggers on object level (table or view) on one or more SQL instances.", "Tags": [ "Database", "Trigger" ], "Synopsis": "Get all existing triggers on object level (table or view) on one or more SQL instances.", "Alias": "", "Author": "Cláudio Silva (@claudioessilva), https://claudioessilva.eu", "CommandName": "Get-DbaDbObjectTrigger", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbObjectTrigger", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbObjectTrigger -SqlInstance sql2017\nReturns all database triggers\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2017 -Database supa | Get-DbaDbObjectTrigger\nReturns all triggers for database supa on sql2017\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbObjectTrigger -SqlInstance sql2017 -Database supa\nReturns all triggers for database supa on sql2017", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "SqlLogin to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance..", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Type", "Allows specify the object type associated with the trigger. Available options All, Table and View. By default is All.", "", false, "false", "All", "All,Table,View" ], [ "InputObject", "Allow pipedline input from Get-DbaDbTable and/or Get-DbaDbView", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/ca", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbObjectTrigger [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-Type] \u003cString\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbOrphanUser", "Description": "An orphan user is defined by a user that does not have their matching login. (Login property = \"\").", "Tags": [ "Orphan", "Database", "User", "Security", "Login" ], "Synopsis": "Get orphaned users.", "Alias": "", "Author": "Claudio Silva (@ClaudioESSilva) | Garry Bargsley (@gbargsley) | Simone Bizzotto (@niphlod)", "CommandName": "Get-DbaDbOrphanUser", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbOrphanUser", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbOrphanUser -SqlInstance localhost\\sql2016\nFinds all orphan users without matching Logins in all databases present on server \u0027localhost\\sql2016\u0027.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbOrphanUser -SqlInstance localhost\\sql2016 -SqlCredential $cred\nFinds all orphan users without matching Logins in all databases present on server \u0027localhost\\sql2016\u0027. SQL Server authentication will be used in connecting to the server.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbOrphanUser -SqlInstance localhost\\sql2016 -Database db1\nFinds orphan users without matching Logins in the db1 database present on server \u0027localhost\\sql2016\u0027.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbOrphanUser [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbPageInfo", "Description": "Get-DbaDbPageInfo is able to return information about the pages in a database.\nIt\u0027s possible to return the information for multiple databases and filter on specific databases, schemas and tables.", "Tags": [ "Database", "Page" ], "Synopsis": "Get-DbaDbPageInfo will return page information for a database", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbPageInfo", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbPageInfo", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbPageInfo -SqlInstance sql2017\nReturns page information for all databases on sql2017\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbPageInfo -SqlInstance sql2017, sql2016 -Database testdb\nReturns page information for the testdb on sql2017 and sql2016\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers | Get-DbaDatabase -Database testdb | Get-DbaDbPageInfo\nReturns page information for the testdb on all $servers", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Filter to only get specific databases", "", false, "false", "", "" ], [ "Schema", "Filter to only get specific schemas", "", false, "false", "", "" ], [ "Table", "Filter to only get specific tables", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbPageInfo [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Schema] \u003cString[]\u003e] [[-Table] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbPartitionFunction", "Description": "Gets database Partition Functions", "Tags": "Database", "Synopsis": "Gets database Partition Functions", "Alias": "", "Author": "Klaas Vandenberghe ( @PowerDbaKlaas )", "CommandName": "Get-DbaDbPartitionFunction", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbPartitionFunction", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbPartitionFunction -SqlInstance sql2016\nGets all database Partition Functions\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbPartitionFunction -SqlInstance Server1 -Database db1\nGets the Partition Functions for the db1 database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbPartitionFunction -SqlInstance Server1 -ExcludeDatabase db1\nGets the Partition Functions for all databases except db1\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbPartitionFunction\nGets the Partition Functions for the databases on Sql1 and Sql2/sqlexpress", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "To get users from specific database(s)", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto populated from the server", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbPartitionFunction [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbPartitionScheme", "Description": "Gets database Partition Schemes", "Tags": "Database", "Synopsis": "Gets database Partition Schemes", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDbaKlaas)", "CommandName": "Get-DbaDbPartitionScheme", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbPartitionScheme", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbPartitionScheme -SqlInstance sql2016\nGets all database Partition Schemes\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbPartitionScheme -SqlInstance Server1 -Database db1\nGets the Partition Schemes for the db1 database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbPartitionScheme -SqlInstance Server1 -ExcludeDatabase db1\nGets the Partition Schemes for all databases except db1\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbPartitionScheme\nGets the Partition Schemes for the databases on Sql1 and Sql2/sqlexpress", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "To get users from specific database(s)", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto populated from the server", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbPartitionScheme [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbQueryStoreOption", "Description": "Retrieves and returns the Query Store configuration for every database that has the Query Store feature enabled.", "Tags": "QueryStore", "Synopsis": "Get the Query Store configuration for Query Store enabled databases.", "Alias": "", "Author": "Enrico van de Laar (@evdlaar) | Klaas Vandenberghe (@PowerDBAKlaas) | Tracy Boggiano (@TracyBoggiano)", "CommandName": "Get-DbaDbQueryStoreOption", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbQueryStoreOption", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbQueryStoreOption -SqlInstance ServerA\\sql\nReturns Query Store configuration settings for every database on the ServerA\\sql instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbQueryStoreOption -SqlInstance ServerA\\sql | Where-Object {$_.ActualState -eq \"ReadWrite\"}\nReturns the Query Store configuration for all databases on ServerA\\sql where the Query Store feature is in Read/Write mode.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbQueryStoreOption -SqlInstance localhost | format-table -AutoSize -Wrap\nReturns Query Store configuration settings for every database on the ServerA\\sql instance inside a table format.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "SqlLogin to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance..", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbQueryStoreOption [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbRecoveryModel", "Description": "Get-DbaDbRecoveryModel displays the Recovery Model for all databases. This is the default, you can filter using -Database, -ExcludeDatabase, -RecoveryModel", "Tags": [ "Recovery", "RecoveryModel", "Simple", "Full", "Bulk", "BulkLogged" ], "Synopsis": "Get-DbaDbRecoveryModel displays the Recovery Model.", "Alias": "", "Author": "Viorel Ciucu (@viorelciucu), https://www.cviorel.com", "CommandName": "Get-DbaDbRecoveryModel", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbRecoveryModel", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbRecoveryModel -SqlInstance sql2014 -RecoveryModel BulkLogged -Verbose\nGets all databases on SQL Server instance sql2014 having RecoveryModel set to BulkLogged.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbRecoveryModel -SqlInstance sql2014 -Database TestDB\nGets recovery model information for TestDB. If TestDB does not exist on the instance nothing is returned.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "RecoveryModel", "Filters the output based on Recovery Model. Valid options are Simple, Full and BulkLogged\nDetails about the recovery models can be found here:\r\nhttps://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/recovery-models-sql-server", "", false, "false", "", "Simple,Full,BulkLogged" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. if unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbRecoveryModel [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-RecoveryModel] \u003cString[]\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbRestoreHistory", "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/SqlInstancetip/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.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbRestoreHistory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbRestoreHistory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbRestoreHistory -SqlInstance sql2016\nReturns server name, database, username, restore type, date for all restored databases on sql2016.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbRestoreHistory -SqlInstance sql2016 -Database db1, db2 -Since \u00272016-07-01 10:47:00\u0027\nReturns restore information only for databases db1 and db2 on sql2016 since July 1, 2016 at 10:47 AM.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbRestoreHistory -SqlInstance sql2014, sql2016 -Exclude db1\nReturns restore information for all databases except db1 on sql2014 and sql2016.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Get-DbaDbRestoreHistory -SqlInstance sql2014 -Database AdventureWorks2014, pubs -SqlCredential $cred | Format-Table\nReturns database restore information for AdventureWorks2014 and pubs database on sql2014, connects using SQL Authentication via sqladmin account. Formats the data as a table.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sql2016 | Get-DbaDbRestoreHistory\nReturns database restore information for every database on every server listed in the Central Management Server on sql2016.", "Params": [ [ "SqlInstance", "Specifies the SQL Server instance(s) to operate on. Requires SQL Server 2005 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "Since", "Specifies a datetime to use as the starting point for searching backup history.", "", false, "false", "", "" ], [ "Force", "Deprecated.", "", false, "false", "False", "" ], [ "Last", "If this switch is enabled, the last restore action performed on each database is returned.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbRestoreHistory [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-Since] \u003cDateTime\u003e] [-Force] [-Last] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbRole", "Description": "The Get-DbaDbRole returns connected SMO object for database roles for each instance(s) of SQL Server.", "Tags": [ "Role", "Database", "Security", "Login" ], "Synopsis": "Get the database roles for each instance(s) of SQL Server.", "Alias": "", "Author": "Ben Miller (@DBAduck)", "CommandName": "Get-DbaDbRole", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbRole", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbRole -SqlInstance localhost\nReturns all database roles in all databases on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbRole -SqlInstance localhost, sql2016\nReturns all roles of all database(s) on the local and sql2016 SQL Server instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers = Get-Content C:\\servers.txt\nPS C:\\\u003e $servers | Get-DbaDbRole\nReturns roles of all database(s) for every server in C:\\servers.txt\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbRole -SqlInstance localhost -Database msdb\nReturns roles of the database msdb on localhost.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDbRole -SqlInstance localhost -Database msdb -ExcludeFixedRole\nReturns all non-fixed roles in the msdb database on localhost.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaDbRole -SqlInstance localhost -Database msdb -Role \u0027db_owner\u0027\nReturns the db_owner role in the msdb database on localhost.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "Role", "The role(s) to process. If unspecified, all roles will be processed.", "", false, "false", "", "" ], [ "ExcludeRole", "The role(s) to exclude.", "", false, "false", "", "" ], [ "ExcludeFixedRole", "Excludes all fixed roles.", "", false, "false", "False", "" ], [ "InputObject", "Enables piped input from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbRole [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-Role] \u003cString[]\u003e] [[-ExcludeRole] \u003cString[]\u003e] [-ExcludeFixedRole] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbRoleMember", "Description": "The Get-DbaDbRoleMember returns connected SMO object for database roles for each instance(s) of SQL Server.", "Tags": [ "Role", "Database", "Security", "Login" ], "Synopsis": "Get members of database roles for each instance(s) of SQL Server.", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDBAKlaas)", "CommandName": "Get-DbaDbRoleMember", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbRoleMember", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbRoleMember -SqlInstance localhost\nReturns all members of all database roles on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbRoleMember -SqlInstance localhost, sql2016\nReturns all members of all database roles on the local and sql2016 SQL Server instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers = Get-Content C:\\servers.txt\nPS C:\\\u003e $servers | Get-DbaDbRoleMember\nReturns all members of all database roles for every server in C:\\servers.txt\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbRoleMember -SqlInstance localhost -Database msdb\nReturns non-system members of all roles in the msdb database on localhost.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDbRoleMember -SqlInstance localhost -Database msdb -IncludeSystemUser -ExcludeFixedRole\nReturns all members of non-fixed roles in the msdb database on localhost.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaDbRoleMember -SqlInstance localhost -Database msdb -Role \u0027db_owner\u0027\nReturns all members of the db_owner role in the msdb database on localhost.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$roles = Get-DbaDbRole -SqlInstance localhost -Database msdb -Role \u0027db_owner\u0027\nPS C:\\\u003e $roles | Get-DbaDbRoleMember\nReturns all members of the db_owner role in the msdb database on localhost.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "Role", "The role(s) to process. If unspecified, all roles will be processed.", "", false, "false", "", "" ], [ "ExcludeRole", "The role(s) to exclude.", "", false, "false", "", "" ], [ "ExcludeFixedRole", "Excludes all members of fixed roles.", "", false, "false", "False", "" ], [ "IncludeSystemUser", "Includes system users. By default system users are not included.", "", false, "false", "False", "" ], [ "InputObject", "Enables piped input from Get-DbaDbRole or Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbRoleMember [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-Role] \u003cString[]\u003e] [[-ExcludeRole] \u003cString[]\u003e] [-ExcludeFixedRole] [-IncludeSystemUser] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbSchema", "Description": "Finds the database schema SMO object(s) based on the given filter params.", "Tags": [ "Data", "Database", "Migration", "Permission", "Security", "Schema", "Table", "User" ], "Synopsis": "Finds the database schema SMO object(s) based on the given filter params.", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "Get-DbaDbSchema", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbSchema", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbSchema -SqlInstance localhost\nGets all non-system database schemas from all user databases on the localhost instance. Note: the dbo schema is a system schema and won\u0027t be included in the output from this example. To include the \r\ndbo schema specify -IncludeSystemSchemas\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbSchema -SqlInstance localhost -Schema dbo -IncludeSystemSchemas\nReturns the dbo schema from the databases on the localhost instance.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbSchema -SqlInstance localhost -IncludeSystemDatabases -IncludeSystemSchemas\nGets all database schemas from all databases on the localhost instance.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbSchema -SqlInstance localhost -Schema TestSchema\nFinds and returns the TestSchema schema from the localhost instance.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDbSchema -SqlInstance localhost -SchemaOwner DBUser1\nFinds and returns the schemas owned by DBUser1 from the localhost instance.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaDbSchema -SqlInstance localhost -Database TestDB -SchemaOwner DBUser1\nFinds and returns the schemas owned by DBUser1 in the TestDB database from the localhost instance.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$schema = Get-DbaDbSchema -SqlInstance localhost -Database TestDB -Schema TestSchema\nPS C:\\\u003e $schema.Owner = DBUser2\r\nPS C:\\\u003e $schema.Alter()\nFinds the TestSchema in the TestDB on the localhost instance and then changes the schema owner to DBUser2\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003e$schema = Get-DbaDbSchema -SqlInstance localhost -Database TestDB -Schema TestSchema\nPS C:\\\u003e $schema.Drop()\nFinds the TestSchema in the TestDB on the localhost instance and then drops it. Note: to drop a schema all objects must be transferred to another schema or dropped.\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003e$db = Get-DbaDatabase -SqlInstance localhost -Database TestDB\nPS C:\\\u003e $schema = $db | Get-DbaDbSchema -Schema TestSchema\nFinds the TestSchema in the TestDB which is passed via pipeline into the Get-DbaDbSchema command.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database(s).", "", false, "false", "", "" ], [ "Schema", "The name(s) of the schema(s)", "", false, "false", "", "" ], [ "SchemaOwner", "The name(s) of the database user(s) that own(s) the schema(s).", "", false, "false", "", "" ], [ "IncludeSystemDatabases", "Include the system databases.", "", false, "false", "False", "" ], [ "IncludeSystemSchemas", "Include the system schemas.", "", false, "false", "False", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Get-DbaDbSchema [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Schema] \u003cString[]\u003e] [[-SchemaOwner] \u003cString[]\u003e] [-IncludeSystemDatabases] [-IncludeSystemSchemas] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbSequence", "Description": "Finds a sequence in the database(s) specified.", "Tags": [ "Data", "Sequence", "Table" ], "Synopsis": "Finds a sequence.", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "Get-DbaDbSequence", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbSequence", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbSequence -SqlInstance sqldev01 -Database TestDB -Name TestSequence\nFinds the sequence TestSequence in the TestDB database on the sqldev01 instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqldev01 -Database TestDB | Get-DbaDbSequence -Name TestSequence -Schema TestSchema\nUsing a pipeline this command finds the sequence named TestSchema.TestSequence in the TestDB database on the sqldev01 instance.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbSequence -SqlInstance localhost\nFinds all the sequences on the localhost instance.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbSequence -SqlInstance localhost -Database db\nFinds all the sequences in the db database on the localhost instance.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDbSequence -SqlInstance localhost -Name seq\nFinds all the sequences named seq on the localhost instance.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaDbSequence -SqlInstance localhost -Schema sch\nFinds all the sequences in the sch schema on the localhost instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database(s).", "", false, "false", "", "" ], [ "Name", "The name of the sequence.", "", false, "false", "", "" ], [ "Schema", "The name of the schema for the sequence. The default is dbo.", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbSequence [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Name] \u003cString[]\u003e] [[-Schema] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbServiceBrokerService", "Description": "Gets database Sservice broker services", "Tags": [ "Database", "ServiceBroker", "Service" ], "Synopsis": "Gets database service broker services", "Alias": "", "Author": "Ant Green (@ant_green)", "CommandName": "Get-DbaDbServiceBrokerService", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbServiceBrokerService", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbServiceBrokerService -SqlInstance sql2016\nGets all database service broker queues\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbServiceBrokerService -SqlInstance Server1 -Database db1\nGets the service broker queues for the db1 database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbServiceBrokerService -SqlInstance Server1 -ExcludeDatabase db1\nGets the service broker queues for all databases except db1\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbServiceBrokerService -SqlInstance Server1 -ExcludeSystemService\nGets the service broker queues for all databases that are not system objects", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "To get service broker services from specific database(s)", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto populated from the server", "", false, "false", "", "" ], [ "ExcludeSystemService", "This switch removes all system objects from the queue collection", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbServiceBrokerService [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-ExcludeSystemService] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbSharePoint", "Description": "Returns databases that are part of a SharePoint Farm, as found in the SharePoint Configuration database.\n\nBy default, this command checks SharePoint_Config. To use an alternate database, use the ConfigDatabase parameter.", "Tags": "SharePoint", "Synopsis": "Returns databases that are part of a SharePoint Farm.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbSharePoint", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbSharePoint", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbSharePoint -SqlInstance sqlcluster\nReturns databases that are part of a SharePoint Farm, as found in SharePoint_Config on sqlcluster\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqlcluster -Database SharePoint_Config_2016 | Get-DbaDbSharePoint\nReturns databases that are part of a SharePoint Farm, as found in SharePoint_Config_2016 on sqlcluster", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "ConfigDatabase", "The name of the SharePoint Configuration database. Defaults to SharePoint_Config.", "", false, "false", "SharePoint_Config", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbSharePoint [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-ConfigDatabase] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbSnapshot", "Description": "Retrieves the list of database snapshot available, along with their base (the db they are the snapshot of) and creation time", "Tags": "Snapshot", "Synopsis": "Get database snapshots with details", "Alias": "", "Author": "Simone Bizzotto (@niphlod)", "CommandName": "Get-DbaDbSnapshot", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbSnapshot", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbSnapshot -SqlInstance sqlserver2014a\nReturns a custom object displaying Server, Database, DatabaseCreated, SnapshotOf, SizeMB, DatabaseCreated\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbSnapshot -SqlInstance sqlserver2014a -Database HR, Accounting\nReturns information for database snapshots having HR and Accounting as base dbs\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbSnapshot -SqlInstance sqlserver2014a -Snapshot HR_snapshot, Accounting_snapshot\nReturns information for database snapshots HR_snapshot and Accounting_snapshot", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Return information for only specific databases", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Snapshot", "Return information for only specific snapshots", "", false, "false", "", "" ], [ "ExcludeSnapshot", "The snapshot(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbSnapshot [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-Snapshot] \u003cObject[]\u003e] [[-ExcludeSnapshot] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbSpace", "Description": "This function returns database file space information for a SQL Instance or group of SQL Instances. Information is based on a query against sys.database_files and the FILEPROPERTY function to query and return information.\n\nFile free space script borrowed and modified from Glenn Berry\u0027s DMV scripts (http://www.sqlskills.com/blogs/glenn/category/dmv-queries/)", "Tags": [ "Database", "Space" ], "Synopsis": "Returns database file space information for database files on a SQL instance.", "Alias": "", "Author": "Michael Fal (@Mike_Fal), http://mikefal.net", "CommandName": "Get-DbaDbSpace", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbSpace", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbSpace -SqlInstance localhost\nReturns all user database files and free space information for the localhost.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbSpace -SqlInstance localhost | Where-Object {$_.PercentUsed -gt 80}\nReturns all user database files and free space information for the local host. Filters the output object by any files that have a percent used of greater than 80%.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027localhost\u0027,\u0027localhost\\namedinstance\u0027 | Get-DbaDbSpace\nReturns all user database files and free space information for the localhost and localhost\\namedinstance SQL Server instances. Processes data via the pipeline.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbSpace -SqlInstance localhost -Database db1, db2 | Where-Object { $_.SpaceUntilMaxSize.Megabyte -lt 1 }\nReturns database files and free space information for the db1 and db2 on localhost where there is only 1MB left until the space is maxed out\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDbSpace -SqlInstance localhost -Database db1, db2 | Where-Object { $_.SpaceUntilMaxSize.Gigabyte -lt 1 }\nReturns database files and free space information for the db1 and db2 on localhost where there is only 1GB left until the space is maxed out", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "IncludeSystemDBs", "Deprecated - if filtering is needed, please pipe filtered results from Get-DbaDatabase", "", false, "false", "False", "" ], [ "InputObject", "A piped collection of database objects from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbSpace [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [-IncludeSystemDBs] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbState", "Description": "Gets some common \"states\" on databases:\n- \"RW\" options : READ_ONLY or READ_WRITE\n- \"Status\" options : ONLINE, OFFLINE, EMERGENCY, RESTORING\n- \"Access\" options : SINGLE_USER, RESTRICTED_USER, MULTI_USER\n\nReturns an object with SqlInstance, Database, RW, Status, Access", "Tags": "Database", "Synopsis": "Gets various options for databases, hereby called \"states\"", "Alias": "", "Author": "Simone Bizzotto (@niphold)", "CommandName": "Get-DbaDbState", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbState", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbState -SqlInstance sqlserver2014a\nGets options for all databases of the sqlserver2014a instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbState -SqlInstance sqlserver2014a -Database HR, Accounting\nGets options for both HR and Accounting database of the sqlserver2014a instance\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbState -SqlInstance sqlserver2014a -Exclude HR\nGets options for all databases of the sqlserver2014a instance except HR\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e\u0027sqlserver2014a\u0027, \u0027sqlserver2014b\u0027 | Get-DbaDbState\nGets options for all databases of sqlserver2014a and sqlserver2014b instances", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbState [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbStoredProcedure", "Description": "Gets database Stored Procedures", "Tags": [ "Database", "StoredProcedure", "Proc" ], "Synopsis": "Gets database Stored Procedures", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDbaKlaas)", "CommandName": "Get-DbaDbStoredProcedure", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbStoredProcedure", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbStoredProcedure -SqlInstance sql2016\nGets all database Stored Procedures\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbStoredProcedure -SqlInstance Server1 -Database db1\nGets the Stored Procedures for the db1 database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbStoredProcedure -SqlInstance Server1 -ExcludeDatabase db1\nGets the Stored Procedures for all databases except db1\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbStoredProcedure -SqlInstance Server1 -ExcludeSystemSp\nGets the Stored Procedures for all databases that are not system objects\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbStoredProcedure\nGets the Stored Procedures for the databases on Sql1 and Sql2/sqlexpress\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance Server1 -ExcludeSystem | Get-DbaDbStoredProcedure\nPipe the databases from Get-DbaDatabase into Get-DbaDbStoredProcedure", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "To get Stored Procedures from specific database(s)", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto populated from the server", "", false, "false", "", "" ], [ "ExcludeSystemSp", "This switch removes all system objects from the Stored Procedure collection", "", false, "false", "False", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbStoredProcedure [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-ExcludeSystemSp] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbSynonym", "Description": "The Get-DbaDbSynonym returns the synonym(s) for database(s) / instance(s) of SQL Server.", "Tags": [ "Synonym", "Database" ], "Synopsis": "Get the synonym(s) for database(s) / instance(s) of SQL Server.", "Alias": "", "Author": "Mikey Bronowski (@MikeyBronowski), https://bronowski.it", "CommandName": "Get-DbaDbSynonym", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbSynonym", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbSynonym -SqlInstance localhost\nReturns all database synonyms in all databases on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbSynonym -SqlInstance localhost, sql2016\nReturns all synonyms of all database(s) on the local and sql2016 SQL Server instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers = Get-Content C:\\servers.txt\nPS C:\\\u003e $servers | Get-DbaDbSynonym\nReturns synonyms of all database(s) for every server in C:\\servers.txt\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbSynonym -SqlInstance localhost -Database db1\nReturns synonyms of the database db1 on localhost.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDbSynonym -SqlInstance localhost -Database db1 -Synonym \u0027synonym1\u0027\nReturns the synonym1 synonym in the db1 database on localhost.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "Schema", "The schema(s) to process. If unspecified, all schemas will be processed.", "", false, "false", "", "" ], [ "ExcludeSchema", "The schema(s) to exclude.", "", false, "false", "", "" ], [ "Synonym", "The synonym(s) to process. If unspecified, all synonyms will be processed.", "", false, "false", "", "" ], [ "ExcludeSynonym", "The synonym(s) to exclude.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Get-DbaDbSynonym [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-Schema] \u003cString[]\u003e] [[-ExcludeSchema] \u003cString[]\u003e] [[-Synonym] \u003cString[]\u003e] [[-ExcludeSynonym] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbTable", "Description": "Shows table information around table row and data sizes and if it has any table type information.", "Tags": [ "Database", "Tables" ], "Synopsis": "Returns a summary of information on the tables", "Alias": "", "Author": "Stephen Bennett, https://sqlnotesfromtheunderground.wordpress.com/", "CommandName": "Get-DbaDbTable", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbTable", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance DEV01 -Database Test1\nReturn all tables in the Test1 database\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance DEV01 -Database MyDB -Table MyTable\nReturn only information on the table MyTable from the database MyDB\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance DEV01 -Database MyDB -Table MyTable -Schema MySchema\nReturn only information on the table MyTable from the database MyDB and only from the schema MySchema\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance DEV01 -Table MyTable\nReturns information on table called MyTable if it exists in any database on the server, under any schema\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance DEV01 -Table dbo.[First.Table]\nReturns information on table called First.Table on schema dbo if it exists in any database on the server\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e\u0027localhost\u0027,\u0027localhost\\namedinstance\u0027 | Get-DbaDbTable -Database DBA -Table Commandlog\nReturns information on the CommandLog table in the DBA database on both instances localhost and the named instance localhost\\namedinstance\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance DEV01 -Table \"[[DbName]]].[Schema.With.Dots].[`\"[Process]]`\"]\" -Verbose\nFor the instance Dev01 Returns information for a table named: \"[Process]\" in schema named: Schema.With.Dots in database named: [DbName]\r\nThe Table name, Schema name and Database name must be wrapped in square brackets [ ]\r\nSpecial charcters like \" must be escaped by a ` charcter.\r\nIn addition any actual instance of the ] character must be escaped by being duplicated.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "IncludeSystemDBs", "Switch parameter that when used will display system database information", "", false, "false", "False", "" ], [ "Table", "Define a specific table you would like to query. You can specify up to three-part name like db.sch.tbl.\nIf the object has special characters please wrap them in square brackets [ ].\r\nUsing dbo.First.Table will try to find table named \u0027Table\u0027 on schema \u0027First\u0027 and database \u0027dbo\u0027.\r\nThe correct way to find table named \u0027First.Table\u0027 on schema \u0027dbo\u0027 is by passing dbo.[First.Table]\r\nAny actual usage of the ] must be escaped by duplicating the ] character.\r\nThe correct way to find a table Name] in schema Schema.Name is by passing [Schema.Name].[Name]]]", "", false, "false", "", "" ], [ "Schema", "Only return tables from the specified schema", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbTable [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [-IncludeSystemDBs] [[-Table] \u003cString[]\u003e] [[-Schema] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbTrigger", "Description": "Get all existing database triggers on one or more SQL instances.", "Tags": [ "Database", "Trigger" ], "Synopsis": "Get all existing database triggers on one or more SQL instances.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbTrigger", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbTrigger", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbTrigger -SqlInstance sql2017\nReturns all database triggers\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2017 -Database supa | Get-DbaDbTrigger\nReturns all triggers for database supa on sql2017\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbTrigger -SqlInstance sql2017 -Database supa\nReturns all triggers for database supa on sql2017", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "SqlLogin to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance..", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "InputObject", "Allow pipedline input from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/ca", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbTrigger [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbUdf", "Description": "Gets database User Defined Functions", "Tags": [ "Security", "Database" ], "Synopsis": "Gets database User Defined Functions", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDbaKlaas)", "CommandName": "Get-DbaDbUdf", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbUdf", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbUdf -SqlInstance sql2016\nGets all database User Defined Functions\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbUdf -SqlInstance Server1 -Database db1\nGets the User Defined Functions for the db1 database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbUdf -SqlInstance Server1 -ExcludeDatabase db1\nGets the User Defined Functions for all databases except db1\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbUdf -SqlInstance Server1 -ExcludeSystemUdf\nGets the User Defined Functions for all databases that are not system objects (there can be 100+ system User Defined Functions in each DB)\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbUdf\nGets the User Defined Functions for the databases on Sql1 and Sql2/sqlexpress", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "To get User Defined Functions from specific database(s)", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto populated from the server", "", false, "false", "", "" ], [ "ExcludeSystemUdf", "This switch removes all system objects from the UDF collection", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbUdf [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-ExcludeSystemUdf] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbUser", "Description": "Gets database users", "Tags": [ "Security", "Database" ], "Synopsis": "Gets database users", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDbaKlaas)", "CommandName": "Get-DbaDbUser", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbUser", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbUser -SqlInstance sql2016\nGets all database users\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbUser -SqlInstance Server1 -Database db1\nGets the users for the db1 database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbUser -SqlInstance Server1 -ExcludeDatabase db1\nGets the users for all databases except db1\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbUser -SqlInstance Server1 -ExcludeSystemUser\nGets the users for all databases that are not system objects, like \u0027dbo\u0027, \u0027guest\u0027 or \u0027INFORMATION_SCHEMA\u0027\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbUser\nGets the users for the databases on Sql1 and Sql2/sqlexpress", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "To get users from specific database(s)", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto populated from the server", "", false, "false", "", "" ], [ "ExcludeSystemUser", "This switch removes all system objects from the user collection", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbUser [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-ExcludeSystemUser] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbUserDefinedTableType", "Description": "Gets database user defined table tpes", "Tags": [ "Database", "UserDefinedTableType", "Type" ], "Synopsis": "Gets database user defined table types", "Alias": "", "Author": "Ant Green (@ant_green)", "CommandName": "Get-DbaDbUserDefinedTableType", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbUserDefinedTableType", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbUserDefinedTableType -SqlInstance sql2016\nGets all database Stored Procedures\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbUserDefinedTableType -SqlInstance Server1 -Database db1\nGets the Stored Procedures for the db1 database", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "To get Stored Procedures from specific database(s)", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto populated from the server", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbUserDefinedTableType [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbView", "Description": "Gets database views for each SqlInstance.", "Tags": [ "Security", "Database" ], "Synopsis": "Gets database views for each SqlInstance.", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDbaKlaas)", "CommandName": "Get-DbaDbView", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbView", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbView -SqlInstance sql2016\nGets all database views\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbView -SqlInstance Server1 -Database db1\nGets the views for the db1 database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbView -SqlInstance Server1 -ExcludeDatabase db1\nGets the views for all databases except db1\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbView -SqlInstance Server1 -ExcludeSystemView\nGets the views for all databases that are not system objects (there can be 400+ system views in each DB)\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaDbView\nGets the views for the databases on Sql1 and Sql2/sqlexpress\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance Server1 -ExcludeSystem | Get-DbaDbView\nPipe the databases from Get-DbaDatabase into Get-DbaDbView\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaDbView -SqlInstance Server1 -Database db1 -View vw1\nGets the view vw1 for the db1 database", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "To get views from specific database(s) - this list is auto populated from the server.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto populated from the server.", "", false, "false", "", "" ], [ "ExcludeSystemView", "This switch removes all system objects from the view collection.", "", false, "false", "False", "" ], [ "View", "The view(s) to include - all views are selected if not populated", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbView [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-ExcludeSystemView] [[-View] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDbVirtualLogFile", "Description": "Having a transaction log file with too many virtual log files (VLFs) can hurt database performance.\n\nToo many VLFs 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\nReferences:\nhttp://www.sqlskills.com/blogs/kimberly/transaction-log-vlfs-too-many-or-too-few/\nhttp://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-DbaDbLogFile to reduce the number.", "Tags": [ "VLF", "Database", "LogFile" ], "Synopsis": "Returns database virtual log file information for database files on a SQL instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDbVirtualLogFile", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDbVirtualLogFile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDbVirtualLogFile -SqlInstance sqlcluster\nReturns all user database virtual log file details for the sqlcluster instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbVirtualLogFile -SqlInstance sqlserver | Group-Object -Property Database | Where-Object Count -gt 50\nReturns user databases that have 50 or more VLFs.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027sqlserver\u0027,\u0027sqlcluster\u0027 | Get-DbaDbVirtualLogFile\nReturns all VLF information for the sqlserver and sqlcluster SQL Server instances. Processes data via the pipeline.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbVirtualLogFile -SqlInstance sqlcluster -Database db1, db2\nReturns the VLF counts for the db1 and db2 databases on sqlcluster.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "IncludeSystemDBs", "If this switch is enabled, system database information will be displayed.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDbVirtualLogFile [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-IncludeSystemDBs] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDefaultPath", "Description": "Gets the default SQL Server paths for data, logs and backups", "Tags": "Config", "Synopsis": "Gets the default SQL Server paths for data, logs and backups", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDefaultPath", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDefaultPath", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDefaultPath -SqlInstance sql01\\sharepoint\nReturns the default file paths for sql01\\sharepoint\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$servers = \"sql2014\",\"sql2016\", \"sqlcluster\\sharepoint\"\nPS C:\\\u003e $servers | Get-DbaDefaultPath\nReturns the default file paths for \"sql2014\",\"sql2016\" and \"sqlcluster\\sharepoint\"", "Params": [ [ "SqlInstance", "TThe target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDefaultPath [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDependency", "Description": "This function recursively finds all objects that depends on the input.\nIt will then retrieve rich information from them, including their creation scripts and the order in which it should be applied.\n\nBy using the \u0027Parents\u0027 switch, the function will instead retrieve all items that the input depends on (including their creation scripts).\n\nFor more details on dependency, see:\nhttps://technet.microsoft.com/en-us/library/ms345449(v=sql.105).aspx", "Tags": [ "Database", "Dependent", "Dependency", "Object" ], "Synopsis": "Finds object dependencies and their relevant creation scripts.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDependency", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDependency", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$table = (Get-DbaDatabase -SqlInstance sql2012 -Database Northwind).tables | Where-Object Name -eq Customers\nPS C:\\\u003e $table | Get-DbaDependency\nReturns everything that depends on the \"Customers\" table", "Params": [ [ "InputObject", "The SMO object to parse", "", false, "true (ByValue)", "", "" ], [ "AllowSystemObjects", "Normally, system objects are ignored by this function as dependencies.\r\nThis switch overrides that behavior.", "", false, "false", "False", "" ], [ "Parents", "Causes the function to retrieve all objects that the input depends on, rather than retrieving everything that depends on the input.", "", false, "false", "False", "" ], [ "IncludeSelf", "Includes the object whose dependencies are retrieves itself.\r\nUseful when exporting an entire logic structure in order to recreate it in another database.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDependency [[-InputObject] \u003cObject\u003e] [-AllowSystemObjects] [-Parents] [-IncludeSelf] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDeprecatedFeature", "Description": "Displays information relating to deprecated features for SQL Server 2005 and above.", "Tags": "Deprecated", "Synopsis": "Displays information relating to deprecated features for SQL Server 2005 and above.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaDeprecatedFeature", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDeprecatedFeature", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDeprecatedFeature -SqlInstance sql2008, sqlserver2012\nCheck deprecated features for all databases on the servers sql2008 and sqlserver2012.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDeprecatedFeature -SqlInstance sql2008\nCheck deprecated features on server sql2008.", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDeprecatedFeature [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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 function only shows drives of types 2 and 3 (removable disk and local disk).\n\nRequires Windows administrator access on SQL Servers", "Tags": [ "Server", "Management", "Space" ], "Synopsis": "Displays disk information for all local disk on a server.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net | Jakob Bindslet", "CommandName": "Get-DbaDiskSpace", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaDiskSpace", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDiskSpace -ComputerName srv0042\nGet disk space for the server srv0042.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDiskSpace -ComputerName srv0042 -Unit MB\nGet disk space for the server srv0042 and displays in megabytes (MB).\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDiskSpace -ComputerName srv0042, srv0007 -Unit TB\nGet disk space from two servers and displays in terabytes (TB).\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDiskSpace -ComputerName srv0042 -Force\nGet all disk and volume space information.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDiskSpace -ComputerName srv0042 -ExcludeDrive \u0027C:\\\u0027\nGet all disk and volume space information.", "Params": [ [ "ComputerName", "The target computer. Defaults to localhost.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Credential object used to connect to the computer as a different user.", "", false, "false", "", "" ], [ "Unit", "This parameter has been deprecated and will be removed in 1.0.0\r\nAll properties previously generated through this command are present at the same time, but hidden by default.", "", false, "false", "GB", "Bytes,KB,MB,GB,TB,PB" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "ExcludeDrive", "Filter out drives - format is C:\\", "", false, "false", "", "" ], [ "CheckFragmentation", "If this switch is enabled, fragmentation of all file systems will be checked.\nThis will increase the runtime of the function by seconds or even minutes per volume.", "", false, "false", "False", "" ], [ "Force", "Enabling this switch will cause the command to include ALL drives.\r\nBy default, only local disks and removable disks are shown, and hidden volumes are excluded.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDiskSpace [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-Unit] \u003cString\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-ExcludeDrive] \u003cString[]\u003e] [-CheckFragmentation] [-Force] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaDump", "Description": "The type of dump included in the search include minidump, all-thread dump, or a full dump. The files have an extendion of .mdmp.", "Tags": [ "Engine", "Corruption" ], "Synopsis": "Locate a SQL Server that has generated any memory dump files.", "Alias": "", "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com", "CommandName": "Get-DbaDump", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaDump", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDump -SqlInstance sql2016\nShows the detailed information for memory dump(s) located on sql2016 instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDump -SqlInstance sql2016 -SqlCredential sqladmin\nShows the detailed information for memory dump(s) located on sql2016 instance. Logs into the SQL Server using the SQL login \u0027sqladmin\u0027", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaDump [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaEndpoint", "Description": "Returns endpoint objects from a SQL Server instance.", "Tags": "Endpoint", "Synopsis": "Returns endpoint objects from a SQL Server instance.", "Alias": "", "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com", "CommandName": "Get-DbaEndpoint", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaEndpoint", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaEndpoint -SqlInstance localhost\nReturns all endpoints on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaEndpoint -SqlInstance localhost, sql2016\nReturns all endpoints for the local and sql2016 SQL Server instances", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Endpoint", "Return only specific endpoints.", "", false, "false", "", "" ], [ "Type", "Return only specific types of endpoints. Options include: DatabaseMirroring, ServiceBroker, Soap, and TSql.", "", false, "false", "", "DatabaseMirroring,ServiceBroker,Soap,TSql" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaEndpoint [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Endpoint] \u003cString[]\u003e] [[-Type] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaErrorLog", "Description": "Gets the \"SQL Error Log\" of an instance. Returns all 10 error logs by default.", "Tags": [ "Instance", "ErrorLog" ], "Synopsis": "Gets the \"SQL Error Log\" of an instance", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaErrorLog", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaErrorLog", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaErrorLog -SqlInstance sql01\\sharepoint\nReturns every log entry from sql01\\sharepoint SQL Server instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaErrorLog -SqlInstance sql01\\sharepoint -LogNumber 3, 6\nReturns all log entries for log number 3 and 6 on sql01\\sharepoint SQL Server instance.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaErrorLog -SqlInstance sql01\\sharepoint -Source Logon\nReturns every log entry, with a source of Logon, from sql01\\sharepoint SQL Server instance.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaErrorLog -SqlInstance sql01\\sharepoint -LogNumber 3 -Text \"login failed\"\nReturns every log entry for log number 3, with \"login failed\" in the text, from sql01\\sharepoint SQL Server instance.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$servers = \"sql2014\",\"sql2016\", \"sqlcluster\\sharepoint\"\nPS C:\\\u003e $servers | Get-DbaErrorLog -LogNumber 0\nReturns the most recent SQL Server error logs for \"sql2014\",\"sql2016\" and \"sqlcluster\\sharepoint\"\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaErrorLog -SqlInstance sql01\\sharepoint -After \u00272016-11-14 00:00:00\u0027\nReturns every log entry found after the date 14 November 2016 from sql101\\sharepoint SQL Server instance.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaErrorLog -SqlInstance sql01\\sharepoint -Before \u00272016-08-16 00:00:00\u0027\nReturns every log entry found before the date 16 August 2016 from sql101\\sharepoint SQL Server instance.", "Params": [ [ "SqlInstance", "TThe target SQL Server instance or instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "LogNumber", "An Int32 value that specifies the index number of the error log required.\r\nError logs are listed 0 through 99, where 0 is the current error log and 99 is potential oldest log file.\nSQL Server errorlog rollover defaults to 6, but can be increased to 99. https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/scm-services-configure-sql-server-error-logs", "", false, "false", "", "" ], [ "Source", "Filter results based on the Source of the error (e.g. Logon, Server, etc.)", "", false, "false", "", "" ], [ "Text", "Filter results based on a pattern of text (e.g. \"login failed\", \"error: 12345\").", "", false, "false", "", "" ], [ "After", "Filter the results based on datetime value.", "", false, "false", "", "" ], [ "Before", "Filter the results based on datetime value.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaErrorLog [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-LogNumber] \u003cInt32[]\u003e] [[-Source] \u003cObject[]\u003e] [[-Text] \u003cString\u003e] [[-After] \u003cDateTime\u003e] [[-Before] \u003cDateTime\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaErrorLogConfig", "Description": "Pulls the configuration for the ErrorLog on a given SQL Server instance.\n\nIncludes error log path, number of log files configured and size (SQL Server 2012+ only)", "Tags": [ "Instance", "ErrorLog" ], "Synopsis": "Pulls the configuration for the ErrorLog on a given SQL Server instance", "Alias": "", "Author": "Shawn Melton (@wsmelton), https://wsmelton.github.io", "CommandName": "Get-DbaErrorLogConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaErrorLogConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaErrorLogConfig -SqlInstance server2017,server2014\nReturns error log configuration for server2017 and server2014", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaErrorLogConfig [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaEstimatedCompletionTime", "Description": "Gets execution and estimated completion time information for queries\n\nPercent complete will show for the following commands\n\nALTER INDEX REORGANIZE\nAUTO_SHRINK option with ALTER DATABASE\nBACKUP DATABASE\nDBCC CHECKDB\nDBCC CHECKFILEGROUP\nDBCC CHECKTABLE\nDBCC INDEXDEFRAG\nDBCC SHRINKDATABASE\nDBCC SHRINKFILE\nRECOVERY\nRESTORE DATABASE\nROLLBACK\nTDE ENCRYPTION\n\nFor additional information, check out https://blogs.sentryone.com/loriedwards/patience-dm-exec-requests/ and https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-exec-requests-transact-sql", "Tags": "Database", "Synopsis": "Gets execution and estimated completion time information for queries", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaEstimatedCompletionTime", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaEstimatedCompletionTime", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaEstimatedCompletionTime -SqlInstance sql2016\nGets estimated completion times for queries performed against the entire server\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaEstimatedCompletionTime -SqlInstance sql2016 | Select-Object *\nGets estimated completion times for queries performed against the entire server PLUS the SQL query text of each command\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaEstimatedCompletionTime -SqlInstance sql2016 | Where-Object { $_.Text -match \u0027somequerytext\u0027 }\nGets results for commands whose queries only match specific text (match is like LIKE but way more powerful)\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaEstimatedCompletionTime -SqlInstance sql2016 -Database Northwind,pubs,Adventureworks2014\nGets estimated completion times for queries performed against the Northwind, pubs, and Adventureworks2014 databases", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "SqlLogin to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance..", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaEstimatedCompletionTime [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaExecutionPlan", "Description": "Gets execution plans and metadata. Can pipe to Export-DbaExecutionPlan\n\nThanks to following for the queries:\nhttps://www.simple-talk.com/sql/t-sql-programming/dmvs-for-query-plan-metadata/\nhttp://www.scarydba.com/2017/02/13/export-plans-cache-sqlplan-file/", "Tags": "Performance", "Synopsis": "Gets execution plans and metadata", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaExecutionPlan", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaExecutionPlan", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaExecutionPlan -SqlInstance sqlserver2014a\nGets all execution plans on sqlserver2014a\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaExecutionPlan -SqlInstance sqlserver2014a -Database db1, db2 -SinceLastExecution \u00272016-07-01 10:47:00\u0027\nGets all execution plans for databases db1 and db2 on sqlserver2014a since July 1, 2016 at 10:47 AM.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaExecutionPlan -SqlInstance sqlserver2014a, sql2016 -Exclude db1 | Format-Table\nGets execution plan info for all databases except db1 on sqlserver2014a and sql2016 and makes the output pretty\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaExecutionPlan -SqlInstance sql2014 -Database AdventureWorks2014, pubs -Force\nGets super detailed information for execution plans on only for AdventureWorks2014 and pubs\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$servers = \"sqlserver2014a\",\"sql2016t\"\nPS C:\\\u003e $servers | Get-DbaExecutionPlan -Force\nGets super detailed information for execution plans on sqlserver2014a and sql2016", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Return execution plans and metadata for only specific databases.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Return execution plans and metadata for all but these specific databases", "", false, "false", "", "" ], [ "SinceCreation", "Datetime object used to narrow the results to a date", "", false, "false", "", "" ], [ "SinceLastExecution", "Datetime object used to narrow the results to a date", "", false, "false", "", "" ], [ "ExcludeEmptyQueryPlan", "Exclude results with empty query plan", "", false, "false", "False", "" ], [ "Force", "Returns a ton of raw information about the execution plans", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaExecutionPlan [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-SinceCreation] \u003cDateTime\u003e] [[-SinceLastExecution] \u003cDateTime\u003e] [-ExcludeEmptyQueryPlan] [-Force] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaExtendedProperty", "Description": "Gets extended properties\n\nThis command works out of the box with databases but you can add or get extended properties from any object. Just pipe it in it\u0027ll grab the properties and print them out.\n\nYou can get extended properties on all these different types of objects:\n\nAggregate\nAssembly\nColumn\nConstraint\nContract\nDatabase\nEvent Notification\nFilegroup\nFunction\nIndex\nLogical File Name\nMessage Type\nParameter\nPartition Function\nPartition Scheme\nProcedure\nQueue\nRemote Service Binding\nRoute\nRule\nSchema\nService\nSynonym\nTable\nTrigger\nType\nView\nXml Schema Collection", "Tags": "extended properties", "Synopsis": "Gets extended properties", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaExtendedProperty", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaExtendedProperty", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaExtendedProperty -SqlInstance sql2016\nGets all extended properties on all databases\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaExtendedProperty -SqlInstance Server1 -Database db1\nGets the extended properties for the db1 database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaExtendedProperty -SqlInstance Server1 -Database db1 -Name info1, info2\nGets the info1 and info2 extended properties within the db1 database\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbStoredProcedure -SqlInstance localhost -Database tempdb | Get-DbaExtendedProperty\nGet the extended properties for all stored procedures in the tempdb database\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance localhost -Database mydb -Table mytable | Get-DbaExtendedProperty\nGet the extended properties for the mytable table in the mydb database", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Get extended properties from specific database", "", false, "false", "", "" ], [ "Name", "Get specific extended properties by name", "Property", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-Dba* commands", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaExtendedProperty [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Name] \u003cString[]\u003e] [[-InputObject] \u003cPSObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaExtendedProtection", "Description": "Get the Extended Protection setting of the SQL Server network configuration.\n\nThis setting requires access to the Windows Server and not the SQL Server instance. The setting is found in SQL Server Configuration Manager under the properties of SQL Server Network Configuration \u003e Protocols for \"InstanceName\".", "Tags": [ "Instance", "Security" ], "Synopsis": "Get the Extended Protection setting of the SQL Server network configuration.", "Alias": "", "Author": "Cláudio Silva (@claudioessilva), https://claudioessilva.eu", "CommandName": "Get-DbaExtendedProtection", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaExtendedProtection", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaExtendedProtection\nGets Extended Protection on the default (MSSQLSERVER) instance on localhost - requires (and checks for) RunAs admin.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaExtendedProtection -SqlInstance sql01\\SQL2008R2SP2\nSet Extended Protection of SQL Engine for the SQL2008R2SP2 on sql01 to \"Off\". Uses Windows Credentials to both connect and modify the registry.\r\nGets Extended Protection for the SQL2008R2SP2 on sql01. Uses Windows Credentials to both login and view the registry.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the computer (not SQL Server instance) using alternative Windows credentials", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Get-DbaExtendedProtection [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaExternalProcess", "Description": "Gets OS processes created by SQL Server\n\nHelps when finding hung sessions with External Wait Types\n\nhttps://web.archive.org/web/20201027122300/http://vickyharp.com/2013/12/killing-sessions-with-external-wait-types/", "Tags": "Process", "Synopsis": "Gets OS processes created by SQL Server", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaExternalProcess", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaExternalProcess", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaExternalProcess -ComputerName SERVER01, SERVER02\nGets OS processes created by SQL Server on SERVER01 and SERVER02", "Params": [ [ "ComputerName", "The target SQL Server host computer", "", true, "true (ByValue)", "", "" ], [ "Credential", "Allows you to login to $ComputerName using alternative credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaExternalProcess [-ComputerName] \u003cDbaInstanceParameter[]\u003e [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaFeature", "Description": "Runs the SQL Server feature discovery report (setup.exe /Action=RunDiscovery)\n\nInspired by Dave Mason\u0027s (@BeginTry) post at\nhttps://itsalljustelectrons.blogspot.be/2018/04/SQL-Server-Discovery-Report.html\n\nAssumptions:\n1. The sub-folder \"Microsoft SQL Server\" exists in [System.Environment]::GetFolderPath(\"ProgramFiles\"),\neven if SQL was installed to a non-default path. This has been\nverified on SQL 2008R2 and SQL 2012. Further verification may be needed.\n2. The discovery report displays installed components for the version of SQL\nServer associated with setup.exe, along with installed components of all\nlesser versions of SQL Server that are installed.", "Tags": [ "Feature", "Component" ], "Synopsis": "Runs the SQL Server feature discovery report (setup.exe /Action=RunDiscovery)", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaFeature", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaFeature", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaFeature -ComputerName sql2017, sql2016, sql2005\nGets all SQL Server features for all instances on sql2017, sql2016 and sql2005.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaFeature -Verbose\nGets all SQL Server features for all instances on localhost. Outputs to screen if no instances are found.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaFeature -ComputerName sql2017 -Credential ad\\sqldba\nGets all SQL Server features for all instances on sql2017 using the ad\\sqladmin credential (which has access to the Windows Server).", "Params": [ [ "ComputerName", "The target computer. If the target is not localhost, it must have PowerShell remoting enabled.\nNote that this is not the SqlInstance, but rather the ComputerName", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to servers using alternative credentials. To use:\n$cred = Get-Credential, then pass $cred object to the -Credential parameter.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaFeature [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaFile", "Description": "This command searches all specified directories, allowing a DBA to see file information on a server without direct access\n\nYou can filter by extension using the -FileType parameter. By default, the default data directory will be returned. You can provide and additional paths to search using the -Path parameter.\n\nThanks to serg-52 for the query: https://www.sqlservercentral.com/Forums/Topic1642213-391-1.aspx", "Tags": "Discovery", "Synopsis": "Get-DbaFile finds files in any directory specified on a remote SQL Server", "Alias": "", "Author": "Brandon Abshire, netnerds.net", "CommandName": "Get-DbaFile", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaFile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaFile -SqlInstance sqlserver2014a -Path E:\\Dir1\nLogs into the SQL Server \"sqlserver2014a\" using Windows credentials and searches E:\\Dir for all files\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaFile -SqlInstance sqlserver2014a -SqlCredential $cred -Path \u0027E:\\sql files\u0027\nLogs into the SQL Server \"sqlserver2014a\" using alternative credentials and returns all files in \u0027E:\\sql files\u0027\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$all = Get-DbaDefaultPath -SqlInstance sql2014\nPS C:\\\u003e Get-DbaFile -SqlInstance sql2014 -Path $all.Data, $all.Log, $all.Backup -Depth 3\nReturns the files in the default data, log and backup directories on sql2014, 3 directories deep (recursively).\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaFile -SqlInstance sql2014 -Path \u0027E:\\Dir1\u0027, \u0027E:\\Dir2\u0027\nReturns the files in \"E:\\Dir1\" and \"E:Dir2\" on sql2014\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaFile -SqlInstance sql2014, sql2016 -Path \u0027E:\\Dir1\u0027 -FileType fsf, mld\nFinds files in E:\\Dir1 ending with \".fsf\" and \".mld\" for both the servers sql2014 and sql2016.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Allows you to login to servers using alternative credentials", "", false, "false", "", "" ], [ "Path", "Used to specify extra directories to search in addition to the default data directory.", "", false, "false", "", "" ], [ "FileType", "Used to specify filter by filetype. No dot required, just pass the extension.", "", false, "false", "", "" ], [ "Depth", "Used to specify recursive folder depth. Default is 1, non-recursive.", "", false, "false", "1", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaFile [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Path] \u003cString[]\u003e] [[-FileType] \u003cString[]\u003e] [[-Depth] \u003cInt32\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaFilestream", "Description": "Returns the status of Filestream on specified SQL Server for both the Service and Instance levels.", "Tags": "Filestream", "Synopsis": "Returns the status of Filestream on specified SQL Server for both the Service and Instance levels.", "Alias": "", "Author": "Stuart Moore ( @napalmgram ) | Chrissy LeMaire ( @cl )", "CommandName": "Get-DbaFilestream", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaFilestream", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaFilestream -SqlInstance server1\\instance2\nWill return the status of Filestream configuration for the service and instance server1\\instance2\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaFilestream -SqlInstance server1\\instance2 -SqlCredential sqladmin\nPrompts for the password to the SQL Login \"sqladmin\" then returns the status of Filestream configuration for the service and instance server1\\instance2", "Params": [ [ "SqlInstance", "SQL Server name or SMO object representing the SQL Server to connect to. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Credential", "Login to the target Windows server using alternative credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaFilestream [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaFirewallRule", "Description": "Returns firewall rules for SQL Server instances from the target computer.\nAs the group and the names of the firewall rules are fixed, this command\nonly works for rules created with New-DbaFirewallRule.\n\nThis is basically a wrapper around Get-NetFirewallRule executed at the target computer.\nSo this only works if Get-NetFirewallRule works on the target computer.\n\nThe functionality is currently limited. Help to extend the functionality is welcome.\n\nAs long as you can read this note here, there may be breaking changes in future versions.\nSo please review your scripts using this command after updating dbatools.", "Tags": [ "Firewall", "Network" ], "Synopsis": "Returns firewall rules for SQL Server instances from the target computer.", "Alias": "", "Author": "Andreas Jordan (@JordanOrdix), ordix.de", "CommandName": "Get-DbaFirewallRule", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaFirewallRule", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaFirewallRule -SqlInstance SRV1\nReturns the firewall rule for the default instance on SRV1.\r\nIn case the instance is not listening on port 1433, it also returnes the firewall rule for the SQL Server Browser.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaFirewallRule -SqlInstance SRV1\\SQL2016 -Type Engine\nReturns only the firewall rule for the instance SQL2016 on SRV1.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaFirewallRule -SqlInstance SRV1\\SQL2016 -Type Browser\nPS C:\\\u003e Get-DbaFirewallRule -SqlInstance SRV1 -Type Browser\nBoth commands return the firewall rule for the SQL Serer Browser on SRV1.\r\nAs the Browser is not bound to a specific instance, only the computer part of SqlInstance is used.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaFirewallRule -SqlInstance SRV1\\SQL2016 -Type AllInstance\nReturns all firewall rules on the computer SRV1 related to SQL Server.\r\nThe value \"AllInstance\" only uses the computer name part of SqlInstance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "Credential", "Credential object used to connect to the Computer as a different user.", "", false, "false", "", "" ], [ "Type", "Returns firewall rules for the given type(s).\r\nValid values are:\r\n Engine - for the SQL Server instance\r\n Browser - for the SQL Server Browser\r\n AllInstance - for all firewall rules on the target computer related to SQL Server\r\nIf this parameter is not used, the firewall rule for the SQL Server instance will be returned\r\nand in case the instance is listening on a port other than 1433,\r\nalso the firewall rule for the SQL Server Browser will be returned.", "", false, "false", "", "Engine,Browser,AllInstance" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaFirewallRule [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-Credential] \u003cPSCredential\u003e] [[-Type] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaForceNetworkEncryption", "Description": "Gets Force Encryption settings for a SQL Server instance. Note that this requires access to the Windows Server - not the SQL instance itself.\n\nThis setting is found in Configuration Manager.", "Tags": "Certificate", "Synopsis": "Gets Force Encryption settings for a SQL Server instance", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaForceNetworkEncryption", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaForceNetworkEncryption", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaForceNetworkEncryption\nGets Force Encryption properties on the default (MSSQLSERVER) instance on localhost - requires (and checks for) RunAs admin.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaForceNetworkEncryption -SqlInstance sql01\\SQL2008R2SP2\nGets Force Network Encryption for the SQL2008R2SP2 on sql01. Uses Windows Credentials to both login and view the registry.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Defaults to localhost.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the computer (not sql instance) using alternative Windows credentials", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaForceNetworkEncryption [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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- ObjectName: the table containing the index\n- IndexType: clustered/non-clustered/columnstore and whether the index is unique/primary key\n- KeyColumns: the key columns of the index\n- IncludeColumns: any include columns in the index\n- FilterDefinition: any filter that may have been used in the index\n- DataCompression: row/page/none depending upon whether or not compression has been used\n- IndexReads: the number of reads of the index since last restart or index rebuild\n- IndexUpdates: the number of writes to the index since last restart or index rebuild\n- SizeKB: the size the index in KB\n- IndexRows: the number of the rows in the index (note filtered indexes will have fewer rows than exist in the table)\n- IndexLookups: the number of lookups that have been performed (only applicable for the heap or clustered index)\n- MostRecentlyUsed: when the index was most recently queried (default to 1900 for when never read)\n- StatsSampleRows: the number of rows queried when the statistics were built/rebuilt (not included in SQL Server 2005 unless ObjectName is specified)\n- StatsRowMods: the number of changes to the statistics since the last rebuild\n- HistogramSteps: the number of steps in the statistics histogram (not included in SQL Server 2005 unless ObjectName is specified)\n- StatsLastUpdated: when the statistics were last rebuilt (not included in SQL Server 2005 unless ObjectName is specified)", "Tags": "Index", "Synopsis": "Returns size, row and configuration information for indexes in databases.", "Alias": "", "Author": "Nic Cain, https://sirsql.net/", "CommandName": "Get-DbaHelpIndex", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaHelpIndex", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaHelpIndex -SqlInstance localhost -Database MyDB\nReturns information on all indexes on the MyDB database on the localhost.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaHelpIndex -SqlInstance localhost -Database MyDB,MyDB2\nReturns information on all indexes on the MyDB \u0026 MyDB2 databases.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaHelpIndex -SqlInstance localhost -Database MyDB -ObjectName dbo.Table1\nReturns index information on the object dbo.Table1 in the database MyDB.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaHelpIndex -SqlInstance localhost -Database MyDB -ObjectName dbo.Table1 -IncludeStats\nReturns information on the indexes and statistics for the table dbo.Table1 in the MyDB database.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaHelpIndex -SqlInstance localhost -Database MyDB -ObjectName dbo.Table1 -IncludeDataTypes\nReturns the index information for the table dbo.Table1 in the MyDB database, and includes the data types for the key and include columns.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaHelpIndex -SqlInstance localhost -Database MyDB -ObjectName dbo.Table1 -Raw\nReturns the index information for the table dbo.Table1 in the MyDB database, and returns the numerical data without localized separators.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaHelpIndex -SqlInstance localhost -Database MyDB -IncludeStats -Raw\nReturns the index information for all indexes in the MyDB database as well as their statistics, and formats the numerical data without localized separators.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eGet-DbaHelpIndex -SqlInstance localhost -Database MyDB -IncludeFragmentation\nReturns the index information for all indexes in the MyDB database as well as their fragmentation\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2017 -Database MyDB | Get-DbaHelpIndex\nReturns the index information for all indexes in the MyDB database", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "ObjectName", "The name of a table for which you want to obtain the index information. If the two part naming convention for an object is not used it will use the default schema for the executing user. If not \r\npassed it will return data on all indexes in a given database.", "", false, "false", "", "" ], [ "IncludeStats", "If this switch is enabled, statistics as well as indexes will be returned in the output (statistics information such as the StatsRowMods will always be returned for indexes).", "", false, "false", "False", "" ], [ "IncludeDataTypes", "If this switch is enabled, the output will include the data type of each column that makes up a part of the index definition (key and include columns).", "", false, "false", "False", "" ], [ "Raw", "If this switch is enabled, results may be less user-readable but more suitable for processing by other code.", "", false, "false", "False", "" ], [ "IncludeFragmentation", "If this switch is enabled, the output will include fragmentation information.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaHelpIndex [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [[-ObjectName] \u003cString\u003e] [-IncludeStats] [-IncludeDataTypes] [-Raw] [-IncludeFragmentation] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaHideInstance", "Description": "Gets Hide Instance settings for a SQL Server instance. Note that this requires access to the Windows Server - not the SQL instance itself.\n\nThis setting is found in Configuration Manager.", "Tags": [ "Instance", "Security" ], "Synopsis": "Gets Hide Instance settings for a SQL Server instance", "Alias": "", "Author": "Tracy Boggiano @TracyBoggiano, databaseuperhero.com", "CommandName": "Get-DbaHideInstance", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaHideInstance", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaHideInstance\nGets Hide Instance properties on the default (MSSQLSERVER) instance on localhost - requires (and checks for) RunAs admin.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaHideInstance -SqlInstance sql01\\SQL2008R2SP2\nGets Force Network Encryption for the SQL2008R2SP2 on sql01. Uses Windows Credentials to both login and view the registry.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Defaults to localhost.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the computer (not sql instance) using alternative Windows credentials", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaHideInstance [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaInstalledPatch", "Description": "Retrives a historical list of all SQL Patches (CUs, Service Packs \u0026 Hot-fixes) installed on a Computer.\n\nTo test to see if your build is up to date, use Test-DbaBuild.", "Tags": [ "Updates", "Patches" ], "Synopsis": "Retrives a historical list of all SQL Patches (CUs, Service Packs \u0026 Hot-fixes) installed on a Computer.", "Alias": "", "Author": "Hiram Fleitas, @hiramfleitas, fleitasarts.com", "CommandName": "Get-DbaInstalledPatch", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaInstalledPatch", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaInstalledPatch -ComputerName HiramSQL1, HiramSQL2\nGets a list of SQL Server patches installed on HiramSQL1 and HiramSQL2.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-Content C:\\Monitoring\\Servers.txt | Get-DbaInstalledPatch\nGets the SQL Server patches from a list of computers in C:\\Monitoring\\Servers.txt.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaInstalledPatch -ComputerName SRV1 | Sort-Object InstallDate.Date\nGets the SQL Server patches from SRV1 and orders by date. Note that we use\r\na special customizable date datatype for InstallDate so you\u0027ll need InstallDate.Date", "Params": [ [ "ComputerName", "Allows you to specify a comma separated list of servers to query.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Credential object used to connect to the Computer as a different user.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaInstalledPatch [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaInstanceAudit", "Description": "The Get-DbaInstanceAudit command gets SQL Security Audit information for each instance(s) of SQL Server.", "Tags": [ "Audit", "Security", "SqlAudit" ], "Synopsis": "Gets SQL Security Audit information for each instance(s) of SQL Server.", "Alias": "", "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com", "CommandName": "Get-DbaInstanceAudit", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaInstanceAudit", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaInstanceAudit -SqlInstance localhost\nReturns all Security Audits on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaInstanceAudit -SqlInstance localhost, sql2016\nReturns all Security Audits for the local and sql2016 SQL Server instances", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Audit", "Return only specific audits", "", false, "false", "", "" ], [ "ExcludeAudit", "Exclude specific audits", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaInstanceAudit [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Audit] \u003cString[]\u003e] [[-ExcludeAudit] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaInstanceAuditSpecification", "Description": "The Get-DbaInstanceAuditSpecification command gets SQL Security Audit Specification information for each instance(s) of SQL Server.", "Tags": [ "Audit", "Security", "SqlAudit" ], "Synopsis": "Gets SQL Security Audit Specification information for each instance(s) of SQL Server.", "Alias": "", "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com", "CommandName": "Get-DbaInstanceAuditSpecification", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaInstanceAuditSpecification", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaInstanceAuditSpecification -SqlInstance localhost\nReturns all Security Audit Specifications on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaInstanceAuditSpecification -SqlInstance localhost, sql2016\nReturns all Security Audit Specifications for the local and sql2016 SQL Server instances", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaInstanceAuditSpecification [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaInstanceInstallDate", "Description": "This command returns:\nSqlInstallDate\nWindowsInstallDate (use -IncludeWindows)", "Tags": "Install", "Synopsis": "Returns the install date of a SQL Instance and Windows Server.", "Alias": "", "Author": "Mitchell Hamann (@SirCaptainMitch), mitchellhamann.com", "CommandName": "Get-DbaInstanceInstallDate", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaInstanceInstallDate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaInstanceInstallDate -SqlInstance SqlBox1\\Instance2\nReturns an object with SQL Instance Install date as a string.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaInstanceInstallDate -SqlInstance winserver\\sqlexpress, sql2016\nReturns an object with SQL Instance Install date as a string for both SQLInstances that are passed to the cmdlet.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027sqlserver2014a\u0027, \u0027sql2016\u0027 | Get-DbaInstanceInstallDate\nReturns an object with SQL Instance Install date as a string for both SQLInstances that are passed to the cmdlet via the pipeline.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaInstanceInstallDate -SqlInstance sqlserver2014a, sql2016 -IncludeWindows\nReturns an object with the Windows Install date and the SQL install date as a string.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sql2014 | Get-DbaInstanceInstallDate\nReturns an object with SQL Instance install date as a string for every server listed in the Central Management Server on sql2014", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Credential", "Credential object used to connect to the SQL Server as a different Windows user", "", false, "false", "", "" ], [ "IncludeWindows", "Includes the Windows Server Install date information", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaInstanceInstallDate [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [-IncludeWindows] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaInstanceProperty", "Description": "The Get-DbaInstanceProperty command gets SQL Server instance properties from the SMO object sqlserver.", "Tags": [ "Instance", "Configure", "Configuration" ], "Synopsis": "Gets SQL Server instance properties of one or more instance(s) of SQL Server.", "Alias": "", "Author": "Klaas Vandenberghe (@powerdbaklaas)", "CommandName": "Get-DbaInstanceProperty", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaInstanceProperty", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaInstanceProperty -SqlInstance localhost\nReturns SQL Server instance properties on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaInstanceProperty -SqlInstance sql2, sql4\\sqlexpress\nReturns SQL Server instance properties on default instance on sql2 and sqlexpress instance on sql4\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027sql2\u0027,\u0027sql4\u0027 | Get-DbaInstanceProperty\nReturns SQL Server instance properties on sql2 and sql4\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaInstanceProperty -SqlInstance sql2,sql4 -InstanceProperty DefaultFile\nReturns SQL Server instance property DefaultFile on instance sql2 and sql4\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaInstanceProperty -SqlInstance sql2,sql4 -ExcludeInstanceProperty DefaultFile\nReturns all SQL Server instance properties except DefaultFile on instance sql2 and sql4\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Get-DbaInstanceProperty -SqlInstance sql2 -SqlCredential $cred\nConnects using sqladmin credential and returns SQL Server instance properties from sql2", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "InstanceProperty", "SQL Server instance property(ies) to include.", "", false, "false", "", "" ], [ "ExcludeInstanceProperty", "SQL Server instance property(ies) to exclude.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaInstanceProperty [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-InstanceProperty] \u003cObject[]\u003e] [[-ExcludeInstanceProperty] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaInstanceProtocol", "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": [ "Server", "Management", "Protocol" ], "Synopsis": "Gets the SQL Server related server protocols on a computer.", "Alias": "", "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )", "CommandName": "Get-DbaInstanceProtocol", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaInstanceProtocol", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaInstanceProtocol -ComputerName sqlserver2014a\nGets the SQL Server related server protocols on computer sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\u0027,\u0027sql3\u0027 | Get-DbaInstanceProtocol\nGets the SQL Server related server protocols on computers sql1, sql2 and sql3.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaInstanceProtocol -ComputerName sql1,sql2\nGets the SQL Server related server protocols on computers sql1 and sql2.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e(Get-DbaInstanceProtocol -ComputerName sql1 | Where-Object { $_.DisplayName -eq \u0027Named Pipes\u0027 }).Disable()\nDisables the VIA ServerNetworkProtocol on computer sql1.\r\nIf successful, return code 0 is shown.", "Params": [ [ "ComputerName", "The target SQL Server instance or instances.", "cn,host,Server", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Credential object used to connect to the computer as a different user.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaInstanceProtocol [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaInstanceTrigger", "Description": "Get all existing server triggers on one or more SQL instances.", "Tags": [ "Database", "Trigger" ], "Synopsis": "Get all existing server triggers on one or more SQL instances.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaInstanceTrigger", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaInstanceTrigger", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaInstanceTrigger -SqlInstance sql2017\nReturns all server triggers on sql2017", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "SqlLogin to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance..", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaInstanceTrigger [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaInstanceUserOption", "Description": "The Get-DbaInstanceUserOption command gets SQL Instance user options from the SMO object sqlserver.", "Tags": [ "Instance", "Configure", "UserOption" ], "Synopsis": "Gets SQL Instance user options of one or more instance(s) of SQL Server.", "Alias": "", "Author": "Klaas Vandenberghe (@powerdbaklaas)", "CommandName": "Get-DbaInstanceUserOption", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaInstanceUserOption", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaInstanceUserOption -SqlInstance localhost\nReturns SQL Instance user options on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaInstanceUserOption -SqlInstance sql2, sql4\\sqlexpress\nReturns SQL Instance user options on default instance on sql2 and sqlexpress instance on sql4\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027sql2\u0027,\u0027sql4\u0027 | Get-DbaInstanceUserOption\nReturns SQL Instance user options on sql2 and sql4", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.\r\nThis can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaInstanceUserOption [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaIoLatency", "Description": "This command is based off of Paul Randal\u0027s post \"Advanced SQL Server performance tuning\"\n\nReturns both raw and aggregate information\n\nReference: https://www.sqlskills.com/blogs/paul/how-to-examine-io-subsystem-latencies-from-within-sql-server/\n https://www.sqlskills.com/blogs/paul/capturing-io-latencies-period-time/", "Tags": "IOLatency", "Synopsis": "Displays IO subsystem latency statistics from sys.dm_io_virtual_file_stats. Works on SQL Server 2005 and above.", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaIoLatency", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaIoLatency", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaIoLatency -SqlInstance sql2008, sqlserver2012\nGet IO subsystem latency statistics for servers sql2008 and sqlserver2012.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$output = Get-DbaIoLatency -SqlInstance sql2008 | Select-Object * | ConvertTo-DbaDataTable\nCollects all IO subsystem latency statistics on server sql2008 into a Data Table.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027sql2008\u0027,\u0027sqlserver2012\u0027 | Get-DbaIoLatency\nGet IO subsystem latency statistics for servers sql2008 and sqlserver2012 via pipline\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Get-DbaIoLatency -SqlInstance sql2008 -SqlCredential $cred\nConnects using sqladmin credential and returns IO subsystem latency statistics from sql2008", "Params": [ [ "SqlInstance", "The SQL Server instance. Server version must be SQL Server version 2008 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaIoLatency [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaKbUpdate", "Description": "Parses catalog.update.microsoft.com and grabs details for KB files (SPs/hotfixes/CUs, etc)\n\nBecause Microsoft\u0027s RSS feed does not work, the command has to parse a few webpages which can result in slowness.\n\nUse the Simple parameter for simplified output and faster results.", "Tags": "Update", "Synopsis": "Gets download links and detailed information for KB files (SPs/hotfixes/CUs, etc)", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaKbUpdate", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaKbUpdate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaKbUpdate -Name KB4057119\nGets detailed information about KB4057119. This works for SQL Server or any other KB.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaKbUpdate -Name KB4057119, 4057114\nGets detailed information about KB4057119 and KB4057114. This works for SQL Server or any other KB.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaKbUpdate -Name KB4057119, 4057114 -Simple\nA lil faster. Returns, at the very least: Title, Architecture, Language, Hotfix, UpdateId and Link", "Params": [ [ "Name", "The KB name or number. For example, KB4057119 or 4057119.", "", true, "false", "", "" ], [ "Simple", "A lil faster. Returns, at the very least: Title, Architecture, Language, Hotfix, UpdateId and Link", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaKbUpdate [-Name] \u003cString[]\u003e [-Simple] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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, LastFullBackup, LastDiffBackup, LastLogBackup.", "Tags": [ "DisasterRecovery", "Backup" ], "Synopsis": "Get date/time for last known backups of databases.", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDBAKlaas)", "CommandName": "Get-DbaLastBackup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaLastBackup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaLastBackup -SqlInstance ServerA\\sql987\nReturns a custom object with Server name, Database name, and the date the last time backups were performed.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaLastBackup -SqlInstance ServerA\\sql987 | Select-Object *\nReturns a custom object with Server name, Database name, and the date the last time backups were performed, and also recoverymodel and calculations on how long ago backups were taken and what the \r\nstatus is.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaLastBackup -SqlInstance ServerA\\sql987 | Select-Object * | Out-Gridview\nReturns a gridview displaying ComputerName, InstanceName, SqlInstance, Database, RecoveryModel, LastFullBackup, LastDiffBackup, LastLogBackup, SinceFull, SinceDiff, SinceLog, \r\nLastFullBackupIsCopyOnly, LastDiffBackupIsCopyOnly, LastLogBackupIsCopyOnly, DatabaseCreated, DaysSinceDbCreated, Status\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$MyInstances | Get-DbaLastBackup | Where-Object -FilterScript { $_.LastFullBackup.Date -lt (Get-Date).AddDays(-3) } | Format-Table -Property SqlInstance, Database, LastFullBackup\nReturns all databases on the given instances without a full backup in the last three days.\r\nNote that the property LastFullBackup is a custom object, with the subproperty Date of type datetime and therefore suitable for comparison with dates.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaLastBackup -SqlInstance ServerA\\sql987 | Where-Object { $_.LastFullBackupIsCopyOnly -eq $true }\nFilters for the databases that had a copy_only full backup done as the last backup.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies one or more database(s) to process. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies one or more database(s) to exclude from processing.", "", false, "false", "", "" ], [ "EnableException", "If this switch is enabled exceptions will be thrown to the caller, which will need to perform its own exception processing. Otherwise, the function will try to catch the exception, interpret it and \r\nprovide a friendly error message.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaLastBackup [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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 and higher.\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.\n\nThis script will only display the newest timestamp. If -Verbose is specified, the function will announce every time more than one dbi_dbccLastKnownGood fields is encountered.", "Tags": [ "CHECKDB", "Database" ], "Synopsis": "Get date/time for last known good DBCC CHECKDB", "Alias": "", "Author": "Jakob Bindslet (jakob@bindslet.dk)", "CommandName": "Get-DbaLastGoodCheckDb", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaLastGoodCheckDb", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaLastGoodCheckDb -SqlInstance ServerA\\sql987\nReturns a custom object displaying Server, Database, DatabaseCreated, LastGoodCheckDb, DaysSinceDbCreated, DaysSinceLastGoodCheckDb, Status and DataPurityEnabled\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaLastGoodCheckDb -SqlInstance ServerA\\sql987 -SqlCredential sqladmin | Format-Table -AutoSize\nReturns a formatted table displaying Server, Database, DatabaseCreated, LastGoodCheckDb, DaysSinceDbCreated, DaysSinceLastGoodCheckDb, Status and DataPurityEnabled. Authenticates using SQL Server \r\nauthentication.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaLastGoodCheckDb -SqlInstance sql2016 -ExcludeDatabase \"TempDB\" | Format-Table -AutoSize\nReturns a formatted table displaying Server, Database, DatabaseCreated, LastGoodCheckDb, DaysSinceDbCreated, DaysSinceLastGoodCheckDb, Status and DataPurityEnabled. All databases except for \"TempDB\" \r\nwill be displayed in the output.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2016 -Database DB1, DB2 | Get-DbaLastGoodCheckDb | Format-Table -AutoSize\nReturns a formatted table displaying Server, Database, DatabaseCreated, LastGoodCheckDb, DaysSinceDbCreated, DaysSinceLastGoodCheckDb, Status and DataPurityEnabled. Only databases DB1 abd DB2 will be \r\ndisplayed in the output.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Defaults to localhost.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies one or more database(s) to process. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies one or more database(s) to exclude from processing.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaLastGoodCheckDb [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaLatchStatistic", "Description": "This command is based off of Paul Randal\u0027s post \"Advanced SQL Server performance tuning\"\n\nReturns:\n LatchClass\n WaitSeconds\n WaitCount\n Percentage\n AverageWaitSeconds\n URL\n\nReference: https://www.sqlskills.com/blogs/paul/advanced-performance-troubleshooting-waits-latches-spinlocks/\n https://www.sqlskills.com/blogs/paul/most-common-latch-classes-and-what-they-mean/", "Tags": [ "LatchStatistics", "Waits" ], "Synopsis": "Displays latch statistics from sys.dm_os_latch_stats", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaLatchStatistic", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaLatchStatistic", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaLatchStatistic -SqlInstance sql2008, sqlserver2012\nCheck latch statistics for servers sql2008 and sqlserver2012\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaLatchStatistic -SqlInstance sql2008 -Threshold 98\nCheck latch statistics on server sql2008 for thresholds above 98%\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$output = Get-DbaLatchStatistic -SqlInstance sql2008 -Threshold 100 | Select-Object * | ConvertTo-DbaDataTable\nCollects all latch statistics on server sql2008 into a Data Table.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e\u0027sql2008\u0027,\u0027sqlserver2012\u0027 | Get-DbaLatchStatistic\nGet latch statistics for servers sql2008 and sqlserver2012 via pipline\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Get-DbaLatchStatistic -SqlInstance sql2008 -SqlCredential $cred\nConnects using sqladmin credential and returns latch statistics from sql2008\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$output = Get-DbaLatchStatistic -SqlInstance sql2008\nPS C:\\\u003e $output\r\nPS C:\\\u003e foreach ($row in ($output | Sort-Object -Unique Url)) { Start-Process ($row).Url }\nDisplays the output then loads the associated sqlskills website for each result. Opens one tab per unique URL.", "Params": [ [ "SqlInstance", "The SQL Server instance. Server version must be SQL Server version 2005 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Threshold", "Threshold, in percentage of all latch stats on the system. Default per Paul\u0027s post is 95%.", "", false, "false", "95", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaLatchStatistic [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Threshold] \u003cInt32\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaLinkedServer", "Description": "Retrieves information about each linked server on the instance(s).", "Tags": [ "LinkedServer", "Linked" ], "Synopsis": "Gets all linked servers and a summary of information from the linked servers listed.", "Alias": "", "Author": "Stephen Bennett, https://sqlnotesfromtheunderground.wordpress.com/", "CommandName": "Get-DbaLinkedServer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaLinkedServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaLinkedServer -SqlInstance DEV01\nReturns all linked servers for the SQL Server instance DEV01\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance DEV01 -Group SQLDEV | Get-DbaLinkedServer | Out-GridView\nReturns all linked servers for a group of servers from SQL Server Central Management Server (CMS). Send output to GridView.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "LinkedServer", "The linked server(s) to process - this list is auto-populated from the server. If unspecified, all linked servers will be processed.", "", false, "false", "", "" ], [ "ExcludeLinkedServer", "The linked server(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaLinkedServer [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-LinkedServer] \u003cObject[]\u003e] [[-ExcludeLinkedServer] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaLocaleSetting", "Description": "Gets the Locale settings on one or more computers.\n\nRequires Local Admin rights on destination computer(s).", "Tags": [ "Server", "Management" ], "Synopsis": "Gets the Locale settings on a computer.", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDBAKlaas)", "CommandName": "Get-DbaLocaleSetting", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaLocaleSetting", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaLocaleSetting -ComputerName sqlserver2014a\nGets the Locale settings on computer sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\u0027,\u0027sql3\u0027 | Get-DbaLocaleSetting\nGets the Locale settings on computers sql1, sql2 and sql3.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaLocaleSetting -ComputerName sql1,sql2 -Credential $credential\nGets the Locale settings on computers sql1 and sql2 using SQL Authentication to authenticate to the servers.", "Params": [ [ "ComputerName", "The target SQL Server instance or instances.", "cn,host,Server", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Credential object used to connect to the computer as a different user.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaLocaleSetting [[-ComputerName] \u003cString[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaLogin", "Description": "The Get-DbaLogin function returns an SMO Login object for the logins passed, if there are no users passed it will return all logins.", "Tags": [ "Login", "Security" ], "Synopsis": "Function to get an SMO login object of the logins for a given SQL Server instance. Takes a server object from the pipeline.\nSQL Azure DB is not supported.", "Alias": "", "Author": "Mitchell Hamann (@SirCaptainMitch) | Rob Sewell (@SQLDBaWithBeard)", "CommandName": "Get-DbaLogin", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaLogin", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2016\nGets all the logins from server sql2016 using NT authentication and returns the SMO login objects\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2016 -SqlCredential $sqlcred\nGets all the logins for a given SQL Server using a passed credential object and returns the SMO login objects\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2016 -SqlCredential $sqlcred -Login dbatoolsuser,TheCaptain\nGet specific logins from server sql2016 returned as SMO login objects.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2016 -IncludeFilter \u0027##*\u0027,\u0027NT *\u0027\nGet all user objects from server sql2016 beginning with \u0027##\u0027 or \u0027NT \u0027, returned as SMO login objects.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2016 -ExcludeLogin dbatoolsuser\nGet all user objects from server sql2016 except the login dbatoolsuser, returned as SMO login objects.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2016 -Type Windows\nGet all user objects from server sql2016 that are Windows Logins\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2016 -Type Windows -IncludeFilter *Rob*\nGet all user objects from server sql2016 that are Windows Logins and have Rob in the name\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2016 -Type SQL\nGet all user objects from server sql2016 that are SQL Logins\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2016 -Type SQL -IncludeFilter *Rob*\nGet all user objects from server sql2016 that are SQL Logins and have Rob in the name\n-------------------------- EXAMPLE 10 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2016 -ExcludeSystemLogin\nGet all user objects from server sql2016 that are not system objects\n-------------------------- EXAMPLE 11 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2016 -ExcludeFilter \u0027##*\u0027,\u0027NT *\u0027\nGet all user objects from server sql2016 except any beginning with \u0027##\u0027 or \u0027NT \u0027, returned as SMO login objects.\n-------------------------- EXAMPLE 12 --------------------------\nPS C:\\\u003e\u0027sql2016\u0027, \u0027sql2014\u0027 | Get-DbaLogin -SqlCredential $sqlcred\nUsing Get-DbaLogin on the pipeline, you can also specify which names you would like with -Login.\n-------------------------- EXAMPLE 13 --------------------------\nPS C:\\\u003e\u0027sql2016\u0027, \u0027sql2014\u0027 | Get-DbaLogin -SqlCredential $sqlcred -Locked\nUsing Get-DbaLogin on the pipeline to get all locked logins on servers sql2016 and sql2014.\n-------------------------- EXAMPLE 14 --------------------------\nPS C:\\\u003e\u0027sql2016\u0027, \u0027sql2014\u0027 | Get-DbaLogin -SqlCredential $sqlcred -HasAccess -Disabled\nUsing Get-DbaLogin on the pipeline to get all Disabled logins that have access on servers sql2016 or sql2014.\n-------------------------- EXAMPLE 15 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2016 -Type SQL -Detailed\nGet all user objects from server sql2016 that are SQL Logins. Get additional info for login available from LoginProperty function\n-------------------------- EXAMPLE 16 --------------------------\nPS C:\\\u003e\u0027sql2016\u0027, \u0027sql2014\u0027 | Get-DbaLogin -SqlCredential $sqlcred -MustChangePassword\nUsing Get-DbaLogin on the pipeline to get all logins that must change password on servers sql2016 and sql2014.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Login", "The login(s) to process - this list is auto-populated from the server. If unspecified, all logins will be processed.", "", false, "false", "", "" ], [ "IncludeFilter", "A list of logins to include - accepts wildcard patterns", "", false, "false", "", "" ], [ "ExcludeLogin", "The login(s) to exclude. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "ExcludeFilter", "A list of logins to exclude - accepts wildcard patterns", "", false, "false", "", "" ], [ "ExcludeSystemLogin", "A Switch to remove System Logins from the output.", "ExcludeSystemLogins", false, "false", "False", "" ], [ "Type", "Filters logins by their type. Valid options are Windows and SQL.", "", false, "false", "", "Windows,SQL" ], [ "HasAccess", "A Switch to return Logins that have access to the instance of SQL Server.", "", false, "false", "False", "" ], [ "Locked", "A Switch to return locked Logins.", "", false, "false", "False", "" ], [ "Disabled", "A Switch to return disabled Logins.", "", false, "false", "False", "" ], [ "MustChangePassword", "A Switch to return Logins that need to change password.", "", false, "false", "False", "" ], [ "Detailed", "A Switch to return additional information available from the LoginProperty function", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaLogin [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Login] \u003cString[]\u003e] [[-IncludeFilter] \u003cString[]\u003e] [[-ExcludeLogin] \u003cString[]\u003e] [[-ExcludeFilter] \u003cString[]\u003e] [-ExcludeSystemLogin] [[-Type] \u003cString\u003e] [-HasAccess] [-Locked] [-Disabled] [-MustChangePassword] [-Detailed] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaMaintenanceSolutionLog", "Description": "Ola wrote a .sql script to get the content from the commandLog table. However, if LogToTable=\u0027N\u0027, there will be no logging in that table. This function reads the text files that are written in the SQL Instance\u0027s Log directory.", "Tags": [ "Community", "OlaHallengren" ], "Synopsis": "Reads the log files generated by the IndexOptimize Agent Job from Ola Hallengren\u0027s MaintenanceSolution.", "Alias": "", "Author": "Klaas Vandenberghe (@powerdbaklaas) | Simone Bizzotto ( @niphlod )", "CommandName": "Get-DbaMaintenanceSolutionLog", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaMaintenanceSolutionLog", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaMaintenanceSolutionLog -SqlInstance sqlserver2014a\nGets the outcome of the IndexOptimize job on sql instance sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaMaintenanceSolutionLog -SqlInstance sqlserver2014a -SqlCredential $credential\nGets the outcome of the IndexOptimize job on sqlserver2014a, using SQL Authentication.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027sqlserver2014a\u0027, \u0027sqlserver2020test\u0027 | Get-DbaMaintenanceSolutionLog\nGets the outcome of the IndexOptimize job on sqlserver2014a and sqlserver2020test.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaMaintenanceSolutionLog -SqlInstance sqlserver2014a -Path \u0027D:\\logs\\maintenancesolution\\\u0027\nGets the outcome of the IndexOptimize job on sqlserver2014a, reading the log files in their custom location.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaMaintenanceSolutionLog -SqlInstance sqlserver2014a -Since \u00272017-07-18\u0027\nGets the outcome of the IndexOptimize job on sqlserver2014a, starting from july 18, 2017.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaMaintenanceSolutionLog -SqlInstance sqlserver2014a -LogType IndexOptimize\nGets the outcome of the IndexOptimize job on sqlserver2014a, the other options are not yet available! sorry", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "LogType", "Accepts \u0027IndexOptimize\u0027, \u0027DatabaseBackup\u0027, \u0027DatabaseIntegrityCheck\u0027. ATM only IndexOptimize parsing is available", "", false, "false", "IndexOptimize", "IndexOptimize,DatabaseBackup,DatabaseIntegrityCheck" ], [ "Since", "Consider only files generated since this date", "", false, "false", "", "" ], [ "Path", "Where to search for log files. By default it\u0027s the SQL instance error log path path", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaMaintenanceSolutionLog [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-LogType] \u003cString[]\u003e] [[-Since] \u003cDateTime\u003e] [[-Path] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaManagementObject", "Description": "The Get-DbaManagementObject returns an object with the Version and the\nAdd-Type Load Template for each version on the server.", "Tags": "SMO", "Synopsis": "Gets SQL Mangaement Object versions installed on the machine.", "Alias": "", "Author": "Ben Miller (@DBAduck), http://dbaduck.com", "CommandName": "Get-DbaManagementObject", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaManagementObject", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaManagementObject\nReturns all versions of SMO on the computer\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaManagementObject -VersionNumber 13\nReturns just the version specified. If the version does not exist then it will return nothing.", "Params": [ [ "ComputerName", "The name of the Windows Server(s) you would like to check.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "This command uses Windows credentials. This parameter allows you to connect remotely as a different user.", "", false, "false", "", "" ], [ "VersionNumber", "This is the specific version number you are looking for. The function will look\r\nfor that version only.", "", false, "false", "0", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaManagementObject [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-VersionNumber] \u003cInt32\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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.\n\nResults are turned in megabytes (MB).", "Tags": [ "MaxMemory", "Memory" ], "Synopsis": "Gets the \u0027Max Server Memory\u0027 configuration setting and the memory of the server. Works on SQL Server 2000-2014.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaMaxMemory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaMaxMemory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaMaxMemory -SqlInstance sqlcluster, sqlserver2012\nGet memory settings for instances \"sqlcluster\" and \"sqlserver2012\". Returns results in megabytes (MB).\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlcluster | Get-DbaMaxMemory | Where-Object { $_.MaxValue -gt $_.Total }\nFind all servers in Server Central Management Server that have \u0027Max Server Memory\u0027 set to higher than the total memory of the server (think 2147483647)\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eFind-DbaInstance -ComputerName localhost | Get-DbaMaxMemory | Format-Table -AutoSize\nScans localhost for instances using the browser service, traverses all instances and displays memory settings in a formatted table.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaMaxMemory [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaMemoryCondition", "Description": "The information from SQL Server ring buffers can be used to determine the memory conditions on the server when paging occurs.\n\nThis command is based on a query provided by Microsoft support.\nReference KB article: https://support.microsoft.com/en-us/help/918483/how-to-reduce-paging-of-buffer-pool-memory-in-the-64-bit-version-of-sq", "Tags": "Memory", "Synopsis": "Determine the memory conditions from SQL Server ring buffers.", "Alias": "", "Author": "IJeb Reitsma", "CommandName": "Get-DbaMemoryCondition", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaMemoryCondition", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaMemoryCondition -SqlInstance sqlserver2014a\nReturns the memory conditions for the selected instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlserver2014a -Group GroupName | Get-DbaMemoryCondition | Out-GridView\nReturns the memory conditions for a group of servers from SQL Server Central Management Server (CMS). Send output to GridView.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance..", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaMemoryCondition [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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\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", "Synopsis": "Get amount of memory in use by *all* SQL Server components and instances", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDBAKlaas)", "CommandName": "Get-DbaMemoryUsage", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaMemoryUsage", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaMemoryUsage -ComputerName sql2017\nReturns a custom object displaying Server, counter instance, counter, number of pages, memory\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaMemoryUsage -ComputerName sql2017\\sqlexpress -SqlCredential sqladmin | Where-Object { $_.Memory.Megabyte -gt 100 }\nLogs into the sql2017\\sqlexpress as sqladmin using SQL Authentication then returns results only where memory exceeds 100 MB\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers | Get-DbaMemoryUsage | Out-Gridview\nGets results from an array of $servers then diplays them in a gridview.", "Params": [ [ "ComputerName", "The Windows Server that you are connecting to. Note that this will return all instances, but Out-GridView makes it easy to filter to specific instances.", "Host,cn,Server", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaMemoryUsage [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaModule", "Description": "Quickly find modules (Stored Procs, Functions, Views, Constraints, Rules, Triggers, etc) that have been modified in a database, or across all databases.\nResults will exclude the module definition, but can be queried explicitly.", "Tags": [ "StoredProcedure", "Trigger" ], "Synopsis": "Displays all objects in sys.sys_modules after specified modification date. Works on SQL Server 2008 and above.", "Alias": "Get-DbaDbModule", "Author": "Brandon Abshire, netnerds.net", "CommandName": "Get-DbaModule", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaModule", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaModule -SqlInstance sql2008, sqlserver2012\nReturn all modules for servers sql2008 and sqlserver2012 sorted by Database, Modify_Date ASC.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaModule -SqlInstance sql2008, sqlserver2012 | Select-Object *\nShows hidden definition column (informative wall of text).\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaModule -SqlInstance sql2008 -Database TestDB -ModifiedSince \"2017-01-01 10:00:00\"\nReturn all modules on server sql2008 for only the TestDB database with a modified date after 1 January 2017 10:00:00 AM.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaModule -SqlInstance sql2008 -Type View, Trigger, ScalarFunction\nReturn all modules on server sql2008 for all databases that are triggers, views or scalar functions.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e\u0027sql2008\u0027 | Get-DbaModule -Database TestDB -Type View, StoredProcedure, ScalarFunction\nReturn all modules on server sql2008 for only the TestDB database that are stored procedures, views or scalar functions. Input via Pipeline\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2008 -ExcludeSystem | Get-DbaModule -Type View, Trigger, ScalarFunction\nReturn all modules on server sql2008 for all user databases that are triggers, views or scalar functions.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2008, sqlserver2012 -ExcludeUser | Get-DbaModule -Type StoredProcedure -ExcludeSystemObjects\nReturn all user created stored procedures in the system databases for servers sql2008 and sqlserver2012.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude.", "", false, "false", "", "" ], [ "ModifiedSince", "DateTime value to use as minimum modified date of module.", "", false, "false", "1900-01-01", "" ], [ "Type", "Limit by specific type of module. Valid choices include: View, TableValuedFunction, DefaultConstraint, StoredProcedure, Rule, InlineTableValuedFunction, Trigger, ScalarFunction", "", false, "false", "", "View,TableValuedFunction,DefaultConstraint,StoredProcedure,Rule,InlineTableValuedFunction,Trigger,ScalarFunction" ], [ "ExcludeSystemDatabases", "Allows you to suppress output on system databases", "", false, "false", "False", "" ], [ "ExcludeSystemObjects", "Allows you to suppress output on system objects", "", false, "false", "False", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaModule [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-ModifiedSince] \u003cDateTime\u003e] [[-Type] \u003cString[]\u003e] [-ExcludeSystemDatabases] [-ExcludeSystemObjects] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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": [ "Msdtc", "dtc" ], "Synopsis": "Displays information about the Distributed Transaction Coordinator (MSDTC) on a server", "Alias": "", "Author": "Klaas Vandenberghe (@powerdbaklaas)", "CommandName": "Get-DbaMsdtc", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaMsdtc", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaMsdtc -ComputerName srv0042\nGet DTC status for the server srv0042\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$Computers = (Get-Content D:\\configfiles\\SQL\\MySQLInstances.txt | % {$_.split(\u0027\\\u0027)[0]})\nPS C:\\\u003e $Computers | Get-DbaMsdtc\nGet DTC status for all the computers in a .txt file\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaMsdtc -Computername $Computers | Where-Object { $_.dtcservicestate -ne \u0027running\u0027 }\nGet DTC status for all the computers where the MSDTC Service is not running\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaMsdtc -ComputerName srv0042 | Out-Gridview\nGet DTC status for the computer srv0042 and show in a grid view", "Params": [ [ "ComputerName", "The target computer.", "cn,host,Server", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Alternative credential", "", false, "false", "", "" ], [ "EnableException", "By default in most of our commands, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis command, however, gifts you with \"sea of red\" exceptions, by default, because it is useful for advanced scripting.\nUsing this switch turns our \"nice by default\" feature on which makes errors into pretty warnings.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaMsdtc [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaNetworkActivity", "Description": "Gets the Current traffic on every Network Interface on a computer.\nSee https://msdn.microsoft.com/en-us/library/aa394293(v=vs.85).aspx\n\nRequires Local Admin rights on destination computer(s).", "Tags": [ "Server", "Management", "Network" ], "Synopsis": "Gets the Current traffic on every Network Interface on a computer.", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDBAKlaas)", "CommandName": "Get-DbaNetworkActivity", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaNetworkActivity", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaNetworkActivity -ComputerName sqlserver2014a\nGets the Current traffic on every Network Interface on computer sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\u0027,\u0027sql3\u0027 | Get-DbaNetworkActivity\nGets the Current traffic on every Network Interface on computers sql1, sql2 and sql3.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaNetworkActivity -ComputerName sql1,sql2\nGets the Current traffic on every Network Interface on computers sql1 and sql2.", "Params": [ [ "ComputerName", "The target SQL Server instance or instances.", "cn,host,Server", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Credential object used to connect to the computer as a different user.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaNetworkActivity [[-ComputerName] \u003cString[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaNetworkCertificate", "Description": "Gets the computer certificates that is assigned to the SQL Server instance for enabling network encryption.", "Tags": [ "Certificate", "Encryption" ], "Synopsis": "Gets the computer certificate enabled for the SQL Server instance\u0027s network encryption.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaNetworkCertificate", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaNetworkCertificate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaNetworkCertificate\nGets computer certificates on localhost that are candidates for using with SQL Server\u0027s network encryption\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaNetworkCertificate -ComputerName sql2016\nGets computer certificates on sql2016 that are being used for SQL Server network encryption", "Params": [ [ "ComputerName", "The target SQL Server instance or instances. Defaults to localhost. If target is a cluster, you must specify the distinct nodes.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Alternate credential object to use for accessing the target computer(s).", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaNetworkCertificate [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaNetworkConfiguration", "Description": "Returns a PowerShell object with the network configuration of a SQL Server instance as shown in SQL Server Configuration Manager.\n\nRemote SQL WMI is used by default, with PS Remoting used as a fallback.\n\nFor a detailed explenation of the different properties see the documentation at:\nhttps://docs.microsoft.com/en-us/sql/tools/configuration-manager/sql-server-network-configuration", "Tags": "SQLWMI", "Synopsis": "Returns the network configuration of a SQL Server instance as shown in SQL Server Configuration Manager.", "Alias": "", "Author": "Andreas Jordan (@JordanOrdix), ordix.de", "CommandName": "Get-DbaNetworkConfiguration", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaNetworkConfiguration", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaNetworkConfiguration -SqlInstance sqlserver2014a\nReturns the network configuration for the default instance on sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaNetworkConfiguration -SqlInstance winserver\\sqlexpress, sql2016 -OutputType ServerProtocols\nReturns information about the server protocols for the sqlexpress on winserver and the default instance on sql2016.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "Credential", "Credential object used to connect to the Computer as a different user.", "", false, "false", "", "" ], [ "OutputType", "Defines what information is returned from the command.\r\nOptions include: Full, ServerProtocols, TcpIpProperties or TcpIpAddresses. Full by default.\nFull returns one object per SqlInstance with information about the server protocols\r\nand nested objects with information about TCP/IP properties and TCP/IP addresses.\nServerProtocols returns one object per SqlInstance with information about the server protocols only.\nTcpIpProperties returns one object per SqlInstance with information about the TCP/IP protocol properties only.\nTcpIpAddresses returns one object per SqlInstance and IP address.\r\nIf the instance listens on all IP addresses (TcpIpProperties.ListenAll), only the information about the IPAll address is returned.\r\nOtherwise only information about the individual IP addresses is returned.\r\nFor more details see: https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/configure-a-server-to-listen-on-a-specific-tcp-port", "", false, "false", "Full", "Full,ServerProtocols,TcpIpProperties,TcpIpAddresses" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaNetworkConfiguration [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-Credential] \u003cPSCredential\u003e] [[-OutputType] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaOleDbProvider", "Description": "This command gets a list of all ole db providers available on a server.", "Tags": "OLEDB", "Synopsis": "This command gets a list of all ole db providers available on a server.", "Alias": "", "Author": "Chrissy LeMaire (@cl)", "CommandName": "Get-DbaOleDbProvider", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaOleDbProvider", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaOleDbProvider -SqlInstance SqlBox1\\Instance2\nReturns a list of all OleDb providers on SqlBox1\\Instance2\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaOleDbProvider -SqlInstance SqlBox1\\Instance2 -Provider SSISOLEDB\nReturns the SSISOLEDB provider on SqlBox1\\Instance2", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Provider", "The name of the ole db provider.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaOleDbProvider [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Provider] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaOpenTransaction", "Description": "This command is based on open transaction script published by Paul Randal.\nReference: https://www.sqlskills.com/blogs/paul/script-open-transactions-with-text-and-plans/", "Tags": [ "Database", "Process", "Session", "ActivityMonitor" ], "Synopsis": "Displays all open transactions.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaOpenTransaction", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaOpenTransaction", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaOpenTransaction -SqlInstance sqlserver2014a\nReturns open transactions for sqlserver2014a\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaOpenTransaction -SqlInstance sqlserver2014a -SqlCredential sqladmin\nLogs into sqlserver2014a using the login \"sqladmin\"", "Params": [ [ "SqlInstance", "The SQL Server instance", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaOpenTransaction [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaOperatingSystem", "Description": "Gets operating system information from the server and returns as an object.", "Tags": [ "Server", "Management", "OperatingSystem" ], "Synopsis": "Gets operating system information from the server.", "Alias": "", "Author": "Shawn Melton (@wsmelton), https://wsmelton.github.io", "CommandName": "Get-DbaOperatingSystem", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaOperatingSystem", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaOperatingSystem\nReturns information about the local computer\u0027s operating system\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaOperatingSystem -ComputerName sql2016\nReturns information about the sql2016\u0027s operating system\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$wincred = Get-Credential ad\\sqladmin\nPS C:\\\u003e \u0027sql2016\u0027, \u0027sql2017\u0027 | Get-DbaOperatingSystem -Credential $wincred\nReturns information about the sql2016 and sql2017 operating systems using alternative Windows credentials\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-Content .\\servers.txt | Get-DbaOperatingSystem\nReturns information about all the servers operating system that are stored in the file. Every line in the file can only contain one hostname for a server.", "Params": [ [ "ComputerName", "Target computer(s). If no computer name is specified, the local computer is targeted", "cn,host,Server", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Alternate credential object to use for accessing the target computer(s).", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaOperatingSystem [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPageFileSetting", "Description": "This command uses CIM (or other, related computer management tools) to detect the page file configuration of the target computer(s).\n\nNote that this may require local administrator privileges for the relevant computers.", "Tags": [ "Server", "Management", "PageFile" ], "Synopsis": "Returns information on the page file configuration of the target computer.", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDBAKlaas)", "CommandName": "Get-DbaPageFileSetting", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPageFileSetting", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPageFileSetting -ComputerName ServerA,ServerB\nReturns a custom object displaying ComputerName, AutoPageFile, FileName, Status, LastModified, LastAccessed, AllocatedBaseSize, InitialSize, MaximumSize, PeakUsage, CurrentUsage for ServerA and \r\nServerB\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027ServerA\u0027 | Get-DbaPageFileSetting\nReturns a custom object displaying ComputerName, AutoPageFile, FileName, Status, LastModified, LastAccessed, AllocatedBaseSize, InitialSize, MaximumSize, PeakUsage, CurrentUsage for ServerA", "Params": [ [ "ComputerName", "The target SQL Server instance or instances.\r\nThis can be the name of a computer, a SMO object, an IP address, an AD Computer object, a connection string or a SQL Instance.", "", false, "true (ByValue, ByPropertyName)", "$env:COMPUTERNAME", "" ], [ "Credential", "Credential object used to connect to the Computer as a different user", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPageFileSetting [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPbmCategory", "Description": "Returns policy categories from policy based management from an instance.", "Tags": [ "Policy", "PolicyBasedManagement", "PBM" ], "Synopsis": "Returns policy categories from policy based management from an instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaPbmCategory", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPbmCategory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPbmCategory -SqlInstance sql2016\nReturns all policy categories from the sql2016 PBM server\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPbmCategory -SqlInstance sql2016 -SqlCredential $cred\nUses a credential $cred to connect and return all policy categories from the sql2016 PBM server", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Category", "Filters results to only show specific condition", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaPbmStore", "", false, "true (ByValue)", "", "" ], [ "ExcludeSystemObject", "By default system objects are include. Use this parameter to exclude them.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPbmCategory [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Category] \u003cString[]\u003e] [[-InputObject] \u003cPolicyStore[]\u003e] [-ExcludeSystemObject] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPbmCategorySubscription", "Description": "Returns policy category subscriptions from policy based management from an instance.", "Tags": [ "Policy", "PolicyBasedManagement", "PBM" ], "Synopsis": "Returns policy category subscriptions from policy based management from an instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaPbmCategorySubscription", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPbmCategorySubscription", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPbmCategorySubscription -SqlInstance sql2016\nReturns all policy category subscriptions from the sql2016 PBM server\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPbmCategorySubscription -SqlInstance sql2016 -SqlCredential $cred\nUses a credential $cred to connect and return all policy category subscriptions from the sql2016 PBM server", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaPbmStore", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPbmCategorySubscription [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-InputObject] \u003cPolicyStore[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPbmCondition", "Description": "Returns conditions from policy based management from an instance.", "Tags": [ "Policy", "PolicyBasedManagement", "PBM" ], "Synopsis": "Returns conditions from policy based management from an instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaPbmCondition", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPbmCondition", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPbmCondition -SqlInstance sql2016\nReturns all conditions from the sql2016 PBM server\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPbmCondition -SqlInstance sql2016 -SqlCredential $cred\nUses a credential $cred to connect and return all conditions from the sql2016 PBM server", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Condition", "Filters results to only show specific condition", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaPbmStore", "", false, "true (ByValue)", "", "" ], [ "IncludeSystemObject", "By default system objects are filtered out. Use this parameter to include them.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPbmCondition [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Condition] \u003cString[]\u003e] [[-InputObject] \u003cPolicyStore[]\u003e] [-IncludeSystemObject] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPbmObjectSet", "Description": "Returns object sets from policy based management.", "Tags": [ "Policy", "PolicyBasedManagement", "PBM" ], "Synopsis": "Returns object sets from policy based management.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaPbmObjectSet", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPbmObjectSet", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPbmObjectSet -SqlInstance sql2016\nReturns all object sets from the sql2016 PBM instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPbmObjectSet -SqlInstance sql2016 -SqlCredential $cred\nUses a credential $cred to connect and return all object sets from the sql2016 PBM instance", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "ObjectSet", "Filters results to only show specific object set", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaPbmStore", "", false, "true (ByValue)", "", "" ], [ "IncludeSystemObject", "By default system objects are filtered out. Use this parameter to include them.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPbmObjectSet [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-ObjectSet] \u003cString[]\u003e] [[-InputObject] \u003cPolicyStore[]\u003e] [-IncludeSystemObject] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPbmPolicy", "Description": "Returns details of policies with the option to filter on Category and SystemObjects.", "Tags": [ "Policy", "PolicyBasedManagement", "PBM" ], "Synopsis": "Returns policies from Policy-Based Management from an instance.", "Alias": "", "Author": "Stephen Bennett, https://sqlnotesfromtheunderground.wordpress.com/", "CommandName": "Get-DbaPbmPolicy", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPbmPolicy", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPbmPolicy -SqlInstance sql2016\nReturns all policies from sql2016 server\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPbmPolicy -SqlInstance sql2016 -SqlCredential $cred\nUses a credential $cred to connect and return all policies from sql2016 instance\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaPbmPolicy -SqlInstance sql2016 -Category MorningCheck\nReturns all policies from sql2016 server that part of the PolicyCategory MorningCheck", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Policy", "Filters results to only show specific policy", "", false, "false", "", "" ], [ "Category", "Filters results to only show policies in the category selected", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaPbmStore", "", false, "true (ByValue)", "", "" ], [ "IncludeSystemObject", "By default system objects are filtered out. Use this parameter to INCLUDE them .", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPbmPolicy [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Policy] \u003cString[]\u003e] [[-Category] \u003cString[]\u003e] [[-InputObject] \u003cPolicyStore[]\u003e] [-IncludeSystemObject] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPbmStore", "Description": "Returns the policy based management store.", "Tags": [ "Policy", "PolicyBasedManagement", "PBM" ], "Synopsis": "Returns the policy based management store.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaPbmStore", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPbmStore", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPbmStore -SqlInstance sql2016\nReturn the policy store from the sql2016 instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPbmStore -SqlInstance sql2016 -SqlCredential $cred\nUses a credential $cred to connect and return the policy store from the sql2016 instance", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPbmStore [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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.\nThe CONTROL permission is also returned for dbo users, db_owners, and schema owners.\nTo see server-level implicit permissions via fixed roles run the following command: Get-DbaServerRole -SqlInstance serverName | Select-Object *\n\nSee https://msdn.microsoft.com/en-us/library/ms191291.aspx for more information", "Tags": [ "Permissions", "Databases" ], "Synopsis": "Get a list of Server and Database level permissions", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDBAKlaas)", "CommandName": "Get-DbaPermission", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaPermission", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPermission -SqlInstance ServerA\\sql987\nReturns a custom object with Server name, Database name, permission state, permission type, grantee and securable.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPermission -SqlInstance ServerA\\sql987 | Format-Table -AutoSize\nReturns a formatted table displaying Server, Database, permission state, permission type, grantee, granteetype, securable and securabletype.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaPermission -SqlInstance ServerA\\sql987 -ExcludeSystemObjects -IncludeServerLevel\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.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaPermission -SqlInstance sql2016 -Database master\nReturns a custom object with permissions for the master database.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Defaults to localhost.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies one or more database(s) to process. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies one or more database(s) to exclude from processing.", "", false, "false", "", "" ], [ "IncludeServerLevel", "If this switch is enabled, information about Server Level Permissions will be output.", "", false, "false", "False", "" ], [ "ExcludeSystemObjects", "If this switch is enabled, permissions on system securables will be excluded.", "", false, "false", "False", "" ], [ "EnableException", "If this switch is enabled exceptions will be thrown to the caller, which will need to perform its own exception processing. Otherwise, the function will try to catch the exception, interpret it and \r\nprovide a friendly error message.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPermission [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-IncludeServerLevel] [-ExcludeSystemObjects] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPfAvailableCounter", "Description": "Gathers list of all available counters on local or remote machines. Note, if you pass a credential object, it will be included in the output for easy reuse in your next piped command.\n\nThanks to Daniel Streefkerk for this super fast way of counters\nhttps://daniel.streefkerkonline.com/2016/02/18/use-powershell-to-list-all-windows-performance-counters-and-their-numeric-ids", "Tags": [ "Performance", "DataCollector", "PerfCounter" ], "Synopsis": "Gathers list of all available counters on local or remote machines.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaPfAvailableCounter", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPfAvailableCounter", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPfAvailableCounter\nGets all available counters on the local machine.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPfAvailableCounter -Pattern *sql*\nGets all counters matching sql on the local machine.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaPfAvailableCounter -ComputerName sql2017 -Pattern *sql*\nGets all counters matching sql on the remote server sql2017.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaPfAvailableCounter -Pattern *sql*\nGets all counters matching sql on the local machine.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaPfAvailableCounter -Pattern *sql* | Add-DbaPfDataCollectorCounter -CollectorSet \u0027Test Collector Set\u0027 -Collector DataCollector01\nAdds all counters matching \"sql\" to the DataCollector01 within the \u0027Test Collector Set\u0027 CollectorSet.", "Params": [ [ "ComputerName", "The target computer. Defaults to localhost.", "", false, "false", "$env:ComputerName", "" ], [ "Credential", "Allows you to login to servers using alternative credentials. To use:\n$scred = Get-Credential, then pass $scred object to the -Credential parameter.", "", false, "false", "", "" ], [ "Pattern", "Specify a pattern for filtering.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPfAvailableCounter [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-Pattern] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPfDataCollector", "Description": "Gets Performance Monitor Data Collectors.", "Tags": [ "Performance", "DataCollector", "PerfCounter" ], "Synopsis": "Gets Performance Monitor Data Collectors.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaPfDataCollector", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPfDataCollector", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollector\nGets all Collectors on localhost.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollector -ComputerName sql2017\nGets all Collectors on sql2017.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollector -ComputerName sql2017, sql2016 -Credential ad\\sqldba -CollectorSet \u0027System Correlation\u0027\nGets all Collectors for the \u0027System Correlation\u0027 CollectorSet on sql2017 and sql2016 using alternative credentials.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSet -CollectorSet \u0027System Correlation\u0027 | Get-DbaPfDataCollector\nGets all Collectors for the \u0027System Correlation\u0027 CollectorSet.", "Params": [ [ "ComputerName", "The target computer. Defaults to localhost.", "", false, "false", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to servers using alternative credentials. To use:\n$scred = Get-Credential, then pass $scred object to the -Credential parameter.", "", false, "false", "", "" ], [ "CollectorSet", "The Collector Set name.", "DataCollectorSet", false, "false", "", "" ], [ "Collector", "The Collector name.", "DataCollector", false, "false", "", "" ], [ "InputObject", "Accepts the object output by Get-DbaPfDataCollectorSet via the pipeline.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPfDataCollector [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-CollectorSet] \u003cString[]\u003e] [[-Collector] \u003cString[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPfDataCollectorCounter", "Description": "Gets Performance Counters.", "Tags": [ "Performance", "DataCollector", "PerfCounter" ], "Synopsis": "Gets Performance Counters.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaPfDataCollectorCounter", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPfDataCollectorCounter", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorCounter\nGets all counters for all Collector Sets on localhost.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorCounter -ComputerName sql2017\nGets all counters for all Collector Sets on on sql2017.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorCounter -ComputerName sql2017 -Counter \u0027\\Processor(_Total)\\% Processor Time\u0027\nGets the \u0027\\Processor(_Total)\\% Processor Time\u0027 counter on sql2017.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorCounter -ComputerName sql2017, sql2016 -Credential ad\\sqldba -CollectorSet \u0027System Correlation\u0027\nGets all counters for the \u0027System Correlation\u0027 CollectorSet on sql2017 and sql2016 using alternative credentials.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSet -CollectorSet \u0027System Correlation\u0027 | Get-DbaPfDataCollector | Get-DbaPfDataCollectorCounter\nGets all counters for the \u0027System Correlation\u0027 CollectorSet.", "Params": [ [ "ComputerName", "The target computer. Defaults to localhost.", "", false, "false", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to servers using alternative credentials. To use:\n$scred = Get-Credential, then pass $scred object to the -Credential parameter.", "", false, "false", "", "" ], [ "CollectorSet", "The Collector Set name.", "DataCollectorSet", false, "false", "", "" ], [ "Collector", "The Collector name.", "DataCollector", false, "false", "", "" ], [ "Counter", "The Counter name to capture. This must be in the form of \u0027\\Processor(_Total)\\% Processor Time\u0027.", "", false, "false", "", "" ], [ "InputObject", "Accepts the object output by Get-DbaPfDataCollectorSet via the pipeline.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPfDataCollectorCounter [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-CollectorSet] \u003cString[]\u003e] [[-Collector] \u003cString[]\u003e] [[-Counter] \u003cString[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPfDataCollectorCounterSample", "Description": "Gets Performance Counter Samples.", "Tags": [ "Performance", "DataCollector", "PerfCounter" ], "Synopsis": "Gets Performance Counter Samples.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaPfDataCollectorCounterSample", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPfDataCollectorCounterSample", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorCounterSample\nGets a single sample for all counters for all Collector Sets on localhost.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorCounterSample -Counter \u0027\\Processor(_Total)\\% Processor Time\u0027\nGets a single sample for all counters for all Collector Sets on localhost.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorCounter -ComputerName sql2017, sql2016 | Out-GridView -PassThru | Get-DbaPfDataCollectorCounterSample -MaxSamples 10\nGets 10 samples for all counters for all Collector Sets for servers sql2016 and sql2017.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorCounterSample -ComputerName sql2017\nGets a single sample for all counters for all Collector Sets on sql2017.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorCounterSample -ComputerName sql2017, sql2016 -Credential ad\\sqldba -CollectorSet \u0027System Correlation\u0027\nGets a single sample for all counters for the \u0027System Correlation\u0027 CollectorSet on sql2017 and sql2016 using alternative credentials.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorCounterSample -CollectorSet \u0027System Correlation\u0027\nGets a single sample for all counters for the \u0027System Correlation\u0027 CollectorSet.", "Params": [ [ "ComputerName", "The target computer. Defaults to localhost.", "", false, "false", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to servers using alternative credentials. To use:\n$scred = Get-Credential, then pass $scred object to the -Credential parameter.", "", false, "false", "", "" ], [ "CollectorSet", "The Collector Set name.", "DataCollectorSet", false, "false", "", "" ], [ "Collector", "The Collector name.", "DataCollector", false, "false", "", "" ], [ "Counter", "The Counter name. This must be in the form of \u0027\\Processor(_Total)\\% Processor Time\u0027.", "", false, "false", "", "" ], [ "Continuous", "If this switch is enabled, samples will be retrieved continuously until you press CTRL+C. By default, this command gets only one counter sample. You can use the SampleInterval parameter to set the \r\ninterval for continuous sampling.", "", false, "false", "False", "" ], [ "ListSet", "Gets the specified performance counter sets on the computers. Enter the names of the counter sets. Wildcards are permitted.", "", false, "false", "", "" ], [ "MaxSamples", "Specifies the number of samples to get from each counter. The default is 1 sample. To get samples continuously (no maximum sample size), use the Continuous parameter.\nTo collect a very large data set, consider running a Get-DbaPfDataCollectorCounterSample command as a Windows PowerShell background job.", "", false, "false", "0", "" ], [ "SampleInterval", "Specifies the time between samples in seconds. The minimum value and the default value are 1 second.", "", false, "false", "0", "" ], [ "InputObject", "Accepts the object output by Get-DbaPfDataCollectorCounter via the pipeline.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPfDataCollectorCounterSample [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-CollectorSet] \u003cString[]\u003e] [[-Collector] \u003cString[]\u003e] [[-Counter] \u003cString[]\u003e] [-Continuous] [[-ListSet]] [[-MaxSamples] \u003cInt32\u003e] [[-SampleInterval] \u003cInt32\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPfDataCollectorSet", "Description": "Gets Performance Monitor Data Collector Set.", "Tags": [ "Performance", "DataCollector", "PerfCounter" ], "Synopsis": "Gets Performance Monitor Data Collector Set.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaPfDataCollectorSet", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPfDataCollectorSet", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSet\nGets all Collector Sets on localhost.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSet -ComputerName sql2017\nGets all Collector Sets on sql2017.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSet -ComputerName sql2017 -Credential ad\\sqldba -CollectorSet \u0027System Correlation\u0027\nGets the \u0027System Correlation\u0027 CollectorSet on sql2017 using alternative credentials.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSet | Select-Object *\nDisplays extra columns and also exposes the original COM object in DataCollectorSetObject.", "Params": [ [ "ComputerName", "The target computer. Defaults to localhost.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to servers using alternative credentials. To use:\n$scred = Get-Credential, then pass $scred object to the -Credential parameter.", "", false, "false", "", "" ], [ "CollectorSet", "The Collector set name.", "DataCollectorSet", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPfDataCollectorSet [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-CollectorSet] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPfDataCollectorSetTemplate", "Description": "Parses Perf Monitor XML templates. Defaults to parsing templates in the dbatools template repository (\\bin\\perfmontemplates\\).", "Tags": [ "Performance", "DataCollector", "PerfCounter" ], "Synopsis": "Parses Perf Monitor templates. Defaults to parsing templates in the dbatools template repository (\\bin\\perfmontemplates\\).", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaPfDataCollectorSetTemplate", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPfDataCollectorSetTemplate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSetTemplate\nReturns information about all the templates in the local dbatools repository.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSetTemplate | Out-GridView -PassThru | Import-DbaPfDataCollectorSetTemplate -ComputerName sql2017 | Start-DbaPfDataCollectorSet\nAllows you to select a template, then deploys it to sql2017 and immediately starts the DataCollectorSet.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSetTemplate | Select-Object *\nReturns more information about the template, including the full path/filename.", "Params": [ [ "Path", "The path to the template directory. Defaults to the dbatools template repository (\\bin\\perfmontemplates\\).", "", false, "false", "\"$script:PSModuleRoot\\bin\\perfmontemplates\\collectorsets\"", "" ], [ "Pattern", "Specify a pattern for filtering. Alternatively, you can use Out-GridView -Passthru to select objects and pipe them to Import-DbaPfDataCollectorSetTemplate.", "", false, "false", "", "" ], [ "Template", "Specifies one or more of the templates provided by dbatools. Press tab to cycle through the list to the options.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPfDataCollectorSetTemplate [[-Path] \u003cString[]\u003e] [[-Pattern] \u003cString\u003e] [[-Template] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPlanCache", "Description": "Checks adhoc and prepared plan cache for each database, if over 100 MB you should consider using Remove-DbaQueryPlan to clear the plan caches or turning on \"optimize for adhoc workloads\" configuration if running 2008 or later.\n\nReferences: https://www.sqlskills.com/blogs/kimberly/plan-cache-adhoc-workloads-and-clearing-the-single-use-plan-cache-bloat/\n\nNote: This command returns results from all SQL server instances on the destination server but the process column is specific to -SqlInstance passed.", "Tags": "Memory", "Synopsis": "Provides information about adhoc and prepared plan cache usage", "Alias": "", "Author": "Tracy Boggiano, databasesuperhero.com", "CommandName": "Get-DbaPlanCache", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaPlanCache", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPlanCache -SqlInstance sql2017\nReturns the single use plan cache usage information for SQL Server instance 2017\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPlanCache -SqlInstance sql2017 -SqlCredential sqladmin\nReturns the single use plan cache usage information for SQL Server instance 2017 using login \u0027sqladmin\u0027", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPlanCache [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPowerPlan", "Description": "Gets the Power Plan settings on a computer against best practices recommendations.\nTo display all available Power Plans on a computer, use the parameter List.", "Tags": "PowerPlan", "Synopsis": "Gets the Power Plan settings for compliance with best practices, which recommend High Performance for SQL Server.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaPowerPlan", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPowerPlan", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPowerPlan -ComputerName sql2017\nGets the Power Plan settings for sql2017\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPowerPlan -ComputerName sql2017 -Credential ad\\admin\nGets the Power Plan settings for sql2017 using an alternative credential\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaPowerPlan -ComputerName sql2017 -List\nGets all available Power Plans on sql2017", "Params": [ [ "ComputerName", "The server(s) to check Power Plan settings on.", "", true, "true (ByValue)", "", "" ], [ "Credential", "Specifies a PSCredential object to use in authenticating to the server(s), instead of the current user account.", "", false, "false", "", "" ], [ "List", "Return all available Power Plans.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPowerPlan [-ComputerName] \u003cDbaInstanceParameter[]\u003e [[-Credential] \u003cPSCredential\u003e] [-List] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaPrivilege", "Description": "Gets the users with local privileges \u0027Lock Pages in Memory\u0027, \u0027Instant File Initialization\u0027, \u0027Logon as Batch\u0027, or \u0027Generate Security Audits\u0027 on one or more computers.\n\nRequires Local Admin rights on destination computer(s).", "Tags": "Privilege", "Synopsis": "Gets the users with local privileges on one or more computers.", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDBAKlaas)", "CommandName": "Get-DbaPrivilege", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaPrivilege", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaPrivilege -ComputerName sqlserver2014a\nGets the local privileges on computer sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\u0027,\u0027sql3\u0027 | Get-DbaPrivilege\nGets the local privileges on computers sql1, sql2 and sql3.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaPrivilege -ComputerName sql1,sql2 | Out-GridView\nGets the local privileges on computers sql1 and sql2, and shows them in a grid view.", "Params": [ [ "ComputerName", "The target SQL Server instance or instances.", "cn,host,Server", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Credential object used to connect to the computer as a different user.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaPrivilege [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaProcess", "Description": "This command displays processes associated with a spid, login, host, program or database.\n\nThanks to Michael J Swart at https://sqlperformance.com/2017/07/sql-performance/find-database-connection-leaks for the query to get the last executed SQL statement, minutesasleep and host process ID.", "Tags": [ "Process", "Session", "ActivityMonitor" ], "Synopsis": "This command displays SQL Server processes.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaProcess", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaProcess", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaProcess -SqlInstance sqlserver2014a -Login base\\ctrlb, sa\nShows information about the processes for base\\ctrlb and sa on sqlserver2014a. Windows Authentication is used in connecting to sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaProcess -SqlInstance sqlserver2014a -SqlCredential $credential -Spid 56, 77\nShows information about the processes for spid 56 and 57. Uses alternative (SQL or Windows) credentials to authenticate to sqlserver2014a.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaProcess -SqlInstance sqlserver2014a -Program \u0027Microsoft SQL Server Management Studio\u0027\nShows information about the processes that were created in Microsoft SQL Server Management Studio.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaProcess -SqlInstance sqlserver2014a -Host workstationx, server100\nShows information about the processes that were initiated by hosts (computers/clients) workstationx and server 1000.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Spid", "Specifies one or more process IDs (Spid) to be displayed. Options for this parameter are auto-populated from the server.", "", false, "false", "", "" ], [ "ExcludeSpid", "Specifies one ore more process IDs to exclude from display. Options for this parameter are auto-populated from the server.\nThis is the last filter to run, so even if a Spid matches another filter, it will be excluded by this filter.", "", false, "false", "", "" ], [ "Database", "Specifies one or more databases with active processes to look for. Options for this parameter are auto-populated from the server.", "", false, "false", "", "" ], [ "Login", "Specifies one or more Login names with active processes to look for. Options for this parameter are auto-populated from the server.", "", false, "false", "", "" ], [ "Hostname", "Specifies one or more hostnames with active processes to look for. Options for this parameter are auto-populated from the server.", "", false, "false", "", "" ], [ "Program", "Specifies one or more program names with active processes to look for. Options for this parameter are auto-populated from the server.", "", false, "false", "", "" ], [ "ExcludeSystemSpids", "If this switch is enabled, system Spids will be ignored.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaProcess [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Spid] \u003cInt32[]\u003e] [[-ExcludeSpid] \u003cInt32[]\u003e] [[-Database] \u003cString[]\u003e] [[-Login] \u003cString[]\u003e] [[-Hostname] \u003cString[]\u003e] [[-Program] \u003cString[]\u003e] [-ExcludeSystemSpids] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaProductKey", "Description": "This command find the product key for all installed instances. Clustered instances are supported as well.\n\nUses key decoder by Jakob Bindslet (http://goo.gl/1jiwcB)", "Tags": "ProductKey", "Synopsis": "Gets SQL Server Product Keys from local or destination SQL Servers. Works with SQL Server 2008-2014.\nMore information about wrong results on newer versions: https://github.com/sqlcollaborative/dbatools/issues/6587", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaProductKey", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaProductKey", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaProductKey -ComputerName winxp, sqlservera, sqlserver2014a, win2k8\nGets SQL Server versions, editions and product keys for all instances within each server or workstation.", "Params": [ [ "ComputerName", "The target SQL Server instance or instances.", "SqlInstance", true, "true (ByValue)", "", "" ], [ "SqlCredential", "This command logs into the SQL instance to gather additional information.\nUse this parameter to connect to the discovered SQL instances using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)", "", false, "false", "", "" ], [ "Credential", "Login to the target Windows instance using alternative credentials. Windows Authentication supported. Accepts credential objects (Get-Credential)", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaProductKey [-ComputerName] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaQueryExecutionTime", "Description": "Quickly find slow query executions within a database. Results will include stored procedures and individual SQL statements.", "Tags": [ "Query", "Performance" ], "Synopsis": "Displays Stored Procedures and Ad hoc queries with the highest execution times. Works on SQL Server 2008 and above.", "Alias": "", "Author": "Brandon Abshire, netnerds.net", "CommandName": "Get-DbaQueryExecutionTime", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaQueryExecutionTime", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaQueryExecutionTime -SqlInstance sql2008, sqlserver2012\nReturn the top 100 slowest stored procedures or statements for servers sql2008 and sqlserver2012.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaQueryExecutionTime -SqlInstance sql2008 -Database TestDB\nReturn the top 100 slowest stored procedures or statements on server sql2008 for only the TestDB database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaQueryExecutionTime -SqlInstance sql2008 -Database TestDB -MaxResultsPerDb 100 -MinExecs 200 -MinExecMs 1000\nReturn the top 100 slowest stored procedures or statements on server sql2008 for only the TestDB database, limiting results to queries with more than 200 total executions and an execution time over \r\n1000ms or higher.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "MaxResultsPerDb", "Allows you to limit the number of results returned, as many systems can have very large amounts of query plans. Default value is 100 results.", "", false, "false", "100", "" ], [ "MinExecs", "Allows you to limit the scope to queries that have been executed a minimum number of time. Default value is 100 executions.", "", false, "false", "100", "" ], [ "MinExecMs", "Allows you to limit the scope to queries with a specified average execution time. Default value is 500 (ms).", "", false, "false", "500", "" ], [ "ExcludeSystem", "Allows you to suppress output on system databases", "ExcludeSystemDatabases", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaQueryExecutionTime -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-MaxResultsPerDb \u003cInt32\u003e] [-MinExecs \u003cInt32\u003e] [[-MinExecMs] \u003cInt32\u003e] [[-ExcludeSystem]] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRandomizedDataset", "Description": "Generates a random value based on a template.\nThe templates standardized in the templates folder and can be used to generate a data set.\nThere is also an option to point to a specific template", "Tags": "DataGeneration", "Synopsis": "This function will generate a random data set based on a template", "Alias": "", "Author": "Sander Stad (@sqlstad, sqlstad.nl)", "CommandName": "Get-DbaRandomizedDataset", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaRandomizedDataset", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRandomizedDataset -Template Personaldata\nGenerate a data set based on the default template PersonalData.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRandomizedDataset -Template Personaldata -Rows 10\nGenerate a data set based on the default template PersonalData with 10 rows\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRandomizedDataset -TemplateFile C:\\Dataset\\FinancialData.json\nGenerates data set based on a template file in another directory\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaRandomizedDataset -Template Personaldata, FinancialData\nGenerates multiple data sets\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaRandomizedDatasetTemplate -Template PersonalData | Get-DbaRandomizedDataset\nPipe the templates from Get-DbaRandomizedDatasetTemplate to Get-DbaRandomizedDataset and generate the data set", "Params": [ [ "Template", "The name of the template to use.\r\nIt will go through the default templates to see if it\u0027s present", "", false, "false", "", "" ], [ "TemplateFile", "File to use as a template", "", false, "false", "", "" ], [ "Rows", "Amount of rows to generate. Th default is 100.", "", false, "false", "100", "" ], [ "Locale", "Set the local to enable certain settings in the masking. The default is \u0027en\u0027", "", false, "false", "en", "" ], [ "InputObject", "Accepts piped input from Get-DbaRandomizedDatasetTemplate", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRandomizedDataset [[-Template] \u003cString[]\u003e] [[-TemplateFile] \u003cString[]\u003e] [[-Rows] \u003cInt32\u003e] [[-Locale] \u003cString\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRandomizedDatasetTemplate", "Description": "Retrieves the templates from the default directory and if assigned custom directories", "Tags": "DataGeneration", "Synopsis": "Gets the dataset templates", "Alias": "", "Author": "Sander Stad (@sqlstad, sqlstad.nl)", "CommandName": "Get-DbaRandomizedDatasetTemplate", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaRandomizedDatasetTemplate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRandomizedDatasetTemplate\nGet the templates from the default directory\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRandomizedDatasetTemplate -Template Personaldata, Test\nGet the templates from thedefault directory and filter on PersonalData and Test\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRandomizedDatasetTemplate -Path C:\\DatasetTemplates\nGet the templates from a custom directory", "Params": [ [ "Template", "The name of the template to use.\r\nIt will go through the default templates to see if it\u0027s present", "", false, "false", "", "" ], [ "Path", "Path or paths that contain template files", "", false, "false", "", "" ], [ "ExcludeDefault", "Exclude the default templates", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRandomizedDatasetTemplate [[-Template] \u003cString[]\u003e] [[-Path] \u003cString[]\u003e] [-ExcludeDefault] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRandomizedType", "Description": "Retrieves the types and sub types available", "Tags": "DataGeneration", "Synopsis": "Get the randomized types and sub types", "Alias": "", "Author": "Sander Stad (@sqlstad, sqlstad.nl)", "CommandName": "Get-DbaRandomizedType", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaRandomizedType", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRandomizedType\nGet all the types and subtypes\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRandomizedType -Pattern \"Addr\"\nFind all the types and sub types based on a pattern\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRandomizedType -RandomizedType Person\nFind all the sub types for Person\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaRandomizedType -RandomizedSubType LastName\nGet all the types and subtypes that known by \"LastName\"", "Params": [ [ "RandomizedType", "Filter the randomized types", "", false, "false", "", "" ], [ "RandomizedSubType", "Filter the randomized sub types", "", false, "false", "", "" ], [ "Pattern", "Get the types and sub types based on a pattern", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRandomizedType [[-RandomizedType] \u003cString[]\u003e] [[-RandomizedSubType] \u003cString[]\u003e] [[-Pattern] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRandomizedValue", "Description": "Generates a random value based on the assigned sql data type or bogus type with sub type.\nIt supports a wide range of sql data types and an entire dictionary of various random values.", "Tags": [ "DataMasking", "DataGeneration" ], "Synopsis": "This function will generate a random value for a specific data type or bogus type and subtype", "Alias": "", "Author": "Sander Stad (@sqlstad, sqlstad.nl)", "CommandName": "Get-DbaRandomizedValue", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaRandomizedValue", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRandomizedValue -DataType bit\nWill return either a 1 or 0\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRandomizedValue -DataType int\nWill generate a number between -2147483648 and 2147483647\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRandomizedValue -RandomizerSubType Zipcode\nGenerates a random zipcode\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaRandomizedValue -RandomizerSubType Zipcode -Format \"#### ##\"\nGenerates a random zipcode like \"1234 56\"\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaRandomizedValue -RandomizerSubType PhoneNumber -Format \"(###) #######\"\nGenerates a random phonenumber like \"(123) 4567890\"", "Params": [ [ "DataType", "The target SQL Server instance or instances.\nSupported data types are bigint, bit, bool, char, date, datetime, datetime2, decimal, int, float, guid, money, numeric, nchar, ntext, nvarchar, real, smalldatetime, smallint, text, time, tinyint, \r\nuniqueidentifier, userdefineddatatype, varchar", "", false, "false", "", "" ], [ "RandomizerType", "Bogus type to use.\nSupported types are Address, Commerce, Company, Database, Date, Finance, Hacker, Hashids, Image, Internet, Lorem, Name, Person, Phone, Random, Rant, System", "", false, "false", "", "" ], [ "RandomizerSubType", "Subtype to use.", "", false, "false", "", "" ], [ "Min", "Minimum value used to generate certain lengths of values. Default is 0", "", false, "false", "", "" ], [ "Max", "Maximum value used to generate certain lengths of values. Default is 255", "", false, "false", "", "" ], [ "Precision", "Precision used for numeric sql data types like decimal, numeric, real and float", "", false, "false", "2", "" ], [ "CharacterString", "The characters to use in string data. \u0027abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\u0027 by default", "", false, "false", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", "" ], [ "Format", "Use specilized formatting with certain randomizer types like phone number.", "", false, "false", "", "" ], [ "Symbol", "Use a symbol in front of the value i.e. $100,12", "", false, "false", "", "" ], [ "Separator", "Some masking types support separators", "", false, "false", "", "" ], [ "Value", "This is the value that needs to be used for several possible transformations.\r\nOne example is the subtype \"Shuffling\" where the value will be shuffled.", "", false, "false", "", "" ], [ "Locale", "Set the local to enable certain settings in the masking. The default is \u0027en\u0027", "", false, "false", "en", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRandomizedValue [[-DataType] \u003cString\u003e] [[-RandomizerType] \u003cString\u003e] [[-RandomizerSubType] \u003cString\u003e] [[-Min] \u003cObject\u003e] [[-Max] \u003cObject\u003e] [[-Precision] \u003cInt32\u003e] [[-CharacterString] \u003cString\u003e] [[-Format] \u003cString\u003e] [[-Symbol] \u003cString\u003e] [[-Separator] \u003cString\u003e] [[-Value] \u003cString\u003e] [[-Locale] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRegistryRoot", "Description": "Uses SQL WMI to find the Registry Root of each SQL Server instance on a computer", "Tags": [ "Server", "Management", "Registry" ], "Synopsis": "Uses SQL WMI to find the Registry Root of each SQL Server instance on a computer", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaRegistryRoot", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaRegistryRoot", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRegistryRoot\nGets the registry root for all instances on localhost\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRegistryRoot -ComputerName server1\nGets the registry root for all instances on server1", "Params": [ [ "ComputerName", "The target computer. This is not a SQL Server service, though if you pass a named SQL instance, it\u0027ll parse properly down to the computer name", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to $ComputerName using alternative Windows credentials", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRegistryRoot [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRegServer", "Description": "Gets list of SQL Server objects stored in local registered groups, azure data studio and central management server.\n\nLocal Registered Servers and Azure Data Studio support alternative authentication (excluding MFA) but Central Management Studio does not.", "Tags": [ "RegisteredServer", "CMS" ], "Synopsis": "Gets list of SQL Server objects stored in local registered groups, azure data studio and central management server.", "Alias": "Get-DbaRegisteredServer", "Author": "Bryan Hamby (@galador) | Chrissy LeMaire (@cl)", "CommandName": "Get-DbaRegServer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaRegServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRegServer\nGets a list of servers from the local registered servers and azure data studio\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlserver2014a\nGets a list of servers from the CMS on sqlserver2014a, using Windows Credentials.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlserver2014a -IncludeSelf\nGets a list of servers from the CMS on sqlserver2014a and includes sqlserver2014a in the output results.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlserver2014a -SqlCredential $credential | Select-Object -Unique -ExpandProperty ServerName\nReturns only the server names from the CMS on sqlserver2014a, using SQL Authentication to authenticate to the server.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlserver2014a -Group HR, Accounting\nGets a list of servers in the HR and Accounting groups from the CMS on sqlserver2014a.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlserver2014a -Group HR\\Development\nReturns a list of servers in the HR and sub-group Development from the CMS on sqlserver2014a.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "true (ByValue)", "(Get-DbatoolsConfigValue -FullName \u0027commands.get-dbaregserver.defaultcms\u0027)", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "Specifies one or more names to include. Name is the visible name in SSMS interface (labeled Registered Server Name)", "", false, "false", "", "" ], [ "ServerName", "Specifies one or more server names to include. Server Name is the actual instance name (labeled Server Name)", "", false, "false", "", "" ], [ "Group", "Specifies one or more groups to include from SQL Server Central Management Server.", "", false, "false", "", "" ], [ "ExcludeGroup", "Specifies one or more Central Management Server groups to exclude.", "", false, "false", "", "" ], [ "Id", "Get server by Id(s)", "", false, "false", "", "" ], [ "IncludeSelf", "If this switch is enabled and you\u0027re connecting to a Central Management Server, the CMS server itself will be included in the results, along with all other Registered Servers.", "", false, "false", "False", "" ], [ "ResolveNetworkName", "If this switch is enabled, the NetBIOS name and IP address(es) of each server will be returned.", "", false, "false", "False", "" ], [ "IncludeLocal", "Include local registered servers or Azure Data Studio registered servers in results when specifying SqlInstance.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027commands.get-dbaregserver.includelocal\u0027)", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRegServer [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString[]\u003e] [[-ServerName] \u003cString[]\u003e] [[-Group] \u003cString[]\u003e] [[-ExcludeGroup] \u003cString[]\u003e] [[-Id] \u003cInt32[]\u003e] [-IncludeSelf] [-ResolveNetworkName] [-IncludeLocal] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRegServerGroup", "Description": "Returns an array of Server Groups found in the CMS.", "Tags": [ "RegisteredServer", "CMS" ], "Synopsis": "Gets list of Server Groups objects stored in SQL Server Central Management Server (CMS).", "Alias": "", "Author": "Tony Wilhelm (@tonywsql)", "CommandName": "Get-DbaRegServerGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaRegServerGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRegServerGroup -SqlInstance sqlserver2014a\nGets the top level groups from the CMS on sqlserver2014a, using Windows Credentials.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRegServerGroup -SqlInstance sqlserver2014a -SqlCredential $credential\nGets the top level groups from the CMS on sqlserver2014a, using alternative credentials to authenticate to the server.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRegServerGroup -SqlInstance sqlserver2014a -Group HR, Accounting\nGets the HR and Accounting groups from the CMS on sqlserver2014a.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaRegServerGroup -SqlInstance sqlserver2014a -Group HR\\Development\nReturns the sub-group Development of the HR group from the CMS on sqlserver2014a.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Group", "Specifies one or more groups to include from SQL Server Central Management Server.", "", false, "false", "", "" ], [ "ExcludeGroup", "Specifies one or more Central Management Server groups to exclude.", "", false, "false", "", "" ], [ "Id", "Get group by Id(s). This parameter only works if the group has a registered server in it.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRegServerGroup [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Group] \u003cObject[]\u003e] [[-ExcludeGroup] \u003cObject[]\u003e] [[-Id] \u003cInt32[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRegServerStore", "Description": "Returns a SQL Server Registered Server Store object - useful for working with Central Management Store", "Tags": [ "RegisteredServer", "CMS" ], "Synopsis": "Returns a SQL Server Registered Server Store Object", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaRegServerStore", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaRegServerStore", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRegServerStore -SqlInstance sqlserver2014a\nReturns a SQL Server Registered Server Store Object from sqlserver2014a\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRegServerStore -SqlInstance sqlserver2014a -SqlCredential sqladmin\nReturns a SQL Server Registered Server Store Object from sqlserver2014a by logging in with the sqladmin login", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRegServerStore [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRepDistributor", "Description": "This function locates and enumerates distributor information for a given SQL Server instance.\n\nAll replication commands need SQL Server Management Studio installed and are therefore currently not supported.\nHave a look at this issue to get more information: https://github.com/sqlcollaborative/dbatools/issues/7428", "Tags": "Replication", "Synopsis": "Gets the information about a replication distributor for a given SQL Server instance.", "Alias": "", "Author": "William Durkin (@sql_williamd)", "CommandName": "Get-DbaRepDistributor", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaRepDistributor", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRepDistributor -SqlInstance sql2008, sqlserver2012\nRetrieve distributor information for servers sql2008 and sqlserver2012.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRepDistributor [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRepPublication", "Description": "Quickly find all transactional, merge, and snapshot publications on a specific server or database.\n\nAll replication commands need SQL Server Management Studio installed and are therefore currently not supported.\nHave a look at this issue to get more information: https://github.com/sqlcollaborative/dbatools/issues/7428", "Tags": "Replication", "Synopsis": "Displays all publications for a server or database.", "Alias": "", "Author": "Colin Douglas", "CommandName": "Get-DbaRepPublication", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaRepPublication", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRepPublication -SqlInstance sql2008, sqlserver2012\nReturn all publications for servers sql2008 and sqlserver2012.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRepPublication -SqlInstance sql2008 -Database TestDB\nReturn all publications on server sql2008 for only the TestDB database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRepPublication -SqlInstance sql2008 -PublicationType Transactional\nReturn all publications on server sql2008 for all databases that have Transactional publications", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "Database", "The database(s) to process. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "PublicationType", "Limit by specific type of publication. Valid choices include: Transactional, Merge, Snapshot", "", false, "false", "", "Transactional,Merge,Snapshot" ], [ "EnableException", "byng this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRepPublication [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-Database] \u003cObject[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-PublicationType] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRepServer", "Description": "Gets a replication server object\n\nAll replication commands need SQL Server Management Studio installed and are therefore currently not supported.\nHave a look at this issue to get more information: https://github.com/sqlcollaborative/dbatools/issues/7428", "Tags": "Replication", "Synopsis": "Gets a replication server object", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaRepServer", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaRepServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRepServer -SqlInstance sql2016\nGets the replication server object for sql2016 using Windows authentication\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRepServer -SqlInstance sql2016 -SqlCredential repadmin\nGets the replication server object for sql2016 using SQL authentication", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRepServer [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaResourceGovernor", "Description": "Gets the Resource Governor object", "Tags": "ResourceGovernor", "Synopsis": "Gets the Resource Governor object", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaResourceGovernor", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaResourceGovernor", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaResourceGovernor -SqlInstance sql2016\nGets the resource governor object of the SqlInstance sql2016\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaResourceGovernor\nGets the resource governor object on Sql1 and Sql2/sqlexpress instances", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaResourceGovernor [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRgClassifierFunction", "Description": "Gets the Resource Governor custom classifier Function which is used for customize the workload groups usage", "Tags": [ "Migration", "ResourceGovernor" ], "Synopsis": "Gets the Resource Governor custom classifier Function", "Alias": "", "Author": "Alessandro Alpi (@suxstellino), alessandroalpi.blog", "CommandName": "Get-DbaRgClassifierFunction", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaRgClassifierFunction", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRgClassifierFunction -SqlInstance sql2016\nGets the classifier function from sql2016\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaResourceGovernor | Get-DbaRgClassifierFunction\nGets the classifier function object on Sql1 and Sql2/sqlexpress instances", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "InputObject", "Allows input to be piped from Get-DbaResourceGovernor", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRgClassifierFunction [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-InputObject] \u003cResourceGovernor[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRgResourcePool", "Description": "Gets Resource Governor Pool objects, including internal or external", "Tags": "ResourceGovernor", "Synopsis": "Gets Resource Governor Pool objects, including internal or external", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaRgResourcePool", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaRgResourcePool", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRgResourcePool -SqlInstance sql2016\nGets the internal resource pools on sql2016\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaResourceGovernor | Get-DbaRgResourcePool\nGets the internal resource pools on Sql1 and Sql2/sqlexpress instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Get-DbaResourceGovernor | Get-DbaRgResourcePool -Type External\nGets the external resource pools on Sql1 and Sql2/sqlexpress instances", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Type", "Internal or External", "", false, "false", "Internal", "Internal,External" ], [ "InputObject", "Allows input to be piped from Get-DbaResourceGovernor", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRgResourcePool [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Type] \u003cString\u003e] [[-InputObject] \u003cResourceGovernor[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRgWorkloadGroup", "Description": "Gets all Resource Governor Pool objects, including both internal and external", "Tags": "ResourceGovernor", "Synopsis": "Gets all Resource Governor Pool objects, including both internal and external", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaRgWorkloadGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaRgWorkloadGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRgWorkloadGroup -SqlInstance sql2017\nGets the workload groups on sql2017\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaResourceGovernor -SqlInstance sql2017 | Get-DbaRgResourcePool | Get-DbaRgWorkloadGroup\nGets the workload groups on sql2017", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "InputObject", "Allows input to be piped from Get-DbaRgResourcePool", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRgWorkloadGroup [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-InputObject] \u003cResourcePool[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaRunningJob", "Description": "This function returns agent jobs that active on the SQL Server instance when calling the command", "Tags": [ "Agent", "Job" ], "Synopsis": "Returns all non-idle Agent jobs running on the server", "Alias": "", "Author": "Stephen Bennett, https://sqlnotesfromtheunderground.wordpress.com/", "CommandName": "Get-DbaRunningJob", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaRunningJob", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaRunningJob -SqlInstance sql2017\nReturns any active jobs on sql2017\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance sql2017, sql2019 | Get-DbaRunningJob\nReturns all active jobs on multiple instances piped into the function.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers | Get-DbaRunningJob\nReturns all active jobs on multiple instances piped into the function.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaAgentJob", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaRunningJob [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-InputObject] \u003cJob[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaSchemaChangeHistory", "Description": "Queries the default system trace for any DDL changes in the specified time frame\nOnly works with SQL 2005 and later, as the system trace didn\u0027t exist before then", "Tags": [ "Migration", "Backup", "Database" ], "Synopsis": "Gets DDL changes logged in the system trace.", "Alias": "", "Author": "Stuart Moore (@napalmgram - http://stuart-moore.com)", "CommandName": "Get-DbaSchemaChangeHistory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaSchemaChangeHistory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaSchemaChangeHistory -SqlInstance localhost\nReturns all DDL changes made in all databases on the SQL Server instance localhost since the system trace began\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaSchemaChangeHistory -SqlInstance localhost -Since (Get-Date).AddDays(-7)\nReturns all DDL changes made in all databases on the SQL Server instance localhost in the last 7 days\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaSchemaChangeHistory -SqlInstance localhost -Database Finance, Prod -Since (Get-Date).AddDays(-7)\nReturns all DDL changes made in the Prod and Finance databases on the SQL Server instance localhost in the last 7 days\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaSchemaChangeHistory -SqlInstance localhost -Database Finance -Object AccountsTable -Since (Get-Date).AddDays(-7)\nReturns all DDL changes made to the AccountsTable object in the Finance database on the SQL Server instance localhost in the last 7 days", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Since", "A date from which DDL changes should be returned. Default is to start at the beginning of the current trace file", "", false, "false", "", "" ], [ "Object", "The name of a SQL Server object you want to look for changes on", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaSchemaChangeHistory [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-Since] \u003cDbaDateTime\u003e] [[-Object] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaServerRole", "Description": "Gets the list of server-level roles for SQL Server instance.", "Tags": [ "ServerRole", "Security" ], "Synopsis": "Gets the list of server-level roles.", "Alias": "", "Author": "Shawn Melton (@wsmelton)", "CommandName": "Get-DbaServerRole", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaServerRole", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaServerRole -SqlInstance sql2016a\nOutputs list of server-level roles for sql2016a instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaServerRole -SqlInstance sql2017a -ExcludeFixedRole\nOutputs the server-level role(s) that are not fixed roles on sql2017a instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2005 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "ServerRole", "Server-Level role to filter results to that role only.", "", false, "false", "", "" ], [ "ExcludeServerRole", "Server-Level role to exclude from results.", "", false, "false", "", "" ], [ "ExcludeFixedRole", "Filter the fixed server-level roles. Only applies to SQL Server 2017 that supports creation of server-level roles.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. This avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because \r\nit basically disables advanced scripting. Using this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaServerRole [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-ServerRole] \u003cString[]\u003e] [[-ExcludeServerRole] \u003cString[]\u003e] [-ExcludeFixedRole] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaServerRoleMember", "Description": "The Get-DbaServerRoleMember returns connected SMO object for server roles for each instance(s) of SQL Server.", "Tags": [ "ServerRole", "Security", "Login" ], "Synopsis": "Get members of server roles for each instance(s) of SQL Server.", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDBAKlaas)", "CommandName": "Get-DbaServerRoleMember", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaServerRoleMember", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaServerRoleMember -SqlInstance localhost\nReturns all members of all server roles on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaServerRoleMember -SqlInstance localhost, sql2016\nReturns all members of all server roles on the local and sql2016 SQL Server instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers = Get-Content C:\\servers.txt\nPS C:\\\u003e $servers | Get-DbaServerRoleMember\nReturns all members of all server roles for every server in C:\\servers.txt\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaServerRoleMember -SqlInstance localhost -ServerRole \u0027sysadmin\u0027, \u0027dbcreator\u0027\nReturns all members of the sysadmin or dbcreator roles on localhost.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaServerRoleMember -SqlInstance localhost -ExcludeServerRole \u0027sysadmin\u0027\nReturns all members of server-level roles other than sysadmin.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaServerRoleMember -SqlInstance sql2017a -ExcludeFixedRole\nReturns all members of server-level role(s) that are not fixed roles on sql2017a instance.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaServerRoleMember -SqlInstance localhost -Login \u0027MyFriendlyDeveloper\u0027\nReturns all server-level role(s) for the MyFriendlyDeveloper login on localhost.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "Credential", false, "false", "", "" ], [ "ServerRole", "The role(s) to process. If unspecified, all roles will be processed.", "", false, "false", "", "" ], [ "ExcludeServerRole", "The role(s) to exclude.", "", false, "false", "", "" ], [ "Login", "The login(s) to process. If unspecified, all logins will be processed.", "", false, "false", "", "" ], [ "ExcludeFixedRole", "Filter the fixed server-level roles. Only applies to SQL Server 2017 that supports creation of server-level roles.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaServerRoleMember [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-ServerRole] \u003cString[]\u003e] [[-ExcludeServerRole] \u003cString[]\u003e] [[-Login] \u003cObject[]\u003e] [-ExcludeFixedRole] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaService", "Description": "Gets the SQL Server related services on one or more computers.\n\nRequires Local Admin rights on destination computer(s).", "Tags": [ "Service", "SqlServer", "Instance", "Connect" ], "Synopsis": "Gets the SQL Server related services on a computer.", "Alias": "", "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )", "CommandName": "Get-DbaService", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaService", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaService -ComputerName sqlserver2014a\nGets the SQL Server related services on computer sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\u0027,\u0027sql3\u0027 | Get-DbaService -AdvancedProperties\nGets the SQL Server related services on computers sql1, sql2 and sql3. Includes Advanced Properties from the SqlServiceAdvancedProperty Namespace\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$cred = Get-Credential WindowsUser\nPS C:\\\u003e Get-DbaService -ComputerName sql1,sql2 -Credential $cred | Out-GridView\nGets the SQL Server related services on computers sql1 and sql2 via the user WindowsUser, and shows them in a grid view.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaService -ComputerName sql1,sql2 -InstanceName MSSQLSERVER\nGets the SQL Server related services related to the default instance MSSQLSERVER on computers sql1 and sql2.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaService -ComputerName $MyServers -Type SSRS\nGets the SQL Server related services of type \"SSRS\" (Reporting Services) on computers in the variable MyServers.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$MyServers = Get-Content .\\servers.txt\nPS C:\\\u003e Get-DbaService -ComputerName $MyServers -ServiceName MSSQLSERVER,SQLSERVERAGENT\nGets the SQL Server related services with ServiceName MSSQLSERVER or SQLSERVERAGENT for all the servers that are stored in the file. Every line in the file can only contain one hostname for a server.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$services = Get-DbaService -ComputerName sql1 -Type Agent,Engine\nPS C:\\\u003e $services.ChangeStartMode(\u0027Manual\u0027)\nGets the SQL Server related services of types Sql Agent and DB Engine on computer sql1 and changes their startup mode to \u0027Manual\u0027.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003e(Get-DbaService -ComputerName sql1 -Type Engine).Restart($true)\nCalls a Restart method for each Engine service on computer sql1.", "Params": [ [ "ComputerName", "The target SQL Server instance or instances.", "cn,host,Server", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "InstanceName", "Only returns services that belong to the specific instances.", "Instance", false, "false", "", "" ], [ "Credential", "Credential object used to connect to the computer as a different user.", "", false, "false", "", "" ], [ "Type", "Use -Type to collect only services of the desired SqlServiceType.\r\nCan be one of the following: \"Agent\", \"Browser\", \"Engine\", \"FullText\", \"SSAS\", \"SSIS\", \"SSRS\", \"PolyBase\", \"Launchpad\"", "", false, "false", "", "Agent,Browser,Engine,FullText,SSAS,SSIS,SSRS,PolyBase,Launchpad" ], [ "ServiceName", "Can be used to specify service names explicitly, without looking for service types/instances.", "", false, "false", "", "" ], [ "AdvancedProperties", "Collect additional properties from the SqlServiceAdvancedProperty Namespace\r\nThis collects information about Version, Service Pack Level\", SkuName, Clustered status and the Cluster Service Name\r\nThis adds additional overhead to the command.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaService [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [-InstanceName \u003cString[]\u003e] [-Credential \u003cPSCredential\u003e] [-Type \u003cString[]\u003e] [-AdvancedProperties] [-EnableException] [\u003cCommonParameters\u003e]\nGet-DbaService [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [-Credential \u003cPSCredential\u003e] [-ServiceName \u003cString[]\u003e] [-AdvancedProperties] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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.", "Tags": [ "SpConfig", "Configure", "Configuration" ], "Synopsis": "Returns all server level system configuration (sys.configuration/sp_configure) information", "Alias": "", "Author": "Nic Cain, https://sirsql.net/", "CommandName": "Get-DbaSpConfigure", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaSpConfigure", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaSpConfigure -SqlInstance localhost\nReturns all system configuration information on the localhost.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027localhost\u0027,\u0027localhost\\namedinstance\u0027 | Get-DbaSpConfigure\nReturns system configuration information on multiple instances piped into the function\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaSpConfigure -SqlInstance sql2012 -Name \u0027max server memory (MB)\u0027\nReturns only the system configuration for MaxServerMemory on sql2012.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaSpConfigure -SqlInstance sql2012 -ExcludeName \u0027max server memory (MB)\u0027, RemoteAccess | Out-GridView\nReturns system configuration information on sql2012 but excludes for max server memory (MB) and remote access. Values returned in grid view\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$cred = Get-Credential SqlCredential\nPS C:\\\u003e \u0027sql2012\u0027 | Get-DbaSpConfigure -SqlCredential $cred -Name RemoteAccess, \u0027max server memory (MB)\u0027 -ExcludeName \u0027remote access\u0027 | Out-GridView\nReturns system configuration information on sql2012 using SQL Server Authentication. Only MaxServerMemory is returned as RemoteAccess was also excluded.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "Return only specific configurations. Name can be either values from (sys.configuration/sp_configure) or from SMO object", "Config,ConfigName", false, "false", "", "" ], [ "ExcludeName", "Exclude specific configurations. Name can be either values from (sys.configuration/sp_configure) or from SMO object", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaSpConfigure [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString[]\u003e] [[-ExcludeName] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaSpinLockStatistic", "Description": "This command is based off of Paul Randal\u0027s post \"Advanced SQL Server performance tuning\"\n\nReturns:\n SpinLockName\n Collisions\n Spins\n SpinsPerCollision\n SleepTime\n Backoffs\n\nReference: https://www.sqlskills.com/blogs/paul/advanced-performance-troubleshooting-waits-latches-spinlocks/", "Tags": [ "SpinLockStatistics", "Waits" ], "Synopsis": "Displays information from sys.dm_os_spinlock_stats. Works on SQL Server 2008 and above.", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaSpinLockStatistic", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaSpinLockStatistic", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaSpinLockStatistic -SqlInstance sql2008, sqlserver2012\nGet SpinLock Statistics for servers sql2008 and sqlserver2012.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$output = Get-DbaSpinLockStatistic -SqlInstance sql2008 | Select-Object * | ConvertTo-DbaDataTable\nCollects all SpinLock Statistics on server sql2008 into a Data Table.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027sql2008\u0027,\u0027sqlserver2012\u0027 | Get-DbaSpinLockStatistic\nGet SpinLock Statistics for servers sql2008 and sqlserver2012 via pipline\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Get-DbaSpinLockStatistic -SqlInstance sql2008 -SqlCredential $cred\nConnects using sqladmin credential and returns SpinLock Statistics from sql2008", "Params": [ [ "SqlInstance", "The SQL Server instance. Server version must be SQL Server version 2008 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaSpinLockStatistic [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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 directory account. You can query one, or both. You\u0027ll get a list of every SPN found for either search term.", "Tags": "SPN", "Synopsis": "Returns a list of set service principal names for a given computer/AD account", "Alias": "", "Author": "Drew Furgiuele (@pittfurg), http://www.port1433.com", "CommandName": "Get-DbaSpn", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaSpn", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaSpn -ComputerName SQLSERVERA -Credential ad\\sqldba\nReturns a custom object with SearchTerm (ServerName) and the SPNs that were found\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaSpn -AccountName domain\\account -Credential ad\\sqldba\nReturns a custom object with SearchTerm (domain account) and the SPNs that were found\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaSpn -ComputerName SQLSERVERA,SQLSERVERB -Credential ad\\sqldba\nReturns a custom object with SearchTerm (ServerName) and the SPNs that were found for multiple computers", "Params": [ [ "ComputerName", "The servers you want to return set SPNs for. This is defaulted automatically to localhost.", "", false, "true (ByValue)", "", "" ], [ "AccountName", "The accounts you want to retrieve set SPNs for.", "", false, "false", "", "" ], [ "Credential", "User credential to connect to the remote servers or active directory.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaSpn [[-ComputerName] \u003cString[]\u003e] [[-AccountName] \u003cString[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaSsisExecutionHistory", "Description": "Get-DbaSsisHistory Retreives SSIS project and package execution History, and environments from one SQL Server to another.\n\nThis command gets execution history for SSIS executison given one or more instances and can be filtered by Project, Environment,Folder or Status.", "Tags": [ "Migration", "SSIS" ], "Synopsis": "Get-DbaSsisHistory Retreives SSIS project and package execution History, and environments from one SQL Server to another.", "Alias": "", "Author": "Chris Tucker (@ChrisTuc47368095)", "CommandName": "Get-DbaSsisExecutionHistory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaSsisExecutionHistory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaSsisExecutionHistory -SqlInstance SMTQ01 -Folder SMTQ_PRC\nGet all history items for SMTQ01 in folder SMTQ_PRC.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaSsisExecutionHistory -SqlInstance SMTQ01 -Status Failed,Cancelled\nGets all failed or canceled executions for SMTQ01.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaSsisExecutionHistory -SqlInstance SMTQ01,SMTQ02 -Status Failed,Cancelled\nShows what would happen if the command were executed and would return the SQL statement that would be executed per instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.\r\nThis can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Since", "Datetime object used to narrow the results to a date", "", false, "false", "", "" ], [ "Status", "Specifies a filter by status (created,running,cancelled,failed,pending,halted,succeeded,stopping,completed)", "", false, "false", "", "Created,Running,Cancelled,Failed,Pending,Halted,Succeeded,Stopping,Completed" ], [ "Project", "Specifies a filter by project", "", false, "false", "", "" ], [ "Folder", "Specifies a filter by folder", "", false, "false", "", "" ], [ "Environment", "Specifies a filter by environment", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaSsisExecutionHistory [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Since] \u003cDateTime\u003e] [[-Status] \u003cString[]\u003e] [[-Project] \u003cString[]\u003e] [[-Folder] \u003cString[]\u003e] [[-Environment] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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\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.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaStartupParameter", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaStartupParameter", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaStartupParameter -SqlInstance sql2014\nLogs into SQL WMI as the current user then displays the values for numerous startup parameters.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$wincred = Get-Credential ad\\sqladmin\nPS C:\\\u003e Get-DbaStartupParameter -SqlInstance sql2014 -Credential $wincred -Simple\nLogs in to WMI using the ad\\sqladmin credential and gathers simplified information about the SQL Server Startup Parameters.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "Credential", "Allows you to login to servers using alternate Windows credentials.\n$scred = Get-Credential, then pass $scred object to the -Credential parameter.", "SqlCredential", false, "false", "", "" ], [ "Simple", "If this switch is enabled, simplified output will be produced including only Server, Master Data Path, Master Log path, ErrorLog, TraceFlags and ParameterString.", "", false, "false", "False", "" ], [ "EnableException", "If this switch is enabled, exceptions will be thrown to the caller, which will need to perform its own exception processing. Otherwise, the function will try to catch the exception, interpret it and \r\nprovide a friendly error message.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaStartupParameter [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-Credential] \u003cPSCredential\u003e] [-Simple] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaStartupProcedure", "Description": "By default, this command returns for each SQL Server instance passed in, the SMO StoredProcedure object for all procedures in the master database that are marked as a startup procedure.\nCan be filtered to check only specific procedures", "Tags": [ "Procedure", "Startup", "StartupProcedure" ], "Synopsis": "Get-DbaStartupProcedure gets startup procedures (user defined procedures within master database) from a SQL Server.", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Get-DbaStartupProcedure", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaStartupProcedure", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaStartupProcedure -SqlInstance SqlBox1\\Instance2\nReturns an object with all startup procedures for the Instance2 instance on SqlBox1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaStartupProcedure -SqlInstance SqlBox1\\Instance2 -StartupProcedure \u0027dbo.StartupProc\u0027\nReturns an object with a startup procedure named \u0027dbo.StartupProc\u0027 for the Instance2 instance on SqlBox1\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sql2014 | Get-DbaStartupProcedure\nReturns an object with all startup procedures for every server listed in the Central Management Server on sql2014", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "StartupProcedure", "Use this filter to check if specific procedure(s) are set as startup procedures.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaStartupProcedure [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-StartupProcedure] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaSuspectPage", "Description": "This function returns any records that were stored due to suspect pages in databases on a SQL Server Instance.", "Tags": [ "Pages", "DBCC" ], "Synopsis": "Returns data that is stored in SQL for Suspect Pages on the specified SQL Server Instance", "Alias": "", "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com", "CommandName": "Get-DbaSuspectPage", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaSuspectPage", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaSuspectPage -SqlInstance sql2016\nRetrieve any records stored for Suspect Pages on the sql2016 SQL Server.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaSuspectPage -SqlInstance sql2016 -Database Test\nRetrieve any records stored for Suspect Pages on the sql2016 SQL Server and the Test database only.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "true (ByValue)", "", "" ], [ "Database", "The database to return. If unspecified, all records will be returned.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaSuspectPage [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-Database] \u003cObject\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaTcpPort", "Description": "By default, this function returns just the TCP port used by the specified SQL Server.\n\nIf -All is specified, the server name, IPAddress (ipv4 and ipv6), port number and an indicator of whether or not the port assignment is static are returned.\n\nRemote sqlwmi is used by default. If this doesn\u0027t work, then remoting is used. If neither work, it defaults to T-SQL which can provide only the port.", "Tags": [ "SQLWMI", "tcp" ], "Synopsis": "Returns the TCP port used by the specified SQL Server.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaTcpPort", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaTcpPort", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaTcpPort -SqlInstance sqlserver2014a\nReturns just the port number for the default instance on sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaTcpPort -SqlInstance winserver\\sqlexpress, sql2016\nReturns an object with server name and port number for the sqlexpress on winserver and the default instance on sql2016.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaTcpPort -SqlInstance sqlserver2014a, sql2016 -All\nReturns an object with server name, IPAddress (ipv4 and ipv6), port and static ($true/$false) for sqlserver2014a and sql2016.\nRemote sqlwmi is used by default. If this doesn\u0027t work, then remoting is used. If neither work, it defaults to T-SQL which can provide only the port.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sql2014 | Get-DbaTcpPort -ExcludeIpv6 -All\nReturns an object with server name, IPAddress (just ipv4), port and static ($true/$false) for every server listed in the Central Management Server on sql2014.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Allows you to connect to servers using alternate Windows credentials\n$scred = Get-Credential, then pass $scred object to the -SqlCredential parameter.", "", false, "false", "", "" ], [ "Credential", "Credential object used to connect to the Computer as a different user", "", false, "false", "", "" ], [ "All", "If this switch is enabled, an object with server name, IPAddress (ipv4 and ipv6), port and static ($true/$false) for one or more SQL Servers is returned.", "", false, "false", "False", "" ], [ "ExcludeIpv6", "If this switch is enabled, IPv6 information is excluded from All output.", "Ipv4", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaTcpPort [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [-All] [-ExcludeIpv6] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaTempdbUsage", "Description": "This function queries DMVs for running sessions using tempdb and returns results if those sessions have user or internal space allocated or deallocated against them.", "Tags": "Tempdb", "Synopsis": "Gets Tempdb usage for running queries.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaTempdbUsage", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaTempdbUsage", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaTempdbUsage -SqlInstance localhost\\SQLDEV2K14\nGets tempdb usage for localhost\\SQLDEV2K14", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaTempdbUsage [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbatoolsChangeLog", "Description": "Opens the link to our online change log. To see the local changelog instead, use the Local parameter.", "Tags": [ "Module", "ChangeLog" ], "Synopsis": "Opens the link to our online change log", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbatoolsChangeLog", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbatoolsChangeLog", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbatoolsChangeLog\nOpens a browser to our online changelog\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbatoolsChangeLog -Local\nReturns the content from changelog.md", "Params": [ [ "Local", "Return the local change log to the console", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbatoolsChangeLog [-Local] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbatoolsConfig", "Description": "Retrieves configuration elements by name.\nCan be used to search the existing configuration list.", "Tags": "Module", "Synopsis": "Retrieves configuration elements by name.", "Alias": "", "Author": "Friedrich Weinmann (@FredWeinmann)", "CommandName": "Get-DbatoolsConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbatoolsConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbatoolsConfig \u0027Mail.To\u0027\nRetrieves the configuration element for the key \"Mail.To\"\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbatoolsConfig -Force\nRetrieve all configuration elements from all modules, even hidden ones.", "Params": [ [ "FullName", "Default: \"*\"\r\nSearch for configurations using the full name", "", false, "false", "*", "" ], [ "Name", "Default: \"*\"\r\nThe name of the configuration element(s) to retrieve.\r\nMay be any string, supports wildcards.", "", false, "false", "*", "" ], [ "Module", "Default: \"*\"\r\nSearch configuration by module.", "", false, "false", "*", "" ], [ "Force", "Overrides the default behavior and also displays hidden configuration values.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbatoolsConfig [[-FullName] \u003cString\u003e] [-Force] [\u003cCommonParameters\u003e]\nGet-DbatoolsConfig [[-Name] \u003cString\u003e] [[-Module] \u003cString\u003e] [-Force] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbatoolsConfigValue", "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": "Module", "Synopsis": "Returns the configuration value stored under the specified name.", "Alias": "", "Author": "Friedrich Weinmann (@FredWeinmann)", "CommandName": "Get-DbatoolsConfigValue", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbatoolsConfigValue", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbatoolsConfigValue -Name \u0027System.MailServer\u0027\nReturns the configured value that was assigned to the key \u0027System.MailServer\u0027\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbatoolsConfigValue -Name \u0027Default.CoffeeMilk\u0027 -Fallback 0\nReturns the configured value for \u0027Default.CoffeeMilk\u0027. If no such value is configured, it returns \u00270\u0027 instead.", "Params": [ [ "FullName", "The full name (\u003cModule\u003e.\u003cName\u003e) of the configured value to return.", "Name", true, "false", "", "" ], [ "Fallback", "A fallback value to use, if no value was registered to a specific configuration element.\r\nThis basically is a default value that only applies on a \"per call\" basis, rather than a system-wide default.", "", false, "false", "", "" ], [ "NotNull", "By default, this function returns null if one tries to retrieve the value from either a Configuration that does not exist or a Configuration whose value was set to null.\r\nHowever, sometimes it may be important that some value was returned.\r\nBy specifying this parameter, the function will throw an error if no value was found at all.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbatoolsConfigValue [-FullName] \u003cString\u003e [[-Fallback] \u003cObject\u003e] [-NotNull] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbatoolsError", "Description": "Returns detailed dbatools-related error information\n\nBy default, it only returns the most recent error ($error[0])", "Tags": [ "Module", "Support" ], "Synopsis": "Returns detailed dbatools-related error information", "Alias": "", "Author": "Chrissy LeMaire (@cl)", "CommandName": "Get-DbatoolsError", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbatoolsError", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbatoolsError\nReturns detailed error information for the most recent dbatools error\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbatoolsError -All\nReturns detailed error information for all dbatools-related errors\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbatoolsError -Last 1\nReturns the oldest dbatools-related error in the pipeline", "Params": [ [ "First", "Works like `Select-Object -First 1`", "", false, "false", "0", "" ], [ "Last", "Works like `Select-Object -Last 1`", "", false, "false", "0", "" ], [ "Skip", "Works like `Select-Object -Skip 1`", "", false, "false", "0", "" ], [ "All", "Returns detailed information for all dbatools-related errors", "", false, "false", "False", "" ] ], "Syntax": "Get-DbatoolsError [[-First] \u003cInt32\u003e] [[-Last] \u003cInt32\u003e] [[-Skip] \u003cInt32\u003e] [-All] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbatoolsLog", "Description": "Returns log entries for dbatools. Handy when debugging or developing a script using it.", "Tags": [ "Module", "Support" ], "Synopsis": "Returns log entries for dbatools", "Alias": "", "Author": "Friedrich Weinmann (@FredWeinmann)", "CommandName": "Get-DbatoolsLog", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbatoolsLog", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbatoolsLog\nReturns all log entries currently in memory.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbatooolsLog -LastError\nReturns the last log entry type of error.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbatoolsLog -Target \"a\" -Last 1 -Skip 1\nReturns all log entries that targeted the object \"a\" in the second last execution sent.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbatoolsLog -Tag \"fail\" -Last 5\nReturns all log entries within the last 5 executions that contained the tag \"fail\"", "Params": [ [ "FunctionName", "Default: \"*\"\r\nOnly messages written by similar functions will be returned.", "", false, "false", "*", "" ], [ "ModuleName", "Default: \"*\"\r\nOnly messages written by commands from similar modules will be returned.", "", false, "false", "*", "" ], [ "Target", "Only messages handling the specified target will be returned.", "", false, "false", "", "" ], [ "Tag", "Only messages containing one of these tags will be returned.", "", false, "false", "", "" ], [ "Last", "Only messages written by the last X executions will be returned.\r\nUses Get-History to determine execution. Ignores Get-message commands.\r\nBy default, this will also include messages from other runspaces. If your command executes in parallel, that\u0027s useful.\r\nIf it doesn\u0027t and you were offloading executions to other runspaces, consider also filtering by runspace using \u0027-Runspace\u0027", "", false, "false", "0", "" ], [ "LastError", "Only retrieves the last error message type written.", "", false, "false", "False", "" ], [ "Skip", "How many executions to skip when specifying \u0027-Last\u0027.\r\nHas no effect without the \u0027-Last\u0027 parameter.", "", false, "false", "0", "" ], [ "Runspace", "The guid of the runspace to return messages from.\r\nBy default, messages from all runspaces are returned.\r\nRun the following line to see the list of guids:\nGet-Runspace | ft Id, Name, InstanceId -AutoSize", "", false, "false", "", "" ], [ "Level", "Limit the message selection by level.\r\nMessage levels have a numeric value, making it easier to select a range:\n-Level (1..6)\nWill select the first 6 levels (Critical - SomewhatVerbose).", "", false, "false", "", "" ], [ "Raw", "By default, messages such as SQL statements are flattened. Use raw to see the output without flattened formatting.", "", false, "false", "False", "" ], [ "Errors", "Instead of log entries, the error entries will be retrieved", "", false, "false", "False", "" ] ], "Syntax": "Get-DbatoolsLog [[-FunctionName] \u003cString\u003e] [[-ModuleName] \u003cString\u003e] [[-Target] \u003cObject\u003e] [[-Tag] \u003cString[]\u003e] [[-Last] \u003cInt32\u003e] [-LastError] [[-Skip] \u003cInt32\u003e] [[-Runspace] \u003cGuid\u003e] [[-Level] {Critical | Important | Output | Significant | VeryVerbose | Verbose | SomewhatVerbose | System | Debug | InternalComment | Warning}] [-Raw] [-Errors] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbatoolsPath", "Description": "Access a configured path.\nPaths can be configured using Set-DbatoolsPath or using the configuration system.\nTo register a path using the configuration system create a setting key named like this:\n\"Path.Managed.\u003cPathName\u003e\"\nFor example the following setting points at the temp path:\n\"Path.Managed.Temp\"", "Synopsis": "Access a configured path.", "Alias": "", "CommandName": "Get-DbatoolsPath", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbatoolsPath", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbatoolsPath -Name \u0027temp\u0027\nReturns the temp path.", "Params": [ [ "Name", "Name of the path to retrieve.", "", true, "false", "", "" ] ], "Syntax": "Get-DbatoolsPath [-Name] \u003cString\u003e [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaTopResourceUsage", "Description": "Returns the top 20 resource consumers for cached queries based on four different metrics: duration, frequency, IO, and CPU.\n\nThis command is based off of queries provided by Michael J. Swart at http://michaeljswart.com/go/Top20\n\nPer Michael: \"I\u0027ve posted queries like this before, and others have written many other versions of this query. All these queries are based on sys.dm_exec_query_stats.\"", "Tags": [ "Query", "Performance" ], "Synopsis": "Returns the top 20 resource consumers for cached queries based on four different metrics: duration, frequency, IO, and CPU.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaTopResourceUsage", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaTopResourceUsage", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaTopResourceUsage -SqlInstance sql2008, sql2012\nReturn the 80 (20 x 4 types) top usage results by duration, frequency, IO, and CPU servers for servers sql2008 and sql2012\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaTopResourceUsage -SqlInstance sql2008 -Type Duration, Frequency -Database TestDB\nReturn the highest usage by duration (top 20) and frequency (top 20) for the TestDB on sql2008\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaTopResourceUsage -SqlInstance sql2016 -Limit 30\nReturn the highest usage by duration (top 30) and frequency (top 30) for the TestDB on sql2016\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaTopResourceUsage -SqlInstance sql2008, sql2012 -ExcludeSystem\nReturn the 80 (20 x 4 types) top usage results by duration, frequency, IO, and CPU servers for servers sql2008 and sql2012 without any System Objects\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaTopResourceUsage -SqlInstance sql2016| Select-Object *\nReturn all the columns plus the QueryPlan column", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Type", "By default, all Types run but you can specify one or more of the following: Duration, Frequency, IO, or CPU", "", false, "false", "All", "All,Duration,Frequency,IO,CPU" ], [ "Limit", "By default, these query the Top 20 worst offenders (though more than 20 results can be returned if each of the top 20 have more than 1 subsequent result)", "", false, "false", "20", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "ExcludeSystem", "This will exclude system objects like replication procedures from being returned.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaTopResourceUsage [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-Type] \u003cString[]\u003e] [[-Limit] \u003cInt32\u003e] [-EnableException] [-ExcludeSystem] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaTrace", "Description": "This function returns a list of traces on a SQL Server instance and identifies the default trace file", "Tags": [ "Security", "Trace" ], "Synopsis": "Gets a list of trace(s) from specified SQL Server Instance", "Alias": "", "Author": "Garry Bargsley (@gbargsley), http://blog.garrybargsley.com", "CommandName": "Get-DbaTrace", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaTrace", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaTrace -SqlInstance sql2016\nLists all the trace files on the sql2016 SQL Server.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaTrace -SqlInstance sql2016 -Default\nLists the default trace information on the sql2016 SQL Server.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Id", "The id(s) of the Trace", "", false, "false", "", "" ], [ "Default", "Switch that will only return the information for the default system trace", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaTrace [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Id] \u003cInt32[]\u003e] [-Default] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaTraceFlag", "Description": "Returns Trace Flags that are enabled globally on each instance(s) of SQL Server as an object.", "Tags": [ "TraceFlag", "DBCC" ], "Synopsis": "Get global Trace Flag(s) information for each instance(s) of SQL Server.", "Alias": "", "Author": "Kevin Bullen (@sqlpadawan)", "CommandName": "Get-DbaTraceFlag", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaTraceFlag", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaTraceFlag -SqlInstance localhost\nReturns all Trace Flag information on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaTraceFlag -SqlInstance localhost, sql2016\nReturns all Trace Flag(s) for the local and sql2016 SQL Server instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaTraceFlag -SqlInstance localhost -TraceFlag 4199,3205\nReturns Trace Flag status for TF 4199 and 3205 for the local SQL Server instance if they are enabled.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "TraceFlag", "Use this switch to filter to a specific Trace Flag.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaTraceFlag [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-TraceFlag] \u003cInt32[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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", "Alias": "", "Author": "Stuart Moore (@napalmgram), stuart-moore.com", "CommandName": "Get-DbaUptime", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaUptime", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaUptime -SqlInstance SqlBox1\\Instance2\nReturns an object with SQL Server start time, uptime as TimeSpan object, uptime as a string, and Windows host boot time, host uptime as TimeSpan objects and host uptime as a string for the sqlexpress \r\ninstance on winserver\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaUptime -SqlInstance winserver\\sqlexpress, sql2016\nReturns an object with SQL Server start time, uptime as TimeSpan object, uptime as a string, and Windows host boot time, host uptime as TimeSpan objects and host uptime as a string for the sqlexpress \r\ninstance on host winserver and the default instance on host sql2016\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sql2014 | Get-DbaUptime\nReturns an object with SQL Server start time, uptime as TimeSpan object, uptime as a string, and Windows host boot time, host uptime as TimeSpan objects and host uptime as a string for every server \r\nlisted in the Central Management Server on sql2014", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Credential", "Allows you to login to the computer (not SQL Server instance) using alternative Windows credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaUptime [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaUserPermission", "Description": "This command will display all server logins, server level securables, database logins and database securables.\n\nDISA STIG implementators will find this command useful as it uses Permissions.sql provided by DISA.\n\nNote that if you Ctrl-C out of this command and end it prematurely, it will leave behind a STIG schema in tempdb.", "Tags": [ "Discovery", "Permissions", "Security" ], "Synopsis": "Displays detailed permissions information for the server and database roles and securables.", "Alias": "", "Author": "Brandon Abshire, netnerds.net", "CommandName": "Get-DbaUserPermission", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaUserPermission", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaUserPermission -SqlInstance sql2008, sqlserver2012\nCheck server and database permissions for servers sql2008 and sqlserver2012.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaUserPermission -SqlInstance sql2008 -Database TestDB\nCheck server and database permissions on server sql2008 for only the TestDB database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaUserPermission -SqlInstance sql2008 -Database TestDB -IncludePublicGuest -IncludeSystemObjects\nCheck server and database permissions on server sql2008 for only the TestDB database,\r\nincluding public and guest grants, and sys schema objects.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "ExcludeSystemDatabase", "Allows you to suppress output on system databases", "", false, "false", "False", "" ], [ "IncludePublicGuest", "Allows you to include output for public and guest grants.", "", false, "false", "False", "" ], [ "IncludeSystemObjects", "Allows you to include output on sys schema objects.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaUserPermission [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-ExcludeSystemDatabase] [-IncludePublicGuest] [-IncludeSystemObjects] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaWaitingTask", "Description": "This command is based on waiting task T-SQL script published by Paul Randal.\nReference: https://www.sqlskills.com/blogs/paul/updated-sys-dm_os_waiting_tasks-script-2/", "Tags": [ "Waits", "Task", "WaitTask" ], "Synopsis": "Displays waiting task.", "Alias": "", "Author": "Shawn Melton (@wsmelton), https://wsmelton.github.io", "CommandName": "Get-DbaWaitingTask", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaWaitingTask", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaWaitingTask -SqlInstance sqlserver2014a\nReturns the waiting task for all sessions on sqlserver2014a\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaWaitingTask -SqlInstance sqlserver2014a -IncludeSystemSpid\nReturns the waiting task for all sessions (user and system) on sqlserver2014a", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version XXXX or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Spid", "Find the waiting task of one or more specific process ids", "", false, "true (ByPropertyName)", "", "" ], [ "IncludeSystemSpid", "If this switch is enabled, the output will include the system sessions.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaWaitingTask [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Spid] \u003cObject[]\u003e] [-IncludeSystemSpid] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaWaitResource", "Description": "Given a wait resource in the form of \u0027PAGE: 10:1:9180084\u0027 returns the database, data file and the system object which is being waited up.\n\nGiven a wait resource in the form of \u0027KEY: 7:35457594073541168 (de21f92a1572)\u0027, returns the database, object and index that is being waited on, With the -row switch the row data will also be returned.", "Tags": [ "Pages", "DBCC" ], "Synopsis": "Returns the resource being waited upon", "Alias": "", "Author": "Stuart Moore (@napalmgram), stuart-moore.com", "CommandName": "Get-DbaWaitResource", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaWaitResource", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaWaitResource -SqlInstance server1 -WaitResource \u0027PAGE: 10:1:9180084\u0027\nWill return an object containing; database name, data file name, schema name and the object which owns the resource\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaWaitResource -SqlInstance server2 -WaitResource \u0027KEY: 7:35457594073541168 (de21f92a1572)\u0027\nWill return an object containing; database name, schema name and index name which is being waited on.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaWaitResource -SqlInstance server2 -WaitResource \u0027KEY: 7:35457594073541168 (de21f92a1572)\u0027 -row\nWill return an object containing; database name, schema name and index name which is being waited on, and in addition the contents of the locked row at the time the command is run.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "WaitResource", "The wait resource value as supplied in sys.dm_exec_requests", "", true, "true (ByValue)", "", "" ], [ "Row", "If this switch provided also returns the value of the row being waited on with KEY wait resources", "", false, "false", "False", "" ], [ "EnableException", "Replaces user friendly yellow warnings with bloody red exceptions of doom!\r\nUse this if you want the function to throw terminating errors you want to catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaWaitResource [-SqlInstance] \u003cDbaInstanceParameter\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-WaitResource] \u003cString\u003e [-Row] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaWaitStatistic", "Description": "This command is based off of Paul Randal\u0027s post \"Wait statistics, or please tell me where it hurts\"\n\nReturns:\nWaitType\nCategory\nWaitSeconds\nResourceSeconds\nSignalSeconds\nWaitCount\nPercentage\nAverageWaitSeconds\nAverageResourceSeconds\nAverageSignalSeconds\nURL\n\nReference: https://www.sqlskills.com/blogs/paul/wait-statistics-or-please-tell-me-where-it-hurts/", "Tags": "WaitStatistic", "Synopsis": "Displays wait statistics", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaWaitStatistic", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaWaitStatistic", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaWaitStatistic -SqlInstance sql2008, sqlserver2012\nCheck wait statistics for servers sql2008 and sqlserver2012\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaWaitStatistic -SqlInstance sql2008 -Threshold 98 -IncludeIgnorable\nCheck wait statistics on server sql2008 for thresholds above 98% and include wait stats that are most often, but not always, ignorable\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaWaitStatistic -SqlInstance sql2008 | Select-Object *\nShows detailed notes, if available, from Paul\u0027s post\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$output = Get-DbaWaitStatistic -SqlInstance sql2008 -Threshold 100 -IncludeIgnorable | Select-Object * | ConvertTo-DbaDataTable\nCollects all Wait Statistics (including ignorable waits) on server sql2008 into a Data Table.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$output = Get-DbaWaitStatistic -SqlInstance sql2008\nPS C:\\\u003e foreach ($row in ($output | Sort-Object -Unique Url)) { Start-Process ($row).Url }\nDisplays the output then loads the associated sqlskills website for each result. Opens one tab per unique URL.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2005 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Threshold", "Threshold, in percentage of all waits on the system. Default per Paul\u0027s post is 95%.", "", false, "false", "95", "" ], [ "IncludeIgnorable", "Some waits are no big deal and can be safely ignored in most circumstances. If you\u0027ve got weird issues with mirroring or AGs.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaWaitStatistic [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Threshold] \u003cInt32\u003e] [-IncludeIgnorable] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaWindowsLog", "Description": "Gets Windows Application events associated with an instance", "Tags": "Logging", "Synopsis": "Gets Windows Application events associated with an instance", "Alias": "", "Author": "Drew Furgiuele | Friedrich Weinmann (@FredWeinmann)", "CommandName": "Get-DbaWindowsLog", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaWindowsLog", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$ErrorLogs = Get-DbaWindowsLog -SqlInstance sql01\\sharepoint\nPS C:\\\u003e $ErrorLogs | Where-Object ErrorNumber -eq 18456\nReturns all lines in the errorlogs that have event number 18456 in them\nThis exists to ignore the Script Analyzer rule for Start-Runspace", "Params": [ [ "SqlInstance", "The instance(s) to retrieve the event logs from", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Start", "Default: 1970\r\nRetrieve all events starting from this timestamp.", "", false, "false", "1/1/1970 00:00:00", "" ], [ "End", "Default: Now\r\nRetrieve all events that happened before this timestamp", "", false, "false", "(Get-Date)", "" ], [ "Credential", "Credential to be used to connect to the Server. Note this is a Windows credential, as this command requires we communicate with the computer and not with the SQL instance.", "", false, "false", "", "" ], [ "MaxThreads", "Default: Unlimited\r\nThe maximum number of parallel threads used on the local computer.\r\nGiven that those will mostly be waiting for the remote system, there is usually no need to limit this.", "", false, "false", "0", "" ], [ "MaxRemoteThreads", "Default: 2\r\nThe maximum number of parallel threads that are executed on the target sql server.\r\nThese processes will cause considerable CPU load, so a low limit is advisable in most scenarios.\r\nAny value lower than 1 disables the limit", "", false, "false", "2", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaWindowsLog [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-Start] \u003cDateTime\u003e] [[-End] \u003cDateTime\u003e] [[-Credential] \u003cPSCredential\u003e] [[-MaxThreads] \u003cInt32\u003e] [[-MaxRemoteThreads] \u003cInt32\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaWsfcAvailableDisk", "Description": "Gets information about the disks that can support Failover Clustering and are visible to all nodes, but are not yet part of the set of clustered disks.\n\nAll Windows Server Failover Clustering (Wsfc) commands require local admin on each member node.", "Tags": [ "WSFC", "FCI", "WindowsCluster", "HA" ], "Synopsis": "Gets information about the disks that can support Failover Clustering and are visible to all nodes, but are not yet part of the set of clustered disks.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaWsfcAvailableDisk", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaWsfcAvailableDisk", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaWsfcAvailableDisk -ComputerName cluster01\nGets available disks from the failover cluster cluster01", "Params": [ [ "ComputerName", "The target cluster name. Can be a node or the cluster name itself.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the cluster using alternative credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaWsfcAvailableDisk [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaWsfcCluster", "Description": "Gets information about one or more failover clusters in a given domain.\n\nAll Windows Server Failover Clustering (Wsfc) commands require local admin on each member node.", "Tags": [ "WSFC", "FCI", "WindowsCluster", "HA" ], "Synopsis": "Gets information about one or more failover clusters in a given domain.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaWsfcCluster", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaWsfcCluster", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaWsfcCluster -ComputerName cluster01\nGets failover cluster information about cluster01\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaWsfcCluster -ComputerName cluster01 | Select-Object *\nShows all cluster values, including the ones not shown in the default view", "Params": [ [ "ComputerName", "The target cluster name. Can be a node or the cluster name itself.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the cluster using alternative credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaWsfcCluster [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaWsfcDisk", "Description": "Gets information about the clustered disks on one or more failover clusters in a given domain.\n\nAll Windows Server Failover Clustering (Wsfc) commands require local admin on each member node.", "Tags": [ "WSFC", "FCI", "WindowsCluster", "HA" ], "Synopsis": "Gets information about the clustered disks on one or more failover clusters in a given domain.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaWsfcDisk", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaWsfcDisk", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaWsfcDisk -ComputerName cluster01\nGets disk information from the failover cluster cluster01", "Params": [ [ "ComputerName", "The target cluster name. Can be a node or the cluster name itself.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the cluster using alternative credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaWsfcDisk [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaWsfcNetwork", "Description": "Gets information about one or more networks in a failover cluster.\n\nAll Windows Server Failover Clustering (Wsfc) commands require local admin on each member node.", "Tags": [ "WSFC", "FCI", "WindowsCluster", "HA" ], "Synopsis": "Gets information about one or more networks in a failover cluster.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaWsfcNetwork", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaWsfcNetwork", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaWsfcNetwork -ComputerName cluster01\nGets network information from the failover cluster cluster01", "Params": [ [ "ComputerName", "The target cluster name. Can be a Network or the cluster name itself.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the cluster using alternative credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaWsfcNetwork [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaWsfcNetworkInterface", "Description": "Gets information about one or more network adapters in a failover cluster.\n\nAll Windows Server Failover Clustering (Wsfc) commands require local admin on each member node.", "Tags": [ "WSFC", "FCI", "WindowsCluster", "HA" ], "Synopsis": "Gets information about one or more network adapters in a failover cluster.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaWsfcNetworkInterface", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaWsfcNetworkInterface", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaWsfcNetworkInterface -ComputerName cluster01\nGets network interface information from the failover cluster cluster01\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaWsfcNetworkInterface -ComputerName cluster01 | Select-Object *\nShows all network interface values, including the ones not shown in the default view", "Params": [ [ "ComputerName", "The target cluster name. Can be a Network or the cluster name itself.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the cluster using alternative credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaWsfcNetworkInterface [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaWsfcNode", "Description": "Gets information about one or more nodes, or servers, in a failover cluster.\n\nAll Windows Server Failover Clustering (Wsfc) commands require local admin on each member node.", "Tags": [ "WSFC", "FCI", "WindowsCluster", "HA" ], "Synopsis": "Gets information about one or more nodes, or servers, in a failover cluster.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaWsfcNode", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaWsfcNode", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaWsfcNode -ComputerName cluster01\nGets node information from the failover cluster cluster01\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaWsfcNode -ComputerName cluster01 | Select-Object *\nShows all node values, including the ones not shown in the default view", "Params": [ [ "ComputerName", "The target cluster name. Can be a node or the cluster name itself.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the cluster using alternative credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaWsfcNode [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaWsfcResource", "Description": "Gets information about one or more resources in a failover cluster.\n\nAll Windows Server Failover Clustering (Wsfc) commands require local admin on each member node.", "Tags": [ "WSFC", "FCI", "WindowsCluster", "HA" ], "Synopsis": "Gets information about one or more resources in a failover cluster.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaWsfcResource", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaWsfcResource", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaWsfcResource -ComputerName cluster01\nGets resource information from the failover cluster cluster01\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaWsfcResource -ComputerName cluster01 | Select-Object *\nShows all resource values, including the ones not shown in the default view", "Params": [ [ "ComputerName", "The target cluster name. Can be a node or the cluster name itself.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the cluster using alternative credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaWsfcResource [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaWsfcResourceType", "Description": "Gets information about one or more resource types in a failover cluster.\n\nAll Windows Server Failover Clustering (Wsfc) commands require local admin on each member node.", "Tags": [ "WSFC", "FCI", "WindowsCluster", "HA" ], "Synopsis": "Gets information about one or more resource types in a failover cluster.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaWsfcResourceType", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaWsfcResourceType", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaWsfcResourceType -ComputerName cluster01\nGets resource type information from the failover cluster cluster01", "Params": [ [ "ComputerName", "The target cluster name. Can be a node or the cluster name itself.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the cluster using alternative credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaWsfcResourceType [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaWsfcRole", "Description": "Gets information about one or more clustered roles (resource groups) in a failover cluster.\n\nAll Windows Server Failover Clustering (Wsfc) commands require local admin on each member node.", "Tags": [ "WSFC", "FCI", "WindowsCluster", "HA" ], "Synopsis": "Gets information about one or more clustered roles (resource groups) in a failover cluster.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaWsfcRole", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaWsfcRole", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaWsfcRole -ComputerName cluster01\nGets role information from the failover cluster cluster01\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaWsfcRole -ComputerName cluster01 | Select-Object *\nShows all role values, including the ones not shown in the default view", "Params": [ [ "ComputerName", "The target cluster name. Can be a Role or the cluster name itself.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the cluster using alternative credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaWsfcRole [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaWsfcSharedVolume", "Description": "Gets information about Cluster Shared Volumes in a failover cluster.\n\nAll Windows Server Failover Clustering (Wsfc) commands require local admin on each member node.", "Tags": [ "WSFC", "FCI", "WindowsCluster", "HA" ], "Synopsis": "Gets information about Cluster Shared Volumes in a failover cluster.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaWsfcSharedVolume", "Availability": "Windows only", "Links": "https://dbatools.io/Get-DbaWsfcSharedVolume", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaWsfcSharedVolume -ComputerName cluster01\nGets shared volume (CSV) information from the failover cluster cluster01", "Params": [ [ "ComputerName", "The target cluster name. Can be a node or the cluster name itself.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the cluster using alternative credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaWsfcSharedVolume [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaXEObject", "Description": "This function returns a list of extended events objects exposed by event packages from specified SQL Server instance(s).", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Gets a list of extended events objects exposed by event packages from specified SQL Server instance(s).", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaXEObject", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaXEObject", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaXEObject -SqlInstance sql2016\nLists all the XE Objects on the sql2016 SQL Server.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaXEObject -SqlInstance sql2017 -Type Action, Event\nLists all the XE Objects of type Action and Event on the sql2017 SQL Server.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Type", "Used to specify the type. Valid types include:\nAction\r\nEvent\r\nMap\r\nMessage\r\nPredicateComparator\r\nPredicateSource\r\nTarget\r\nType", "", false, "false", "", "Type,Event,Target,Action,Map,Message,PredicateComparator,PredicateSource" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. This avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because \r\nit basically disables advanced scripting. Using this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaXEObject [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Type] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaXESession", "Description": "Retrieves a list of Extended Events Sessions present on the specified SQL Server instance(s).", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Gets a list of Extended Events Sessions from the specified SQL Server instance(s).", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDBAKlaas)", "CommandName": "Get-DbaXESession", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaXESession", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance ServerA\\sql987\nReturns a custom object with ComputerName, SQLInstance, Session, StartTime, Status and other properties.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance ServerA\\sql987 | Format-Table ComputerName, SqlInstance, Session, Status -AutoSize\nReturns a formatted table displaying ComputerName, SqlInstance, Session, and Status.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027ServerA\\sql987\u0027,\u0027ServerB\u0027 | Get-DbaXESession\nReturns a custom object with ComputerName, SqlInstance, Session, StartTime, Status and other properties, from multiple SQL instances.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Session", "Only return specific sessions. Options for this parameter are auto-populated from the server.", "Sessions", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaXESession [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Session] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaXESessionTarget", "Description": "Retrieves a list of Extended Events Session Targets from the specified SQL Server instance(s).", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Get a list of Extended Events Session Targets from the specified SQL Server instance(s).", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaXESessionTarget", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaXESessionTarget", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaXESessionTarget -SqlInstance ServerA\\sql987 -Session system_health\nShows targets for the system_health session on ServerA\\sql987.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance sql2016 -Session system_health | Get-DbaXESessionTarget\nReturns the targets for the system_health session on sql2016.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance sql2016 -Session system_health | Get-DbaXESessionTarget -Target package0.event_file\nReturn only the package0.event_file target for the system_health session on sql2016.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Session", "Only return a specific session. Options for this parameter are auto-populated from the server.", "", false, "false", "", "" ], [ "Target", "Only return a specific target.", "", false, "false", "", "" ], [ "InputObject", "Specifies an XE session returned by Get-DbaXESession to search.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaXESessionTarget [-SqlCredential \u003cPSCredential\u003e] [-Session \u003cString[]\u003e] [-Target \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]\nGet-DbaXESessionTarget -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Session \u003cString[]\u003e] [-Target \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]\nGet-DbaXESessionTarget [-SqlCredential \u003cPSCredential\u003e] [-Session \u003cString[]\u003e] [-Target \u003cString[]\u003e] -InputObject \u003cSession[]\u003e [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaXESessionTargetFile", "Description": "Get a file system object from the Extended Events Session Target Files.\n\nNote: this performs a Get-ChildItem on remote servers if the specified target SQL Server is remote.", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Get a file system object from the Extended Events Session Target Files.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaXESessionTargetFile", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaXESessionTargetFile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaXESessionTargetFile -SqlInstance sql2017 -Session \u0027Long Running Queries\u0027\nShows Target Files for the \u0027Long Running Queries\u0027 session on sql2017.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance sql2016 -Session \u0027Long Running Queries\u0027 | Get-DbaXESessionTarget | Get-DbaXESessionTargetFile\nReturns the Target Files for the system_health session on sql2016.", "Params": [ [ "SqlInstance", "The target SQL Server", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Session", "Only return files from a specific session. Options for this parameter are auto-populated from the server.", "", false, "false", "", "" ], [ "Target", "Only return files from a specific target.", "", false, "false", "", "" ], [ "InputObject", "Allows results from piping in Get-DbaXESessionTarget.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaXESessionTargetFile [-SqlCredential \u003cPSCredential\u003e] [-Session \u003cString[]\u003e] [-Target \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]\nGet-DbaXESessionTargetFile -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Session \u003cString[]\u003e] [-Target \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]\nGet-DbaXESessionTargetFile [-SqlCredential \u003cPSCredential\u003e] [-Session \u003cString[]\u003e] [-Target \u003cString[]\u003e] -InputObject \u003cTarget[]\u003e [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaXESessionTemplate", "Description": "Parses Extended Event XML templates. Defaults to parsing templates in the dbatools template repository (\\bin\\xetemplates\\).\n\nThe default repository contains templates from:\nMicrosoft\u0027s Templates that come with SSMS\nJes Borland\u0027s \"Everyday Extended Events\" presentation and GitHub repository (https://github.com/grrlgeek/extended-events)\nChristian Grafe (@ChrGraefe) XE Repo: https://github.com/chrgraefe/sqlscripts/blob/master/XE-Events/\nErin Stellato\u0027s Blog: https://www.sqlskills.com/blogs/erin/\n\nSome profile templates converted using:\nsp_SQLskills_ConvertTraceToExtendedEvents.sql\nJonathan M. Kehayias, SQLskills.com\nhttp://sqlskills.com/blogs/jonathan", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Parses Extended Event XML templates. Defaults to parsing templates in the dbatools template repository (\\bin\\xetemplates\\).", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaXESessionTemplate", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaXESessionTemplate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaXESessionTemplate\nReturns information about all the templates in the local dbatools repository.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaXESessionTemplate | Out-GridView -PassThru | Import-DbaXESessionTemplate -SqlInstance sql2017 | Start-DbaXESession\nAllows you to select a Session template, then import it to the specified instance and start the session.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaXESessionTemplate -Path \"$home\\Documents\\SQL Server Management Studio\\Templates\\XEventTemplates\"\nReturns information about all the templates in your local XEventTemplates repository.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaXESessionTemplate -Pattern duration\nReturns information about all the templates that match the word \"duration\" in the title, category or body.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaXESessionTemplate | Select-Object *\nReturns more information about the template, including the full path/filename.", "Params": [ [ "Path", "The path to the template directory. Defaults to the dbatools template repository (\\bin\\xetemplates\\).", "", false, "false", "\"$script:PSModuleRoot\\bin\\xetemplates\"", "" ], [ "Pattern", "Specify a pattern for filtering. Alternatively, you can use Out-GridView -Passthru to select objects and pipe them to Import-DbaXESessionTemplate", "", false, "false", "", "" ], [ "Template", "Specifies one or more of the templates provided by dbatools. Press tab to cycle through the list of options.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaXESessionTemplate [[-Path] \u003cString[]\u003e] [[-Pattern] \u003cString\u003e] [[-Template] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaXESmartTarget", "Description": "Gets an XESmartTarget PowerShell job created by Start-DbaXESmartTarget.", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Gets an XESmartTarget PowerShell job created by Start-DbaXESmartTarget.", "Alias": "", "Author": "Chrissy LeMaire (@cl) | SmartTarget by Gianluca Sartori (@spaghettidba)", "CommandName": "Get-DbaXESmartTarget", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaXESmartTarget", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaXESmartTarget\nGets an XESmartTarget PowerShell Job created by Start-DbaXESmartTarget.", "Params": [ [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaXESmartTarget [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Get-DbaXEStore", "Description": "Get a Extended Events store", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Get a Extended Events store", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Get-DbaXEStore", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Get-DbaXEStore", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaXEStore -SqlInstance ServerA\\sql987\nReturns an XEvent Store.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Get-DbaXEStore [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Grant-DbaAgPermission", "Description": "Grants endpoint and availability group permissions to a login. If the account is a Windows login and does not exist, it will be automatically added.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Grants endpoint and availability group permissions to a login.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Grant-DbaAgPermission", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Grant-DbaAgPermission", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGrant-DbaAgPermission -SqlInstance sql2017a -Type AvailabilityGroup -AvailabilityGroup SharePoint -Login ad\\spservice -Permission CreateAnyDatabase\nAdds CreateAnyDatabase permissions to ad\\spservice on the SharePoint availability group on sql2017a. Does not prompt for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGrant-DbaAgPermission -SqlInstance sql2017a -Type AvailabilityGroup -AvailabilityGroup ag1, ag2 -Login ad\\spservice -Permission CreateAnyDatabase -Confirm\nAdds CreateAnyDatabase permissions to ad\\spservice on the ag1 and ag2 availability groups on sql2017a. Prompts for confirmation.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2017a | Out-GridView -Passthru | Grant-DbaAgPermission -Type EndPoint\nGrants the selected logins Connect permissions on the DatabaseMirroring endpoint for sql2017a", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Login", "The login or logins to modify.", "", false, "false", "", "" ], [ "AvailabilityGroup", "Only modify specific availability groups.", "", false, "false", "", "" ], [ "Type", "Specify type: Endpoint or AvailabilityGroup. Endpoint will modify the DatabaseMirror endpoint type.", "", true, "false", "", "Endpoint,AvailabilityGroup" ], [ "Permission", "Grants one or more permissions:\r\n Alter\r\n Connect\r\n Control\r\n CreateSequence\r\n CreateAnyDatabase\r\n Delete\r\n Execute\r\n Impersonate\r\n Insert\r\n Receive\r\n References\r\n Select\r\n Send\r\n TakeOwnership\r\n Update\r\n ViewChangeTracking\r\n ViewDefinition\n CreateAnyDatabase\nConnect is default.", "", false, "false", "Connect", "Alter,Connect,Control,CreateAnyDatabase,CreateSequence,Delete,Execute,Impersonate,Insert,Receive,References,Select,Send,TakeOwnership,Update,ViewChangeTracking,ViewDefinition" ], [ "InputObject", "Enables piping from Get-DbaLogin.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Grant-DbaAgPermission [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Login] \u003cString[]\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [-Type] \u003cString[]\u003e [[-Permission] \u003cString[]\u003e] [[-InputObject] \u003cLogin[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Import-DbaCsv", "Description": "Import-DbaCsv takes advantage of .NET\u0027s super fast SqlBulkCopy class to import CSV files into SQL Server.\n\nThe entire import is performed within a transaction, so if a failure occurs or the script is aborted, no changes will persist.\n\nIf the table or view specified does not exist and -AutoCreateTable, it will be automatically created using slow and inefficient but accommodating data types.\n\nThis importer supports fields spanning multiple lines. The only restriction is that they must be quoted, otherwise it would not be possible to distinguish between malformed data and multi-line values.", "Tags": [ "Migration", "Import" ], "Synopsis": "Efficiently imports very large (and small) CSV files into SQL Server.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Import-DbaCsv", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Import-DbaCsv", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eImport-DbaCsv -Path C:\\temp\\housing.csv -SqlInstance sql001 -Database markets\nImports the entire comma-delimited housing.csv to the SQL \"markets\" database on a SQL Server named sql001, using the first row as column names.\nSince a table name was not specified, the table name is automatically determined from filename as \"housing\".\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eImport-DbaCsv -Path .\\housing.csv -SqlInstance sql001 -Database markets -Table housing -Delimiter \"`t\" -NoHeaderRow\nImports the entire tab-delimited housing.csv, including the first row which is not used for colum names, to the SQL markets database, into the housing table, on a SQL Server named sql001.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eImport-DbaCsv -Path C:\\temp\\huge.txt -SqlInstance sqlcluster -Database locations -Table latitudes -Delimiter \"|\"\nImports the entire pipe-delimited huge.txt to the locations database, into the latitudes table on a SQL Server named sqlcluster.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eImport-DbaCsv -Path c:\\temp\\SingleColumn.csv -SqlInstance sql001 -Database markets -Table TempTable -SingleColumn\nImports the single column CSV into TempTable\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-ChildItem -Path \\\\FileServer\\csvs | Import-DbaCsv -SqlInstance sql001, sql002 -Database tempdb -AutoCreateTable\nImports every CSV in the \\\\FileServer\\csvs path into both sql001 and sql002\u0027s tempdb database. Each CSV will be imported into an automatically determined table name.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-ChildItem -Path \\\\FileServer\\csvs | Import-DbaCsv -SqlInstance sql001, sql002 -Database tempdb -AutoCreateTable -WhatIf\nShows what would happen if the command were to be executed\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eImport-DbaCsv -Path c:\\temp\\dataset.csv -SqlInstance sql2016 -Database tempdb -Column Name, Address, Mobile\nImport only Name, Address and Mobile even if other columns exist. All other columns are ignored and therefore null or default values.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eImport-DbaCsv -Path C:\\temp\\schema.data.csv -SqlInstance sql2016 -database tempdb -UseFileNameForSchema\nWill import the contents of C:\\temp\\schema.data.csv to table \u0027data\u0027 in schema \u0027schema\u0027.\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eImport-DbaCsv -Path C:\\temp\\schema.data.csv -SqlInstance sql2016 -database tempdb -UseFileNameForSchema -Table testtable\nWill import the contents of C:\\temp\\schema.data.csv to table \u0027testtable\u0027 in schema \u0027schema\u0027.\n-------------------------- EXAMPLE 10 --------------------------\nPS C:\\\u003e$columns = @{\n\u003e\u003e Text = \u0027FirstName\u0027\r\n\u003e\u003e Number = \u0027PhoneNumber\u0027\r\n\u003e\u003e }\r\nPS C:\\\u003e Import-DbaCsv -Path c:\\temp\\supersmall.csv -SqlInstance sql2016 -Database tempdb -ColumnMap $columns\nThe CSV column \u0027Text\u0027 is inserted into SQL column \u0027FirstName\u0027 and CSV column Number is inserted into the SQL Column \u0027PhoneNumber\u0027. All other columns are ignored and therefore null or default values.", "Params": [ [ "Path", "Specifies path to the CSV file(s) to be imported. Multiple files may be imported at once.", "Csv,FullPath", false, "true (ByValue)", "", "" ], [ "SqlInstance", "The SQL Server Instance to import data into.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the name of the database the CSV will be imported into. Options for this this parameter are auto-populated from the server.", "", true, "false", "", "" ], [ "Table", "Specifies the SQL table or view where CSV will be imported into.\nIf a table name is not specified, the table name will be automatically determined from the filename.\nIf the table specified does not exist and -AutoCreateTable, it will be automatically created using slow and inefficient but accommodating data types.\nIf the automatically generated table datatypes do not work for you, please create the table prior to import.\nIf you want to import specific columns from a CSV, create a view with corresponding columns.", "", false, "false", "", "" ], [ "Schema", "Specifies the schema in which the SQL table or view where CSV will be imported into resides. Default is dbo.\nIf a schema does not currently exist, it will be created, after a prompt to confirm this. Authorization will be set to dbo by default.\nThis parameter overrides -UseFileNameForSchema.", "", false, "false", "", "" ], [ "Truncate", "If this switch is enabled, the destination table will be truncated prior to import.", "", false, "false", "False", "" ], [ "Delimiter", "Specifies the delimiter used in the imported file(s). If no delimiter is specified, comma is assumed.\nValid delimiters are \u0027`t`, \u0027|\u0027, \u0027;\u0027,\u0027 \u0027 and \u0027,\u0027 (tab, pipe, semicolon, space, and comma).", "", false, "false", ",", "" ], [ "SingleColumn", "Specifies that the file contains a single column of data. Otherwise, the delimiter check bombs.", "", false, "false", "False", "" ], [ "BatchSize", "Specifies the batch size for the import. Defaults to 50000.", "", false, "false", "50000", "" ], [ "NotifyAfter", "Specifies the import row count interval for reporting progress. A notification will be shown after each group of this many rows has been imported.", "", false, "false", "50000", "" ], [ "TableLock", "If this switch is enabled, the SqlBulkCopy option to acquire a table lock will be used.\nPer Microsoft \"Obtain a bulk update lock for the duration of the bulk copy operation. When not\r\nspecified, row locks are used.\"", "", false, "false", "False", "" ], [ "CheckConstraints", "If this switch is enabled, the SqlBulkCopy option to check constraints will be used.\nPer Microsoft \"Check constraints while data is being inserted. By default, constraints are not checked.\"", "", false, "false", "False", "" ], [ "FireTriggers", "If this switch is enabled, the SqlBulkCopy option to allow insert triggers to be executed will be used.\nPer Microsoft \"When specified, cause the server to fire the insert triggers for the rows being inserted into the database.\"", "", false, "false", "False", "" ], [ "KeepIdentity", "If this switch is enabled, the SqlBulkCopy option to keep identity values from the source will be used.\nPer Microsoft \"Preserve source identity values. When not specified, identity values are assigned by the destination.\"", "", false, "false", "False", "" ], [ "KeepNulls", "If this switch is enabled, the SqlBulkCopy option to keep NULL values in the table will be used.\nPer Microsoft \"Preserve null values in the destination table regardless of the settings for default values. When not specified, null values are replaced by default values where applicable.\"", "", false, "false", "False", "" ], [ "Column", "Import only specific columns. To remap column names, use the ColumnMap.", "", false, "false", "", "" ], [ "ColumnMap", "By default, the bulk copy tries to automap columns. When it doesn\u0027t work as desired, this parameter will help. Check out the examples for more information.", "", false, "false", "", "" ], [ "KeepOrdinalOrder", "By default, the importer will attempt to map exact-match columns names from the source document to the target table. Using this parameter will keep the ordinal order instead.", "", false, "false", "False", "" ], [ "AutoCreateTable", "Creates a table if it does not already exist. The table will be created with sub-optimal data types such as nvarchar(max)", "", false, "false", "False", "" ], [ "NoProgress", "The progress bar is pretty but can slow down imports. Use this parameter to quietly import.", "", false, "false", "False", "" ], [ "NoHeaderRow", "By default, the first row is used to determine column names for the data being imported.\nUse this switch if the first row contains data and not column names.", "", false, "false", "False", "" ], [ "UseFileNameForSchema", "If this switch is enabled, the script will try to find the schema name in the input file by looking for a period (.) in the file name.\nIf used with the -Table parameter you may still specify the target table name. If -Table is not used the file name after the first period will\r\nbe used for the table name.\nFor example test.data.csv will import the csv contents to a table in the test schema.\nIf it finds one it will use the file name up to the first period as the schema. If there is no period in the filename it will default to dbo.\nIf a schema does not currently exist, it will be created, after a prompt to confirm this. Authorization will be set to dbo by default.\nThis behaviour will be overridden if the -Schema parameter is specified.", "", false, "false", "False", "" ], [ "Quote", "Defines the default quote character wrapping every field.\r\nDefault: double-quotes", "", false, "false", "\"", "" ], [ "Escape", "Defines the default escape character letting insert quotation characters inside a quoted field.\nThe escape character can be the same as the quote character.\r\nDefault: double-quotes", "", false, "false", "\"", "" ], [ "Comment", "Defines the default comment character indicating that a line is commented out.\r\nDefault: hashtag", "", false, "false", "#", "" ], [ "TrimmingOption", "Determines which values should be trimmed. Default is \"None\". Options are All, None, UnquotedOnly and QuotedOnly.", "", false, "false", "None", "All,None,UnquotedOnly,QuotedOnly" ], [ "BufferSize", "Defines the default buffer size. The default BufferSize is 4096.", "", false, "false", "4096", "" ], [ "ParseErrorAction", "By default, the parse error action throws an exception and ends the import.\nYou can also choose AdvanceToNextLine which basically ignores parse errors.", "", false, "false", "ThrowException", "AdvanceToNextLine,ThrowException" ], [ "Encoding", "By default, set to UTF-8.\nThe encoding of the file.", "", false, "false", "UTF8", "ASCII,BigEndianUnicode,Byte,String,Unicode,UTF7,UTF8,Unknown" ], [ "NullValue", "The value which denotes a DbNull-value.", "", false, "false", "", "" ], [ "MaxQuotedFieldLength", "The maxmimum length (in bytes) for any quoted field.", "", false, "false", "0", "" ], [ "SkipEmptyLine", "Skip empty lines.", "", false, "false", "False", "" ], [ "SupportsMultiline", "Indicates if the importer should support multiline fields.", "", false, "false", "False", "" ], [ "UseColumnDefault", "Use the column default values if the field is not in the record.", "", false, "false", "False", "" ], [ "NoTransaction", "Do not use a transaction when performing the import.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Import-DbaCsv [[-Path] \u003cObject[]\u003e] [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Database] \u003cString\u003e [[-Table] \u003cString\u003e] [[-Schema] \u003cString\u003e] [-Truncate] [[-Delimiter] \u003cChar\u003e] [-SingleColumn] [[-BatchSize] \u003cInt32\u003e] [[-NotifyAfter] \u003cInt32\u003e] [-TableLock] [-CheckConstraints] [-FireTriggers] [-KeepIdentity] [-KeepNulls] [[-Column] \u003cString[]\u003e] [[-ColumnMap] \u003cHashtable\u003e] [-KeepOrdinalOrder] [-AutoCreateTable] [-NoProgress] [-NoHeaderRow] [-UseFileNameForSchema] [[-Quote] \u003cChar\u003e] [[-Escape] \u003cChar\u003e] [[-Comment] \u003cChar\u003e] [[-TrimmingOption] \u003cString\u003e] [[-BufferSize] \u003cInt32\u003e] \r\n[[-ParseErrorAction] \u003cString\u003e] [[-Encoding] \u003cString\u003e] [[-NullValue] \u003cString\u003e] [[-MaxQuotedFieldLength] \u003cInt32\u003e] [-SkipEmptyLine] [-SupportsMultiline] [-UseColumnDefault] [-NoTransaction] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Import-DbaPfDataCollectorSetTemplate", "Description": "Imports a new Performance Monitor Data Collector Set Template either from the dbatools repository or a file you specify.\nWhen importing data collector sets from the local instance, Run As Admin is required.\n\nNote: The included counters will be added for all SQL instances on the machine by default.\nFor specific instances in addition to the default, use -Instance.\n\nSee https://msdn.microsoft.com/en-us/library/windows/desktop/aa371952 for more information", "Tags": [ "Performance", "DataCollector", "PerfCounter" ], "Synopsis": "Imports a new Performance Monitor Data Collector Set Template either from the dbatools repository or a file you specify.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Import-DbaPfDataCollectorSetTemplate", "Availability": "Windows only", "Links": "https://dbatools.io/Import-DbaPfDataCollectorSetTemplate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eImport-DbaPfDataCollectorSetTemplate -ComputerName sql2017 -Template \u0027Long Running Query\u0027\nCreates a new data collector set named \u0027Long Running Query\u0027 from the dbatools repository on the SQL Server sql2017.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eImport-DbaPfDataCollectorSetTemplate -ComputerName sql2017 -Template \u0027Long Running Query\u0027 -DisplayName \u0027New Long running query\u0027 -Confirm\nCreates a new data collector set named \"New Long Running Query\" using the \u0027Long Running Query\u0027 template. Forces a confirmation if the template exists.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSet -ComputerName sql2017 -Session db_ola_health | Remove-DbaPfDataCollectorSet\nImport-DbaPfDataCollectorSetTemplate -ComputerName sql2017 -Template db_ola_health | Start-DbaPfDataCollectorSet\nImports a session if it exists, then recreates it using a template.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSetTemplate | Out-GridView -PassThru | Import-DbaPfDataCollectorSetTemplate -ComputerName sql2017\nAllows you to select a Session template then import to an instance named sql2017.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eImport-DbaPfDataCollectorSetTemplate -ComputerName sql2017 -Template \u0027Long Running Query\u0027 -Instance SHAREPOINT\nCreates a new data collector set named \u0027Long Running Query\u0027 from the dbatools repository on the SQL Server sql2017 for both the default and the SHAREPOINT instance.\nIf you\u0027d like to remove counters for the default instance, use Remove-DbaPfDataCollectorCounter.", "Params": [ [ "ComputerName", "The target computer. Defaults to localhost.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to servers using alternative credentials. To use:\n$scred = Get-Credential, then pass $scred object to the -Credential parameter.", "", false, "false", "", "" ], [ "DisplayName", "Sets the display name of the data collector set.", "", false, "false", "", "" ], [ "SchedulesEnabled", "If this switch is enabled, sets a value that indicates whether the schedules are enabled.", "", false, "false", "False", "" ], [ "RootPath", "Sets the base path where the subdirectories are created.", "", false, "false", "", "" ], [ "Segment", "Sets a value that indicates whether PLA creates new logs if the maximum size or segment duration is reached before the data collector set is stopped.", "", false, "false", "False", "" ], [ "SegmentMaxDuration", "Sets the duration that the data collector set can run before it begins writing to new log files.", "", false, "false", "0", "" ], [ "SegmentMaxSize", "Sets the maximum size of any log file in the data collector set.", "", false, "false", "0", "" ], [ "Subdirectory", "Sets a base subdirectory of the root path where the next instance of the data collector set will write its logs.", "", false, "false", "", "" ], [ "SubdirectoryFormat", "Sets flags that describe how to decorate the subdirectory name. PLA appends the decoration to the folder name. For example, if you specify plaMonthDayHour, PLA appends the current month, day, and \r\nhour values to the folder name. If the folder name is MyFile, the result could be MyFile110816.", "", false, "false", "3", "" ], [ "SubdirectoryFormatPattern", "Sets a format pattern to use when decorating the folder name. Default is \u0027yyyyMMdd\\-NNNNNN\u0027.", "", false, "false", "yyyyMMdd\\-NNNNNN", "" ], [ "Task", "Sets the name of a Task Scheduler job to start each time the data collector set stops, including between segments.", "", false, "false", "", "" ], [ "TaskRunAsSelf", "If this switch is enabled, sets a value that determines whether the task runs as the data collector set user or as the user specified in the task.", "", false, "false", "False", "" ], [ "TaskArguments", "Sets the command-line arguments to pass to the Task Scheduler job specified in the IDataCollectorSet::Task property.\r\nSee https://msdn.microsoft.com/en-us/library/windows/desktop/aa371992 for more information.", "", false, "false", "", "" ], [ "TaskUserTextArguments", "Sets the command-line arguments that are substituted for the {usertext} substitution variable in the IDataCollectorSet::TaskArguments property.\r\nSee https://msdn.microsoft.com/en-us/library/windows/desktop/aa371993 for more information.", "", false, "false", "", "" ], [ "StopOnCompletion", "If this switch is enabled, sets a value that determines whether the data collector set stops when all the data collectors in the set are in a completed state.", "", false, "false", "False", "" ], [ "Path", "The path to the xml file or files.", "FullName", false, "true (ByPropertyName)", "", "" ], [ "Template", "From one or more of the templates from the dbatools repository. Press Tab to cycle through the available options.", "", false, "false", "", "" ], [ "Instance", "By default, the template will be applied to all instances. If you want to set specific ones in addition to the default, supply just the instance name.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Import-DbaPfDataCollectorSetTemplate [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-DisplayName] \u003cString\u003e] [-SchedulesEnabled] [[-RootPath] \u003cString\u003e] [-Segment] [[-SegmentMaxDuration] \u003cInt32\u003e] [[-SegmentMaxSize] \u003cInt32\u003e] [[-Subdirectory] \u003cString\u003e] [[-SubdirectoryFormat] \u003cInt32\u003e] [[-SubdirectoryFormatPattern] \u003cString\u003e] [[-Task] \u003cString\u003e] [-TaskRunAsSelf] [[-TaskArguments] \u003cString\u003e] [[-TaskUserTextArguments] \u003cString\u003e] [-StopOnCompletion] [[-Path] \u003cString[]\u003e] [[-Template] \u003cString[]\u003e] [[-Instance] \u003cString[]\u003e] [-EnableException] [-WhatIf] [-Confirm] \r\n[\u003cCommonParameters\u003e]" }, { "Name": "Import-DbaRegServer", "Description": "Imports registered servers and registered server groups to SQL Server Central Management Server (CMS)", "Tags": [ "RegisteredServer", "CMS" ], "Synopsis": "Imports registered servers and registered server groups to SQL Server Central Management Server (CMS)", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Import-DbaRegServer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Import-DbaRegServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eImport-DbaRegServer -SqlInstance sql2012 -Path C:\\temp\\corp-regservers.xml\nImports C:\\temp\\corp-regservers.xml to the CMS on sql2012\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eImport-DbaRegServer -SqlInstance sql2008 -Group hr\\Seattle -Path C:\\temp\\Seattle.xml\nImports C:\\temp\\Seattle.xml to Seattle subgroup within the hr group on sql2008\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sql2008, sql2012 | Import-DbaRegServer -SqlInstance sql2017\nImports all registered servers from sql2008 and sql2012 to sql2017\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaRegServerGroup -SqlInstance sql2008 -Group hr\\Seattle | Import-DbaRegServer -SqlInstance sql2017 -Group Seattle\nImports all registered servers from the hr\\Seattle group on sql2008 to the Seattle group on sql2017", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Path", "Optional path to exported reg server XML", "FullName", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaRegServer, Get-DbaRegServerGroup, CSVs and other objects.\nIf importing from CSV or other object, a column named ServerName is required. Optional columns include Name, Description and Group.", "", false, "true (ByValue)", "", "" ], [ "Group", "Imports to specific group", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Import-DbaRegServer [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Path] \u003cString[]\u003e] [[-InputObject] \u003cObject[]\u003e] [[-Group] \u003cObject\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Import-DbaSpConfigure", "Description": "Updates sp_configure settings on destination server.", "Tags": [ "SpConfig", "Configure", "Configuration" ], "Synopsis": "Updates sp_configure settings on destination server.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Import-DbaSpConfigure", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Import-DbaSpConfigure", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eImport-DbaSpConfigure -Source sqlserver -Destination sqlcluster\nImports the sp_configure settings from the source server sqlserver and sets them on the sqlcluster server using Windows Authentication\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eImport-DbaSpConfigure -Source sqlserver -Destination sqlcluster -Force\nImports the sp_configure settings from the source server sqlserver and sets them on the sqlcluster server using Windows Authentication. Will not do a version check between Source and Destination\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eImport-DbaSpConfigure -Source sqlserver -Destination sqlcluster -SourceSqlCredential $SourceSqlCredential -DestinationSqlCredential $DestinationSqlCredential\nImports the sp_configure settings from the source server sqlserver and sets them on the sqlcluster server using the SQL credentials stored in the variables $SourceSqlCredential and \r\n$DestinationSqlCredential\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eImport-DbaSpConfigure -SqlInstance sqlserver -Path .\\spconfig.sql -SqlCredential $SqlCredential\nImports the sp_configure settings from the file .\\spconfig.sql and sets them on the sqlserver server using the SQL credential stored in the variable $SqlCredential", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", false, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "SqlInstance", "Specifies a SQL Server instance to set up sp_configure values on using a SQL file.", "", false, "false", "", "" ], [ "Path", "Specifies the path to a SQL script file holding sp_configure queries for each of the settings to be changed. Export-DbaSPConfigure creates a suitable file as its output.", "", false, "false", "", "" ], [ "SqlCredential", "Use this SQL credential if you are setting up sp_configure values from a SQL file.\nLogin to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, no version check between Source and Destination is performed. By default, the major and minor versions of Source and Destination must match when copying sp_configure \r\nsettings.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Import-DbaSpConfigure [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nImport-DbaSpConfigure [-Source \u003cDbaInstanceParameter\u003e] [-Destination \u003cDbaInstanceParameter\u003e] [-SourceSqlCredential \u003cPSCredential\u003e] [-DestinationSqlCredential \u003cPSCredential\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nImport-DbaSpConfigure [-SqlInstance \u003cDbaInstanceParameter\u003e] [-Path \u003cString\u003e] [-SqlCredential \u003cPSCredential\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Import-DbatoolsConfig", "Description": "Imports a json configuration file into the configuration system.", "Tags": "Module", "Synopsis": "Imports a json configuration file into the configuration system.", "Alias": "", "Author": "Friedrich Weinmann (@FredWeinmann)", "CommandName": "Import-DbatoolsConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Import-DbatoolsConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eImport-DbatoolsConfig -Path \u0027.\\config.json\u0027\nImports the configuration stored in \u0027.\\config.json\u0027\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eImport-DbatoolsConfig -ModuleName message\nImports all the module specific settings that have been persisted in any of the default file system paths.", "Params": [ [ "Path", "The path to the json file to import.", "", true, "true (ByValue)", "", "" ], [ "ModuleName", "Import configuration items specific to a module from the default configuration paths.", "", true, "false", "", "" ], [ "ModuleVersion", "The configuration version of the module-settings to load.", "", false, "false", "1", "" ], [ "Scope", "Where to import the module specific configuration items form.\r\nOnly file-based scopes are supported for this.\r\nBy default, all locations are queried, with user settings beating system settings.", "", false, "false", "FileUserLocal, FileUserShared, FileSystem", "" ], [ "IncludeFilter", "If specified, only elements with names that are similar (-like) to names in this list will be imported.", "", false, "false", "", "" ], [ "ExcludeFilter", "Elements that are similar (-like) to names in this list will not be imported.", "", false, "false", "", "" ], [ "Peek", "Rather than applying the setting, return the configuration items that would have been applied.", "", false, "false", "False", "" ], [ "EnableException", "This parameters disables user-friendly warnings and enables the throwing of exceptions.\r\nThis is less user friendly, but allows catching exceptions in calling scripts.", "", false, "false", "False", "" ] ], "Syntax": "Import-DbatoolsConfig -Path \u003cString[]\u003e [-IncludeFilter \u003cString[]\u003e] [-ExcludeFilter \u003cString[]\u003e] [-Peek] [-EnableException] [\u003cCommonParameters\u003e]\nImport-DbatoolsConfig -ModuleName \u003cString\u003e [-ModuleVersion \u003cInt32\u003e] [-Scope {UserDefault | UserMandatory | SystemDefault | SystemMandatory | FileUserLocal | FileUserShared | FileSystem}] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Import-DbaXESessionTemplate", "Description": "Imports a new XESession XML Template either from the dbatools repository or a file you specify.", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Imports a new XESession XML Template", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Import-DbaXESessionTemplate", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Import-DbaXESessionTemplate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eImport-DbaXESessionTemplate -SqlInstance sql2017 -Template \"15 Second IO Error\"\nCreates a new XESession named \"15 Second IO Error\" from the dbatools repository to the SQL Server sql2017.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eImport-DbaXESessionTemplate -SqlInstance sql2017 -Template \"Index Page Splits\" -StartUpState On\nCreates a new XESession named \"Index Page Splits\" from the dbatools repository to the SQL Server sql2017, starts the XESession and sets the StartUpState to On so that it starts on the next server \r\nrestart.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eImport-DbaXESessionTemplate -SqlInstance sql2017 -Template \"Query Wait Statistics\" -Name \"Query Wait Stats\" | Start-DbaXESession\nCreates a new XESession named \"Query Wait Stats\" using the Query Wait Statistics template, then immediately starts it.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance sql2017 -Session \u0027Database Health 2014\u0027 | Remove-DbaXESession\nPS C:\\\u003e Import-DbaXESessionTemplate -SqlInstance sql2017 -Template \u0027Database Health 2014\u0027 | Start-DbaXESession\nRemoves a session if it exists, then recreates it using a template.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaXESessionTemplate | Out-GridView -PassThru | Import-DbaXESessionTemplate -SqlInstance sql2017\nAllows you to select a Session template then import to an instance named sql2017.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "The Name of the session to create.", "", false, "false", "", "" ], [ "Path", "The path to the xml file or files for the session(s).", "FullName", false, "true (ByPropertyName)", "", "" ], [ "Template", "Specifies the name of one of the templates from the dbatools repository. Press tab to cycle through the provided templates.", "", false, "false", "", "" ], [ "TargetFilePath", "By default, files will be created in the default xel directory. Use TargetFilePath to change all instances of\r\nfilename = \"file.xel\" to filename = \"$TargetFilePath\\file.xel\". Only specify the directory, not the file itself.\nThis path is relative to the destination directory", "", false, "false", "", "" ], [ "TargetFileMetadataPath", "By default, files will be created in the default xem directory. Use TargetFileMetadataPath to change all instances of\r\nfilename = \"file.xem\" to filename = \"$TargetFilePath\\file.xem\". Only specify the directory, not the file itself.\nThis path is relative to the destination directory", "", false, "false", "", "" ], [ "StartUpState", "Specifies the start up state of the session. The default is Off.", "", false, "false", "Off", "On,Off" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Import-DbaXESessionTemplate [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString\u003e] [[-Path] \u003cString[]\u003e] [[-Template] \u003cString[]\u003e] [[-TargetFilePath] \u003cString\u003e] [[-TargetFileMetadataPath] \u003cString\u003e] [[-StartUpState] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Install-DbaDarlingData", "Description": "Downloads, extracts and installs Erik Darling\u0027s stored procedures\n\nDarlingData links:\nhttps://www.erikdarlingdata.com\nhttps://github.com/erikdarlingdata/DarlingData", "Tags": [ "Community", "Erik Darling", "DarlingData" ], "Synopsis": "Installs or updates Erik Darling\u0027s stored procedures.", "Alias": "", "Author": "Ant Green (@ant_green)", "CommandName": "Install-DbaDarlingData", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Install-DbaDarlingData", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInstall-DbaDarlingData -SqlInstance server1 -Database master\nLogs into server1 with Windows authentication and then installs all of Erik\u0027s scripts in the master database.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInstall-DbaDarlingData -SqlInstance server1\\instance1 -Database DBA\nLogs into server1\\instance1 with Windows authentication and then installs tall of Erik\u0027s scripts in the DBA database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInstall-DbaDarlingData -SqlInstance server1\\instance1 -Database master -SqlCredential $cred\nLogs into server1\\instance1 with SQL authentication and then installs all of Erik\u0027s scripts in the master database.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInstall-DbaDarlingData -SqlInstance sql2016\\standardrtm, sql2016\\sqlexpress, sql2014\nLogs into sql2016\\standardrtm, sql2016\\sqlexpress and sql2014 with Windows authentication and then installs al of Erik\u0027s scripts in the master database.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eInstall-DbaDarlingData -SqlInstance sql2016 -Branch dev\nInstalls the dev branch version of Erik\u0027s scripts in the master database on sql2016 instance.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eInstall-DbaDarlingData -SqlInstance server1\\instance1 -Database DBA -Procedure Human, Pressure\nLogs into server1\\instance1 with Windows authentication and then installs sp_HumanEvents and sp_PressureDetector of Erik\u0027s scripts in the DBA database.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database to install Erik\u0027s stored procedures into", "", false, "false", "master", "" ], [ "Branch", "Specifies an alternate branch of Erik\u0027s to install.\r\nAllowed values:\r\n master (default)\r\n dev", "", false, "false", "master", "master,dev" ], [ "Procedure", "Specifies the name(s) of the procedures to install\r\nAllowed Values or Combination of Values:\r\n All (default, to install all 3 procedures)\r\n Human (to install sp_HumanEvents)\r\n Pressure (to install sp_PressureDetector)\r\n Quickie (to install sp_QuickieStore)", "", false, "false", "All", "All,Human,Pressure,Quickie" ], [ "LocalFile", "Specifies the path to a local file to install from. This *should* be the zip file as distributed by the maintainers.\r\nIf this parameter is not specified, the latest version will be downloaded and installed from https://github.com/erikdarlingdata/DarlingData", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, the zip will be downloaded from the internet even if previously cached.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts to confirm actions", "cf", false, "false", "", "" ] ], "Syntax": "Install-DbaDarlingData [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject\u003e] [[-Branch] \u003cString\u003e] [[-Procedure] \u003cString[]\u003e] [[-LocalFile] \u003cString\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Install-DbaFirstResponderKit", "Description": "Downloads, extracts and installs the First Responder Kit stored procedures\n\nFirst Responder Kit links:\nhttp://FirstResponderKit.org\nhttps://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit", "Tags": [ "Community", "FirstResponderKit" ], "Synopsis": "Installs or updates the First Responder Kit stored procedures.", "Alias": "", "Author": "Tara Kizer, Brent Ozar Unlimited (https://www.brentozar.com/)", "CommandName": "Install-DbaFirstResponderKit", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Install-DbaFirstResponderKit", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInstall-DbaFirstResponderKit -SqlInstance server1 -Database master\nLogs into server1 with Windows authentication and then installs the FRK in the master database.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInstall-DbaFirstResponderKit -SqlInstance server1\\instance1 -Database DBA\nLogs into server1\\instance1 with Windows authentication and then installs the FRK in the DBA database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInstall-DbaFirstResponderKit -SqlInstance server1\\instance1 -Database master -SqlCredential $cred\nLogs into server1\\instance1 with SQL authentication and then installs the FRK in the master database.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInstall-DbaFirstResponderKit -SqlInstance sql2016\\standardrtm, sql2016\\sqlexpress, sql2014\nLogs into sql2016\\standardrtm, sql2016\\sqlexpress and sql2014 with Windows authentication and then installs the FRK in the master database.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$servers = \"sql2016\\standardrtm\", \"sql2016\\sqlexpress\", \"sql2014\"\nPS C:\\\u003e $servers | Install-DbaFirstResponderKit\nLogs into sql2016\\standardrtm, sql2016\\sqlexpress and sql2014 with Windows authentication and then installs the FRK in the master database.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eInstall-DbaFirstResponderKit -SqlInstance sql2016 -Branch dev\nInstalls the dev branch version of the FRK in the master database on sql2016 instance.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eInstall-DbaFirstResponderKit -SqlInstance sql2016 -OnlyScript sp_Blitz.sql, sp_BlitzWho.sql, SqlServerVersions.sql\nInstalls only the procedures sp_Blitz and sp_BlitzWho and the table SqlServerVersions by running the corresponding scripts.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eInstall-DbaFirstResponderKit -SqlInstance sql2016 -OnlyScript Install-Core-Blitz-No-Query-Store.sql\nInstalls only part of the First Responder Kit by running the official install script.\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eInstall-DbaFirstResponderKit -SqlInstance sql2016 -OnlyScript Uninstall.sql\nUninstalls the First Responder Kit by running the official uninstall script.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Branch", "Specifies an alternate branch of the First Responder Kit to install.\r\nAllowed values:\r\n main (default)\r\n dev", "", false, "false", "main", "main,dev" ], [ "Database", "Specifies the database to install the First Responder Kit stored procedures into", "", false, "false", "master", "" ], [ "LocalFile", "Specifies the path to a local file to install FRK from. This *should* be the zip file as distributed by the maintainers.\r\nIf this parameter is not specified, the latest version will be downloaded and installed from https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit", "", false, "false", "", "" ], [ "OnlyScript", "Specifies the name(s) of the script(s) to run for installation. Wildcards are permitted.\r\nThis way only part of the First Responder Kit can be installed.\r\nUsing one of the three official Install-* scripts (Install-All-Scripts.sql, Install-Core-Blitz-No-Query-Store.sql, Install-Core-Blitz-With-Query-Store.sql) is possible this way.\r\nEven removing the First Responder Kit is possible by using the official Uninstall.sql.", "", false, "false", "", "Install-All-Scripts.sql,Install-Core-Blitz-No-Query-Store.sql,Install-Core-Blitz-With-Query-Store.sql,sp_Blitz.sql,sp_BlitzFirst.sql,sp_BlitzIndex.sql,sp_BlitzCache.sql,sp_BlitzWho.sql,sp_BlitzQueryStore.sql,sp_BlitzAnalysis.sql,sp_BlitzBackups.sql,sp_BlitzInMemoryOLTP.sql,sp_BlitzLock.sql,sp_AllNightLog.sql,sp_AllNightLog_Setup.sql,sp_DatabaseRestore.sql,sp_ineachdb.sql,SqlServerVersions.sql,Uninstall.sql" ], [ "Force", "If this switch is enabled, the FRK will be downloaded from the internet even if previously cached.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts to confirm actions", "cf", false, "false", "", "" ] ], "Syntax": "Install-DbaFirstResponderKit [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Branch] \u003cString\u003e] [[-Database] \u003cObject\u003e] [[-LocalFile] \u003cString\u003e] [[-OnlyScript] \u003cString[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Install-DbaInstance", "Description": "This function will help you to quickly install a SQL Server instance on one or many computers.\nSome of the things this function will do for you:\n* Add your login as an admin to the new instance\n* Search for SQL Server installations in the specified file repository\n* Generate SA password if needed\n* Install specific features using \u0027Default\u0027 and \u0027All\u0027 templates or cherry-pick the ones you need\n* Set number of tempdb files based on number of cores (SQL2016+)\n* Activate .Net 3.5 feature for SQL2012/2014\n* Restart the machine if needed after the installation is done\n\nFully customizable installation parameters allow you to:\n* Use existing Configuration.ini files for the installation\n* Define service account credentials using native Powershell syntax\n* Override any configurations by using -Configuration switch\n* Change the TCP port after the installation is done\n* Enable \u0027Perform volume maintenance tasks\u0027 for the SQL Server account\n\nNote that the dowloaded installation media must be extracted and available to the server where the installation runs.\nNOTE: If no ProductID (PID) is found in the configuration files/parameters, Evaluation version is going to be installed.\n\nWhen using CredSSP authentication, this function will configure CredSSP authentication for PowerShell Remoting sessions.\nIf this is not desired (e.g.: CredSSP authentication is managed externally, or is already configured appropriately,)\nit can be disabled by setting the dbatools configuration option \u0027commands.initialize-credssp.bypass\u0027 value to $true.", "Tags": "Install", "Synopsis": "This function will help you to quickly install a SQL Server instance.", "Alias": "", "Author": "Reitse Eskens (@2meterDBA), Kirill Kravtsov (@nvarscar)", "CommandName": "Install-DbaInstance", "Availability": "Windows only", "Links": "https://dbatools.io/Install-DbaInstance", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInstall-DbaInstance -Version 2017 -Feature All\nInstall a default SQL Server instance and run the installation enabling all features with default settings. Automatically generates configuration.ini\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInstall-DbaInstance -SqlInstance sql2017\\sqlexpress, server01 -Version 2017 -Feature Default\nInstall a named SQL Server instance named sqlexpress on sql2017, and a default instance on server01. Automatically generates configuration.ini.\r\nDefault features will be installed.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInstall-DbaInstance -Version 2008R2 -SqlInstance sql2017 -ConfigurationFile C:\\temp\\configuration.ini\nInstall a default named SQL Server instance on the remote machine, sql2017 and use the local configuration.ini\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInstall-DbaInstance -Version 2017 -InstancePath G:\\SQLServer -UpdateSourcePath \u0027\\\\my\\updates\u0027\nRun the installation locally with default settings apart from the application volume, this will be redirected to G:\\SQLServer.\r\nThe installation procedure would search for SQL Server updates in \\\\my\\updates and slipstream them into the installation.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$svcAcc = Get-Credential MyDomain\\SvcSqlServer\nPS C:\\\u003e Install-DbaInstance -Version 2016 -InstancePath D:\\Root -DataPath E: -LogPath L: -PerformVolumeMaintenanceTasks -EngineCredential $svcAcc\nInstall SQL Server 2016 instance into D:\\Root drive, set default data folder as E: and default logs folder as L:.\r\nPerform volume maintenance tasks permission is granted. MyDomain\\SvcSqlServer is used as a service account for SqlServer.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$config = @{\n\u003e\u003e AGTSVCSTARTUPTYPE = \"Manual\"\r\n\u003e\u003e SQLCOLLATION = \"Latin1_General_CI_AS\"\r\n\u003e\u003e BROWSERSVCSTARTUPTYPE = \"Manual\"\r\n\u003e\u003e FILESTREAMLEVEL = 1\r\n\u003e\u003e }\r\nPS C:\\\u003e Install-DbaInstance -SqlInstance localhost\\v2017:1337 -Version 2017 -Configuration $config\nRun the installation locally with default settings overriding the value of specific configuration items.\r\nInstance name will be defined as \u0027v2017\u0027; TCP port will be changed to 1337 after installation.", "Params": [ [ "SqlInstance", "The target computer and, optionally, a new instance name and a port number.\r\nUse one of the following generic formats:\r\nServer1\r\nServer2\\Instance1\r\nServer1\\Alpha:1533, Server2\\Omega:1566\r\n\"ServerName\\NewInstanceName,1534\"\nYou can also define instance name and port using -InstanceName and -Port parameters.", "ComputerName", false, "false", "$env:COMPUTERNAME", "" ], [ "Version", "SQL Server version you wish to install.\r\nThis is the year version (e.g. \"2008R2\", \"2017\", \"2019\")", "", true, "false", "", "2008,2008R2,2012,2014,2016,2017,2019" ], [ "InstanceName", "Name of the SQL Server instance to install. Overrides the instance name specified in -SqlInstance.", "", false, "false", "", "" ], [ "SaCredential", "Securely provide the password for the sa account when using mixed mode authentication.", "", false, "false", "", "" ], [ "Credential", "Used when executing installs against remote servers", "", false, "false", "", "" ], [ "Authentication", "Chooses an authentication protocol for remote connections.\r\nAllowed values: \u0027Default\u0027, \u0027Basic\u0027, \u0027Negotiate\u0027, \u0027NegotiateWithImplicitCredential\u0027, \u0027Credssp\u0027, \u0027Digest\u0027, \u0027Kerberos\u0027\r\nIf the protocol fails to establish a connection\nDefaults:\r\n* CredSSP when -Credential is specified - due to the fact that repository Path is usually a network share and credentials need to be passed to the remote host\r\n to avoid the double-hop issue.\r\n* Default when -Credential is not specified. Will likely fail if a network path is specified.", "", false, "false", "Credssp", "Default,Basic,Negotiate,NegotiateWithImplicitCredential,Credssp,Digest,Kerberos" ], [ "ConfigurationFile", "The path to the custom Configuration.ini file.", "FilePath", false, "true (ByValue)", "", "" ], [ "Configuration", "A hashtable with custom configuration items that you want to use during the installation.\r\nOverrides all other parameters.\r\nFor example, to define a custom server collation you can use the following parameter:\r\nPS\u003e Install-DbaInstance -Version 2017 -Configuration @{ SQLCOLLATION = \u0027Latin1_General_BIN\u0027 }\nFull list of parameters can be found here: https://docs.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt#Install", "", false, "false", "", "" ], [ "Path", "Path to the folder(s) with SQL Server installation media downloaded. It will be scanned recursively for a corresponding setup.exe.\r\nPath should be available from the remote server.\r\nIf a setup.exe file is missing in the repository, the installation will fail.\r\nConsider setting the following configuration in your session if you want to omit this parameter: `Set-DbatoolsConfig -Name Path.SQLServerSetup -Value \u0027\\\\path\\to\\installations\u0027`", "", false, "false", "(Get-DbatoolsConfigValue -Name \u0027Path.SQLServerSetup\u0027)", "" ], [ "Feature", "Features to install. Templates like \"Default\" and \"All\" can be used to setup a predefined set of components. Full list of features:\nDefault\r\nAll\r\nEngine\r\nTools\r\nReplication\r\nFullText\r\nDataQuality\r\nPolyBase\r\nMachineLearning\r\nAnalysisServices\r\nReportingServices\r\nReportingForSharepoint\r\nSharepointAddin\r\nIntegrationServices\r\nMasterDataServices\r\nPythonPackages\r\nRPackages\r\nReplayController\r\nReplayClient\r\nSDK\r\nBIDS\r\nSSMS", "", false, "false", "Default", "Default,All,Engine,Tools,Replication,FullText,DataQuality,PolyBase,MachineLearning,AnalysisServices,ReportingServices,ReportingForSharepoint,SharepointAddin,IntegrationServices,MasterDataServices,PythonPackages,RPackages,ReplayController,ReplayClient,SDK,BIDS,SSMS" ], [ "AuthenticationMode", "Chooses authentication mode for SQL Server. Allowed values: Mixed, Windows.", "", false, "false", "Windows", "Windows,Mixed" ], [ "InstancePath", "Root folder for instance components. Includes SQL Server logs, system databases, etc.", "", false, "false", "", "" ], [ "DataPath", "Path to the Data folder.", "", false, "false", "", "" ], [ "LogPath", "Path to the Log folder.", "", false, "false", "", "" ], [ "TempPath", "Path to the TempDB folder.", "", false, "false", "", "" ], [ "BackupPath", "Path to the Backup folder.", "", false, "false", "", "" ], [ "UpdateSourcePath", "Path to the updates that you want to slipstream into the installation.", "", false, "false", "", "" ], [ "AdminAccount", "One or more members of the sysadmin group. Uses UserName from the -Credential parameter if specified, or current Windows user by default.", "", false, "false", "", "" ], [ "Port", "After successful installation, changes SQL Server TCP port to this value. Overrides the port specified in -SqlInstance.", "", false, "false", "0", "" ], [ "Throttle", "Maximum number of computers updated in parallel. Once reached, the update operations will queue up.\r\nDefault: 50", "", false, "false", "50", "" ], [ "ProductID", "Product ID, or simply, serial number of your SQL Server installation, which will determine which version to install.\r\nIf the PID is already built into the installation media, can be ignored.", "PID", false, "false", "", "" ], [ "EngineCredential", "Service account of the SQL Server Database Engine", "", false, "false", "", "" ], [ "AgentCredential", "Service account of the SQL Server Agent", "", false, "false", "", "" ], [ "ASCredential", "Service account of the Analysis Services", "", false, "false", "", "" ], [ "ISCredential", "Service account of the Integration Services", "", false, "false", "", "" ], [ "RSCredential", "Service account of the Reporting Services", "", false, "false", "", "" ], [ "FTCredential", "Service account of the Full-Text catalog service", "", false, "false", "", "" ], [ "PBEngineCredential", "Service account of the PolyBase service", "", false, "false", "", "" ], [ "SaveConfiguration", "Save installation configuration file in a custom location. Will not be preserved otherwise.", "", false, "false", "", "" ], [ "PerformVolumeMaintenanceTasks", "Allow SQL Server service account to perform Volume Maintenance tasks.", "", false, "false", "False", "" ], [ "Restart", "Restart computer automatically if a restart is required before or after the installation.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Install-DbaInstance [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [-Version] \u003cString\u003e [[-InstanceName] \u003cString\u003e] [[-SaCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [[-Authentication] \u003cString\u003e] [[-ConfigurationFile] \u003cObject\u003e] [[-Configuration] \u003cHashtable\u003e] [[-Path] \u003cString[]\u003e] [[-Feature] \u003cString[]\u003e] [[-AuthenticationMode] \u003cString\u003e] [[-InstancePath] \u003cString\u003e] [[-DataPath] \u003cString\u003e] [[-LogPath] \u003cString\u003e] [[-TempPath] \u003cString\u003e] [[-BackupPath] \u003cString\u003e] [[-UpdateSourcePath] \u003cString\u003e] [[-AdminAccount] \u003cString[]\u003e] [[-Port] \u003cInt32\u003e] [[-Throttle] \u003cInt32\u003e] [[-ProductID] \u003cString\u003e] \r\n[[-EngineCredential] \u003cPSCredential\u003e] [[-AgentCredential] \u003cPSCredential\u003e] [[-ASCredential] \u003cPSCredential\u003e] [[-ISCredential] \u003cPSCredential\u003e] [[-RSCredential] \u003cPSCredential\u003e] [[-FTCredential] \u003cPSCredential\u003e] [[-PBEngineCredential] \u003cPSCredential\u003e] [[-SaveConfiguration] \u003cString\u003e] [-PerformVolumeMaintenanceTasks] [-Restart] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Install-DbaMaintenanceSolution", "Description": "This script will download and install the latest version of SQL Server Maintenance Solution created by Ola Hallengren", "Tags": [ "Community", "OlaHallengren" ], "Synopsis": "Download and Install SQL Server Maintenance Solution created by Ola Hallengren (https://ola.hallengren.com)", "Alias": "", "Author": "Viorel Ciucu, cviorel.com", "CommandName": "Install-DbaMaintenanceSolution", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Install-DbaMaintenanceSolution", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInstall-DbaMaintenanceSolution -SqlInstance RES14224 -Database DBA -CleanupTime 72\nInstalls Ola Hallengren\u0027s Solution objects on RES14224 in the DBA database.\r\nBackups will default to the default Backup Directory.\r\nIf the Maintenance Solution already exists, the script will be halted.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInstall-DbaMaintenanceSolution -SqlInstance RES14224 -Database DBA -BackupLocation \"Z:\\SQLBackup\" -CleanupTime 72\nThis will create the Ola Hallengren\u0027s Solution objects. Existing objects are not affected in any way.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$params = @{\n\u003e\u003e SqlInstance = \u0027MyServer\u0027\r\n\u003e\u003e Database = \u0027maintenance\u0027\r\n\u003e\u003e ReplaceExisting = $true\r\n\u003e\u003e InstallJobs = $true\r\n\u003e\u003e LogToTable = $true\r\n\u003e\u003e BackupLocation = \u0027C:\\Data\\Backup\u0027\r\n\u003e\u003e CleanupTime = 65\r\n\u003e\u003e Verbose = $true\r\n\u003e\u003e }\r\n\u003e\u003e Install-DbaMaintenanceSolution @params\nInstalls Maintenance Solution to myserver in database. Adds Agent Jobs, and if any currently exist, they\u0027ll be replaced.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInstall-DbaMaintenanceSolution -SqlInstance RES14224 -Database DBA -BackupLocation \"Z:\\SQLBackup\" -CleanupTime 72 -ReplaceExisting\nThis will drop and then recreate the Ola Hallengren\u0027s Solution objects\r\nThe cleanup script will drop and recreate:\r\n- TABLE [dbo].[CommandLog]\r\n- STORED PROCEDURE [dbo].[CommandExecute]\r\n- STORED PROCEDURE [dbo].[DatabaseBackup]\r\n- STORED PROCEDURE [dbo].[DatabaseIntegrityCheck]\r\n- STORED PROCEDURE [dbo].[IndexOptimize]\nThe following SQL Agent jobs will be deleted:\r\n- \u0027Output File Cleanup\u0027\r\n- \u0027IndexOptimize - USER_DATABASES\u0027\r\n- \u0027sp_delete_backuphistory\u0027\r\n- \u0027DatabaseBackup - USER_DATABASES - LOG\u0027\r\n- \u0027DatabaseBackup - SYSTEM_DATABASES - FULL\u0027\r\n- \u0027DatabaseBackup - USER_DATABASES - FULL\u0027\r\n- \u0027sp_purge_jobhistory\u0027\r\n- \u0027DatabaseIntegrityCheck - SYSTEM_DATABASES\u0027\r\n- \u0027CommandLog Cleanup\u0027\r\n- \u0027DatabaseIntegrityCheck - USER_DATABASES\u0027\r\n- \u0027DatabaseBackup - USER_DATABASES - DIFF\u0027\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eInstall-DbaMaintenanceSolution -SqlInstance RES14224 -Database DBA -InstallParallel\nThis will create the Queue and QueueDatabase tables for uses when manually changing jobs to use the @DatabasesInParallel = \u0027Y\u0027 flag", "Params": [ [ "SqlInstance", "The target SQL Server instance onto which the Maintenance Solution will be installed.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database where Ola Hallengren\u0027s solution will be installed. Defaults to master.", "", false, "false", "master", "" ], [ "BackupLocation", "Location of the backup root directory. If this is not supplied, the default backup directory will be used.", "", false, "false", "", "" ], [ "CleanupTime", "Time in hours, after which backup files are deleted.", "", false, "false", "0", "" ], [ "OutputFileDirectory", "Specify the output file directory where the Maintenance Solution will write to.", "", false, "false", "", "" ], [ "ReplaceExisting", "If this switch is enabled, objects already present in the target database will be dropped and recreated.", "", false, "false", "False", "" ], [ "LogToTable", "If this switch is enabled, the Maintenance Solution will be configured to log commands to a table.", "", false, "false", "False", "" ], [ "Solution", "Specifies which portion of the Maintenance solution to install. Valid values are All (full solution), Backup, IntegrityCheck and IndexOptimize.", "", false, "false", "All", "All,Backup,IntegrityCheck,IndexOptimize" ], [ "InstallJobs", "If this switch is enabled, the corresponding SQL Agent Jobs will be created.", "", false, "false", "False", "" ], [ "LocalFile", "Specifies the path to a local file to install Ola\u0027s solution from. This *should* be the zip file as distributed by the maintainers.\r\nIf this parameter is not specified, the latest version will be downloaded and installed from https://github.com/olahallengren/sql-server-maintenance-solution", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, the Ola\u0027s solution will be downloaded from the internet even if previously cached.", "", false, "false", "False", "" ], [ "InstallParallel", "If this switch is enabled, the Queue and QueueDatabase tables are created, for use when @DatabasesInParallel = \u0027Y\u0027 are set in the jobs.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Install-DbaMaintenanceSolution [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject\u003e] [[-BackupLocation] \u003cString\u003e] [[-CleanupTime] \u003cInt32\u003e] [[-OutputFileDirectory] \u003cString\u003e] [-ReplaceExisting] [-LogToTable] [[-Solution] \u003cString[]\u003e] [-InstallJobs] [[-LocalFile] \u003cString\u003e] [-Force] [-InstallParallel] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Install-DbaMultiTool", "Description": "Downloads, extracts and installs the DBA MultiTool stored procedures.\n\nDBA MultiTool links:\nhttps://dba-multitool.org\nhttps://github.com/LowlyDBA/dba-multitool/", "Tags": [ "Community", "DbaMultiTool" ], "Synopsis": "Installs or updates the DBA MultiTool stored procedures.", "Alias": "", "Author": "John McCall (@lowlydba), https://lowlydba.com/", "CommandName": "Install-DbaMultiTool", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Install-DbaMultiTool", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInstall-DbaMultiTool -SqlInstance server1 -Database master\nLogs into server1 with Windows authentication and then installs the DBA MultiTool in the master database.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInstall-DbaMultiTool -SqlInstance server1\\instance1 -Database DBA\nLogs into server1\\instance1 with Windows authentication and then installs the DBA MultiTool in the DBA database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInstall-DbaMultiTool -SqlInstance server1\\instance1 -Database master -SqlCredential $cred\nLogs into server1\\instance1 with SQL authentication and then installs the DBA MultiTool in the master database.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInstall-DbaMultiTool -SqlInstance sql2016\\standardrtm, sql2016\\sqlexpress, sql2014\nLogs into sql2016\\standardrtm, sql2016\\sqlexpress and sql2014 with Windows authentication and then installs the DBA MultiTool in the master database.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$servers = \"sql2016\\standardrtm\", \"sql2016\\sqlexpress\", \"sql2014\"\nPS C:\\\u003e $servers | Install-DbaMultiTool\nLogs into sql2016\\standardrtm, sql2016\\sqlexpress and sql2014 with Windows authentication and then installs the DBA MultiTool in the master database.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eInstall-DbaMultiTool -SqlInstance sql2016 -Branch development\nInstalls the development branch version of the DBA MultiTool in the master database on sql2016 instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Branch", "Specifies an alternate branch of the DBA MultiTool to install.\r\nAllowed values:\r\n master (default)\r\n development", "", false, "false", "master", "master,development" ], [ "Database", "Specifies the database to install DBA MultiTool stored procedures into.", "", false, "false", "master", "" ], [ "LocalFile", "Specifies the path to a local file to install DBA MultiTool from. This *should* be the zip file as distributed by the maintainers.\r\nIf this parameter is not specified, the latest version will be downloaded and installed from https://github.com/LowlyDBA/dba-multitool/.", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, the DBA MultiTool will be downloaded from the internet even if previously cached.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts to confirm actions.", "cf", false, "false", "", "" ] ], "Syntax": "Install-DbaMultiTool [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Branch] \u003cString\u003e] [[-Database] \u003cObject\u003e] [[-LocalFile] \u003cString\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Install-DbaSqlWatch", "Description": "Downloads, extracts and installs or updates SqlWatch.\nhttps://sqlwatch.io/", "Tags": [ "Community", "SqlWatch" ], "Synopsis": "Installs or updates SqlWatch.", "Alias": "", "Author": "Ken K (github.com/koglerk)", "CommandName": "Install-DbaSqlWatch", "Availability": "Windows only", "Links": "https://dbatools.io/Install-DbaSqlWatch", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInstall-DbaSqlWatch -SqlInstance server1\nLogs into server1 with Windows authentication and then installs SqlWatch in the SQLWATCH database.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInstall-DbaSqlWatch -SqlInstance server1\\instance1 -Database DBA\nLogs into server1\\instance1 with Windows authentication and then installs SqlWatch in the DBA database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInstall-DbaSqlWatch -SqlInstance server1\\instance1 -Database DBA -SqlCredential $cred\nLogs into server1\\instance1 with SQL authentication and then installs SqlWatch in the DBA database.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInstall-DbaSqlWatch -SqlInstance sql2016\\standardrtm, sql2016\\sqlexpress, sql2014\nLogs into sql2016\\standardrtm, sql2016\\sqlexpress and sql2014 with Windows authentication and then installs SqlWatch in the SQLWATCH database.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$servers = \"sql2016\\standardrtm\", \"sql2016\\sqlexpress\", \"sql2014\"\n$servers | Install-DbaSqlWatch\nLogs into sql2016\\standardrtm, sql2016\\sqlexpress and sql2014 with Windows authentication and then installs SqlWatch in the SQLWATCH database.", "Params": [ [ "SqlInstance", "SQL Server name or SMO object representing the SQL Server to connect to.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database to install SqlWatch into. Defaults to SQLWATCH.", "", false, "false", "SQLWATCH", "" ], [ "LocalFile", "Specifies the path to a local file to install SqlWatch from. This *should* be the zipfile as distributed by the maintainers.\r\nIf this parameter is not specified, the latest version will be downloaded and installed from https://github.com/marcingminski/sqlwatch", "", false, "false", "", "" ], [ "PreRelease", "If specified, a pre-release (beta) will be downloaded rather than a stable release", "", false, "false", "False", "" ], [ "Force", "If this switch is enabled, SqlWatch will be downloaded from the internet even if previously cached.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts to confirm actions", "cf", false, "false", "", "" ] ], "Syntax": "Install-DbaSqlWatch [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString\u003e] [[-LocalFile] \u003cString\u003e] [-PreRelease] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Install-DbatoolsWatchUpdate", "Description": "Adds the scheduled task to support Watch-DbaUpdate.", "Tags": [ "Module", "Watcher" ], "Synopsis": "Adds the scheduled task to support Watch-DbaUpdate.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Install-DbatoolsWatchUpdate", "Availability": "Windows only", "Links": "https://dbatools.io/Install-DbatoolsWatchUpdate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInstall-DbatoolsWatchUpdate\nAdds the scheduled task needed by Watch-DbaUpdate\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInstall-DbatoolsWatchUpdate -TaskName MyScheduledTask\nWill create the scheduled task as the name MyScheduledTask", "Params": [ [ "TaskName", "Provide custom name for the Scheduled Task", "", false, "false", "dbatools version check", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Install-DbatoolsWatchUpdate [[-TaskName] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Install-DbaWhoIsActive", "Description": "This command downloads, extracts and installs sp_WhoisActive with Adam\u0027s permission. To read more about sp_WhoisActive, please visit http://whoisactive.com and http://sqlblog.com/blogs/adam_machanic/archive/tags/who+is+active/default.aspx\n\nPlease consider donating to Adam if you find this stored procedure helpful: http://tinyurl.com/WhoIsActiveDonate\n\nNote that you will be prompted a bunch of times to confirm an action.", "Tags": [ "Community", "WhoIsActive" ], "Synopsis": "Automatically installs or updates sp_WhoisActive by Adam Machanic.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Install-DbaWhoIsActive", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Install-DbaWhoIsActive", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInstall-DbaWhoIsActive -SqlInstance sqlserver2014a -Database master\nDownloads sp_WhoisActive from the internet and installs to sqlserver2014a\u0027s master database. Connects to SQL Server using Windows Authentication.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInstall-DbaWhoIsActive -SqlInstance sqlserver2014a -SqlCredential $cred\nPops up a dialog box asking which database on sqlserver2014a you want to install the procedure into. Connects to SQL Server using SQL Authentication.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInstall-DbaWhoIsActive -SqlInstance sqlserver2014a -Database master -LocalFile c:\\SQLAdmin\\whoisactive_install.sql\nInstalls sp_WhoisActive to sqlserver2014a\u0027s master database from the local file whoisactive_install.sql\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$instances = Get-DbaRegServer sqlserver\nPS C:\\\u003e Install-DbaWhoIsActive -SqlInstance $instances -Database master\nInstalls sp_WhoisActive to all servers within CMS", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2005 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "LocalFile", "Specifies the path to a local file to install sp_WhoisActive from. This can be either the zip file as distributed by the website or the expanded SQL script. If this parameter is not specified, the \r\nlatest version will be downloaded and installed from https://whoisactive.com/", "", false, "false", "", "" ], [ "Database", "The database to install sp_WhoisActive into. This parameter is mandatory when executing this command unattended.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "Force", "If this switch is enabled, the sp_WhoisActive will be downloaded from the internet even if previously cached.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Install-DbaWhoIsActive [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-LocalFile \u003cString\u003e] [-Database \u003cObject\u003e] [-EnableException] [-Force] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaAdvancedInstall", "Description": "Invokes an install process for a single computer and restarts it if needed", "Tags": [ "Instance", "Update" ], "Synopsis": "Designed for internal use, implements parallel execution for Install-DbaInstance.", "Alias": "", "CommandName": "Invoke-DbaAdvancedInstall", "Availability": "Windows only", "Links": "https://dbatools.io/Invoke-DbaAdvancedInstall", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaAdvancedUpdate -ComputerName SQL1 -Action $actions\nInvokes update actions on SQL1 after restarting it.", "Params": [ [ "ComputerName", "Target computer with SQL instance or instances.", "", false, "false", "", "" ], [ "InstanceName", "Instance name to be used for the installation", "", false, "false", "", "" ], [ "Port", "After successful installation, changes SQL Server TCP port to this value. Overrides the port specified in -SqlInstance.", "", false, "false", "", "" ], [ "InstallationPath", "Path to setup.exe", "", false, "false", "", "" ], [ "ConfigurationPath", "Path to Configuration.ini on a local machine", "", false, "false", "", "" ], [ "ArgumentList", "Array of command line arguments for setup.exe", "", false, "false", "", "" ], [ "Version", "Canonic version of SQL Server, e.g. 10.50, 11.0", "", false, "false", "", "" ], [ "Configuration", "A hashtable with custom configuration items that you want to use during the installation.\r\nOverrides all other parameters.\r\nFor example, to define a custom server collation you can use the following parameter:\r\nPS\u003e Install-DbaInstance -Version 2017 -Configuration @{ SQLCOLLATION = \u0027Latin1_General_BIN\u0027 }\nFull list of parameters can be found here: https://docs.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-command-prompt#Install", "", false, "false", "", "" ], [ "Restart", "Restart computer automatically after a successful installation of Sql Server and wait until it comes back online.\r\nUsing this parameter is the only way to chain-install more than 1 instance, since every single patch will require a restart of said computer.", "", false, "false", "False", "" ], [ "PerformVolumeMaintenanceTasks", "Allow SQL Server service account to perform Volume Maintenance tasks.", "", false, "false", "False", "" ], [ "SaveConfiguration", "Save installation configuration file in a custom location. Will not be preserved otherwise.", "", false, "false", "", "" ], [ "Authentication", "Chooses an authentication protocol for remote connections.\r\nIf the protocol fails to establish a connection\nDefaults:\r\n* CredSSP when -Credential is specified - due to the fact that repository Path is usually a network share and credentials need to be passed to the remote host\r\n to avoid the double-hop issue.\r\n* Default when -Credential is not specified. Will likely fail if a network path is specified.", "", false, "false", "Credssp", "Default,Basic,Negotiate,NegotiateWithImplicitCredential,Credssp,Digest,Kerberos" ], [ "Credential", "Windows Credential with permission to log on to the remote server.\r\nMust be specified for any remote connection if installation media is located on a network folder.", "", false, "false", "", "" ], [ "SaCredential", "Securely provide the password for the sa account when using mixed mode authentication.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Invoke-DbaAdvancedInstall [[-ComputerName] \u003cString\u003e] [[-InstanceName] \u003cString\u003e] [[-Port] \u003cNullable`1\u003e] [[-InstallationPath] \u003cString\u003e] [[-ConfigurationPath] \u003cString\u003e] [[-ArgumentList] \u003cString[]\u003e] [[-Version] \u003cVersion\u003e] [[-Configuration] \u003cHashtable\u003e] [[-Restart] \u003cBoolean\u003e] [[-PerformVolumeMaintenanceTasks] \u003cBoolean\u003e] [[-SaveConfiguration] \u003cString\u003e] [[-Authentication] \u003cString\u003e] [[-Credential] \u003cPSCredential\u003e] [[-SaCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaAdvancedRestore", "Description": "This is the final piece in the Restore-DbaDatabase Stack. Usually a BackupHistory object will arrive here from `Restore-DbaDatabase` via the following pipeline:\n`Get-DbaBackupInformation | Select-DbaBackupInformation | Format-DbaBackupInformation | Test-DbaBackupInformation | Invoke-DbaAdvancedRestore`\n\nWe have exposed these functions publicly to allow advanced users to perform operations that we don\u0027t support, or won\u0027t add as they would make things too complex for the majority of our users\n\nFor example if you wanted to do some very complex redirection during a migration, then doing the rewrite of destinations may be better done with your own custom scripts rather than via `Format-DbaBackupInformation`\n\nWe would recommend ALWAYS pushing your input through `Test-DbaBackupInformation` just to make sure that it makes sense to us.", "Tags": [ "Restore", "Backup" ], "Synopsis": "Allows the restore of modified BackupHistory Objects\nFor 90% of users Restore-DbaDatabase should be your point of access to this function. The other 10% use it at their own risk", "Alias": "", "Author": "Stuart Moore (@napalmgram - http://stuart-moore.com)", "CommandName": "Invoke-DbaAdvancedRestore", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaAdvancedRestore", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$BackupHistory | Invoke-DbaAdvancedRestore -SqlInstance MyInstance\nWill restore all the backups in the BackupHistory object according to the transformations it contains\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$BackupHistory | Invoke-DbaAdvancedRestore -SqlInstance MyInstance -OutputScriptOnly\nPS C:\\\u003e $BackupHistory | Invoke-DbaAdvancedRestore -SqlInstance MyInstance\nFirst generates just the T-SQL restore scripts so they can be sanity checked, and then if they are good perform the full restore.\r\nBy reusing the BackupHistory object there is no need to rescan all the backup files again", "Params": [ [ "BackupHistory", "The BackupHistory object to be restored.\r\nCan be passed in on the pipeline", "", true, "true (ByValue)", "", "" ], [ "SqlInstance", "The SqlInstance to which the backups should be restored", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "OutputScriptOnly", "If set, the restore will not be performed, but the T-SQL scripts to perform it will be returned", "", false, "false", "False", "" ], [ "VerifyOnly", "If set, performs a Verify of the backups rather than a full restore", "", false, "false", "False", "" ], [ "RestoreTime", "Point in Time to which the database should be restored.\nThis should be the same value or earlier, as used in the previous pipeline stages", "", false, "false", "(Get-Date).AddDays(2)", "" ], [ "StandbyDirectory", "A folder path where a standby file should be created to put the recovered databases in a standby mode", "", false, "false", "", "" ], [ "NoRecovery", "Leave the database in a restoring state so that further restore may be made", "", false, "false", "False", "" ], [ "MaxTransferSize", "Parameter to set the unit of transfer. Values must be a multiple by 64kb", "", false, "false", "0", "" ], [ "BlockSize", "Specifies the block size to use. Must be one of 0.5kb,1kb,2kb,4kb,8kb,16kb,32kb or 64kb\r\nCan be specified in bytes\r\nRefer to https://msdn.microsoft.com/en-us/library/ms178615.aspx for more detail", "", false, "false", "0", "" ], [ "BufferCount", "Number of I/O buffers to use to perform the operation.\r\nRefer to https://msdn.microsoft.com/en-us/library/ms178615.aspx for more detail", "", false, "false", "0", "" ], [ "Continue", "Indicates that the restore is continuing a restore, so target database must be in Recovering or Standby states\r\nWhen specified, WithReplace will be set to true", "", false, "false", "False", "" ], [ "AzureCredential", "AzureCredential required to connect to blob storage holding the backups", "", false, "false", "", "" ], [ "WithReplace", "Indicated that if the database already exists it should be replaced", "", false, "false", "False", "" ], [ "KeepReplication", "Indicates whether replication configuration should be restored as part of the database restore operation", "", false, "false", "False", "" ], [ "KeepCDC", "Indicates whether CDC information should be restored as part of the database", "", false, "false", "False", "" ], [ "PageRestore", "The output from Get-DbaSuspect page containing the suspect pages to be restored.", "", false, "false", "", "" ], [ "ExecuteAs", "If set, this will cause the database(s) to be restored (and therefore owned) as the SA user", "", false, "false", "", "" ], [ "StopBefore", "Switch to indicate the restore should stop before StopMark", "", false, "false", "False", "" ], [ "StopMark", "Mark in the transaction log to stop the restore at", "", false, "false", "", "" ], [ "StopAfterDate", "By default the restore will stop at the first occurence of StopMark found in the chain, passing a datetime where will cause it to stop the first StopMark atfer that datetime", "", false, "false", "", "" ], [ "EnableException", "Replaces user friendly yellow warnings with bloody red exceptions of doom!\r\nUse this if you want the function to throw terminating errors you want to catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the cmdlet runs. The cmdlet is not run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the cmdlet.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaAdvancedRestore [-BackupHistory] \u003cObject[]\u003e [[-SqlInstance] \u003cDbaInstanceParameter\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [-OutputScriptOnly] [-VerifyOnly] [[-RestoreTime] \u003cDateTime\u003e] [[-StandbyDirectory] \u003cString\u003e] [-NoRecovery] [[-MaxTransferSize] \u003cInt32\u003e] [[-BlockSize] \u003cInt32\u003e] [[-BufferCount] \u003cInt32\u003e] [-Continue] [[-AzureCredential] \u003cString\u003e] [-WithReplace] [-KeepReplication] [-KeepCDC] [[-PageRestore] \u003cObject[]\u003e] [[-ExecuteAs] \u003cString\u003e] [-StopBefore] [[-StopMark] \u003cString\u003e] [[-StopAfterDate] \u003cDateTime\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaAdvancedUpdate", "Description": "Invokes an update process for a single computer and restarts it if needed", "Tags": [ "Instance", "Update" ], "Synopsis": "Designed for internal use, implements parallel execution for Update-DbaInstance.", "Alias": "", "CommandName": "Invoke-DbaAdvancedUpdate", "Availability": "Windows only", "Links": "https://dbatools.io/Invoke-DbaAdvancedUpdate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaAdvancedUpdate -ComputerName SQL1 -Action $actions\nInvokes update actions on SQL1 after restarting it.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaAdvancedUpdate -ComputerName SQL1 -Action $actions -ExtractPath C:\\temp\nExtracts required files to the specific location \"C:\\temp\". Invokes update actions on SQL1 after restarting it.", "Params": [ [ "ComputerName", "Target computer with SQL instance or instances.", "", false, "false", "", "" ], [ "Action", "An object containing the action plan", "", false, "false", "", "" ], [ "Restart", "Restart computer automatically after a successful installation of a patch and wait until it comes back online.\r\nUsing this parameter is the only way to chain-install more than 1 patch on a computer, since every single patch will require a restart of said computer.", "", false, "false", "False", "" ], [ "Authentication", "Chooses an authentication protocol for remote connections.\r\nIf the protocol fails to establish a connection\nDefaults:\r\n* CredSSP when -Credential is specified - due to the fact that repository Path is usually a network share and credentials need to be passed to the remote host\r\n to avoid the double-hop issue.\r\n* Default when -Credential is not specified. Will likely fail if a network path is specified.", "", false, "false", "Credssp", "Default,Basic,Negotiate,NegotiateWithImplicitCredential,Credssp,Digest,Kerberos" ], [ "Credential", "Windows Credential with permission to log on to the remote server.\r\nMust be specified for any remote connection if update Repository is located on a network folder.", "", false, "false", "", "" ], [ "ExtractPath", "Lets you specify a location to extract the update file to on the system requiring the update. e.g. C:\\temp", "", false, "false", "", "" ], [ "ArgumentList", "A list of extra arguments to pass to the execution file. Accepts one or more strings containing command line parameters.\r\nExample: ... -ArgumentList \"/SkipRules=RebootRequiredCheck\", \"/Q\"", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaAdvancedUpdate [[-ComputerName] \u003cString\u003e] [[-Action] \u003cObject[]\u003e] [[-Restart] \u003cBoolean\u003e] [[-Authentication] \u003cString\u003e] [[-Credential] \u003cPSCredential\u003e] [[-ExtractPath] \u003cString\u003e] [[-ArgumentList] \u003cString[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaAgFailover", "Description": "Failover an availability group.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Failover an availability group.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Invoke-DbaAgFailover", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaAgFailover", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaAgFailover -SqlInstance sql2017 -AvailabilityGroup SharePoint\nSafely (no potential data loss) fails over the SharePoint AG to sql2017. Prompts for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sql2017 | Out-GridView -Passthru | Invoke-DbaAgFailover -Confirm:$false\nSafely (no potential data loss) fails over the selected availability groups to sql2017. Does not prompt for confirmation.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInvoke-DbaAgFailover -SqlInstance sql2017 -AvailabilityGroup SharePoint -Force\nForcefully (with potential data loss) fails over the SharePoint AG to sql2017. Prompts for confirmation.", "Params": [ [ "SqlInstance", "The SQL Server instance. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance..", "", false, "false", "", "" ], [ "AvailabilityGroup", "Only failover specific availability groups.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaAvailabilityGroup", "", false, "true (ByValue)", "", "" ], [ "Force", "Force Failover and allow data loss", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaAgFailover [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [[-InputObject] \u003cAvailabilityGroup[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaBalanceDataFiles", "Description": "When you have a large database with a single data file and add another file, SQL Server will only use the new file until it\u0027s about the same size.\nYou may want to balance the data between all the data files.\n\nThe function will check the server version and edition to see if the it allows for online index rebuilds.\nIf the server does support it, it will try to rebuild the index online.\nIf the server doesn\u0027t support it, it will rebuild the index offline. Be carefull though, this can cause downtime\n\nThe tables must have a clustered index to be able to balance out the data.\nThe function does NOT yet support heaps.\n\nThe function will also check if the file groups are subject to balance out.\nA file group whould have at least have 2 data files and should be writable.\nIf a table is within such a file group it will be subject for processing. If not the table will be skipped.", "Tags": [ "Database", "FileManagement", "File", "Space" ], "Synopsis": "Re-balance data between data files", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Invoke-DbaBalanceDataFiles", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaBalanceDataFiles", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaBalanceDataFiles -SqlInstance sql1 -Database db1\nThis command will distribute the data in database db1 on instance sql1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaBalanceDataFiles -SqlInstance sql1 -Database db1 | Select-Object -ExpandProperty DataFilesEnd\nThis command will distribute the data in database db1 on instance sql1\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInvoke-DbaBalanceDataFiles -SqlInstance sql1 -Database db1 -Table table1,table2,table5\nThis command will distribute the data for only the tables table1,table2 and table5\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInvoke-DbaBalanceDataFiles -SqlInstance sql1 -Database db1 -RebuildOffline\nThis command will consider the fact that there might be a SQL Server edition that does not support online rebuilds of indexes.\r\nBy supplying this parameter you give permission to do the rebuilds offline if the edition does not support it.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process.", "", false, "false", "", "" ], [ "Table", "The tables(s) of the database to process. If unspecified, all tables will be processed.", "Tables", false, "false", "", "" ], [ "RebuildOffline", "Will set all the indexes to rebuild offline.\r\nThis option is also needed when the server version is below 2005.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "Force", "This will disable the check for enough disk space for the action to be successful.\r\nUse this with caution!!", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run", "wi", false, "false", "", "" ], [ "Confirm", "Prompts for confirmation of every step. For example:\nThe server does not support online rebuilds of indexes.\r\nDo you want to rebuild the indexes offline?\r\n[Y] Yes [N] No [?] Help (default is \"Y\"):", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaBalanceDataFiles [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-Table \u003cObject[]\u003e] [-RebuildOffline] [-EnableException] [-Force] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nInvoke-DbaBalanceDataFiles -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-Table \u003cObject[]\u003e] [-RebuildOffline] [-EnableException] [-Force] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaCycleErrorLog", "Description": "Cycles the current error log for the instance (SQL Server) and/or SQL Server Agent.", "Tags": [ "Log", "Cycle" ], "Synopsis": "Cycles the current instance or agent log.", "Alias": "", "Author": "Shawn Melton (@wsmelton), https://wsmelton.github.io", "CommandName": "Invoke-DbaCycleErrorLog", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaCycleErrorLog", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaCycleLog -SqlInstance sql2016 -Type agent\nCycles the current error log for the SQL Server Agent on SQL Server instance sql2016\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaCycleLog -SqlInstance sql2016 -Type instance\nCycles the current error log for the SQL Server instance on SQL Server instance sql2016\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInvoke-DbaCycleLog -SqlInstance sql2016\nCycles the current error log for both SQL Server instance and SQL Server Agent on SQL Server instance sql2016", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Type", "The log to cycle.\r\nAccepts: instance or agent.", "", false, "false", "", "instance,agent" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaCycleErrorLog [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Type] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbccDropCleanBuffer", "Description": "Allows execution of Database Console Command DBCC DROPCLEANBUFFERS\n\nRemoves all clean buffers from the buffer pool, and columnstore objects from the columnstore object pool.\n\nRead more:\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-dropcleanbuffers-transact-sql", "Tags": "DBCC", "Synopsis": "Execution of Database Console Command DBCC DROPCLEANBUFFERS", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Invoke-DbaDbccDropCleanBuffer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbccDropCleanBuffer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbccDropCleanBuffer -SqlInstance SqlServer2017\nRuns the command DBCC DROPCLEANBUFFERS against the instance SqlServer2017 using Windows Authentication\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaDbccDropCleanBuffer -SqlInstance SqlServer2017 -NoInformationalMessages\nRuns the command DBCC DROPCLEANBUFFERS WITH NO_INFOMSGS against the instance SqlServer2017 using Windows Authentication\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Invoke-DbaDbccDropCleanBuffer -WhatIf\nDisplays what will happen if command DBCC DROPCLEANBUFFERS is called against Sql1 and Sql2/sqlexpress\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Invoke-DbaDbccDropCleanBuffer -SqlInstance Server1 -SqlCredential $cred\nConnects using sqladmin credential and executes command DBCC DROPCLEANBUFFERS for instance Server1", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "NoInformationalMessages", "Suppresses all informational messages.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the cmdlet runs. The cmdlet is not run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the cmdlet.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbccDropCleanBuffer [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-NoInformationalMessages] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbccFreeCache", "Description": "Allows execution of Database Console Commands that act at Server Level to clear Memory caches\n\nAllows execution of the following commands\n DBCC FREEPROCCACHE\n DBCC FREESESSIONCACHE\n DBCC FREESYSTEMCACHE\n\nRead more:\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-freeproccache-transact-sql\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-freesessioncache-transact-sql\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-freesystemcache-transact-sql", "Tags": "DBCC", "Synopsis": "Execution of Database Console Commands that clear Server level Memory caches", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Invoke-DbaDbccFreeCache", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbccFreeCache", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbccFreeCache -SqlInstance SqlServer2017 -Operation FREEPROCCACHE\nRuns the command DBCC FREEPROCCACHE against the instance SqlServer2017 using Windows Authentication\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaDbccFreeCache -SqlInstance SqlServer2017 -Operation FREESESSIONCACHE -NoInformationalMessages\nRuns the command DBCC FREESESSIONCACHE WITH NO_INFOMSGS against the instance SqlServer2017 using Windows Authentication\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInvoke-DbaDbccFreeCache -SqlInstance SqlServer2017 -Operation FREESYSTEMCACHE -NoInformationalMessages\nRuns the command DBCC FREESYSTEMCACHE WITH NO_INFOMSGS against the instance SqlServer2017 using Windows Authentication\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInvoke-DbaDbccFreeCache -SqlInstance SqlServer2017 -Operation FREEPROCCACHE -InputValue 0x060006001ECA270EC0215D05000000000000000000000000\nRemove a specific plan with plan_handle 0x060006001ECA270EC0215D05000000000000000000000000 from the cache via the command DBCC FREEPROCCACHE(0x060006001ECA270EC0215D05000000000000000000000000) \r\nagainst the instance SqlServer2017 using Windows Authentication\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eInvoke-DbaDbccFreeCache -SqlInstance SqlServer2017 -Operation FREEPROCCACHE -InputValue default\nRuns the command DBCC FREEPROCCACHE(\u0027default\u0027) against the instance SqlServer2017 using Windows Authentication. This clears all cache entries associated with a resource pool \u0027default\u0027.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eInvoke-DbaDbccFreeCache -SqlInstance SqlServer2017 -Operation FREESYSTEMCACHE -InputValue default\nRuns the command DBCC FREESYSTEMCACHE (\u0027ALL\u0027, default) against the instance SqlServer2017 using Windows Authentication. This will clean all the caches with entries specific to the resource pool named \r\n\"default\".\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eInvoke-DbaDbccFreeCache -SqlInstance SqlServer2017 -Operation FREESYSTEMCACHE -InputValue default -MarkInUseForRemoval\nRuns the command DBCC FREESYSTEMCACHE (\u0027ALL\u0027, default) WITH MARK_IN_USE_FOR_REMOVAL against the instance SqlServer2017 using Windows Authentication. This will to release entries once the entries \r\nbecome unused for all the caches with entries specific to the resource pool named \"default\".", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Operation", "DBCC Operation to Perform - Supports specific set of operations", "", false, "false", "FreeProcCache", "FreeProcCache,FreeSessionCache,FreeSystemCache" ], [ "InputValue", "Value used for Operation - meaning depends on Operation\r\nDBCC FREEPROCCACHE accepts\r\n a plan_handle of type varbinary(64)\r\n a sql_handle of type varbinary(64)\r\n or the name of a Resource Governor resource pool of type sysname\r\n If blank then clears all elements from the plan cache\r\nDBCC FREESYSTEMCACHE accepts\r\n \u0027ALL\u0027 for ALL specifies all supported caches\r\n or name of a Resource Governor pool cache\r\nNot required for other values", "", false, "false", "", "" ], [ "NoInformationalMessages", "Suppresses all informational messages.", "", false, "false", "False", "" ], [ "MarkInUseForRemoval", "Used when Operation = DBCC FREESYSTEMCACHE\r\nAsynchronously frees currently used entries from their respective caches after they become unused", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the cmdlet runs. The cmdlet is not run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the cmdlet.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbccFreeCache [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Operation] \u003cString\u003e] [[-InputValue] \u003cString\u003e] [-NoInformationalMessages] [-MarkInUseForRemoval] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbClone", "Description": "Clones a database schema and statistics.\n\nThis can be useful for testing query performance without requiring all the space needed for the data in the database.\n\nRead more:\n - https://sqlperformance.com/2016/08/sql-statistics/expanding-dbcc-clonedatabase\n - https://support.microsoft.com/en-us/help/3177838/how-to-use-dbcc-clonedatabase-to-generate-a-schema-and-statistics-only\n\nThanks to Microsoft Tiger Team for the code and idea https://github.com/Microsoft/tigertoolbox/", "Tags": [ "Statistics", "Performance", "Clone" ], "Synopsis": "Clones a database schema and statistics", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Invoke-DbaDbClone", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbClone", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbClone -SqlInstance sql2016 -Database mydb -CloneDatabase myclone\nClones mydb to myclone on sql2016\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2016 -Database mydb | Invoke-DbaDbClone -CloneDatabase myclone, myclone2 -UpdateStatistics\nUpdates the statistics of mydb then clones to myclone and myclone2", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database to clone - this list is auto-populated from the server.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "CloneDatabase", "The name(s) to clone to.", "", false, "false", "", "" ], [ "ExcludeStatistics", "Exclude the statistics in the cloned database", "", false, "false", "False", "" ], [ "ExcludeQueryStore", "Exclude the QueryStore data in the cloned database", "", false, "false", "False", "" ], [ "UpdateStatistics", "Update the statistics prior to cloning (per Microsoft Tiger Team formula)", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbClone [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [[-CloneDatabase] \u003cString[]\u003e] [-ExcludeStatistics] [-ExcludeQueryStore] [-UpdateStatistics] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbDataGenerator", "Description": "Invoke-DbaDbDataMasking is able to generate random data for tables.", "Tags": [ "DataGeneration", "Database" ], "Synopsis": "Invoke-DbaDbDataGenerator generates random data for tables", "Alias": "", "Author": "Sander Stad (@sqlstad, sqlstad.nl)", "CommandName": "Invoke-DbaDbDataGenerator", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbDataGenerator", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbDataGenerator -SqlInstance sqldb2 -Database DB1 -FilePath C:\\temp\\sqldb1.db1.tables.json\nApply the data generation configuration from the file \"sqldb1.db1.tables.json\" to the db1 database on sqldb2. Prompt for confirmation for each table.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Databases to process through", "", false, "false", "", "" ], [ "FilePath", "Configuration file that contains the which tables and columns need to be masked", "Path,FullName", true, "true (ByValue)", "", "" ], [ "Locale", "Set the local to enable certain settings in the masking", "", false, "false", "en", "" ], [ "CharacterString", "The characters to use in string data. \u0027abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\u0027 by default", "", false, "false", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", "" ], [ "Table", "Tables to process. By default all the tables will be processed", "", false, "false", "", "" ], [ "Column", "Columns to process. By default all the columns will be processed", "", false, "false", "", "" ], [ "ExcludeTable", "Exclude specific tables even if it\u0027s listed in the config file.", "", false, "false", "", "" ], [ "ExcludeColumn", "Exclude specific columns even if it\u0027s listed in the config file.", "", false, "false", "", "" ], [ "MaxValue", "Force a max length of strings instead of relying on datatype maxes. Note if a string datatype has a lower MaxValue, that will be used instead.\nUseful for adhoc updates and testing, otherwise, the config file should be used.", "", false, "false", "0", "" ], [ "ExactLength", "Mask string values to the same length. So \u0027Tate\u0027 will be replaced with 4 random characters.", "", false, "false", "False", "" ], [ "ModulusFactor", "Calculating the next nullable by using the remainder from the modulus. Default is every 10.", "", false, "false", "10", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbDataGenerator [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [-FilePath] \u003cObject\u003e [[-Locale] \u003cString\u003e] [[-CharacterString] \u003cString\u003e] [[-Table] \u003cString[]\u003e] [[-Column] \u003cString[]\u003e] [[-ExcludeTable] \u003cString[]\u003e] [[-ExcludeColumn] \u003cString[]\u003e] [[-MaxValue] \u003cInt32\u003e] [-ExactLength] [[-ModulusFactor] \u003cInt32\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbDataMasking", "Description": "TMasks data by using randomized values determined by a configuration file and a randomizer framework\n\nIt will use a configuration file that can be made manually or generated using New-DbaDbMaskingConfig\n\nNote that the following column and data types are not currently supported:\nIdentity\nForeignKey\nComputed\nHierarchyid\nGeography\nGeometry\nXml", "Tags": [ "Masking", "DataMasking" ], "Synopsis": "Masks data by using randomized values determined by a configuration file and a randomizer framework", "Alias": "", "Author": "Sander Stad (@sqlstad, sqlstad.nl) | Chrissy LeMaire (@cl, netnerds.net)", "CommandName": "Invoke-DbaDbDataMasking", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbDataMasking", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbDataMasking -SqlInstance SQLDB2 -Database DB1 -FilePath C:\\Temp\\sqldb1.db1.tables.json\nApply the data masking configuration from the file \"sqldb1.db1.tables.json\" to the db1 database on sqldb2. Prompt for confirmation for each table.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-ChildItem -Path C:\\Temp\\sqldb1.db1.tables.json | Invoke-DbaDbDataMasking -SqlInstance SQLDB2 -Database DB1 -Confirm:$false\nApply the data masking configuration from the file \"sqldb1.db1.tables.json\" to the db1 database on sqldb2. Do not prompt for confirmation.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaDbMaskingConfig -SqlInstance SQLDB1 -Database DB1 -Path C:\\Temp\\clone -OutVariable file\n$file | Invoke-DbaDbDataMasking -SqlInstance SQLDB2 -Database DB1 -Confirm:$false\nCreate the data masking configuration file \"sqldb1.db1.tables.json\", then use it to mask the db1 database on sqldb2. Do not prompt for confirmation.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-ChildItem -Path C:\\Temp\\sqldb1.db1.tables.json | Invoke-DbaDbDataMasking -SqlInstance SQLDB2, sqldb3 -Database DB1 -Confirm:$false\nSee what would happen if you the data masking configuration from the file \"sqldb1.db1.tables.json\" to the db1 database on sqldb2 and sqldb3. Do not prompt for confirmation.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Databases to process through", "", false, "false", "", "" ], [ "FilePath", "Configuration file that contains the which tables and columns need to be masked", "Path,FullName", true, "true (ByValue)", "", "" ], [ "Locale", "Set the local to enable certain settings in the masking", "", false, "false", "en", "" ], [ "CharacterString", "The characters to use in string data. \u0027abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\u0027 by default", "", false, "false", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", "" ], [ "Table", "Tables to process. By default all the tables will be processed", "", false, "false", "", "" ], [ "Column", "Columns to process. By default all the columns will be processed", "", false, "false", "", "" ], [ "ExcludeTable", "Exclude specific tables even if it\u0027s listed in the config file.", "", false, "false", "", "" ], [ "ExcludeColumn", "Exclude specific columns even if it\u0027s listed in the config file.", "", false, "false", "", "" ], [ "MaxValue", "Force a max length of strings instead of relying on datatype maxes. Note if a string datatype has a lower MaxValue, that will be used instead.\nUseful for adhoc updates and testing, otherwise, the config file should be used.", "", false, "false", "0", "" ], [ "ModulusFactor", "Calculating the next nullable by using the remainder from the modulus. Default is every 10.", "", false, "false", "0", "" ], [ "ExactLength", "Mask string values to the same length. So \u0027Tate\u0027 will be replaced with 4 random characters.", "", false, "false", "False", "" ], [ "CommandTimeout", "Timeout for the database connection in seconds. Default is 300.", "", false, "false", "0", "" ], [ "BatchSize", "Size of the batch to use to write the masked data back to the database", "", false, "false", "0", "" ], [ "Retry", "The amount of retries to generate a unique row for a table. Default is 1000.", "", false, "false", "0", "" ], [ "DictionaryFilePath", "Import the dictionary to be used in in the database masking", "", false, "false", "", "" ], [ "DictionaryExportPath", "Export the dictionary to the given path. Naming convention will be [computername]_[instancename]_[database]_Dictionary.csv\nBe careful with this feature, this export is the key to get the original values which is a security risk!", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbDataMasking [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [-FilePath] \u003cObject\u003e [[-Locale] \u003cString\u003e] [[-CharacterString] \u003cString\u003e] [[-Table] \u003cString[]\u003e] [[-Column] \u003cString[]\u003e] [[-ExcludeTable] \u003cString[]\u003e] [[-ExcludeColumn] \u003cString[]\u003e] [[-MaxValue] \u003cInt32\u003e] [[-ModulusFactor] \u003cInt32\u003e] [-ExactLength] [[-CommandTimeout] \u003cInt32\u003e] [[-BatchSize] \u003cInt32\u003e] [[-Retry] \u003cInt32\u003e] [[-DictionaryFilePath] \u003cString[]\u003e] [[-DictionaryExportPath] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbDbccCheckConstraint", "Description": "Executes the command DBCC CHECKCONSTRAINTS and returns results\n\nReports and corrects pages and row count inaccuracies in the catalog views.\nThese inaccuracies may cause incorrect space usage reports returned by the sp_spaceused system stored procedure.\n\nRead more:\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-checkconstraints-transact-sql", "Tags": "DBCC", "Synopsis": "Execution of Database Console Command DBCC CHECKCONSTRAINTS", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Invoke-DbaDbDbccCheckConstraint", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbDbccCheckConstraint", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbDbccCheckConstraint -SqlInstance SqlServer2017\nRuns the command DBCC CHECKCONSTRAINTS to check all enabled constraints on all tables for all databases for the instance SqlServer2017. Connect using Windows Authentication\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaDbDbccCheckConstraint -SqlInstance SqlServer2017 -Database CurrentDB\nConnect to instance SqlServer2017 using Windows Authentication and run the command DBCC CHECKCONSTRAINTS to check all enabled constraints on all tables in the CurrentDB database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInvoke-DbaDbDbccCheckConstraint -SqlInstance SqlServer2017 -Database CurrentDB -Object Sometable\nConnects to CurrentDB on instance SqlServer2017 using Windows Authentication and runs the command DBCC CHECKCONSTRAINTS(SometableId) to check all enabled constraints in the table.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInvoke-DbaDbDbccCheckConstraint -SqlInstance SqlServer2017 -Database CurrentDB -Object ConstraintId\nConnects to CurrentDB on instance SqlServer2017 using Windows Authentication and runs the command DBCC CHECKCONSTRAINTS(ConstraintId) to check the constraint with constraint_id = ConstraintId.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Invoke-DbaDbDbccCheckConstraint -SqlInstance SqlServer2017 -SqlCredential $cred -Database CurrentDB -Object TableId -AllConstraints -AllErrorMessages -NoInformationalMessages\nConnects to CurrentDB on instance SqlServer2017 using sqladmin credential and runs the command DBCC CHECKCONSTRAINTS(TableId) WITH ALL_CONSTRAINTS, ALL_ERRORMSGS, NO_INFOMSGS to check all enabled and \r\ndisabled constraints on the table with able_id = TableId. Returns all rows that violate constraints.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Invoke-DbaDbDbccCheckConstraint -WhatIf\nDisplays what will happen if command DBCC CHECKCONSTRAINTS is called against all databses on Sql1 and Sql2/sqlexpress", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "Object", "The table or constraint to be checked.\r\nWhen table_name or table_id is specified, all enabled constraints on that table are checked.\r\nWhen constraint_name or constraint_id is specified, only that constraint is checked.\r\nIf neither a table identifier nor a constraint identifier is specified, all enabled constraints on all tables in the current database are checked.", "", false, "false", "", "" ], [ "AllConstraints", "Checks all enabled and disabled constraints on the table if the table name is specified or if all tables are checked;\r\nOtherwise, checks only the enabled constraint.\r\nHas no effect when a constraint is specified", "", false, "false", "False", "" ], [ "AllErrorMessages", "Returns all rows that violate constraints in the table that is checked.\r\nThe default is the first 200 rows.", "", false, "false", "False", "" ], [ "NoInformationalMessages", "Suppresses all informational messages.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the cmdlet runs. The cmdlet is not run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the cmdlet.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbDbccCheckConstraint [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Object] \u003cString\u003e] [-AllConstraints] [-AllErrorMessages] [-NoInformationalMessages] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbDbccCleanTable", "Description": "Executes the command DBCC CLEANTABLE against defined objects and returns results\n\nReclaims space from dropped variable-length columns in tables or indexed views\n\nRead more:\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-cleantable-transact-sql", "Tags": "DBCC", "Synopsis": "Execution of Database Console Command DBCC CLEANTABLE", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Invoke-DbaDbDbccCleanTable", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbDbccCleanTable", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbDbccCleanTable -SqlInstance SqlServer2017 -Database CurrentDB -Object \u0027dbo.SomeTable\u0027\nConnects to CurrentDB on instance SqlServer2017 using Windows Authentication and runs the command DBCC CLEANTABLE(\u0027CurrentDB\u0027, \u0027dbo.SomeTable\u0027) to reclaim space after variable-length columns have \r\nbeen dropped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaDbDbccCleanTable -SqlInstance SqlServer2017 -Database CurrentDB -Object 34636372 -BatchSize 5000\nConnects to CurrentDB on instance SqlServer2017 using Windows Authentication and runs the command DBCC CLEANTABLE(\u0027CurrentDB\u0027, 34636372, 5000) to reclaim space from table with Table_Id = 34636372 \r\nafter variable-length columns have been dropped.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Invoke-DbaDbDbccCleanTable -SqlInstance SqlServer2017 -SqlCredential $cred -Database CurrentDB -Object \u0027dbo.SomeTable\u0027 -NoInformationalMessages\nConnects to CurrentDB on instance SqlServer2017 using sqladmin credential and runs the command DBCC CLEANTABLE(\u0027CurrentDB\u0027, \u0027dbo.SomeTable\u0027) WITH NO_INFOMSGS to reclaim space after variable-length \r\ncolumns have been dropped.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Invoke-DbaDbDbccCleanTable -Object \u0027dbo.SomeTable\u0027 -BatchSize 5000\nRuns the command DBCC CLEANTABLE(\u0027DatabaseName\u0027, \u0027dbo.SomeTable\u0027, 5000) against all databses on Sql1 and Sql2/sqlexpress", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "Object", "The table(s) or indexed view(s) to be cleaned.", "", false, "false", "", "" ], [ "BatchSize", "Is the number of rows processed per transaction.\r\nIf not specified, or if 0 is specified, the statement processes the whole table in one transaction.", "", false, "false", "0", "" ], [ "NoInformationalMessages", "Suppresses all informational messages.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the cmdlet runs. The cmdlet is not run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the cmdlet.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbDbccCleanTable [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Object] \u003cString[]\u003e] [[-BatchSize] \u003cInt32\u003e] [-NoInformationalMessages] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbDbccUpdateUsage", "Description": "Executes the command DBCC UPDATEUSAGE and returns results\n\nReports and corrects pages and row count inaccuracies in the catalog views.\nThese inaccuracies may cause incorrect space usage reports returned by the sp_spaceused system stored procedure.\n\nRead more:\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-updateusage-transact-sql", "Tags": "DBCC", "Synopsis": "Execution of Database Console Command DBCC UPDATEUSAGE", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Invoke-DbaDbDbccUpdateUsage", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbDbccUpdateUsage", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbDbccUpdateUsage -SqlInstance SqlServer2017\nRuns the command DBCC UPDATEUSAGE to update the page or row counts or both for all objects in all databases for the instance SqlServer2017. Connect using Windows Authentication\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaDbDbccUpdateUsage -SqlInstance SqlServer2017 -Database CurrentDB\nRuns the command DBCC UPDATEUSAGE to update the page or row counts or both for all objects in the CurrentDB database for the instance SqlServer2017. Connect using Windows Authentication\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInvoke-DbaDbDbccUpdateUsage -SqlInstance SqlServer2017 -Database CurrentDB -Table Sometable\nConnects to CurrentDB on instance SqlServer2017 using Windows Authentication and runs the command DBCC UPDATEUSAGE(SometableId) to update the page or row counts for all indexes in the table.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Invoke-DbaDbDbccUpdateUsage -SqlInstance SqlServer2017 -SqlCredential $cred -Database CurrentDB -Table \u0027SometableId -Index IndexName -NoInformationalMessages -CountRows\nConnects to CurrentDB on instance SqlServer2017 using sqladmin credential and runs the command DBCC UPDATEUSAGE(SometableId, IndexName) WITH NO_INFOMSGS, COUNT_ROWS to update the page or row counts.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e\u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Invoke-DbaDbDbccUpdateUsage -WhatIf\nDisplays what will happen if command DBCC UPDATEUSAGE is called against all databses on Sql1 and Sql2/sqlexpress", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. If unspecified, all databases will be processed.\r\nThe Name or Id of a database can be specified\r\nDatabase names must comply with the rules for identifiers.", "", false, "false", "", "" ], [ "Table", "The table or indexed view to process.\r\nTable and view names must comply with the rules for identifiers\r\nThe Id of Table or View can be specified\r\nIf not specified, all tables or indexed views will be processed", "", false, "false", "", "" ], [ "Index", "The Index to process.\r\nThe Id of Index can be specified\r\nIf not specified, all indexes for the specified table or view will be processed.", "", false, "false", "", "" ], [ "NoInformationalMessages", "Suppresses all informational messages.", "", false, "false", "False", "" ], [ "CountRows", "Specifies that the row count column is updated with the current count of the number of rows in the table or view.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the cmdlet runs. The cmdlet is not run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the cmdlet.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbDbccUpdateUsage [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Table] \u003cString\u003e] [[-Index] \u003cString\u003e] [-NoInformationalMessages] [-CountRows] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbDecryptObject", "Description": "SQL Server provides an option to encrypt the code used in various types of objects.\nIf the original code is no longer available for an encrypted object it won\u0027t be possible to view the definition.\nWith this command the dedicated admin connection (DAC) can be used to search for the object and decrypt it.\n\nThe command will output the results to the console by default.\nThere is an option to export all the results to a folder creating .sql files.\n\nTo connect to a remote SQL instance the remote dedicated administrator connection option will need to be configured.\nThe binary versions of the objects can only be retrieved using a DAC connection.\nYou can check the remote DAC connection with:\n\u0027Get-DbaSpConfigure -SqlInstance [yourinstance] -ConfigName RemoteDacConnectionsEnabled\u0027\nIt should say 1 in the ConfiguredValue.\n\nThe local DAC connection is enabled by default.\n\nTo change the configurations you can use the Set-DbaSpConfigure command:\n\u0027Set-DbaSpConfigure -SqlInstance [yourinstance] -ConfigName RemoteDacConnectionsEnabled -Value 1\u0027\nIn some cases you may need to reboot the instance.", "Tags": [ "Encryption", "Decrypt", "Database" ], "Synopsis": "Invoke-DbaDbDecryptObject returns the decrypted version of an object", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Invoke-DbaDbDecryptObject", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbDecryptObject", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbDecryptObject -SqlInstance SQLDB1 -Database DB1 -ObjectName Function1\nDecrypt object \"Function1\" in DB1 of instance SQLDB1 and output the data to the user.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaDbDecryptObject -SqlInstance SQLDB1 -Database DB1 -ObjectName Function1 -ExportDestination C:\\temp\\decrypt\nDecrypt object \"Function1\" in DB1 of instance SQLDB1 and output the data to the folder \"C:\\temp\\decrypt\".\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInvoke-DbaDbDecryptObject -SqlInstance SQLDB1 -Database DB1 -ExportDestination C:\\temp\\decrypt\nDecrypt all objects in DB1 of instance SQLDB1 and output the data to the folder \"C:\\temp\\decrypt\"\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInvoke-DbaDbDecryptObject -SqlInstance SQLDB1 -Database DB1 -ObjectName Function1, Function2\nDecrypt objects \"Function1\" and \"Function2\" and output the data to the user.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e\"SQLDB1\" | Invoke-DbaDbDecryptObject -Database DB1 -ObjectName Function1, Function2\nDecrypt objects \"Function1\" and \"Function2\" and output the data to the user using a pipeline for the instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Database to search for the object.", "", true, "false", "", "" ], [ "ObjectName", "The name of the object to search for in the database.", "", false, "false", "", "" ], [ "EncodingType", "The encoding type used to decrypt and encrypt values.", "", false, "false", "ASCII", "ASCII,UTF8" ], [ "ExportDestination", "Location to output the decrypted object definitions.\r\nThe destination will use the instance name, database name and object type i.e.: C:\\temp\\decrypt\\SQLDB1\\DB1\\StoredProcedure", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Invoke-DbaDbDecryptObject [-SqlInstance] \u003cDbaInstanceParameter\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Database] \u003cObject[]\u003e [[-ObjectName] \u003cString[]\u003e] [[-EncodingType] \u003cString\u003e] [[-ExportDestination] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbLogShipping", "Description": "Invoke-DbaDbLogShipping helps to easily set up log shipping for one or more databases.\n\nThis function will make a lot of decisions for you assuming you want default values like a daily interval for the schedules with a 15 minute interval on the day.\nThere are some settings that cannot be made by the function and they need to be prepared before the function is executed.\n\nThe following settings need to be made before log shipping can be initiated:\n- Backup destination (the folder and the privileges)\n- Copy destination (the folder and the privileges)\n\n* Privileges\nMake sure your agent service on both the primary and the secondary instance is an Active Directory account.\nAlso have the credentials ready to set the folder permissions\n\n** Network share\nThe backup destination needs to be shared and have the share privileges of FULL CONTROL to Everyone.\n\n** NTFS permissions\nThe backup destination must have at least read/write permissions for the primary instance agent account.\nThe backup destination must have at least read permissions for the secondary instance agent account.\nThe copy destination must have at least read/write permission for the secondary instance agent acount.", "Tags": "LogShipping", "Synopsis": "Invoke-DbaDbLogShipping sets up log shipping for one or more databases", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Invoke-DbaDbLogShipping", "Availability": "Windows only", "Links": "https://dbatools.io/Invoke-DbaDbLogShipping", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$params = @{\n\u003e\u003e SourceSqlInstance = \u0027sql1\u0027\r\n\u003e\u003e DestinationSqlInstance = \u0027sql2\u0027\r\n\u003e\u003e Database = \u0027db1\u0027\r\n\u003e\u003e SharedPath= \u0027\\\\sql1\\logshipping\u0027\r\n\u003e\u003e LocalPath= \u0027D:\\Data\\logshipping\u0027\r\n\u003e\u003e BackupScheduleFrequencyType = \u0027daily\u0027\r\n\u003e\u003e BackupScheduleFrequencyInterval = 1\r\n\u003e\u003e CompressBackup = $true\r\n\u003e\u003e CopyScheduleFrequencyType = \u0027daily\u0027\r\n\u003e\u003e CopyScheduleFrequencyInterval = 1\r\n\u003e\u003e GenerateFullBackup = $true\r\n\u003e\u003e RestoreScheduleFrequencyType = \u0027daily\u0027\r\n\u003e\u003e RestoreScheduleFrequencyInterval = 1\r\n\u003e\u003e SecondaryDatabaseSuffix = \u0027DR\u0027\r\n\u003e\u003e CopyDestinationFolder = \u0027\\\\sql2\\logshippingdest\u0027\r\n\u003e\u003e Force = $true\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e Invoke-DbaDbLogShipping @params\nSets up log shipping for database \"db1\" with the backup path to a network share allowing local backups.\r\nIt creates daily schedules for the backup, copy and restore job with all the defaults to be executed every 15 minutes daily.\r\nThe secondary database will be called \"db1_LS\".\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$params = @{\n\u003e\u003e SourceSqlInstance = \u0027sql1\u0027\r\n\u003e\u003e DestinationSqlInstance = \u0027sql2\u0027\r\n\u003e\u003e Database = \u0027db1\u0027\r\n\u003e\u003e SharedPath= \u0027\\\\sql1\\logshipping\u0027\r\n\u003e\u003e GenerateFullBackup = $true\r\n\u003e\u003e Force = $true\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e Invoke-DbaDbLogShipping @params\nSets up log shipping with all defaults except that a backup file is generated.\r\nThe script will show a message that the copy destination has not been supplied and asks if you want to use the default which would be the backup directory of the secondary server with the folder \r\n\"logshipping\" i.e. \"D:\\SQLBackup\\Logshiping\".", "Params": [ [ "SourceSqlInstance", "Source SQL Server instance which contains the databases to be log shipped.\r\nYou must have sysadmin access and server version must be SQL Server version 2000 or greater.", "SourceServerInstance,SourceSqlServerSqlServer,Source", true, "false", "", "" ], [ "DestinationSqlInstance", "Destination SQL Server instance which contains the databases to be log shipped.\r\nYou must have sysadmin access and server version must be SQL Server version 2000 or greater.", "DestinationServerInstance,DestinationSqlServer,Destination", true, "false", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "SourceCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "DestinationCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Database to set up log shipping for.", "", true, "true (ByValue)", "", "" ], [ "SharedPath", "The backup unc path to place the backup files. This is the root directory.\r\nA directory with the name of the database will be created in this path.", "BackupNetworkPath", true, "false", "", "" ], [ "LocalPath", "If the backup path is locally for the source server you can also set this value.", "BackupLocalPath", false, "false", "", "" ], [ "BackupJob", "Name of the backup that will be created in the SQL Server agent.\r\nThe parameter works as a prefix where the name of the database will be added to the backup job name.\r\nThe default is \"LSBackup_[databasename]\"", "", false, "false", "", "" ], [ "BackupRetention", "The backup retention period in minutes. Default is 4320 / 72 hours", "", false, "false", "0", "" ], [ "BackupSchedule", "Name of the backup schedule created for the backup job.\r\nThe parameter works as a prefix where the name of the database will be added to the backup job schedule name.\r\nDefault is \"LSBackupSchedule_[databasename]\"", "", false, "false", "", "" ], [ "BackupScheduleDisabled", "Parameter to set the backup schedule to disabled upon creation.\r\nBy default the schedule is enabled.", "", false, "false", "False", "" ], [ "BackupScheduleFrequencyType", "A value indicating when a job is to be executed.\r\nAllowed values are \"Daily\", \"AgentStart\", \"IdleComputer\"", "", false, "false", "", "Daily,Weekly,AgentStart,IdleComputer" ], [ "BackupScheduleFrequencyInterval", "The number of type periods to occur between each execution of the backup job.", "", false, "false", "", "" ], [ "BackupScheduleFrequencySubdayType", "Specifies the units for the sub-day FrequencyInterval.\r\nAllowed values are \"Time\", \"Seconds\", \"Minutes\", \"Hours\"", "", false, "false", "", "Time,Seconds,Minutes,Hours" ], [ "BackupScheduleFrequencySubdayInterval", "The number of sub-day type periods to occur between each execution of the backup job.", "", false, "false", "0", "" ], [ "BackupScheduleFrequencyRelativeInterval", "A job\u0027s occurrence of FrequencyInterval in each month, if FrequencyInterval is 32 (monthlyrelative).", "", false, "false", "", "Unused,First,Second,Third,Fourth,Last" ], [ "BackupScheduleFrequencyRecurrenceFactor", "The number of weeks or months between the scheduled execution of a job. FrequencyRecurrenceFactor is used only if FrequencyType is 8, \"Weekly\", 16, \"Monthly\", 32 or \"MonthlyRelative\".", "", false, "false", "0", "" ], [ "BackupScheduleStartDate", "The date on which execution of a job can begin.", "", false, "false", "", "" ], [ "BackupScheduleEndDate", "The date on which execution of a job can stop.", "", false, "false", "", "" ], [ "BackupScheduleStartTime", "The time on any day to begin execution of a job. Format HHMMSS / 24 hour clock.\r\nExample: \u0027010000\u0027 for 01:00:00 AM.\r\nExample: \u0027140000\u0027 for 02:00:00 PM.", "", false, "false", "", "" ], [ "BackupScheduleEndTime", "The time on any day to end execution of a job. Format HHMMSS / 24 hour clock.\r\nExample: \u0027010000\u0027 for 01:00:00 AM.\r\nExample: \u0027140000\u0027 for 02:00:00 PM.", "", false, "false", "", "" ], [ "BackupThreshold", "Is the length of time, in minutes, after the last backup before a threshold alert error is raised.\r\nThe default is 60.", "", false, "false", "0", "" ], [ "CompressBackup", "Do the backups need to be compressed. By default the backups are not compressed.", "", false, "false", "False", "" ], [ "CopyDestinationFolder", "The path to copy the transaction log backup files to. This is the root directory.\r\nA directory with the name of the database will be created in this path.", "", false, "false", "", "" ], [ "CopyJob", "Name of the copy job that will be created in the SQL Server agent.\r\nThe parameter works as a prefix where the name of the database will be added to the copy job name.\r\nThe default is \"LSBackup_[databasename]\"", "", false, "false", "", "" ], [ "CopyRetention", "The copy retention period in minutes. Default is 4320 / 72 hours", "", false, "false", "0", "" ], [ "CopySchedule", "Name of the backup schedule created for the copy job.\r\nThe parameter works as a prefix where the name of the database will be added to the copy job schedule name.\r\nDefault is \"LSCopy_[DestinationServerName]_[DatabaseName]\"", "", false, "false", "", "" ], [ "CopyScheduleDisabled", "Parameter to set the copy schedule to disabled upon creation.\r\nBy default the schedule is enabled.", "", false, "false", "False", "" ], [ "CopyScheduleFrequencyType", "A value indicating when a job is to be executed.\r\nAllowed values are \"Daily\", \"AgentStart\", \"IdleComputer\"", "", false, "false", "", "Daily,Weekly,AgentStart,IdleComputer" ], [ "CopyScheduleFrequencyInterval", "The number of type periods to occur between each execution of the copy job.", "", false, "false", "", "" ], [ "CopyScheduleFrequencySubdayType", "Specifies the units for the subday FrequencyInterval.\r\nAllowed values are \"Time\", \"Seconds\", \"Minutes\", \"Hours\"", "", false, "false", "", "Time,Seconds,Minutes,Hours" ], [ "CopyScheduleFrequencySubdayInterval", "The number of subday type periods to occur between each execution of the copy job.", "", false, "false", "0", "" ], [ "CopyScheduleFrequencyRelativeInterval", "A job\u0027s occurrence of FrequencyInterval in each month, if FrequencyInterval is 32 (monthlyrelative).", "", false, "false", "", "Unused,First,Second,Third,Fourth,Last" ], [ "CopyScheduleFrequencyRecurrenceFactor", "The number of weeks or months between the scheduled execution of a job. FrequencyRecurrenceFactor is used only if FrequencyType is 8, \"Weekly\", 16, \"Monthly\", 32 or \"MonthlyRelative\".", "", false, "false", "0", "" ], [ "CopyScheduleStartDate", "The date on which execution of a job can begin.", "", false, "false", "", "" ], [ "CopyScheduleEndDate", "The date on which execution of a job can stop.", "", false, "false", "", "" ], [ "CopyScheduleStartTime", "The time on any day to begin execution of a job. Format HHMMSS / 24 hour clock.\r\nExample: \u0027010000\u0027 for 01:00:00 AM.\r\nExample: \u0027140000\u0027 for 02:00:00 PM.", "", false, "false", "", "" ], [ "CopyScheduleEndTime", "The time on any day to end execution of a job. Format HHMMSS / 24 hour clock.\r\nExample: \u0027010000\u0027 for 01:00:00 AM.\r\nExample: \u0027140000\u0027 for 02:00:00 PM.", "", false, "false", "", "" ], [ "DisconnectUsers", "If this parameter is set in combinations of standby the users will be disconnected during restore.", "", false, "false", "False", "" ], [ "FullBackupPath", "Path to an existing full backup. Use this when an existing backup needs to used to initialize the database on the secondary instance.", "", false, "false", "", "" ], [ "GenerateFullBackup", "If the database is not initialized on the secondary instance it can be done by creating a new full backup and\r\nrestore it for you.", "", false, "false", "False", "" ], [ "HistoryRetention", "Is the length of time in minutes in which the history is retained.\r\nThe default value is 14420", "", false, "false", "0", "" ], [ "NoRecovery", "If this parameter is set the database will be in recovery mode. The database will not be readable.\r\nThis setting is default.", "", false, "false", "False", "" ], [ "NoInitialization", "If this parameter is set the secondary database will not be initialized.\r\nThe database needs to be on the secondary instance in recovery mode.", "", false, "false", "False", "" ], [ "PrimaryMonitorServer", "Is the name of the monitor server for the primary server.\r\nThe default is the name of the primary sql server.", "", false, "false", "", "" ], [ "PrimaryMonitorCredential", "Allows you to login to enter a secure credential. Only needs to be used when the PrimaryMonitorServerSecurityMode is 0 or \"sqlserver\"\r\nTo use: $scred = Get-Credential, then pass $scred object to the -PrimaryMonitorCredential parameter.", "", false, "false", "", "" ], [ "PrimaryMonitorServerSecurityMode", "The security mode used to connect to the monitor server for the primary server. Allowed values are 0, \"sqlserver\", 1, \"windows\"\r\nThe default is 1 or Windows.", "", false, "false", "", "0,sqlserver,1,windows" ], [ "PrimaryThresholdAlertEnabled", "Enables the Threshold alert for the primary database", "", false, "false", "False", "" ], [ "RestoreDataFolder", "Folder to be used to restore the database data files. Only used when parameter GenerateFullBackup or UseExistingFullBackup are set.\r\nIf the parameter is not set the default data folder of the secondary instance will be used including the name of the database.\r\nIf the folder is set but doesn\u0027t exist the default data folder of the secondary instance will be used including the name of the database.", "", false, "false", "", "" ], [ "RestoreLogFolder", "Folder to be used to restore the database log files. Only used when parameter GenerateFullBackup or UseExistingFullBackup are set.\r\nIf the parameter is not set the default transaction log folder of the secondary instance will be used.\r\nIf the folder is set but doesn\u0027t exist the default transaction log folder of the secondary instance will be used.", "", false, "false", "", "" ], [ "RestoreDelay", "In case a delay needs to be set for the restore.\r\nThe default is 0.", "", false, "false", "0", "" ], [ "RestoreAlertThreshold", "The amount of minutes after which an alert will be raised is no restore has taken place.\r\nThe default is 45 minutes.", "", false, "false", "0", "" ], [ "RestoreJob", "Name of the restore job that will be created in the SQL Server agent.\r\nThe parameter works as a prefix where the name of the database will be added to the restore job name.\r\nThe default is \"LSRestore_[databasename]\"", "", false, "false", "", "" ], [ "RestoreRetention", "The backup retention period in minutes. Default is 4320 / 72 hours", "", false, "false", "0", "" ], [ "RestoreSchedule", "Name of the backup schedule created for the restore job.\r\nThe parameter works as a prefix where the name of the database will be added to the restore job schedule name.\r\nDefault is \"LSRestore_[DestinationServerName]_[DatabaseName]\"", "", false, "false", "", "" ], [ "RestoreScheduleDisabled", "Parameter to set the restore schedule to disabled upon creation.\r\nBy default the schedule is enabled.", "", false, "false", "False", "" ], [ "RestoreScheduleFrequencyType", "A value indicating when a job is to be executed.\r\nAllowed values are \"Daily\", \"AgentStart\", \"IdleComputer\"", "", false, "false", "", "Daily,Weekly,AgentStart,IdleComputer" ], [ "RestoreScheduleFrequencyInterval", "The number of type periods to occur between each execution of the restore job.", "", false, "false", "", "" ], [ "RestoreScheduleFrequencySubdayType", "Specifies the units for the subday FrequencyInterval.\r\nAllowed values are \"Time\", \"Seconds\", \"Minutes\", \"Hours\"", "", false, "false", "", "Time,Seconds,Minutes,Hours" ], [ "RestoreScheduleFrequencySubdayInterval", "The number of subday type periods to occur between each execution of the restore job.", "", false, "false", "0", "" ], [ "RestoreScheduleFrequencyRelativeInterval", "A job\u0027s occurrence of FrequencyInterval in each month, if FrequencyInterval is 32 (monthlyrelative).", "", false, "false", "", "Unused,First,Second,Third,Fourth,Last" ], [ "RestoreScheduleFrequencyRecurrenceFactor", "The number of weeks or months between the scheduled execution of a job. FrequencyRecurrenceFactor is used only if FrequencyType is 8, \"Weekly\", 16, \"Monthly\", 32 or \"MonthlyRelative\".", "", false, "false", "0", "" ], [ "RestoreScheduleStartDate", "The date on which execution of a job can begin.", "", false, "false", "", "" ], [ "RestoreScheduleEndDate", "The date on which execution of a job can stop.", "", false, "false", "", "" ], [ "RestoreScheduleStartTime", "The time on any day to begin execution of a job. Format HHMMSS / 24 hour clock.\r\nExample: \u0027010000\u0027 for 01:00:00 AM.\r\nExample: \u0027140000\u0027 for 02:00:00 PM.", "", false, "false", "", "" ], [ "RestoreScheduleEndTime", "The time on any day to end execution of a job. Format HHMMSS / 24 hour clock.\r\nExample: \u0027010000\u0027 for 01:00:00 AM.\r\nExample: \u0027140000\u0027 for 02:00:00 PM.", "", false, "false", "", "" ], [ "RestoreThreshold", "The number of minutes allowed to elapse between restore operations before an alert is generated.\r\nThe default value = 0", "", false, "false", "0", "" ], [ "SecondaryDatabasePrefix", "The secondary database can be renamed to include a prefix.", "", false, "false", "", "" ], [ "SecondaryDatabaseSuffix", "The secondary database can be renamed to include a suffix.", "", false, "false", "", "" ], [ "SecondaryMonitorServer", "Is the name of the monitor server for the secondary server.\r\nThe default is the name of the secondary sql server.", "", false, "false", "", "" ], [ "SecondaryMonitorCredential", "Allows you to login to enter a secure credential. Only needs to be used when the SecondaryMonitorServerSecurityMode is 0 or \"sqlserver\"\r\nTo use: $scred = Get-Credential, then pass $scred object to the -SecondaryMonitorCredential parameter.", "", false, "false", "", "" ], [ "SecondaryMonitorServerSecurityMode", "The security mode used to connect to the monitor server for the secondary server. Allowed values are 0, \"sqlserver\", 1, \"windows\"\r\nThe default is 1 or Windows.", "", false, "false", "", "0,sqlserver,1,windows" ], [ "SecondaryThresholdAlertEnabled", "Enables the Threshold alert for the secondary database", "", false, "false", "False", "" ], [ "Standby", "If this parameter is set the database will be set to standby mode making the database readable.\r\nIf not set the database will be in recovery mode.", "", false, "false", "False", "" ], [ "StandbyDirectory", "Directory to place the standby file(s) in", "", false, "false", "", "" ], [ "UseExistingFullBackup", "If the database is not initialized on the secondary instance it can be done by selecting an existing full backup\r\nand restore it for you.", "", false, "false", "False", "" ], [ "UseBackupFolder", "This enables the user to specify a specific backup folder containing one or more backup files to initialize the database on the secondary instance.", "", false, "false", "", "" ], [ "Force", "The force parameter will ignore some errors in the parameters and assume defaults.\r\nIt will also remove the any present schedules with the same name for the specific job.", "", false, "false", "False", "" ], [ "EnableException", "Use this switch to disable any kind of verbose messages", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbLogShipping [-SourceSqlInstance] \u003cDbaInstanceParameter\u003e [-DestinationSqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [[-SourceCredential] \u003cPSCredential\u003e] [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-DestinationCredential] \u003cPSCredential\u003e] [-Database] \u003cObject[]\u003e [-SharedPath] \u003cString\u003e [[-LocalPath] \u003cString\u003e] [[-BackupJob] \u003cString\u003e] [[-BackupRetention] \u003cInt32\u003e] [[-BackupSchedule] \u003cString\u003e] [-BackupScheduleDisabled] [[-BackupScheduleFrequencyType] \u003cObject\u003e] [[-BackupScheduleFrequencyInterval] \u003cObject[]\u003e] [[-BackupScheduleFrequencySubdayType] \u003cObject\u003e] \r\n[[-BackupScheduleFrequencySubdayInterval] \u003cInt32\u003e] [[-BackupScheduleFrequencyRelativeInterval] \u003cObject\u003e] [[-BackupScheduleFrequencyRecurrenceFactor] \u003cInt32\u003e] [[-BackupScheduleStartDate] \u003cString\u003e] [[-BackupScheduleEndDate] \u003cString\u003e] [[-BackupScheduleStartTime] \u003cString\u003e] [[-BackupScheduleEndTime] \u003cString\u003e] [[-BackupThreshold] \u003cInt32\u003e] [-CompressBackup] [[-CopyDestinationFolder] \u003cString\u003e] [[-CopyJob] \u003cString\u003e] [[-CopyRetention] \u003cInt32\u003e] [[-CopySchedule] \u003cString\u003e] [-CopyScheduleDisabled] [[-CopyScheduleFrequencyType] \u003cObject\u003e] [[-CopyScheduleFrequencyInterval] \u003cObject[]\u003e] \r\n[[-CopyScheduleFrequencySubdayType] \u003cObject\u003e] [[-CopyScheduleFrequencySubdayInterval] \u003cInt32\u003e] [[-CopyScheduleFrequencyRelativeInterval] \u003cObject\u003e] [[-CopyScheduleFrequencyRecurrenceFactor] \u003cInt32\u003e] [[-CopyScheduleStartDate] \u003cString\u003e] [[-CopyScheduleEndDate] \u003cString\u003e] [[-CopyScheduleStartTime] \u003cString\u003e] [[-CopyScheduleEndTime] \u003cString\u003e] [-DisconnectUsers] [[-FullBackupPath] \u003cString\u003e] [-GenerateFullBackup] [[-HistoryRetention] \u003cInt32\u003e] [-NoRecovery] [-NoInitialization] [[-PrimaryMonitorServer] \u003cString\u003e] [[-PrimaryMonitorCredential] \u003cPSCredential\u003e] [[-PrimaryMonitorServerSecurityMode] \u003cObject\u003e] \r\n[-PrimaryThresholdAlertEnabled] [[-RestoreDataFolder] \u003cString\u003e] [[-RestoreLogFolder] \u003cString\u003e] [[-RestoreDelay] \u003cInt32\u003e] [[-RestoreAlertThreshold] \u003cInt32\u003e] [[-RestoreJob] \u003cString\u003e] [[-RestoreRetention] \u003cInt32\u003e] [[-RestoreSchedule] \u003cString\u003e] [-RestoreScheduleDisabled] [[-RestoreScheduleFrequencyType] \u003cObject\u003e] [[-RestoreScheduleFrequencyInterval] \u003cObject[]\u003e] [[-RestoreScheduleFrequencySubdayType] \u003cObject\u003e] [[-RestoreScheduleFrequencySubdayInterval] \u003cInt32\u003e] [[-RestoreScheduleFrequencyRelativeInterval] \u003cObject\u003e] [[-RestoreScheduleFrequencyRecurrenceFactor] \u003cInt32\u003e] [[-RestoreScheduleStartDate] \r\n\u003cString\u003e] [[-RestoreScheduleEndDate] \u003cString\u003e] [[-RestoreScheduleStartTime] \u003cString\u003e] [[-RestoreScheduleEndTime] \u003cString\u003e] [[-RestoreThreshold] \u003cInt32\u003e] [[-SecondaryDatabasePrefix] \u003cString\u003e] [[-SecondaryDatabaseSuffix] \u003cString\u003e] [[-SecondaryMonitorServer] \u003cString\u003e] [[-SecondaryMonitorCredential] \u003cPSCredential\u003e] [[-SecondaryMonitorServerSecurityMode] \u003cObject\u003e] [-SecondaryThresholdAlertEnabled] [-Standby] [[-StandbyDirectory] \u003cString\u003e] [-UseExistingFullBackup] [[-UseBackupFolder] \u003cString\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbLogShipRecovery", "Description": "By default all the databases for a particular instance are recovered.\nIf the database is in the right state, either standby or recovering, the process will try to recover the database.\n\nAt first the function will check if the backup source directory can still be reached.\nIf so it will look up the last transaction log backup for the database. If that backup file is not the last copied file the log shipping copy job will be started.\nIf the directory cannot be reached for the function will continue to the restoring process.\nAfter the copy job check is performed the job is disabled to prevent the job to run.\n\nFor the restore the log shipping status is checked in the msdb database.\nIf the last restored file is not the same as the last file name found, the log shipping restore job will be executed.\nAfter the restore job check is performed the job is disabled to prevent the job to run\n\nThe last part is to set the database online by restoring the databases with recovery", "Tags": "LogShipping", "Synopsis": "Invoke-DbaDbLogShipRecovery recovers log shipped databases to a normal state to act upon a migration or disaster.", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Invoke-DbaDbLogShipRecovery", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbLogShipRecovery", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbLogShipRecovery -SqlInstance server1\nRecovers all the databases on the instance that are enabled for log shipping\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaDbLogShipRecovery -SqlInstance server1 -SqlCredential $cred -Verbose\nRecovers all the databases on the instance that are enabled for log shipping using a credential\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInvoke-DbaDbLogShipRecovery -SqlInstance server1 -database db_logship -Verbose\nRecovers the database \"db_logship\" to a normal status\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003edb1, db2, db3, db4 | Invoke-DbaDbLogShipRecovery -SqlInstance server1 -Verbose\nRecovers the database db1, db2, db3, db4 to a normal status\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eInvoke-DbaDbLogShipRecovery -SqlInstance server1 -WhatIf\nShows what would happen if the command were executed.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "Database", "Database to perform the restore for. This value can also be piped enabling multiple databases to be recovered.\r\nIf this value is not supplied all databases will be recovered.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "NoRecovery", "Allows you to choose to not restore the database to a functional state (Normal) in the final steps of the process.\r\nBy default the database is restored to a functional state (Normal).", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "Force", "Use this parameter to force the function to continue and perform any adjusting actions to successfully execute", "", false, "false", "False", "" ], [ "InputObject", "Allows piped input from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "Delay", "Set the delay in seconds to wait for the copy and/or restore jobs.\r\nBy default the delay is 5 seconds", "", false, "false", "5", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbLogShipRecovery [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-Database] \u003cString[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [-NoRecovery] [-EnableException] [-Force] [[-InputObject] \u003cDatabase[]\u003e] [[-Delay] \u003cInt32\u003e] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbMirrorFailover", "Description": "Failover a mirrored database", "Tags": [ "Mirroring", "Mirror", "HA" ], "Synopsis": "Failover a mirrored database", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Invoke-DbaDbMirrorFailover", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbMirrorFailover", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbMirrorFailover -SqlInstance sql2016 -Database pubs\nFails over the pubs database on sql2016. Prompts for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2016 -Database pubs | Invoke-DbaDbMirrorFailover -Force -Confirm:$false\nForces the failover of the pubs database on sql2016 and allows data loss.\r\nDoes not prompt for confirmation.", "Params": [ [ "SqlInstance", "SQL Server name or SMO object representing the primary SQL Server.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database or databases to mirror", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "Force", "Force Failover and allow data loss", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbMirrorFailover [[-SqlInstance] \u003cDbaInstanceParameter\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbMirroring", "Description": "Automates the creation of database mirrors.\n\n* Verifies that a mirror is possible\n* Sets the recovery model to Full if needed\n* If the database does not exist on mirror or witness, a backup/restore is performed\n* Sets up endpoints if necessary\n* Creates a login and grants permissions to service accounts if needed\n* Starts endpoints if needed\n* Sets up partner for mirror\n* Sets up partner for primary\n* Sets up witness if one is specified\n\nNOTE: If a backup / restore is performed, the backups will be left in tact on the network share.", "Tags": [ "Mirroring", "Mirror", "HA" ], "Synopsis": "Automates the creation of database mirrors.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Invoke-DbaDbMirroring", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbMirroring", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$params = @{\n\u003e\u003e Primary = \u0027sql2017a\u0027\r\n\u003e\u003e Mirror = \u0027sql2017b\u0027\r\n\u003e\u003e MirrorSqlCredential = \u0027sqladmin\u0027\r\n\u003e\u003e Witness = \u0027sql2019\u0027\r\n\u003e\u003e Database = \u0027pubs\u0027\r\n\u003e\u003e SharedPath = \u0027\\\\nas\\sql\\share\u0027\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e Invoke-DbaDbMirroring @params\nPerforms a bunch of checks to ensure the pubs database on sql2017a\r\ncan be mirrored from sql2017a to sql2017b. Logs in to sql2019 and sql2017a\r\nusing Windows credentials and sql2017b using a SQL credential.\nPrompts for confirmation for most changes. To avoid confirmation, use -Confirm:$false or\r\nuse the syntax in the second example.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$params = @{\n\u003e\u003e Primary = \u0027sql2017a\u0027\r\n\u003e\u003e Mirror = \u0027sql2017b\u0027\r\n\u003e\u003e MirrorSqlCredential = \u0027sqladmin\u0027\r\n\u003e\u003e Witness = \u0027sql2019\u0027\r\n\u003e\u003e Database = \u0027pubs\u0027\r\n\u003e\u003e SharedPath = \u0027\\\\nas\\sql\\share\u0027\r\n\u003e\u003e Force = $true\r\n\u003e\u003e Confirm = $false\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e Invoke-DbaDbMirroring @params\nPerforms a bunch of checks to ensure the pubs database on sql2017a\r\ncan be mirrored from sql2017a to sql2017b. Logs in to sql2019 and sql2017a\r\nusing Windows credentials and sql2017b using a SQL credential.\nDrops existing pubs database on Mirror and Witness and restores them with\r\na fresh backup.\nDoes all the things in the description, does not prompt for confirmation.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$map = @{ \u0027database_data\u0027 = \u0027M:\\Data\\database_data.mdf\u0027 \u0027database_log\u0027 = \u0027L:\\Log\\database_log.ldf\u0027 }\nPS C:\\\u003e Get-ChildItem \\\\nas\\seed | Restore-DbaDatabase -SqlInstance sql2017b -FileMapping $map -NoRecovery\r\nPS C:\\\u003e Get-DbaDatabase -SqlInstance sql2017a -Database pubs | Invoke-DbaDbMirroring -Mirror sql2017b -Confirm:$false\nRestores backups from sql2017a to a specific file structure on sql2017b then creates mirror with no prompts for confirmation.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2017a -Database pubs |\n\u003e\u003e Invoke-DbaDbMirroring -Mirror sql2017b -UseLastBackup -Confirm:$false\nMirrors pubs on sql2017a to sql2017b and uses the last full and logs from sql2017a to seed. Doesn\u0027t prompt for confirmation.", "Params": [ [ "Primary", "SQL Server name or SMO object representing the primary SQL Server.", "", false, "false", "", "" ], [ "PrimarySqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Mirror", "SQL Server name or SMO object representing the mirror SQL Server.", "", true, "false", "", "" ], [ "MirrorSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Witness", "SQL Server name or SMO object representing the witness SQL Server.", "", false, "false", "", "" ], [ "WitnessSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database or databases to mirror.", "", false, "false", "", "" ], [ "SharedPath", "The network share where the backups will be backed up and restored from.\nEach SQL Server service account must have access to this share.\nNOTE: If a backup / restore is performed, the backups will be left in tact on the network share.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "UseLastBackup", "Use the last full backup of database.", "", false, "false", "False", "" ], [ "Force", "Drop and recreate the database on remote servers using fresh backup.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbMirroring [[-Primary] \u003cDbaInstanceParameter\u003e] [[-PrimarySqlCredential] \u003cPSCredential\u003e] [-Mirror] \u003cDbaInstanceParameter[]\u003e [[-MirrorSqlCredential] \u003cPSCredential\u003e] [[-Witness] \u003cDbaInstanceParameter\u003e] [[-WitnessSqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-SharedPath] \u003cString\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-UseLastBackup] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbPiiScan", "Description": "This command will go through the tables in your database and assess each column.\nIt will first check the columns names if it was named in such a way that it would indicate PII.\nThe next thing that it will do is pattern recognition by looking into the data from the table.\nCustom scan definitions can be specified using the formats seen in \u003cdbatools module root\u003e\\bin\\datamasking\\pii-knownnames.json and \u003cdbatools module root\u003e\\bin\\datamasking\\pii-patterns.json.", "Tags": [ "Data Masking", "Database", "Personal Information", "GDPR", "Policy Compliance" ], "Synopsis": "Command to return any columns that could potentially contain PII (Personal Identifiable Information)", "Alias": "", "Author": "Sander Stad (@sqlstad, sqlstad.nl)", "CommandName": "Invoke-DbaDbPiiScan", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbPiiScan", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbPiiScan -SqlInstance sql1 -Database db1\nScan the database db1 on instance sql1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaDbPiiScan -SqlInstance sql1, sql2 -Database db1, db2\nScan multiple databases on multiple instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInvoke-DbaDbPiiScan -SqlInstance sql1 -Database db2 -ExcludeColumn firstname\nScan database db2 but exclude the column firstname\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInvoke-DbaDbPiiScan -SqlInstance sql1 -Database db2 -CountryCode US\nScan database db2 but only apply data patterns used for the United States\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eInvoke-DbaDbPiiScan -SqlInstance sql1 -Database db1 -PatternFilePath c:\\pii\\patterns.json\nScans db1 on instance sql1 with additional custom patterns\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eInvoke-DbaDbPiiScan -SqlInstance sql1 -Database db1 -PatternFilePath c:\\pii\\patterns.json -ExcludeDefaultPattern\nScans db1 on instance sql1 with additional custom patterns, excluding the default patterns", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Databases to process through", "", false, "false", "", "" ], [ "Table", "Table(s) to process. By default all the tables will be processed", "", false, "false", "", "" ], [ "Column", "Column(s) to process. By default all the columns will be processed", "", false, "false", "", "" ], [ "Country", "Filter out the patterns and known types for one or more countries", "", false, "false", "", "" ], [ "CountryCode", "Filter out the patterns and known types for one or more country code", "", false, "false", "", "" ], [ "ExcludeTable", "Exclude certain tables", "", false, "false", "", "" ], [ "ExcludeColumn", "Exclude certain columns", "", false, "false", "", "" ], [ "SampleCount", "Amount of rows to sample to make an assessment. The default is 100", "", false, "false", "100", "" ], [ "KnownNameFilePath", "Points to a file containing the custom known names. Custom scan definitions can be specified using the format seen in \u003cdbatools module root\u003e\\bin\\datamasking\\pii-knownnames.json.", "", false, "false", "", "" ], [ "PatternFilePath", "Points to a file containing the custom patterns. Custom scan definitions can be specified using the format seen in \u003cdbatools module root\u003e\\bin\\datamasking\\pii-patterns.json.", "", false, "false", "", "" ], [ "ExcludeDefaultKnownName", "Excludes the default known names", "", false, "false", "False", "" ], [ "ExcludeDefaultPattern", "Excludes the default patterns", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Invoke-DbaDbPiiScan [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Table] \u003cString[]\u003e] [[-Column] \u003cString[]\u003e] [[-Country] \u003cString[]\u003e] [[-CountryCode] \u003cString[]\u003e] [[-ExcludeTable] \u003cString[]\u003e] [[-ExcludeColumn] \u003cString[]\u003e] [[-SampleCount] \u003cInt32\u003e] [[-KnownNameFilePath] \u003cString\u003e] [[-PatternFilePath] \u003cString\u003e] [-ExcludeDefaultKnownName] [-ExcludeDefaultPattern] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbShrink", "Description": "Shrinks all files in a database. Databases should be shrunk only when completely necessary.\n\nMany awesome SQL people have written about why you should not shrink your data files. Paul Randal and Kalen Delaney wrote great posts about this topic:\n\nhttp://www.sqlskills.com/blogs/paul/why-you-should-not-shrink-your-data-files\nhttps://www.itprotoday.com/sql-server/shrinking-data-files\n\nHowever, there are some cases where a database will need to be shrunk. In the event that you must shrink your database:\n\n1. Ensure you have plenty of space for your T-Log to grow\n2. Understand that shrinks require a lot of CPU and disk resources\n3. Consider running DBCC INDEXDEFRAG or ALTER INDEX ... REORGANIZE after the shrink is complete.", "Tags": [ "Shrink", "Database" ], "Synopsis": "Shrinks all files in a database. This is a command that should rarely be used.\n\n- Shrinks can cause severe index fragmentation (to the tune of 99%)\n- Shrinks can cause massive growth in the database\u0027s transaction log\n- Shrinks can require a lot of time and system resources to perform data movement", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Invoke-DbaDbShrink", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbShrink", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbShrink -SqlInstance sql2016 -Database Northwind,pubs,Adventureworks2014\nShrinks Northwind, pubs and Adventureworks2014 to have as little free space as possible.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaDbShrink -SqlInstance sql2014 -Database AdventureWorks2014 -PercentFreeSpace 50\nShrinks AdventureWorks2014 to have 50% free space. So let\u0027s say AdventureWorks2014 was 1GB and it\u0027s using 100MB space. The database free space would be reduced to 50MB.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInvoke-DbaDbShrink -SqlInstance sql2014 -Database AdventureWorks2014 -PercentFreeSpace 50 -FileType Data -StepSize 25MB\nShrinks AdventureWorks2014 to have 50% free space, runs shrinks in 25MB chunks for improved performance.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInvoke-DbaDbShrink -SqlInstance sql2012 -AllUserDatabases\nShrinks all user databases on SQL2012 (not ideal for production)", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Defaults to the default instance on localhost.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance..", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server.", "", false, "false", "", "" ], [ "AllUserDatabases", "Run command against all user databases.", "", false, "false", "False", "" ], [ "PercentFreeSpace", "Specifies how much free space to leave, defaults to 0.", "", false, "false", "0", "" ], [ "ShrinkMethod", "Specifies the method that is used to shrink the database\r\nDefault\r\nData in pages located at the end of a file is moved to pages earlier in the file. Files are truncated to reflect allocated space.\r\nEmptyFile\r\nMigrates all of the data from the referenced file to other files in the same filegroup. (DataFile and LogFile objects only).\r\nNoTruncate\r\nData in pages located at the end of a file is moved to pages earlier in the file.\r\nTruncateOnly\r\nData distribution is not affected. Files are truncated to reflect allocated space, recovering free space at the end of any file.", "", false, "false", "Default", "Default,EmptyFile,NoTruncate,TruncateOnly" ], [ "FileType", "Specifies the files types that will be shrunk\r\nAll - All Data and Log files are shrunk, using database shrink (Default)\r\nData - Just the Data files are shrunk using file shrink\r\nLog - Just the Log files are shrunk using file shrink", "", false, "false", "All", "All,Data,Log" ], [ "StepSize", "Measured in bits - but no worries! PowerShell has a very cool way of formatting bits. Just specify something like: 1MB or 10GB. See the examples for more information.\nIf specified, this will chunk a larger shrink operation into multiple smaller shrinks.\r\nIf shrinking a file by a large amount there are benefits of doing multiple smaller chunks.", "", false, "false", "0", "" ], [ "StatementTimeout", "Timeout in minutes. Defaults to infinity (shrinks can take a while).", "", false, "false", "0", "" ], [ "ExcludeIndexStats", "Exclude statistics about fragmentation.", "", false, "false", "False", "" ], [ "ExcludeUpdateUsage", "Exclude DBCC UPDATE USAGE for database.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts for confirmation of every step. For example:\nAre you sure you want to perform this action?\r\nPerforming the operation \"Shrink database\" on target \"pubs on SQL2016\\VNEXT\".\r\n[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is \"Y\"):", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbShrink [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-AllUserDatabases] [[-PercentFreeSpace] \u003cInt32\u003e] [[-ShrinkMethod] \u003cString\u003e] [[-FileType] \u003cString\u003e] [[-StepSize] \u003cInt64\u003e] [[-StatementTimeout] \u003cInt32\u003e] [-ExcludeIndexStats] [-ExcludeUpdateUsage] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbTransfer", "Description": "Invokes database transfer by either accepting an object generated by New-DbaDbTransfer, or generates such object\non the fly when provided with enough parameters. The transfer would follow the rules defined in the transfer object;\nthe list of such rules could be displayed when listing members of the transfer object:\n\n$transfer = New-DbaDbTransfer -SqlInstance MyInstance -Database MyDB\n$transfer | Get-Member", "Tags": "Migration", "Synopsis": "Invokes database transfer using a transfer object that clones objects from one database to another.", "Alias": "", "Author": "Kirill Kravtsov (@nvarscar)", "CommandName": "Invoke-DbaDbTransfer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbTransfer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbTransfer -SqlInstance sql1 -DestinationSqlInstance sql2 -Database mydb -CopyAll Tables -DestinationDatabase newdb\nCopies all tables from database mydb on sql1 to database newdb on sql2.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaDbTransfer -SqlInstance sql1 -DestinationSqlInstance sql2 -Database mydb -CopyAllObjects\nCopies all objects from database mydb on sql1 to database mydb on sql2.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$transfer = New-DbaDbTransfer -SqlInstance sql1 -DestinationSqlInstance sql2 -Database mydb -CopyAllObjects\nPS C:\\\u003e $transfer.Options.ScriptDrops = $true\r\nPS C:\\\u003e $transfer.SchemaOnly = $true\r\nPS C:\\\u003e $transfer | Invoke-DbaDbTransfer\nCopies object schema from database mydb on sql1 to database mydb on sql2 using customized transfer parameters.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$options = New-DbaScriptingOption\nPS C:\\\u003e $options.ScriptDrops = $true\r\nPS C:\\\u003e $transfer = New-DbaDbTransfer -SqlInstance sql1 -DestinationSqlInstance sql2 -Database mydb -CopyAll StoredProcedures -ScriptingOption $options\r\nPS C:\\\u003e $transfer | Invoke-DbaDbTransfer\nCopies procedures from database mydb on sql1 to database mydb on sql2 using custom scripting parameters.", "Params": [ [ "SqlInstance", "Source SQL Server instance name.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "DestinationSqlInstance", "Destination Sql Server. You must have appropriate access to create objects on the target server.", "", false, "false", "", "" ], [ "DestinationSqlCredential", "Login to the source instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\r\nOnly SQL authentication is supported. When not specified, uses Trusted Authentication.", "", false, "false", "", "" ], [ "Database", "The database to copy the objects from.", "", false, "false", "", "" ], [ "DestinationDatabase", "The database to copy the objects to. If not specified, it is assumed to be same as the source database.", "", false, "false", "$Database", "" ], [ "BatchSize", "The BatchSize for the data copy defaults to 5000.", "", false, "false", "50000", "" ], [ "BulkCopyTimeOut", "Value in seconds for the BulkCopy operations timeout. The default is 30 seconds.", "", false, "false", "5000", "" ], [ "ScriptingOption", "Custom scripting rules, generated by New-DbaScriptingOption", "", false, "false", "", "" ], [ "InputObject", "Enables piping of database SMO objects into the command.", "", false, "true (ByValue)", "", "" ], [ "CopyAllObjects", "Transfer all objects of the source database", "", false, "false", "False", "" ], [ "CopyAll", "Object types to be transferred from a database. Allowed values:\r\nFullTextCatalogs\r\nFullTextStopLists\r\nSearchPropertyLists\r\nTables\r\nViews\r\nStoredProcedures\r\nUserDefinedFunctions\r\nUserDefinedDataTypes\r\nUserDefinedTableTypes\r\nPlanGuides\r\nRules\r\nDefaults\r\nUsers\r\nRoles\r\nPartitionSchemes\r\nPartitionFunctions\r\nXmlSchemaCollections\r\nSqlAssemblies\r\nUserDefinedAggregates\r\nUserDefinedTypes\r\nSchemas\r\nSynonyms\r\nSequences\r\nDatabaseTriggers\r\nDatabaseScopedCredentials\r\nExternalFileFormats\r\nExternalDataSources\r\nLogins\r\nExternalLibraries", "", false, "false", "", "FullTextCatalogs,FullTextStopLists,SearchPropertyLists,Tables,Views,StoredProcedures,UserDefinedFunctions,UserDefinedDataTypes,UserDefinedTableTypes,PlanGuides,Rules,Defaults,Users,Roles,PartitionSchemes,PartitionFunctions,XmlSchemaCollections,SqlAssemblies,UserDefinedAggregates,UserDefinedTypes,Schemas,Synonyms,Sequences,DatabaseTriggers,DatabaseScopedCredentials,ExternalFileFormats,ExternalDataSources,Logins,ExternalLibraries" ], [ "SchemaOnly", "Transfers only object schema.", "", false, "false", "False", "" ], [ "DataOnly", "Transfers only data without copying schema.", "", false, "false", "False", "" ], [ "ScriptOnly", "Generate the script without moving any objects. Does not include any data - just object definitions.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbTransfer [[-SqlInstance] \u003cDbaInstanceParameter\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-DestinationSqlInstance] \u003cDbaInstanceParameter\u003e] [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString\u003e] [[-DestinationDatabase] \u003cString\u003e] [[-BatchSize] \u003cInt32\u003e] [[-BulkCopyTimeOut] \u003cInt32\u003e] [[-ScriptingOption] \u003cScriptingOptions\u003e] [[-InputObject] \u003cTransfer\u003e] [-CopyAllObjects] [[-CopyAll] \u003cString[]\u003e] [-SchemaOnly] [-DataOnly] [-ScriptOnly] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDbUpgrade", "Description": "Updates compatibility level, then runs CHECKDB with data_purity, DBCC updateusage, sp_updatestats and finally sp_refreshview against all user views.", "Tags": [ "Shrink", "Database" ], "Synopsis": "Take a database and upgrades it to compatibility of the SQL Instance its hosted on. Based on https://thomaslarock.com/2014/06/upgrading-to-sql-server-2014-a-dozen-things-to-check/", "Alias": "", "Author": "Stephen Bennett, https://sqlnotesfromtheunderground.wordpress.com/", "CommandName": "Invoke-DbaDbUpgrade", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDbUpgrade", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDbUpgrade -SqlInstance PRD-SQL-MSD01 -Database Test\nRuns the below processes against the databases\r\n-- Puts compatibility of database to level of SQL Instance\r\n-- Runs CHECKDB DATA_PURITY\r\n-- Runs DBCC UPDATESUSAGE\r\n-- Updates all users statistics\r\n-- Runs sp_refreshview against every view in the database\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaDbUpgrade -SqlInstance PRD-SQL-INT01 -Database Test -NoRefreshView\nRuns the upgrade command skipping the sp_refreshview update on all views\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInvoke-DbaDbUpgrade -SqlInstance PRD-SQL-INT01 -Database Test -Force\nIf database Test is already at the correct compatibility, runs every necessary step\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2016 | Out-GridView -Passthru | Invoke-DbaDbUpgrade\nGet only specific databases using GridView and pass those to Invoke-DbaDbUpgrade", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "SqlLogin to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance..", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is autopopulated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is autopopulated from the server", "", false, "false", "", "" ], [ "NoCheckDb", "Skip checkdb", "", false, "false", "False", "" ], [ "NoUpdateUsage", "Skip usage update", "", false, "false", "False", "" ], [ "NoUpdateStats", "Skip stats update", "", false, "false", "False", "" ], [ "NoRefreshView", "Skip view update", "", false, "false", "False", "" ], [ "AllUserDatabases", "Run command against all user databases", "", false, "false", "False", "" ], [ "Force", "Don\u0027t skip over databases that are already at the same level the instance is", "", false, "false", "False", "" ], [ "InputObject", "A collection of databases (such as returned by Get-DbaDatabase)", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run", "wi", false, "false", "", "" ], [ "Confirm", "Prompts for confirmation of every step. For example:\nAre you sure you want to perform this action?\r\nPerforming the operation \"Update database\" on target \"pubs on SQL2016\\VNEXT\".\r\n[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is \"Y\"):", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDbUpgrade [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-NoCheckDb] [-NoUpdateUsage] [-NoUpdateStats] [-NoRefreshView] [-AllUserDatabases] [-Force] [-InputObject \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaDiagnosticQuery", "Description": "This is the main function of the Sql Server Diagnostic Queries related functions in dbatools.\nThe diagnostic queries are developed and maintained by Glenn Berry and they can be found here along with a lot of documentation:\nhttps://glennsqlperformance.com/resources/\n\nThe most recent version of the diagnostic queries are included in the dbatools module.\nBut it is possible to download a newer set or a specific version to an alternative location and parse and run those scripts.\nIt will run all or a selection of those scripts on one or multiple servers and return the result as a PowerShell Object", "Tags": [ "Community", "GlennBerry" ], "Synopsis": "Invoke-DbaDiagnosticQuery runs the scripts provided by Glenn Berry\u0027s DMV scripts on specified servers", "Alias": "", "Author": "Andre Kamman (@AndreKamman), http://andrekamman.com", "CommandName": "Invoke-DbaDiagnosticQuery", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaDiagnosticQuery", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaDiagnosticQuery -SqlInstance sql2016\nRun the selection made by the user on the Sql Server instance specified.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaDiagnosticQuery -SqlInstance sql2016 -UseSelectionHelper | Export-DbaDiagnosticQuery -Path C:\\temp\\gboutput\nProvides a grid view with all the queries to choose from and will run the selection made by the user on the SQL Server instance specified.\r\nThen it will export the results to Export-DbaDiagnosticQuery.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInvoke-DbaDiagnosticQuery -SqlInstance localhost -ExportQueries -OutputPath \"C:\\temp\\DiagnosticQueries\"\nExport All Queries to Disk\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInvoke-DbaDiagnosticQuery -SqlInstance localhost -DatabaseSpecific -ExportQueries -OutputPath \"C:\\temp\\DiagnosticQueries\"\nExport Database Specific Queries for all User Dbs\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eInvoke-DbaDiagnosticQuery -SqlInstance localhost -DatabaseSpecific -DatabaseName \u0027tempdb\u0027 -ExportQueries -OutputPath \"C:\\temp\\DiagnosticQueries\"\nExport Database Specific Queries For One Target Database\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eInvoke-DbaDiagnosticQuery -SqlInstance localhost -DatabaseSpecific -DatabaseName \u0027tempdb\u0027 -ExportQueries -OutputPath \"C:\\temp\\DiagnosticQueries\" -QueryName \u0027Database-scoped Configurations\u0027\nExport Database Specific Queries For One Target Database and One Specific Query\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eInvoke-DbaDiagnosticQuery -SqlInstance localhost -UseSelectionHelper\nChoose Queries To Export\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003e[PSObject[]]$results = Invoke-DbaDiagnosticQuery -SqlInstance localhost -WhatIf\nParse the appropriate diagnostic queries by connecting to server, and instead of running them, return as [PSCustomObject[]] to work with further\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003e$results = Invoke-DbaDiagnosticQuery -SqlInstance Sql2017 -DatabaseSpecific -QueryName \u0027Database-scoped Configurations\u0027 -DatabaseName TestStuff\nRun diagnostic queries targeted at specific database, and only run database level queries against this database.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Can be either a string or SMO server", "", true, "true (ByValue)", "", "" ], [ "Database", "The database(s) to process. If unspecified, all databases will be processed", "DatabaseName", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude", "", false, "false", "", "" ], [ "ExcludeQuery", "The Queries to exclude", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "Credential", false, "false", "", "" ], [ "Path", "Alternate path for the diagnostic scripts", "", false, "false", "", "" ], [ "QueryName", "Only run specific query", "", false, "false", "", "" ], [ "UseSelectionHelper", "Provides a grid view with all the queries to choose from and will run the selection made by the user on the Sql Server instance specified.", "", false, "false", "False", "" ], [ "InstanceOnly", "Run only instance level queries", "", false, "false", "False", "" ], [ "DatabaseSpecific", "Run only database level queries", "", false, "false", "False", "" ], [ "ExcludeQueryTextColumn", "Use this switch to exclude the [Complete Query Text] column from relevant queries", "", false, "false", "False", "" ], [ "ExcludePlanColumn", "Use this switch to exclude the [Query Plan] column from relevant queries", "", false, "false", "False", "" ], [ "NoColumnParsing", "Does not parse the [Complete Query Text] and [Query Plan] columns and disregards the ExcludeQueryTextColumn and NoColumnParsing switches", "", false, "false", "False", "" ], [ "OutputPath", "Directory to parsed diagnostics queries to. This will split them based on server, database name, and query.", "", false, "false", "", "" ], [ "ExportQueries", "Use this switch to export the diagnostic queries to sql files. Instead of running the queries, the server will be evaluated to find the appropriate queries to run based on SQL Version.\r\nThese sql files will then be created in the OutputDirectory", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command would execute, but does not actually perform the command", "wi", false, "false", "", "" ], [ "Confirm", "Prompts to confirm certain actions", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbaDiagnosticQuery [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-ExcludeQuery \u003cObject[]\u003e] [-SqlCredential \u003cPSCredential\u003e] [-Path \u003cFileInfo\u003e] [-QueryName \u003cString[]\u003e] [-UseSelectionHelper] [-InstanceOnly] [-DatabaseSpecific] [-ExcludeQueryTextColumn] [-ExcludePlanColumn] [-NoColumnParsing] [-OutputPath \u003cString\u003e] [-ExportQueries] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaPfRelog", "Description": "Pipeline-compatible wrapper for the relog command. Relog is useful for converting Windows Perfmon.\n\nExtracts performance counters from performance counter logs into other formats,\nsuch as text-TSV (for tab-delimited text), text-CSV (for comma-delimited text), binary-BIN, or SQL.\n\n`relog \"C:\\PerfLogs\\Admin\\System Correlation\\WORKSTATIONX_20180112-000001\\DataCollector01.blg\" -o C:\\temp\\foo.csv -f tsv`\n\nIf you find any input hangs, please send us the output so we can accommodate for it then use -Raw for an immediate solution.", "Tags": [ "Performance", "DataCollector", "PerfCounter", "Relog" ], "Synopsis": "Pipeline-compatible wrapper for the relog command which is available on modern Windows platforms.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Invoke-DbaPfRelog", "Availability": "Windows only", "Links": "https://dbatools.io/Invoke-DbaPfRelog", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaPfRelog -Path C:\\temp\\perfmon.blg\nCreates C:\\temp\\perfmon.tsv from C:\\temp\\perfmon.blg.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaPfRelog -Path C:\\temp\\perfmon.blg -Destination C:\\temp\\a\\b\\c\nCreates the temp, a, and b directories if needed, then generates c.tsv (tab separated) from C:\\temp\\perfmon.blg.\nReturns the newly created file as a file object.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSet -ComputerName sql2016 | Get-DbaPfDataCollector | Invoke-DbaPfRelog -Destination C:\\temp\\perf\nCreates C:\\temp\\perf if needed, then generates computername-datacollectorname.tsv (tab separated) from the latest logs of all data collector sets on sql2016. This destination format was chosen to \r\navoid naming conflicts with piped input.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInvoke-DbaPfRelog -Path C:\\temp\\perfmon.blg -Destination C:\\temp\\a\\b\\c -Raw\n```\r\n[Invoke-DbaPfRelog][21:21:35] relog \"C:\\temp\\perfmon.blg\" -f csv -o C:\\temp\\a\\b\\c\nInput\r\n----------------\r\nFile(s):\r\nC:\\temp\\perfmon.blg (Binary)\nBegin: 1/13/2018 5:13:23\r\nEnd: 1/13/2018 14:29:55\r\nSamples: 2227\n100.00%\nOutput\r\n----------------\r\nFile: C:\\temp\\a\\b\\c.csv\nBegin: 1/13/2018 5:13:23\r\nEnd: 1/13/2018 14:29:55\r\nSamples: 2227\nThe command completed successfully.\r\n```\nCreates the temp, a, and b directories if needed, then generates c.tsv (tab separated) from C:\\temp\\perfmon.blg then outputs the raw results of the relog command.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eInvoke-DbaPfRelog -Path \u0027C:\\temp\\perflog with spaces.blg\u0027 -Destination C:\\temp\\a\\b\\c -Type csv -BeginTime ((Get-Date).AddDays(-30)) -EndTime ((Get-Date).AddDays(-1))\nCreates the temp, a, and b directories if needed, then generates c.csv (comma separated) from C:\\temp\\perflog with spaces.blg\u0027, starts 30 days ago and ends one day ago.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$servers | Get-DbaPfDataCollectorSet | Get-DbaPfDataCollector | Invoke-DbaPfRelog -Multithread -AllowClobber\nRelogs latest data files from all collectors within the servers listed in $servers.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollector -Collector DataCollector01 | Invoke-DbaPfRelog -AllowClobber -AllTime\nRelogs all the log files from the DataCollector01 on the local computer and allows overwrite.", "Params": [ [ "Path", "Specifies the pathname of an existing performance counter log or performance counter path. You can specify multiple input files.", "FullName", false, "true (ByPropertyName)", "", "" ], [ "Destination", "Specifies the pathname of the output file or SQL database where the counters will be written. Defaults to the same directory as the source.", "", false, "false", "", "" ], [ "Type", "The output format. Defaults to tsv. Options include tsv, csv, bin, and sql.\nFor a SQL database, the output file specifies the DSN!counter_log. You can specify the database location by using the ODBC manager to configure the DSN (Database System Name).\nFor more information, read here: https://technet.microsoft.com/en-us/library/bb490958.aspx", "", false, "false", "tsv", "tsv,csv,bin,sql" ], [ "Append", "If this switch is enabled, output will be appended to the specified file instead of overwriting. This option does not apply to SQL format where the default is always to append.", "", false, "false", "False", "" ], [ "AllowClobber", "If this switch is enabled, the destination file will be overwritten if it exists.", "", false, "false", "False", "" ], [ "PerformanceCounter", "Specifies the performance counter path to log.", "", false, "false", "", "" ], [ "PerformanceCounterPath", "Specifies the pathname of the text file that lists the performance counters to be included in a relog file. Use this option to list counter paths in an input file, one per line. Default setting is \r\nall counters in the original log file are relogged.", "", false, "false", "", "" ], [ "Interval", "Specifies sample intervals in \"n\" records. Includes every nth data point in the relog file. Default is every data point.", "", false, "false", "0", "" ], [ "BeginTime", "This is is Get-Date object and we format it for you.", "", false, "false", "", "" ], [ "EndTime", "Specifies end time for copying last record from the input file. This is is Get-Date object and we format it for you.", "", false, "false", "", "" ], [ "ConfigPath", "Specifies the pathname of the settings file that contains command-line parameters.", "", false, "false", "", "" ], [ "Summary", "If this switch is enabled, the performance counters and time ranges of log files specified in the input file will be displayed.", "", false, "false", "False", "" ], [ "InputObject", "Accepts the output of Get-DbaPfDataCollector and Get-DbaPfDataCollectorSet as input via the pipeline.", "", false, "true (ByValue)", "", "" ], [ "Multithread", "If this switch is enabled, processing will be done in parallel. This may speed up large batches or large files.", "", false, "false", "False", "" ], [ "AllTime", "If this switch is enabled and a datacollector or datacollectorset is passed in via the pipeline, collects all logs, not just the latest.", "", false, "false", "False", "" ], [ "Raw", "If this switch is enabled, the results of the DOS command instead of Get-ChildItem will be displayed. This does not run in parallel.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Invoke-DbaPfRelog [[-Path] \u003cString[]\u003e] [[-Destination] \u003cString\u003e] [[-Type] \u003cString\u003e] [-Append] [-AllowClobber] [[-PerformanceCounter] \u003cString[]\u003e] [[-PerformanceCounterPath] \u003cString\u003e] [[-Interval] \u003cInt32\u003e] [[-BeginTime] \u003cDateTime\u003e] [[-EndTime] \u003cDateTime\u003e] [[-ConfigPath] \u003cString\u003e] [-Summary] [[-InputObject] \u003cObject[]\u003e] [-Multithread] [-AllTime] [-Raw] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaQuery", "Description": "This function is a wrapper command around Invoke-DbaAsync, which in turn is based on Invoke-SqlCmd2.\nIt was designed to be more convenient to use in a pipeline and to behave in a way consistent with the rest of our functions.", "Tags": [ "Database", "Query" ], "Synopsis": "A command to run explicit T-SQL commands or files.", "Alias": "ivq", "Author": "Friedrich Weinmann (@FredWeinmann)", "CommandName": "Invoke-DbaQuery", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaQuery", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaQuery -SqlInstance server\\instance -Query \u0027SELECT foo FROM bar\u0027\nRuns the sql query \u0027SELECT foo FROM bar\u0027 against the instance \u0027server\\instance\u0027\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance [SERVERNAME] -Group [GROUPNAME] | Invoke-DbaQuery -Query \u0027SELECT foo FROM bar\u0027\nRuns the sql query \u0027SELECT foo FROM bar\u0027 against all instances in the group [GROUPNAME] on the CMS [SERVERNAME]\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\"server1\", \"server1\\nordwind\", \"server2\" | Invoke-DbaQuery -File \"C:\\scripts\\sql\\rebuild.sql\"\nRuns the sql commands stored in rebuild.sql against the instances \"server1\", \"server1\\nordwind\" and \"server2\"\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance \"server1\", \"server1\\nordwind\", \"server2\" | Invoke-DbaQuery -File \"C:\\scripts\\sql\\rebuild.sql\"\nRuns the sql commands stored in rebuild.sql against all accessible databases of the instances \"server1\", \"server1\\nordwind\" and \"server2\"\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eInvoke-DbaQuery -SqlInstance . -Query \u0027SELECT * FROM users WHERE Givenname = @name\u0027 -SqlParameter @{ Name = \"Maria\" }\nExecutes a simple query against the users table using SQL Parameters.\r\nThis avoids accidental SQL Injection and is the safest way to execute queries with dynamic content.\r\nKeep in mind the limitations inherent in parameters - it is quite impossible to use them for content references.\r\nWhile it is possible to parameterize a where condition, it is impossible to use this to select which columns to select.\r\nThe inserted text will always be treated as string content, and not as a reference to any SQL entity (such as columns, tables or databases).\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eInvoke-DbaQuery -SqlInstance aglistener1 -ReadOnly -Query \"select something from readonlydb.dbo.atable\"\nExecutes a query with ReadOnly application intent on aglistener1.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eInvoke-DbaQuery -SqlInstance \"server1\" -Database tempdb -Query \"Example_SP\" -SqlParameter @{ Name = \"Maria\" } -CommandType StoredProcedure\nExecutes a stored procedure Example_SP using SQL Parameters\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003e$QueryParameters = @{\n\"StartDate\" = $startdate;\r\n \"EndDate\" = $enddate;\r\n};\r\nPS C:\\\u003e Invoke-DbaQuery -SqlInstance \"server1\" -Database tempdb -Query \"Example_SP\" -SqlParameter $QueryParameters -CommandType StoredProcedure\nExecutes a stored procedure Example_SP using multiple SQL Parameters\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003e$inparam = @()\nPS C:\\\u003e $inparam += [pscustomobject]@{\r\n\u003e\u003e somestring = \u0027string1\u0027\r\n\u003e\u003e somedate = \u00272021-07-15T01:02:00\u0027\r\n\u003e\u003e }\r\nPS C:\\\u003e $inparam += [pscustomobject]@{\r\n\u003e\u003e somestring = \u0027string2\u0027\r\n\u003e\u003e somedate = \u00272021-07-15T02:03:00\u0027\r\n\u003e\u003e }\r\n\u003e\u003e $inparamAsDataTable = ConvertTo-DbaDataTable -InputObject $inparam\r\nPS C:\\\u003e New-DbaSqlParameter -SqlDbType structured -Value $inparamAsDataTable -TypeName \u0027dbatools_tabletype\u0027\r\nPS C:\\\u003e Invoke-DbaQuery -SqlInstance localhost -Database master -CommandType StoredProcedure -Query my_proc -SqlParameter $inparamAsDataTable\nCreates an TVP input parameter and uses it to invoke a stored procedure.\n-------------------------- EXAMPLE 10 --------------------------\nPS C:\\\u003e$output = New-DbaSqlParameter -ParameterName json_result -SqlDbType NVarChar -Size -1 -Direction Output\nPS C:\\\u003e Invoke-DbaQuery -SqlInstance localhost -Database master -CommandType StoredProcedure -Query my_proc -SqlParameter $output\r\nPS C:\\\u003e $output.Value\nCreates an output parameter and uses it to invoke a stored procedure.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Credential object used to connect to the SQL Server Instance as a different user. This can be a Windows or SQL Server account. Windows users are determined by the existence of a backslash, so if you \r\nare intending to use an alternative Windows connection instead of a SQL login, ensure it contains a backslash.", "", false, "false", "", "" ], [ "Database", "The database to select before running the query. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "Query", "Specifies one or more queries to be run. The queries can be Transact-SQL, XQuery statements, or sqlcmd commands. Multiple queries in a single batch may be separated by a semicolon or a GO\nEscape any double quotation marks included in the string.\nConsider using bracketed identifiers such as [MyTable] instead of quoted identifiers such as \"MyTable\".", "", true, "false", "", "" ], [ "QueryTimeout", "Specifies the number of seconds before the queries time out.", "", false, "false", "600", "" ], [ "File", "Specifies the path to one or several files to be used as the query input.", "InputFile", true, "false", "", "" ], [ "SqlObject", "Specify one or more SQL objects. Those will be converted to script and their scripts run on the target system(s).", "", true, "false", "", "" ], [ "As", "Specifies output type. Valid options for this parameter are \u0027DataSet\u0027, \u0027DataTable\u0027, \u0027DataRow\u0027, \u0027PSObject\u0027, \u0027PSObjectArray\u0027, and \u0027SingleValue\u0027.\nPSObject and PSObjectArray output introduces overhead but adds flexibility for working with results: https://forums.powershell.org/t/dealing-with-dbnull/2328/2", "", false, "false", "DataRow", "DataSet,DataTable,DataRow,PSObject,PSObjectArray,SingleValue" ], [ "SqlParameter", "Specifies a hashtable of parameters or output from New-DbaSqlParameter for parameterized SQL queries. http://blog.codinghorror.com/give-me-parameterized-sql-or-give-me-death/", "SqlParameters", false, "false", "", "" ], [ "CommandType", "Specifies the type of command represented by the query string. Valid options for this parameter are \u0027Text\u0027, \u0027TableDirect\u0027, and \u0027StoredProcedure\u0027.\r\nDefault is \u0027Text\u0027. Further information: https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlcommand.commandtype", "", false, "false", "Text", "" ], [ "AppendServerInstance", "If this switch is enabled, the SQL Server instance will be appended to PSObject and DataRow output.", "", false, "false", "False", "" ], [ "MessagesToOutput", "Use this switch to have on the output stream messages too (e.g. PRINT statements). Output will hold the resultset too.", "", false, "false", "False", "" ], [ "InputObject", "A collection of databases (such as returned by Get-DbaDatabase)", "", false, "true (ByValue)", "", "" ], [ "ReadOnly", "Execute the query with ReadOnly application intent.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Invoke-DbaQuery [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cString\u003e] -Query \u003cString\u003e [-QueryTimeout \u003cInt32\u003e] [-As \u003cString\u003e] [-SqlParameter \u003cPSObject[]\u003e] [-CommandType {Text | StoredProcedure | TableDirect}] [-AppendServerInstance] [-MessagesToOutput] [-InputObject \u003cDatabase[]\u003e] [-ReadOnly] [-EnableException] [\u003cCommonParameters\u003e]\nInvoke-DbaQuery [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cString\u003e] [-QueryTimeout \u003cInt32\u003e] -SqlObject \u003cSqlSmoObject[]\u003e [-As \u003cString\u003e] [-SqlParameter \u003cPSObject[]\u003e] [-CommandType {Text | StoredProcedure | TableDirect}] [-AppendServerInstance] [-MessagesToOutput] [-InputObject \u003cDatabase[]\u003e] [-ReadOnly] [-EnableException] [\u003cCommonParameters\u003e]\nInvoke-DbaQuery [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cString\u003e] [-QueryTimeout \u003cInt32\u003e] -File \u003cObject[]\u003e [-As \u003cString\u003e] [-SqlParameter \u003cPSObject[]\u003e] [-CommandType {Text | StoredProcedure | TableDirect}] [-AppendServerInstance] [-MessagesToOutput] [-InputObject \u003cDatabase[]\u003e] [-ReadOnly] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbatoolsFormatter", "Description": "Uses PSSA\u0027s Invoke-Formatter to format the target files and saves it without the BOM.", "Tags": [ "Module", "Support" ], "Synopsis": "Helps formatting function files to dbatools\u0027 standards", "Alias": "", "Author": "Simone Bizzotto", "CommandName": "Invoke-DbatoolsFormatter", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbatoolsFormatter", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbatoolsFormatter -Path C:\\dbatools\\functions\\Get-DbaDatabase.ps1\nReformats C:\\dbatools\\functions\\Get-DbaDatabase.ps1 to dbatools\u0027 standards", "Params": [ [ "Path", "The path to the ps1 file that needs to be formatted", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Invoke-DbatoolsFormatter [-Path] \u003cObject[]\u003e [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbatoolsRenameHelper", "Description": "Older dbatools command names have been changed. This script helps keep up.", "Tags": "Module", "Synopsis": "Older dbatools command names have been changed. This script helps keep up.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Invoke-DbatoolsRenameHelper", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbatoolsRenameHelper", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-ChildItem C:\\temp\\ps\\*.ps1 -Recurse | Invoke-DbatoolsRenameHelper\nChecks to see if any ps1 file in C:\\temp\\ps matches an old command name.\r\nIf so, then the command name within the text is updated and the resulting changes are written to disk in UTF-8.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-ChildItem C:\\temp\\ps\\*.ps1 -Recurse | Invoke-DbatoolsRenameHelper -Encoding Ascii -WhatIf\nShows what would happen if the command would run. If the command would run and there were matches,\r\nthe resulting changes would be written to disk as Ascii encoded.", "Params": [ [ "InputObject", "A piped in object from Get-ChildItem", "", true, "true (ByValue)", "", "" ], [ "Encoding", "Specifies the file encoding. The default is UTF8.\nValid values are:\r\n-- ASCII: Uses the encoding for the ASCII (7-bit) character set.\r\n-- BigEndianUnicode: Encodes in UTF-16 format using the big-endian byte order.\r\n-- Byte: Encodes a set of characters into a sequence of bytes.\r\n-- String: Uses the encoding type for a string.\r\n-- Unicode: Encodes in UTF-16 format using the little-endian byte order.\r\n-- UTF7: Encodes in UTF-7 format.\r\n-- UTF8: Encodes in UTF-8 format.\r\n-- Unknown: The encoding type is unknown or invalid. The data can be treated as binary.", "", false, "false", "UTF8", "ASCII,BigEndianUnicode,Byte,String,Unicode,UTF7,UTF8,Unknown" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command", "cf", false, "false", "", "" ] ], "Syntax": "Invoke-DbatoolsRenameHelper [-InputObject] \u003cFileInfo[]\u003e [[-Encoding] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaWhoIsActive", "Description": "Output results of Adam Machanic\u0027s sp_WhoIsActive\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": [ "Community", "WhoIsActive" ], "Synopsis": "Outputs results of Adam Machanic\u0027s sp_WhoIsActive DataTable", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Invoke-DbaWhoIsActive", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaWhoIsActive", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eInvoke-DbaWhoIsActive -SqlInstance sqlserver2014a\nExecute sp_whoisactive on sqlserver2014a. This command expects sp_WhoIsActive to be in the master database. Logs into the SQL Server with Windows credentials.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eInvoke-DbaWhoIsActive -SqlInstance sqlserver2014a -SqlCredential $credential -Database dbatools\nExecute sp_whoisactive on sqlserver2014a. This command expects sp_WhoIsActive to be in the dbatools database. Logs into the SQL Server with SQL Authentication.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eInvoke-DbaWhoIsActive -SqlInstance sqlserver2014a -GetAverageTime\nSimilar to running sp_WhoIsActive @get_avg_time\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eInvoke-DbaWhoIsActive -SqlInstance sqlserver2014a -GetOuterCommand -FindBlockLeaders\nSimilar to running sp_WhoIsActive @get_outer_command = 1, @find_block_leaders = 1", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database where sp_WhoIsActive is installed. Defaults to master. If the sp_WhoIsActive is not installed, the command will warn and exit.", "", false, "false", "", "" ], [ "Filter", "FiltersBoth inclusive and exclusive\r\nSet either filter to \u0027\u0027 to disable\r\nSession is a session ID, and either 0 or \u0027\u0027 can be used to indicate \"all\" sessions\r\nAll other filter types support % or _ as wildcards", "As", false, "false", "", "" ], [ "FilterType", "Valid filter types are: session, program, database, login, and host", "", false, "false", "Session", "Session,Program,Database,Login,Host" ], [ "NotFilter", "FiltersBoth inclusive and exclusive\r\nSet either filter to \u0027\u0027 to disable\r\nSession is a session ID, and either 0 or \u0027\u0027 can be used to indicate \"all\" sessions\r\nAll other filter types support % or _ as wildcards", "", false, "false", "", "" ], [ "NotFilterType", "Valid filter types are: session, program, database, login, and host", "", false, "false", "Session", "Session,Program,Database,Login,Host" ], [ "ShowOwnSpid", "Retrieve data about the calling session?", "", false, "false", "False", "" ], [ "ShowSystemSpids", "Retrieve data about system sessions?", "", false, "false", "False", "" ], [ "ShowSleepingSpids", "Controls how sleeping SPIDs are handled, based on the idea of levels of interest\r\n0 does not pull any sleeping SPIDs\r\n1 pulls only those sleeping SPIDs that also have an open transaction\r\n2 pulls all sleeping SPIDs", "", false, "false", "0", "" ], [ "GetFullInnerText", "If 1, gets the full stored procedure or running batch, when available\r\nIf 0, gets only the actual statement that is currently running in the batch or procedure", "", false, "false", "False", "" ], [ "GetPlans", "Get associated query plans for running tasks, if available\r\nIf 1, gets the plan based on the request\u0027s statement offset\r\nIf 2, gets the entire plan based on the request\u0027s plan_handle", "", false, "false", "0", "" ], [ "GetOuterCommand", "Get the associated outer ad hoc query or stored procedure call, if available", "", false, "false", "False", "" ], [ "GetTransactionInfo", "Enables pulling transaction log write info and transaction duration", "", false, "false", "False", "" ], [ "GetTaskInfo", "Get information on active tasks, based on three interest levels\r\nLevel 0 does not pull any task-related information\r\nLevel 1 is a lightweight mode that pulls the top non-CXPACKET wait, giving preference to blockers\r\nLevel 2 pulls all available task-based metrics, including:\r\nnumber of active tasks, current wait stats, physical I/O, context switches, and blocker information", "", false, "false", "0", "" ], [ "GetLocks", "Gets associated locks for each request, aggregated in an XML format", "", false, "false", "False", "" ], [ "GetAverageTime", "Get average time for past runs of an active query\r\n(based on the combination of plan handle, sql handle, and offset)", "", false, "false", "False", "" ], [ "GetAdditonalInfo", "Get additional non-performance-related information about the session or request text_size, language, date_format, date_first, quoted_identifier, arithabort, ansi_null_dflt_on, ansi_defaults, \r\nansi_warnings, ansi_padding, ansi_nulls, concat_null_yields_null, transaction_isolation_level, lock_timeout, deadlock_priority, row_count, command_type\nIf a SQL Agent job is running, an subnode called agent_info will be populated with some or all of the following: job_id, job_name, step_id, step_name, msdb_query_error (in the event of an error)\nIf @get_task_info is set to 2 and a lock wait is detected, a subnode called block_info will be populated with some or all of the following: lock_type, database_name, object_id, file_id, hobt_id, \r\napplock_hash, metadata_resource, metadata_class_id, object_name, schema_name", "", false, "false", "False", "" ], [ "FindBlockLeaders", "Walk the blocking chain and count the number of\r\ntotal SPIDs blocked all the way down by a given session\r\nAlso enables task_info Level 1, if @get_task_info is set to 0", "", false, "false", "False", "" ], [ "DeltaInterval", "Pull deltas on various metrics\r\nInterval in seconds to wait before doing the second data pull", "", false, "false", "0", "" ], [ "OutputColumnList", "List of desired output columns, in desired order\r\nNote that the final output will be the intersection of all enabled features and all columns in the list. Therefore, only columns associated with enabled features will actually appear in the output. \r\nLikewise, removing columns from this list may effectively disable features, even if they are turned on\nEach element in this list must be one of the valid output column names. Names must be delimited by square brackets. White space, formatting, and additional characters are allowed, as long as the list \r\ncontains exact matches of delimited valid column names.", "", false, "false", "[dd%][session_id][sql_text][sql_command][login_name][wait_info][tasks][tran_log%][cpu%][temp%][block%][reads%][writes%][context%][physical%][query_plan][locks][%]", "" ], [ "SortOrder", "Column(s) by which to sort output, optionally with sort directions.\r\nValid column choices:\r\nsession_id, physical_io, reads, physical_reads, writes, tempdb_allocations,\r\ntempdb_current, CPU, context_switches, used_memory, physical_io_delta,\r\nreads_delta, physical_reads_delta, writes_delta, tempdb_allocations_delta,\r\ntempdb_current_delta, CPU_delta, context_switches_delta, used_memory_delta,\r\ntasks, tran_start_time, open_tran_count, blocking_session_id, blocked_session_count,\r\npercent_complete, host_name, login_name, database_name, start_time, login_time\nNote that column names in the list must be bracket-delimited. Commas and/or white space are not required.", "", false, "false", "[start_time] ASC", "" ], [ "FormatOutput", "Formats some of the output columns in a more \"human readable\" form\r\n0 disables output format\r\n1 formats the output for variable-width fonts\r\n2 formats the output for fixed-width fonts", "", false, "false", "1", "" ], [ "DestinationTable", "If set to a non-blank value, the script will attempt to insert into the specified destination table. Please note that the script will not verify that the table exists, or that it has the correct \r\nschema, before doing the insert. Table can be specified in one, two, or three-part format", "", false, "false", "", "" ], [ "ReturnSchema", "If set to 1, no data collection will happen and no result set will be returned; instead, a CREATE TABLE statement will be returned via the @schema parameter, which will match the schema of the result \r\nset that would be returned by using the same collection of the rest of the parameters. The CREATE TABLE statement will have a placeholder token of \u003ctable_name\u003e in place of an actual table name.", "", false, "false", "False", "" ], [ "Schema", "If set to 1, no data collection will happen and no result set will be returned; instead, a CREATE TABLE statement will be returned via the @schema parameter, which will match the schema of the result \r\nset that would be returned by using the same collection of the rest of the parameters. The CREATE TABLE statement will have a placeholder token of \u003ctable_name\u003e in place of an actual table name.", "", false, "false", "", "" ], [ "Help", "Help! What do I do?", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Invoke-DbaWhoIsActive [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject\u003e] [[-Filter] \u003cString\u003e] [[-FilterType] \u003cString\u003e] [[-NotFilter] \u003cString\u003e] [[-NotFilterType] \u003cString\u003e] [-ShowOwnSpid] [-ShowSystemSpids] [[-ShowSleepingSpids] \u003cInt32\u003e] [-GetFullInnerText] [[-GetPlans] \u003cInt32\u003e] [-GetOuterCommand] [-GetTransactionInfo] [[-GetTaskInfo] \u003cInt32\u003e] [-GetLocks] [-GetAverageTime] [-GetAdditonalInfo] [-FindBlockLeaders] [[-DeltaInterval] \u003cInt32\u003e] [[-OutputColumnList] \u003cString\u003e] [[-SortOrder] \u003cString\u003e] [[-FormatOutput] \u003cInt32\u003e] [[-DestinationTable] \u003cString\u003e] \r\n[-ReturnSchema] [[-Schema] \u003cString\u003e] [-Help] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Invoke-DbaXEReplay", "Description": "This command replays events from Read-DbaXEFile. It is simplistic in its approach.\n\n- Writes all queries to a temp sql file\n- Executes temp file using . $sqlcmd so that batches are executed properly\n- Deletes temp file", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "This command replays events from Read-DbaXEFile on one or more target servers", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Invoke-DbaXEReplay", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Invoke-DbaXEReplay", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRead-DbaXEFile -Path C:\\temp\\sample.xel | Invoke-DbaXEReplay -SqlInstance sql2017\nRuns all batch_text for sql_batch_completed against tempdb on sql2017.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRead-DbaXEFile -Path C:\\temp\\sample.xel | Invoke-DbaXEReplay -SqlInstance sql2017 -Database planning -Event sql_batch_completed\nSets the *initial* database to planning then runs only sql_batch_completed against sql2017.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRead-DbaXEFile -Path C:\\temp\\sample.xel | Invoke-DbaXEReplay -SqlInstance sql2017, sql2016\nRuns all batch_text for sql_batch_completed against tempdb on sql2017 and sql2016.", "Params": [ [ "SqlInstance", "Target SQL Server(s)", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The initial starting database.", "", false, "false", "", "" ], [ "Event", "Each Response can be limited to processing specific events, while ignoring all the other ones. When this attribute is omitted, all events are processed.", "", false, "false", "@(\u0027sql_batch_completed\u0027, \u0027rcp_completed\u0027)", "" ], [ "InputObject", "Accepts the object output of Read-DbaXESession.", "", true, "true (ByValue)", "", "" ], [ "Raw", "By dafault, the results of . $sqlcmd are collected, cleaned up and displayed. If you\u0027d like to see all results immeidately, use Raw.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Invoke-DbaXEReplay [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Event] \u003cString[]\u003e] [-InputObject] \u003cObject\u003e [-Raw] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Join-DbaAvailabilityGroup", "Description": "Joins a secondary replica to an availability group on a SQL Server instance.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Joins a secondary replica to an availability group on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Join-DbaAvailabilityGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Join-DbaAvailabilityGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sql01 -AvailabilityGroup SharePoint | Join-DbaAvailabilityGroup -SqlInstance sql02\nJoins sql02 to the SharePoint availability group on sql01\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$ag = Get-DbaAvailabilityGroup -SqlInstance sql01 -AvailabilityGroup SharePoint\nPS C:\\\u003e Join-DbaAvailabilityGroup -SqlInstance sql02 -InputObject $ag\nJoins sql02 to the SharePoint availability group on sql01\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sql01 -AvailabilityGroup SharePoint | Join-DbaAvailabilityGroup -SqlInstance sql02 -WhatIf\nShows what would happen if the command were to run. No actions are actually performed.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sql01 -AvailabilityGroup SharePoint | Join-DbaAvailabilityGroup -SqlInstance sql02 -Confirm\nPrompts for confirmation then joins sql02 to the SharePoint availability group on sql01.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "The availability group to join.", "", false, "false", "", "" ], [ "ClusterType", "Cluster type of the Availability Group. Only supported in SQL Server 2017 and above.\r\nOptions include: External, Wsfc or None.", "", false, "false", "", "External,Wsfc,None" ], [ "InputObject", "Enables piped input from Get-DbaAvailabilityGroup.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Join-DbaAvailabilityGroup [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [[-ClusterType] \u003cString\u003e] [[-InputObject] \u003cAvailabilityGroup[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Join-DbaPath", "Description": "Performs multisegment path joins.", "Synopsis": "Performs multisegment path joins.", "Alias": "", "CommandName": "Join-DbaPath", "Availability": "Windows, Linux, macOS", "Links": null, "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eJoin-DbaPath -Path \u0027C:\\temp\u0027 \u0027Foo\u0027 \u0027Bar\u0027\nReturns \u0027C:\\temp\\Foo\\Bar\u0027 on windows.\r\nReturns \u0027C:/temp/Foo/Bar\u0027 on non-windows.", "Params": [ [ "Path", "The basepath to join on.", "", true, "false", "", "" ], [ "SqlInstance", "Optional -- tests to see if destination SQL Server is Linux or Windows", "", false, "false", "", "" ], [ "Child", "Any number of child paths to add.", "ChildPath", false, "false", "", "" ] ], "Syntax": "Join-DbaPath [-Path] \u003cString\u003e [-SqlInstance \u003cDbaInstanceParameter\u003e] [-Child \u003cString[]\u003e] [\u003cCommonParameters\u003e]" }, { "Name": "Measure-DbaBackupThroughput", "Description": "Returns backup history details for one or more databases on a SQL Server.\n\nOutput looks like this:\nSqlInstance : sql2016\nDatabase : SharePoint_Config\nAvgThroughput : 1.07 MB\nAvgSize : 24.17\nAvgDuration : 00:00:01.1000000\nMinThroughput : 0.02 MB\nMaxThroughput : 2.26 MB\nMinBackupDate : 8/6/2015 10:22:01 PM\nMaxBackupDate : 6/19/2016 12:57:45 PM\nBackupCount : 10", "Tags": [ "Backup", "Database" ], "Synopsis": "Determines how quickly SQL Server is backing up databases to media.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Measure-DbaBackupThroughput", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Measure-DbaBackupThroughput", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eMeasure-DbaBackupThroughput -SqlInstance sql2016\nParses every backup in msdb\u0027s backuphistory for stats on all databases.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eMeasure-DbaBackupThroughput -SqlInstance sql2016 -Database AdventureWorks2014\nParses every backup in msdb\u0027s backuphistory for stats on AdventureWorks2014.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eMeasure-DbaBackupThroughput -SqlInstance sql2005 -Last\nProcesses the last full, diff and log backups every backup for all databases on sql2005.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eMeasure-DbaBackupThroughput -SqlInstance sql2005 -Last -Type Log\nProcesses the last log backups every backup for all databases on sql2005.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eMeasure-DbaBackupThroughput -SqlInstance sql2016 -Since (Get-Date).AddDays(-7) | Where-Object { $_.MinThroughput.Gigabyte -gt 1 }\nGets backup calculations for the last week and filters results that have a minimum of 1GB throughput\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eMeasure-DbaBackupThroughput -SqlInstance sql2016 -Since (Get-Date).AddDays(-365) -Database bigoldb\nGets backup calculations, limited to the last year and only the bigoldb database", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "Since", "All backups taken on or after the point in time represented by this datetime object will be processed.", "", false, "false", "", "" ], [ "Last", "If this switch is enabled, only the last backup will be measured.", "", false, "false", "False", "" ], [ "Type", "By default, this command measures the speed of Full backups. Valid options are \"Full\", \"Log\" and \"Differential\".", "", false, "false", "Full", "Full,Log,Differential,File,Differential File,Partial Full,Partial Differential" ], [ "DeviceType", "Specifies one or more DeviceTypes to use in filtering backup sets. Valid values are \"Disk\", \"Permanent Disk Device\", \"Tape\", \"Permanent Tape Device\", \"Pipe\", \"Permanent Pipe Device\" and \"Virtual \r\nDevice\", as well as custom integers for your own DeviceTypes.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Measure-DbaBackupThroughput [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-Since] \u003cDateTime\u003e] [-Last] [[-Type] \u003cString\u003e] [[-DeviceType] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Measure-DbaDbVirtualLogFile", "Description": "Having a transaction log file with too many virtual log files (VLFs) can hurt database performance.\n\nToo many VLFs 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\nReferences:\nhttp://www.sqlskills.com/blogs/kimberly/transaction-log-vlfs-too-many-or-too-few/\nhttp://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": [ "VLF", "Database" ], "Synopsis": "Returns calculations on the database virtual log files for database on a SQL instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Measure-DbaDbVirtualLogFile", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Measure-DbaDbVirtualLogFile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eMeasure-DbaDbVirtualLogFile -SqlInstance sqlcluster\nReturns all user database virtual log file counts for the sqlcluster instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eMeasure-DbaDbVirtualLogFile -SqlInstance sqlserver | Where-Object {$_.Total -ge 50}\nReturns user databases that have 50 or more VLFs.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e@(\u0027sqlserver\u0027,\u0027sqlcluster\u0027) | Measure-DbaDbVirtualLogFile\nReturns all VLF information for the sqlserver and sqlcluster SQL Server instances. Processes data via the pipeline.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eMeasure-DbaDbVirtualLogFile -SqlInstance sqlcluster -Database db1, db2\nReturns VLF counts for the db1 and db2 databases on sqlcluster.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "IncludeSystemDBs", "If this switch is enabled, system database information will be displayed.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Measure-DbaDbVirtualLogFile [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-IncludeSystemDBs] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Measure-DbaDiskSpaceRequirement", "Description": "Returns a file list from source and destination where source file may overwrite destination. Complex scenarios where a new file may exist is taken into account.\nThis command will accept a hash object in pipeline with the following keys: Source, SourceDatabase, Destination. Using this command will provide a way to prepare before a complex migration with multiple databases from different sources and destinations.", "Tags": [ "Server", "Management", "Space", "Database" ], "Synopsis": "Calculate the space needed to copy and possibly replace a database from one SQL server to another.", "Alias": "", "Author": "Pollus Brodeur (@pollusb)", "CommandName": "Measure-DbaDiskSpaceRequirement", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Measure-DbaDiskSpaceRequirement", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eMeasure-DbaDiskSpaceRequirement -Source INSTANCE1 -Database DB1 -Destination INSTANCE2\nCalculate space needed for a simple migration with one database with the same name at destination.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e@(\n\u003e\u003e [PSCustomObject]@{Source=\u0027SQL1\u0027;Destination=\u0027SQL2\u0027;Database=\u0027DB1\u0027},\r\n\u003e\u003e [PSCustomObject]@{Source=\u0027SQL1\u0027;Destination=\u0027SQL2\u0027;Database=\u0027DB2\u0027}\r\n\u003e\u003e ) | Measure-DbaDiskSpaceRequirement\nUsing a PSCustomObject with 2 databases to migrate on SQL2.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eImport-Csv -Path .\\migration.csv -Delimiter \"`t\" | Measure-DbaDiskSpaceRequirement | Format-Table -AutoSize\nUsing a CSV file. You will need to use this header line \"Source\u003ctab\u003eDestination\u003ctab\u003eDatabase\u003ctab\u003eDestinationDatabase\".\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$qry = \"SELECT Source, Destination, Database FROM dbo.Migrations\"\nPS C:\\\u003e Invoke-DbaCmd -SqlInstance DBA -Database Migrations -Query $qry | Measure-DbaDiskSpaceRequirement\nUsing a SQL table. We are DBA after all!", "Params": [ [ "Source", "Source SQL Server.", "", true, "true (ByPropertyName)", "", "" ], [ "Database", "The database to copy. It MUST exist.", "", true, "true (ByPropertyName)", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "true (ByPropertyName)", "", "" ], [ "Destination", "Destination SQL Server instance.", "", true, "true (ByPropertyName)", "", "" ], [ "DestinationDatabase", "The database name at destination.\r\nMay or may not be present, if unspecified it will default to the database name provided in SourceDatabase.", "", false, "true (ByPropertyName)", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "true (ByPropertyName)", "", "" ], [ "Credential", "The credentials to use to connect via CIM/WMI/PowerShell remoting.", "", false, "true (ByPropertyName)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Measure-DbaDiskSpaceRequirement [-Source] \u003cDbaInstanceParameter\u003e [-Database] \u003cString\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter\u003e [[-DestinationDatabase] \u003cString\u003e] [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Measure-DbatoolsImport", "Description": "Displays the import load times of the dbatools PowerShell module", "Tags": [ "Module", "Support" ], "Synopsis": "Displays the import load times of the dbatools PowerShell module", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Measure-DbatoolsImport", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Measure-DbatoolsImport", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eMeasure-DbatoolsImport\nDisplays the import load times of the dbatools PowerShell module\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eImport-Module dbatools\nPS C:\\\u003e Measure-DbatoolsImport\nDisplays the import load times of the dbatools PowerShell module", "Params": [ ], "Syntax": "Measure-DbatoolsImport [\u003cCommonParameters\u003e]" }, { "Name": "Mount-DbaDatabase", "Description": "This command will attach a SQL Server database.", "Tags": "Database", "Synopsis": "Attach a SQL Server Database - aliased to Attach-DbaDatabase", "Alias": "Attach-DbaDatabase", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Mount-DbaDatabase", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Mount-DbaDatabase", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$fileStructure = New-Object System.Collections.Specialized.StringCollection\nPS C:\\\u003e $fileStructure.Add(\"E:\\archive\\example.mdf\")\r\nPS C:\\\u003e $filestructure.Add(\"E:\\archive\\example.ldf\")\r\nPS C:\\\u003e $filestructure.Add(\"E:\\archive\\example.ndf\")\r\nPS C:\\\u003e Mount-DbaDatabase -SqlInstance sql2016 -Database example -FileStructure $fileStructure\nAttaches a database named \"example\" to sql2016 with the files \"E:\\archive\\example.mdf\", \"E:\\archive\\example.ldf\" and \"E:\\archive\\example.ndf\". The database owner will be set to sa and the attach \r\noption is None.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eMount-DbaDatabase -SqlInstance sql2016 -Database example\nSince the FileStructure was not provided, this command will attempt to determine it based on backup history. If found, a database named example will be attached to sql2016.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eMount-DbaDatabase -SqlInstance sql2016 -Database example -WhatIf\nShows what would happen if the command were executed (without actually performing the command)", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to attach.", "", true, "false", "", "" ], [ "FileStructure", "A StringCollection object value that contains a list database files. If FileStructure is not specified, BackupHistory will be used to guess the structure.", "", false, "false", "", "" ], [ "DatabaseOwner", "Sets the database owner for the database. The sa account (or equivalent) will be used if DatabaseOwner is not specified.", "", false, "false", "", "" ], [ "AttachOption", "An AttachOptions object value that contains the attachment options. Valid options are \"None\", \"RebuildLog\", \"EnableBroker\", \"NewBroker\" and \"ErrorBrokerConversations\".", "", false, "false", "None", "None,RebuildLog,EnableBroker,NewBroker,ErrorBrokerConversations" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Mount-DbaDatabase [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Database] \u003cString[]\u003e [[-FileStructure] \u003cStringCollection\u003e] [[-DatabaseOwner] \u003cString\u003e] [[-AttachOption] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Move-DbaDbFile", "Description": "Moves database files from one local drive or folder to another.\nIt will put database offline, update metadata and set it online again.\nIt can also be used to move database files on an AG secondary.", "Tags": [ "Database", "Move", "File" ], "Synopsis": "Moves database files from one local drive or folder to another.", "Alias": "", "Author": "Cláudio Silva (@claudioessilva), claudioeesilva.eu", "CommandName": "Move-DbaDbFile", "Availability": "Windows only", "Links": "https://dbatools.io/Move-DbaDbFile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eMove-DbaDbFile -SqlInstance sql2017 -Database dbatools -FileType Data -FileDestination \"D:\\DATA2\"\nCopy all data files of dbatools database on sql2017 instance to the \"D:\\DATA2\" path.\r\nBefore it puts database offline and after copy each file will update database metadata and it ends by set the database back online\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$fileToMove=@{\n\u003e\u003e \u0027dbatools\u0027=\u0027D:\\DATA3\u0027\r\n\u003e\u003e \u0027dbatools_log\u0027=\u0027D:\\LOG2\u0027\r\n\u003e\u003e }\r\nPS C:\\\u003e Move-DbaDbFile -SqlInstance sql2019 -Database dbatools -FileToMove $fileToMove\nDeclares a hashtable that says for each logical file the new path.\r\nCopy each dbatools database file referenced on the hashtable on the sql2019 instance from the current location to the new mentioned location (D:\\DATA3 and D:\\LOG2 paths).\r\nBefore it puts database offline and after copy each file will update database metadata and it ends by set the database back online\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eMove-DbaDbFile -SqlInstance sql2017 -Database dbatools -FileStructureOnly\nShows the current database file structure (without filenames). Example: \u0027dbatools\u0027=\u0027D:\\Data\u0027", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database to be moved.", "", true, "false", "", "" ], [ "FileType", "Define the file type to move; accepted values: Data, Log or Both.\r\nDefault value: Both\r\nExclusive, cannot be used in conjunction with FileToMove.", "", false, "false", "", "Data,Log,Both" ], [ "FileDestination", "Destination directory of the database file(s).", "", false, "false", "", "" ], [ "FileToMove", "Pass a hashtable that contains a list of database files and their destination path.\r\nKey and value should be the logical name and then the path (e.g. \u0027db1_log\u0027 = \u0027D:\\mssql\\logs\u0027)", "", false, "false", "", "" ], [ "DeleteAfterMove", "Remove the source database file(s) after the successful move operation.", "", false, "false", "False", "" ], [ "FileStructureOnly", "Return a hashtable of the Database file structure.\r\nModifying the hashtable it can then be utilized with the FileToMove parameter", "", false, "false", "False", "" ], [ "Force", "Database(s) is set offline as part of the move process, this will utilize WITH ROLLBACK IMMEDIATE and rollback any open transaction running against the database(s).", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Move-DbaDbFile -SqlInstance \u003cDbaInstanceParameter\u003e [-SqlCredential \u003cPSCredential\u003e] -Database \u003cString\u003e [-FileType \u003cString\u003e] [-FileDestination \u003cString\u003e] [-DeleteAfterMove] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nMove-DbaDbFile -SqlInstance \u003cDbaInstanceParameter\u003e [-SqlCredential \u003cPSCredential\u003e] -Database \u003cString\u003e [-FileToMove \u003cHashtable\u003e] [-DeleteAfterMove] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nMove-DbaDbFile -SqlInstance \u003cDbaInstanceParameter\u003e [-SqlCredential \u003cPSCredential\u003e] -Database \u003cString\u003e [-FileStructureOnly] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Move-DbaRegServer", "Description": "Moves registered servers around SQL Server Central Management Server (CMS). Local Registered Servers not currently supported.", "Tags": [ "RegisteredServer", "CMS" ], "Synopsis": "Moves registered servers around SQL Server Central Management Server (CMS). Local Registered Servers not currently supported.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Move-DbaRegServer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Move-DbaRegServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eMove-DbaRegServer -SqlInstance sql2012 -Name \u0027Web SQL Cluster\u0027 -Group HR\\Prod\nMoves the registered server on sql2012 titled \u0027Web SQL Cluster\u0027 to the Prod group within the HR group\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sql2017 -Name \u0027Web SQL Cluster\u0027 | Move-DbaRegServer -Group Web\nMoves the registered server \u0027Web SQL Cluster\u0027 on sql2017 to the Web group, also on sql2017", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "Specifies one or more reg servers to move. Name is the visible name in SSMS CMS interface (labeled Registered Server Name)", "", false, "false", "", "" ], [ "ServerName", "Specifies one or more reg servers to move. Server Name is the actual instance name (labeled Server Name)", "", false, "false", "", "" ], [ "Group", "The new group. If no new group is specified, the default root will used", "NewGroup", false, "false", "", "" ], [ "InputObject", "Allows results from Get-DbaRegServer to be piped in", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Move-DbaRegServer [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString[]\u003e] [[-ServerName] \u003cString[]\u003e] [[-Group] \u003cString\u003e] [[-InputObject] \u003cRegisteredServer[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Move-DbaRegServerGroup", "Description": "Moves registered server groups around SQL Server Central Management Server (CMS). Local Registered Server Groups not currently supported.", "Tags": [ "RegisteredServer", "CMS" ], "Synopsis": "Moves registered server groups around SQL Server Central Management Server (CMS). Local Registered Server Groups not currently supported.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Move-DbaRegServerGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Move-DbaRegServerGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eMove-DbaRegServerGroup -SqlInstance sql2012 -Group HR\\Development -NewGroup AD\\Prod\nMoves the Development group within HR to the Prod group within AD\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRegServerGroup -SqlInstance sql2017 -Group HR\\Development| Move-DbaRegServerGroup -NewGroup Web\nMoves the Development group within HR to the Web group", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Group", "Specifies one or more groups to include from SQL Server Central Management Server.", "", false, "false", "", "" ], [ "NewGroup", "The new location.", "", true, "false", "", "" ], [ "InputObject", "Allows results from Get-DbaRegServerGroup to be piped in", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Move-DbaRegServerGroup [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Group] \u003cString[]\u003e] [-NewGroup] \u003cString\u003e [[-InputObject] \u003cServerGroup[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaAgentAlertCategory", "Description": "New-DbaAgentAlertCategory makes it possible to create a Agent Alert category that can be used with Alerts.\nIt returns an array of the alert categories created .", "Tags": [ "Agent", "Alert", "AlertCategory" ], "Synopsis": "New-DbaAgentAlertCategory creates a new alert category.", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "New-DbaAgentAlertCategory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaAgentAlertCategory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaAgentAlertCategory -SqlInstance sql1 -Category \u0027Category 1\u0027\nCreates a new alert category with the name \u0027Category 1\u0027.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027sql1\u0027 | New-DbaAgentAlertCategory -Category \u0027Category 2\u0027\nCreates a new alert category with the name \u0027Category 2\u0027.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Category", "The name of the category", "", true, "false", "", "" ], [ "Force", "The force parameter will ignore some errors in the parameters and assume defaults.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaAgentAlertCategory [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Category] \u003cString[]\u003e [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaAgentJob", "Description": "New-DbaAgentJob makes is possible to create a job in the SQL Server Agent.\nIt returns an array of the job(s) created", "Tags": [ "Agent", "Job", "JobStep" ], "Synopsis": "New-DbaAgentJob creates a new job", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "New-DbaAgentJob", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaAgentJob", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaAgentJob -SqlInstance sql1 -Job \u0027Job One\u0027 -Description \u0027Just another job\u0027\nCreates a job with the name \"Job1\" and a small description\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaAgentJob -SqlInstance sql1 -Job \u0027Job One\u0027 -Disabled\nCreates the job but sets it to disabled\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaAgentJob -SqlInstance sql1 -Job \u0027Job One\u0027 -EventLogLevel OnSuccess\nCreates the job and sets the notification to write to the Windows Application event log on success\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eNew-DbaAgentJob -SqlInstance SSTAD-PC -Job \u0027Job One\u0027 -EmailLevel OnFailure -EmailOperator dba\nCreates the job and sets the notification to send an e-mail to the e-mail operator\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eNew-DbaAgentJob -SqlInstance sql1 -Job \u0027Job One\u0027 -Description \u0027Just another job\u0027 -Whatif\nDoesn\u0027t create the job but shows what would happen.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eNew-DbaAgentJob -SqlInstance sql1, sql2, sql3 -Job \u0027Job One\u0027\nCreates a job with the name \"Job One\" on multiple servers\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e\"sql1\", \"sql2\", \"sql3\" | New-DbaAgentJob -Job \u0027Job One\u0027\nCreates a job with the name \"Job One\" on multiple servers using the pipe line", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "The name of the job. The name must be unique and cannot contain the percent (%) character.", "", true, "false", "", "" ], [ "Schedule", "Schedule to attach to job. This can be more than one schedule.", "", false, "false", "", "" ], [ "ScheduleId", "Schedule ID to attach to job. This can be more than one schedule ID.", "", false, "false", "", "" ], [ "Disabled", "Sets the status of the job to disabled. By default a job is enabled.", "", false, "false", "False", "" ], [ "Description", "The description of the job.", "", false, "false", "", "" ], [ "StartStepId", "The identification number of the first step to execute for the job.", "", false, "false", "0", "" ], [ "Category", "The category of the job.", "", false, "false", "", "" ], [ "OwnerLogin", "The name of the login that owns the job.", "", false, "false", "", "" ], [ "EventLogLevel", "Specifies when to place an entry in the Microsoft Windows application log for this job.\r\nAllowed values 0, \"Never\", 1, \"OnSuccess\", 2, \"OnFailure\", 3, \"Always\"\r\nThe text value can either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "", "0,Never,1,OnSuccess,2,OnFailure,3,Always" ], [ "EmailLevel", "Specifies when to send an e-mail upon the completion of this job.\r\nAllowed values 0, \"Never\", 1, \"OnSuccess\", 2, \"OnFailure\", 3, \"Always\"\r\nThe text value can either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "", "0,Never,1,OnSuccess,2,OnFailure,3,Always" ], [ "PageLevel", "Specifies when to send a page upon the completion of this job.\r\nAllowed values 0, \"Never\", 1, \"OnSuccess\", 2, \"OnFailure\", 3, \"Always\"\r\nThe text value can either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "", "0,Never,1,OnSuccess,2,OnFailure,3,Always,0,Never,1,OnSuccess,2,OnFailure,3,Always" ], [ "EmailOperator", "The e-mail name of the operator to whom the e-mail is sent when EmailLevel is reached.", "", false, "false", "", "" ], [ "NetsendOperator", "The name of the operator to whom the network message is sent.", "", false, "false", "", "" ], [ "PageOperator", "The name of the operator to whom a page is sent.", "", false, "false", "", "" ], [ "DeleteLevel", "Specifies when to delete the job.\r\nAllowed values 0, \"Never\", 1, \"OnSuccess\", 2, \"OnFailure\", 3, \"Always\"\r\nThe text value can either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "", "0,Never,1,OnSuccess,2,OnFailure,3,Always" ], [ "Force", "The force parameter will ignore some errors in the parameters and assume defaults.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaAgentJob [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Job] \u003cString\u003e [[-Schedule] \u003cObject[]\u003e] [[-ScheduleId] \u003cInt32[]\u003e] [-Disabled] [[-Description] \u003cString\u003e] [[-StartStepId] \u003cInt32\u003e] [[-Category] \u003cString\u003e] [[-OwnerLogin] \u003cString\u003e] [[-EventLogLevel] \u003cObject\u003e] [[-EmailLevel] \u003cObject\u003e] [[-PageLevel] \u003cObject\u003e] [[-EmailOperator] \u003cString\u003e] [[-NetsendOperator] \u003cString\u003e] [[-PageOperator] \u003cString\u003e] [[-DeleteLevel] \u003cObject\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaAgentJobCategory", "Description": "New-DbaAgentJobCategory makes it possible to create a job category that can be used with jobs.\nIt returns an array of the job categories created .", "Tags": [ "Agent", "Job", "JobCategory" ], "Synopsis": "New-DbaAgentJobCategory creates a new job category.", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "New-DbaAgentJobCategory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaAgentJobCategory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaAgentJobCategory -SqlInstance sql1 -Category \u0027Category 1\u0027\nCreates a new job category with the name \u0027Category 1\u0027.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaAgentJobCategory -SqlInstance sql1 -Category \u0027Category 2\u0027 -CategoryType MultiServerJob\nCreates a new job category with the name \u0027Category 2\u0027 and assign the category type for a multi server job.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Category", "The name of the category", "", true, "false", "", "" ], [ "CategoryType", "The type of category. This can be \"LocalJob\", \"MultiServerJob\" or \"None\".\r\nThe default is \"LocalJob\" and will automatically be set when no option is chosen.", "", false, "false", "", "LocalJob,MultiServerJob,None" ], [ "Force", "The force parameter will ignore some errors in the parameters and assume defaults.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaAgentJobCategory [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Category] \u003cString[]\u003e [[-CategoryType] \u003cString\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaAgentJobStep", "Description": "New-DbaAgentJobStep creates a new job in the SQL Server Agent for a specific job", "Tags": [ "Agent", "Job", "JobStep" ], "Synopsis": "New-DbaAgentJobStep creates a new job step for a job", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "New-DbaAgentJobStep", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaAgentJobStep", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaAgentJobStep -SqlInstance sql1 -Job Job1 -StepName Step1\nCreate a step in \"Job1\" with the name Step1 with the default subsystem TransactSql.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaAgentJobStep -SqlInstance sql1 -Job Job1 -StepName Step1 -Database msdb\nCreate a step in \"Job1\" with the name Step1 where the database will the msdb\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaAgentJobStep -SqlInstance sql1, sql2, sql3 -Job Job1 -StepName Step1 -Database msdb\nCreate a step in \"Job1\" with the name Step1 where the database will the \"msdb\" for multiple servers\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eNew-DbaAgentJobStep -SqlInstance sql1, sql2, sql3 -Job Job1, Job2, \u0027Job Three\u0027 -StepName Step1 -Database msdb\nCreate a step in \"Job1\" with the name Step1 where the database will the \"msdb\" for multiple servers for multiple jobs\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003esql1, sql2, sql3 | New-DbaAgentJobStep -Job Job1 -StepName Step1 -Database msdb\nCreate a step in \"Job1\" with the name Step1 where the database will the \"msdb\" for multiple servers using pipeline\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eNew-DbaAgentJobStep -SqlInstance sq1 -Job Job1 -StepName StepA -Database msdb -StepId 2 -Insert\nAssuming Job1 already has steps Step1 and Step2, will create a new step Step A and set the step order as Step1, StepA, Step2\r\nInternal StepIds will be updated, and any specific OnSuccess/OnFailure step references will also be updated", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "The name of the job to which to add the step.", "", true, "false", "", "" ], [ "StepId", "The sequence identification number for the job step. Step identification numbers start at 1 and increment without gaps.", "", false, "false", "0", "" ], [ "StepName", "The name of the step.", "", true, "false", "", "" ], [ "Subsystem", "The subsystem used by the SQL Server Agent service to execute command.\r\nAllowed values \u0027ActiveScripting\u0027,\u0027AnalysisCommand\u0027,\u0027AnalysisQuery\u0027,\u0027CmdExec\u0027,\u0027Distribution\u0027,\u0027LogReader\u0027,\u0027Merge\u0027,\u0027PowerShell\u0027,\u0027QueueReader\u0027,\u0027Snapshot\u0027,\u0027Ssis\u0027,\u0027TransactSql\u0027\r\nThe default is \u0027TransactSql\u0027", "", false, "false", "TransactSql", "ActiveScripting,AnalysisCommand,AnalysisQuery,CmdExec,Distribution,LogReader,Merge,PowerShell,QueueReader,Snapshot,Ssis,TransactSql" ], [ "SubsystemServer", "The subsystems AnalysisScripting, AnalysisCommand, AnalysisQuery ned the server property to be able to apply", "", false, "false", "", "" ], [ "Command", "The commands to be executed by SQLServerAgent service through subsystem.", "", false, "false", "", "" ], [ "CmdExecSuccessCode", "The value returned by a CmdExec subsystem command to indicate that command executed successfully.", "", false, "false", "0", "" ], [ "OnSuccessAction", "The action to perform if the step succeeds.\r\nAllowed values \"QuitWithSuccess\" (default), \"QuitWithFailure\", \"GoToNextStep\", \"GoToStep\".\r\nThe text value van either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "QuitWithSuccess", "QuitWithSuccess,QuitWithFailure,GoToNextStep,GoToStep" ], [ "OnSuccessStepId", "The ID of the step in this job to execute if the step succeeds and OnSuccessAction is \"GoToStep\".", "", false, "false", "0", "" ], [ "OnFailAction", "The action to perform if the step fails.\r\nAllowed values \"QuitWithSuccess\" (default), \"QuitWithFailure\", \"GoToNextStep\", \"GoToStep\".\r\nThe text value van either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "QuitWithFailure", "QuitWithSuccess,QuitWithFailure,GoToNextStep,GoToStep" ], [ "OnFailStepId", "The ID of the step in this job to execute if the step fails and OnFailAction is \"GoToStep\".", "", false, "false", "0", "" ], [ "Database", "The name of the database in which to execute a Transact-SQL step. The default is \u0027master\u0027.", "", false, "false", "", "" ], [ "DatabaseUser", "The name of the user account to use when executing a Transact-SQL step.", "", false, "false", "", "" ], [ "RetryAttempts", "The number of retry attempts to use if this step fails. The default is 0.", "", false, "false", "0", "" ], [ "RetryInterval", "The amount of time in minutes between retry attempts. The default is 0.", "", false, "false", "0", "" ], [ "OutputFileName", "The name of the file in which the output of this step is saved.", "", false, "false", "", "" ], [ "Insert", "This switch indicates the new step is inserted at the specified stepid.\r\nAll following steps will have their IDs incremented by, and success/failure next steps incremented accordingly", "", false, "false", "False", "" ], [ "Flag", "Sets the flag(s) for the job step.\nFlag Description\r\n----------------------------------------------------------------------------\r\nAppendAllCmdExecOutputToJobHistory Job history, including command output, is appended to the job history file.\r\nAppendToJobHistory Job history is appended to the job history file.\r\nAppendToLogFile Job history is appended to the SQL Server log file.\r\nAppendToTableLog Job history is appended to a log table.\r\nLogToTableWithOverwrite Job history is written to a log table, overwriting previous contents.\r\nNone Job history is not appended to a file.\r\nProvideStopProcessEvent Job processing is stopped.", "", false, "false", "", "AppendAllCmdExecOutputToJobHistory,AppendToJobHistory,AppendToLogFile,AppendToTableLog,LogToTableWithOverwrite,None,ProvideStopProcessEvent" ], [ "ProxyName", "The name of the proxy that the job step runs as.", "", false, "false", "", "" ], [ "Force", "The force parameter will ignore some errors in the parameters and assume defaults.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaAgentJobStep [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Job] \u003cObject[]\u003e [[-StepId] \u003cInt32\u003e] [-StepName] \u003cString\u003e [[-Subsystem] \u003cString\u003e] [[-SubsystemServer] \u003cString\u003e] [[-Command] \u003cString\u003e] [[-CmdExecSuccessCode] \u003cInt32\u003e] [[-OnSuccessAction] \u003cString\u003e] [[-OnSuccessStepId] \u003cInt32\u003e] [[-OnFailAction] \u003cString\u003e] [[-OnFailStepId] \u003cInt32\u003e] [[-Database] \u003cObject\u003e] [[-DatabaseUser] \u003cString\u003e] [[-RetryAttempts] \u003cInt32\u003e] [[-RetryInterval] \u003cInt32\u003e] [[-OutputFileName] \u003cString\u003e] [-Insert] [[-Flag] \u003cString[]\u003e] [[-ProxyName] \u003cString\u003e] [-Force] [-EnableException] [-WhatIf] \r\n[-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaAgentOperator", "Description": "If the operator already exists on the destination, it will not be created unless -Force is used.", "Tags": [ "Agent", "Operator" ], "Synopsis": "Creates a new operator on an instance.", "Alias": "", "Author": "Tracy Boggiano (@TracyBoggiano), databasesuperhero.com", "CommandName": "New-DbaAgentOperator", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaAgentOperator", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS:\\\u003eNew-DbaAgentOperator -SqlInstance sql01 -Operator DBA -EmailAddress operator@operator.com -PagerDay Everyday -Force\nThis sets a new operator named DBA with the above email address with default values to alerts everyday\r\nfor all hours of the day.\n-------------------------- EXAMPLE 2 --------------------------\nPS:\\\u003eNew-DbaAgentOperator -SqlInstance sql01 -Operator DBA -EmailAddress operator@operator.com -NetSendAddress dbauser1 -PagerAddress dbauser1@pager.dbatools.io -PagerDay Everyday -SaturdayStartTime \r\n070000 -SaturdayEndTime 180000 -SundayStartTime 080000 -SundayEndTime 170000 -WeekdayStartTime 060000 -WeekdayEndTime 190000\nCreates a new operator named DBA on the sql01 instance with email address operator@operator.com, net send address of dbauser1, pager address of dbauser1@pager.dbatools.io, page day as every day, \r\nSaturday start time of 7am, Saturday end time of 6pm, Sunday start time of 8am, Sunday end time of 5pm, Weekday start time of 6am, and Weekday end time of 7pm.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Operator", "Name of the operator in SQL Agent.", "", true, "false", "", "" ], [ "EmailAddress", "The email address the SQL Agent will use to email alerts to the operator.", "", false, "false", "", "" ], [ "NetSendAddress", "The net send address the SQL Agent will use for the operator to net send alerts.", "", false, "false", "", "" ], [ "PagerAddress", "The pager email address the SQL Agent will use to send alerts to the oeprator.", "", false, "false", "", "" ], [ "PagerDay", "Defines what days the pager portion of the operator will be used. The default is \u0027Everyday\u0027. Valid parameters\r\nare \u0027EveryDay\u0027, \u0027Weekdays\u0027, \u0027Weekend\u0027, \u0027Sunday\u0027, \u0027Monday\u0027, \u0027Tuesday\u0027, \u0027Wednesday\u0027, \u0027Thursday\u0027, \u0027Friday\u0027, and\r\n\u0027Saturday\u0027.", "", false, "false", "", "EveryDay,Weekdays,Weekend,Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday" ], [ "SaturdayStartTime", "This a string that takes the Saturday Pager Start Time.", "", false, "false", "", "" ], [ "SaturdayEndTime", "This a string that takes the Saturday Pager End Time.", "", false, "false", "", "" ], [ "SundayStartTime", "This a string that takes the Sunday Pager Start Time.", "", false, "false", "", "" ], [ "SundayEndTime", "This a string that takes the Sunday Pager End Time.", "", false, "false", "", "" ], [ "WeekdayStartTime", "This a string that takes the Weekdays Pager Start Time.", "", false, "false", "", "" ], [ "WeekdayEndTime", "This a string that takes the Weekdays Pager End Time.", "", false, "false", "", "" ], [ "IsFailsafeOperator", "If this switch is enabled, this operator will be your failsafe operator and replace the one that existed before.", "", false, "false", "False", "" ], [ "FailsafeNotificationMethod", "Defines the notification method for the failsafe oeprator. Value must be NotifyMail or NotifyPager.\r\nThe default is NotifyEmail.", "", false, "false", "NotifyEmail", "" ], [ "Force", "If this switch is enabled, the Operator will be dropped and recreated on instance.", "", false, "false", "False", "" ], [ "InputObject", "SMO Server Objects (pipeline input from Connect-DbaInstance)", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaAgentOperator [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [-Operator] \u003cString\u003e [[-EmailAddress] \u003cString\u003e] [[-NetSendAddress] \u003cString\u003e] [[-PagerAddress] \u003cString\u003e] [[-PagerDay] \u003cString\u003e] [[-SaturdayStartTime] \u003cString\u003e] [[-SaturdayEndTime] \u003cString\u003e] [[-SundayStartTime] \u003cString\u003e] [[-SundayEndTime] \u003cString\u003e] [[-WeekdayStartTime] \u003cString\u003e] [[-WeekdayEndTime] \u003cString\u003e] [-IsFailsafeOperator] [[-FailsafeNotificationMethod] \u003cString\u003e] [-Force] [[-InputObject] \u003cServer[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaAgentProxy", "Description": "Adds one or more proxies to SQL Server Agent\n\nNote: ActiveScripting (ActiveX scripting) was discontinued in SQL Server 2016: https://docs.microsoft.com/en-us/sql/database-engine/discontinued-database-engine-functionality-in-sql-server", "Tags": [ "Agent", "Proxy" ], "Synopsis": "Adds one or more proxies to SQL Server Agent", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaAgentProxy", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaAgentProxy", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaAgentProxy -SqlInstance sql2016 -Name STIG -ProxyCredential \u0027PowerShell Proxy\u0027\nCreates an Agent Proxy on sql2016 with the name STIG with the \u0027PowerShell Proxy\u0027 credential.\r\nThe proxy is automatically added to the CmdExec subsystem.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaAgentProxy -SqlInstance localhost\\sql2016 -Name STIG -ProxyCredential \u0027PowerShell Proxy\u0027 -Description \"Used for auditing purposes\" -Login ad\\sqlstig -SubSystem CmdExec, PowerShell \r\n-ServerRole securityadmin -MsdbRole ServerGroupAdministratorRole\nCreates an Agent Proxy on sql2016 with the name STIG with the \u0027PowerShell Proxy\u0027 credential and the following principals:\nLogin: ad\\sqlstig\r\nServerRole: securityadmin\r\nMsdbRole: ServerGroupAdministratorRole\nBy default, only sysadmins have access to create job steps with proxies. This will allow 3 additional principals access:\r\nThe proxy is then added to the CmdExec and PowerShell subsystems", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "The name of the proxy or proxies you want to create", "", true, "false", "", "" ], [ "ProxyCredential", "The associated SQL Server Credential. The credential must be created prior to creating the Proxy.", "", true, "false", "", "" ], [ "SubSystem", "The associated subsystem or subsystems. Defaults to CmdExec.\nValid options include:\r\nActiveScripting\r\nAnalysisCommand\r\nAnalysisQuery\r\nCmdExec\r\nDistribution\r\nLogReader\r\nMerge\r\nPowerShell\r\nQueueReader\r\nSnapshot\r\nSsis", "", false, "false", "CmdExec", "ActiveScripting,AnalysisCommand,AnalysisQuery,CmdExec,Distribution,LogReader,Merge,PowerShell,QueueReader,Snapshot,Ssis" ], [ "Description", "A description of the proxy", "", false, "false", "", "" ], [ "Login", "The SQL Server login or logins (known as proxy principals) to assign to the proxy", "", false, "false", "", "" ], [ "ServerRole", "The SQL Server role or roles (known as proxy principals) to assign to the proxy", "", false, "false", "", "" ], [ "MsdbRole", "The msdb role or roles (known as proxy principals) to assign to the proxy", "", false, "false", "", "" ], [ "Disabled", "Create the proxy as disabled", "", false, "false", "False", "" ], [ "Force", "Drop and recreate the proxy if it already exists", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaAgentProxy [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Name] \u003cString[]\u003e [-ProxyCredential] \u003cString[]\u003e [[-SubSystem] \u003cString[]\u003e] [[-Description] \u003cString\u003e] [[-Login] \u003cString[]\u003e] [[-ServerRole] \u003cString[]\u003e] [[-MsdbRole] \u003cString[]\u003e] [-Disabled] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaAgentSchedule", "Description": "New-DbaAgentSchedule will help create a new schedule for a job.\nIf the job parameter is not supplied the schedule will not be attached to a job.", "Tags": [ "Agent", "Job", "JobStep" ], "Synopsis": "New-DbaAgentSchedule creates a new schedule in the msdb database.", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "New-DbaAgentSchedule", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaAgentSchedule", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaAgentSchedule -SqlInstance localhost\\SQL2016 -Schedule daily -FrequencyType Daily -FrequencyInterval Everyday -Force\nCreates a schedule with a daily frequency every day. It assumes default values for the start date, start time, end date and end time due to -Force.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaAgentSchedule -SqlInstance sstad-pc -Schedule MonthlyTest -FrequencyType Monthly -FrequencyInterval 10 -FrequencyRecurrenceFactor 1 -Force\nCreate a schedule with a monhtly frequency occuring every 10th of the month. It assumes default values for the start date, start time, end date and end time due to -Force.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "The name of the job that has the schedule.", "", false, "false", "", "" ], [ "Schedule", "The name of the schedule.", "", false, "false", "", "" ], [ "Disabled", "Set the schedule to disabled. Default is enabled", "", false, "false", "False", "" ], [ "FrequencyType", "A value indicating when a job is to be executed.\nAllowed values: \u0027Once\u0027, \u0027OneTime\u0027, \u0027Daily\u0027, \u0027Weekly\u0027, \u0027Monthly\u0027, \u0027MonthlyRelative\u0027, \u0027AgentStart\u0027, \u0027AutoStart\u0027, \u0027IdleComputer\u0027, \u0027OnIdle\u0027\nThe following synonyms provide flexibility to the allowed values for this function parameter:\r\nOnce=OneTime\r\nAgentStart=AutoStart\r\nIdleComputer=OnIdle\nIf force is used the default will be \"Once\".", "", false, "false", "", "Once,OneTime,Daily,Weekly,Monthly,MonthlyRelative,AgentStart,AutoStart,IdleComputer,OnIdle" ], [ "FrequencyInterval", "The days that a job is executed\nAllowed values for FrequencyType \u0027Daily\u0027: EveryDay or a number between 1 and 365.\r\nAllowed values for FrequencyType \u0027Weekly\u0027: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Weekdays, Weekend or EveryDay.\r\nAllowed values for FrequencyType \u0027Monthly\u0027: Numbers 1 to 31 for each day of the month.\nIf \"Weekdays\", \"Weekend\" or \"EveryDay\" is used it over writes any other value that has been passed before.\nIf force is used the default will be 1.", "", false, "false", "", "" ], [ "FrequencySubdayType", "Specifies the units for the subday FrequencyInterval.\nAllowed values: \u0027Once\u0027, \u0027Time\u0027, \u0027Seconds\u0027, \u0027Second\u0027, \u0027Minutes\u0027, \u0027Minute\u0027, \u0027Hours\u0027, \u0027Hour\u0027\nThe following synonyms provide flexibility to the allowed values for this function parameter:\r\nOnce=Time\r\nSeconds=Second\r\nMinutes=Minute\r\nHours=Hour", "", false, "false", "", "Once,Time,Seconds,Second,Minutes,Minute,Hours,Hour" ], [ "FrequencySubdayInterval", "The number of subday type periods to occur between each execution of a job.", "", false, "false", "0", "" ], [ "FrequencyRelativeInterval", "A job\u0027s occurrence of FrequencyInterval in each month, if FrequencyInterval is 32 (monthlyrelative).\nAllowed values: First, Second, Third, Fourth or Last", "", false, "false", "", "Unused,First,Second,Third,Fourth,Last" ], [ "FrequencyRecurrenceFactor", "The number of weeks or months between the scheduled execution of a job.\nFrequencyRecurrenceFactor is used only if FrequencyType is \"Weekly\", \"Monthly\" or \"MonthlyRelative\".", "", false, "false", "0", "" ], [ "StartDate", "The date on which execution of a job can begin.\nIf force is used the start date will be the current day", "", false, "false", "", "" ], [ "EndDate", "The date on which execution of a job can stop.\nIf force is used the end date will be \u00279999-12-31\u0027", "", false, "false", "", "" ], [ "StartTime", "The time on any day to begin execution of a job. Format HHMMSS / 24 hour clock.\r\nExample: \u0027010000\u0027 for 01:00:00 AM.\r\nExample: \u0027140000\u0027 for 02:00:00 PM.\nIf force is used the start time will be \u002700:00:00\u0027", "", false, "false", "", "" ], [ "EndTime", "The time on any day to end execution of a job. Format HHMMSS / 24 hour clock.\r\nExample: \u0027010000\u0027 for 01:00:00 AM.\r\nExample: \u0027140000\u0027 for 02:00:00 PM.\nIf force is used the start time will be \u002723:59:59\u0027", "", false, "false", "", "" ], [ "Force", "The force parameter will ignore some errors in the parameters and assume defaults.\r\nIt will also remove the any present schedules with the same name for the specific job.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaAgentSchedule [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Job] \u003cObject[]\u003e] [[-Schedule] \u003cObject\u003e] [-Disabled] [[-FrequencyType] \u003cObject\u003e] [[-FrequencyInterval] \u003cObject[]\u003e] [[-FrequencySubdayType] \u003cObject\u003e] [[-FrequencySubdayInterval] \u003cInt32\u003e] [[-FrequencyRelativeInterval] \u003cObject\u003e] [[-FrequencyRecurrenceFactor] \u003cInt32\u003e] [[-StartDate] \u003cString\u003e] [[-EndDate] \u003cString\u003e] [[-StartTime] \u003cString\u003e] [[-EndTime] \u003cString\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaAvailabilityGroup", "Description": "Automates the creation of availability groups.\n\n* Checks prerequisites\n* Creates Availability Group and adds primary replica\n* Grants cluster permissions if necessary\n* Adds secondary replica if supplied\n* Adds databases if supplied\n * Performs backup/restore if seeding mode is manual\n * Performs backup to NUL if seeding mode is automatic\n* Adds listener to primary if supplied\n* Joins secondaries to availability group\n* Grants endpoint connect permissions to service accounts\n* Grants CreateAnyDatabase permissions if seeding mode is automatic\n* Returns Availability Group object from primary\n\nNOTES:\n- If a backup / restore is performed, the backups will be left intact on the network share.\n- If you\u0027re using SQL Server on Linux and a fully qualified domain name is required, please use the FQDN to create a proper Endpoint\n\nPLEASE NOTE THE CHANGED DEFAULTS:\nStarting with version 1.1.x we changed the defaults of the following parameters to have the same defaults\nas the T-SQL command \"CREATE AVAILABILITY GROUP\" and the wizard in SQL Server Management Studio:\n* ClusterType from External to Wsfc (Windows Server Failover Cluster).\n* FailureConditionLevel from OnServerDown (Level 1) to OnCriticalServerErrors (Level 3).\n* ConnectionModeInSecondaryRole from AllowAllConnections (ALL) to AllowNoConnections (NO).\nTo change these defaults we have introduced configuration parameters for all of them, see documentation of the parameters for details.\n\nThanks for this, Thomas Stringer! https://blogs.technet.microsoft.com/heyscriptingguy/2013/04/29/set-up-an-alwayson-availability-group-with-powershell/", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Automates the creation of availability groups.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaAvailabilityGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaAvailabilityGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaAvailabilityGroup -Primary sql2016a -Name SharePoint\nCreates a new availability group on sql2016a named SharePoint\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaAvailabilityGroup -Primary sql2016a -Name SharePoint -Secondary sql2016b\nCreates a new availability group on sql2016a named SharePoint with a secondary replica, sql2016b\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaAvailabilityGroup -Primary sql2016std -Name BAG1 -Basic -Confirm:$false\nCreates a basic availability group named BAG1 on sql2016std and does not confirm when setting up\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eNew-DbaAvailabilityGroup -Primary sql2016b -Name AG1 -Dhcp -Database db1 -UseLastBackup\nCreates an availability group on sql2016b with the name ag1. Uses the last backups available to add the database db1 to the AG.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eNew-DbaAvailabilityGroup -Primary sql2017 -Name SharePoint -ClusterType None -FailoverMode Manual\nCreates a new availability group on sql2017 named SharePoint with a cluster type of none and a failover mode of manual\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eNew-DbaAvailabilityGroup -Primary sql1 -Secondary sql2 -Name ag1 -Database pubs -ClusterType None -SeedingMode Automatic -FailoverMode Manual\nCreates a new availability group with a primary replica on sql1 and a secondary on sql2. Automatically adds the database pubs.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eNew-DbaAvailabilityGroup -Primary sql1 -Secondary sql2 -Name ag1 -Database pubs -EndpointUrl \u0027TCP://sql1.specialnet.local:5022\u0027, \u0027TCP://sql2.specialnet.local:5022\u0027\nCreates a new availability group with a primary replica on sql1 and a secondary on sql2 with custom endpoint urls. Automatically adds the database pubs.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e $params = @{\r\n\u003e\u003e Primary = \"sql1\"\r\n\u003e\u003e PrimarySqlCredential = $cred\r\n\u003e\u003e Secondary = \"sql2\"\r\n\u003e\u003e SecondarySqlCredential = $cred\r\n\u003e\u003e Name = \"test-ag\"\r\n\u003e\u003e Database = \"pubs\"\r\n\u003e\u003e ClusterType = \"None\"\r\n\u003e\u003e SeedingMode = \"Automatic\"\r\n\u003e\u003e FailoverMode = \"Manual\"\r\n\u003e\u003e Confirm = $false\r\n\u003e\u003e }\r\nPS C:\\\u003e New-DbaAvailabilityGroup @params\nThis exact command was used to create an availability group on docker!", "Params": [ [ "Primary", "The primary SQL Server instance. Server version must be SQL Server version 2012 or higher.", "", false, "true (ByValue)", "", "" ], [ "PrimarySqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Secondary", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SecondarySqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "The name of the Availability Group.", "", true, "false", "", "" ], [ "DtcSupport", "Indicates whether the DtcSupport is enabled", "", false, "false", "False", "" ], [ "ClusterType", "Cluster type of the Availability Group. Only supported in SQL Server 2017 and above.\r\nOptions include: Wsfc, External or None.\nDefaults to Wsfc (Windows Server Failover Cluster).\nThe default can be changed with:\r\nSet-DbatoolsConfig -FullName \u0027AvailabilityGroups.Default.ClusterType\u0027 -Value \u0027...\u0027 -Passthru | Register-DbatoolsConfig", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027AvailabilityGroups.Default.ClusterType\u0027 -Fallback \u0027Wsfc\u0027)", "Wsfc,External,None" ], [ "AutomatedBackupPreference", "Specifies how replicas in the primary role are treated in the evaluation to pick the desired replica to perform a backup.", "", false, "false", "Secondary", "None,Primary,Secondary,SecondaryOnly" ], [ "FailureConditionLevel", "Specifies the different conditions that can trigger an automatic failover in Availability Group.\nDefaults to OnCriticalServerErrors (Level 3).\nFrom https://docs.microsoft.com/en-us/sql/t-sql/statements/create-availability-group-transact-sql:\r\n Level 1 = OnServerDown\r\n Level 2 = OnServerUnresponsive\r\n Level 3 = OnCriticalServerErrors (the default in CREATE AVAILABILITY GROUP and in this command)\r\n Level 4 = OnModerateServerErrors\r\n Level 5 = OnAnyQualifiedFailureCondition\nThe default can be changed with:\r\nSet-DbatoolsConfig -FullName \u0027AvailabilityGroups.Default.FailureConditionLevel\u0027 -Value \u0027On...\u0027 -Passthru | Register-DbatoolsConfig", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027AvailabilityGroups.Default.FailureConditionLevel\u0027 -Fallback \u0027OnCriticalServerErrors\u0027)", "OnAnyQualifiedFailureCondition,OnCriticalServerErrors,OnModerateServerErrors,OnServerDown,OnServerUnresponsive" ], [ "HealthCheckTimeout", "This setting used to specify the length of time, in milliseconds, that the SQL Server resource DLL should wait for information returned by the sp_server_diagnostics stored procedure before reporting \r\nthe Always On Failover Cluster Instance (FCI) as unresponsive.\nChanges that are made to the timeout settings are effective immediately and do not require a restart of the SQL Server resource.\nDefaults to 30000 (30 seconds).", "", false, "false", "30000", "" ], [ "Basic", "Indicates whether the availability group is basic. Basic availability groups like pumpkin spice and uggs.\nhttps://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/basic-availability-groups-always-on-availability-groups", "", false, "false", "False", "" ], [ "DatabaseHealthTrigger", "Indicates whether the availability group triggers the database health.", "", false, "false", "False", "" ], [ "Passthru", "Don\u0027t create the availability group, just pass thru an object that can be further customized before creation.", "", false, "false", "False", "" ], [ "Database", "The database or databases to add.", "", false, "false", "", "" ], [ "SharedPath", "The network share where the backups will be backed up and restored from.\nEach SQL Server service account must have access to this share.\nNOTE: If a backup / restore is performed, the backups will be left in tact on the network share.", "", false, "false", "", "" ], [ "UseLastBackup", "Use the last full and log backup of database. A log backup must be the last backup.", "", false, "false", "False", "" ], [ "Force", "Drop and recreate the database on remote servers using fresh backup.", "", false, "false", "False", "" ], [ "AvailabilityMode", "Sets the availability mode of the availability group replica. Options are: AsynchronousCommit and SynchronousCommit. SynchronousCommit is default.", "", false, "false", "SynchronousCommit", "AsynchronousCommit,SynchronousCommit" ], [ "FailoverMode", "Sets the failover mode of the availability group replica. Options are Automatic, Manual and External. Automatic is default.", "", false, "false", "Automatic", "Automatic,Manual,External" ], [ "BackupPriority", "Sets the backup priority availability group replica. Default is 50.", "", false, "false", "50", "" ], [ "ConnectionModeInPrimaryRole", "Specifies the connection intent modes of an Availability Replica in primary role. AllowAllConnections by default.", "", false, "false", "AllowAllConnections", "AllowAllConnections,AllowReadWriteConnections" ], [ "ConnectionModeInSecondaryRole", "Specifies the connection modes of an Availability Replica in secondary role.\r\nOptions include: AllowNoConnections (Alias: No), AllowReadIntentConnectionsOnly (Alias: Read-intent only), AllowAllConnections (Alias: Yes)\nDefaults to AllowNoConnections.\nThe default can be changed with:\r\nSet-DbatoolsConfig -FullName \u0027AvailabilityGroups.Default.ConnectionModeInSecondaryRole\u0027 -Value \u0027...\u0027 -Passthru | Register-DbatoolsConfig", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027AvailabilityGroups.Default.ConnectionModeInSecondaryRole\u0027 -Fallback \u0027AllowNoConnections\u0027)", "AllowNoConnections,AllowReadIntentConnectionsOnly,AllowAllConnections,No,Read-intent only,Yes" ], [ "SeedingMode", "Specifies how the secondary replica will be initially seeded.\nAutomatic enables direct seeding. This method will seed the secondary replica over the network. This method does not require you to backup and restore a copy of the primary database on the replica.\nManual requires you to create a backup of the database on the primary replica and manually restore that backup on the secondary replica.", "", false, "false", "Manual", "Automatic,Manual" ], [ "Endpoint", "By default, this command will attempt to find a DatabaseMirror endpoint. If one does not exist, it will create it.\nIf an endpoint must be created, the name \"hadr_endpoint\" will be used. If an alternative is preferred, use Endpoint.", "", false, "false", "", "" ], [ "EndpointUrl", "By default, the property Fqdn of Get-DbaEndpoint is used as EndpointUrl.\nUse EndpointUrl if different URLs are required due to special network configurations.\r\nEndpointUrl has to be an array of strings in format \u0027TCP://system-address:port\u0027, one entry for every instance.\r\nFirst entry for the primary instance, following entries for secondary instances in the order they show up in Secondary.\r\nSee details regarding the format at: https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/specify-endpoint-url-adding-or-modifying-availability-replica", "", false, "false", "", "" ], [ "ReadonlyRoutingConnectionUrl", "Sets the read only routing connection url for the availability replica.", "", false, "false", "", "" ], [ "Certificate", "Specifies that the endpoint is to authenticate the connection using the certificate specified by certificate_name to establish identity for authorization.\nThe far endpoint must have a certificate with the public key matching the private key of the specified certificate.", "", false, "false", "", "" ], [ "ConfigureXESession", "Configure the AlwaysOn_health extended events session to start automatically on every replica as the SSMS wizard would do.\r\nhttps://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/always-on-extended-events#BKMK_alwayson_health", "", false, "false", "False", "" ], [ "IPAddress", "Sets the IP address of the availability group listener.", "", false, "false", "", "" ], [ "SubnetMask", "Sets the subnet IP mask of the availability group listener.", "", false, "false", "255.255.255.0", "" ], [ "Port", "Sets the number of the port used to communicate with the availability group.", "", false, "false", "1433", "" ], [ "Dhcp", "Indicates whether the object is DHCP.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaAvailabilityGroup [[-Primary] \u003cDbaInstanceParameter\u003e] [[-PrimarySqlCredential] \u003cPSCredential\u003e] [[-Secondary] \u003cDbaInstanceParameter[]\u003e] [[-SecondarySqlCredential] \u003cPSCredential\u003e] [-Name] \u003cString\u003e [-DtcSupport] [[-ClusterType] \u003cString\u003e] [[-AutomatedBackupPreference] \u003cString\u003e] [[-FailureConditionLevel] \u003cString\u003e] [[-HealthCheckTimeout] \u003cInt32\u003e] [-Basic] [-DatabaseHealthTrigger] [-Passthru] [[-Database] \u003cString[]\u003e] [[-SharedPath] \u003cString\u003e] [-UseLastBackup] [-Force] [[-AvailabilityMode] \u003cString\u003e] [[-FailoverMode] \u003cString\u003e] [[-BackupPriority] \u003cInt32\u003e] [[-ConnectionModeInPrimaryRole] \u003cString\u003e] \r\n[[-ConnectionModeInSecondaryRole] \u003cString\u003e] [[-SeedingMode] \u003cString\u003e] [[-Endpoint] \u003cString\u003e] [[-EndpointUrl] \u003cString[]\u003e] [[-ReadonlyRoutingConnectionUrl] \u003cString\u003e] [[-Certificate] \u003cString\u003e] [-ConfigureXESession] [[-IPAddress] \u003cIPAddress[]\u003e] [[-SubnetMask] \u003cIPAddress\u003e] [[-Port] \u003cInt32\u003e] [-Dhcp] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaAzAccessToken", "Description": "Generates an oauth2 access token. Currently supports Managed Identities, Service Principals and IRenewableToken.\n\nWant to know more about Access Tokens? This page explains it well: https://dzone.com/articles/using-managed-identity-to-securely-access-azure-re", "Tags": [ "Connect", "Connection", "Azure" ], "Synopsis": "Simplifies the generation of Azure oauth2 tokens.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaAzAccessToken", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaAzAccessToken", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaAzAccessToken -Type ManagedIdentity\nReturns a plain-text token for Managed Identities for SQL Azure Db.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$token = New-DbaAzAccessToken -Type ManagedIdentity -Subtype AzureSqlDb\nPS C:\\\u003e $server = Connect-DbaInstance -SqlInstance myserver.database.windows.net -Database mydb -AccessToken $token -DisableException\nGenerates a token then uses it to connect to Azure SQL DB then connects to an Azure SQL Db\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$token = New-DbaAzAccessToken -Type ServicePrincipal -Tenant whatup.onmicrosoft.com -Credential ee590f55-9b2b-55d4-8bca-38ab123db670\nPS C:\\\u003e $server = Connect-DbaInstance -SqlInstance myserver.database.windows.net -Database mydb -AccessToken $token -DisableException\r\nPS C:\\\u003e Invoke-DbaQuery -SqlInstance $server -Query \"select 1 as test\"\nGenerates a token then uses it to connect to Azure SQL DB then connects to an Azure SQL Db.\r\nOnce the connection is made, it is used to perform a test query.", "Params": [ [ "Type", "The type of request:\r\nManagedIdentity\r\nServicePrincipal\r\nRenewableServicePrincipal", "", true, "false", "", "ManagedIdentity,ServicePrincipal,RenewableServicePrincipal" ], [ "Subtype", "The subtype. Options include:\r\nAzureSqlDb (default)\r\nResourceManager\r\nDataLake\r\nEventHubs\r\nKeyVault\r\nResourceManager\r\nServiceBus\r\nStorage\nRead more here: https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/tutorial-windows-vm-access-sql", "", false, "false", "AzureSqlDb", "AzureSqlDb,ResourceManager,DataLake,EventHubs,KeyVault,ResourceManager,ServiceBus,Storage" ], [ "Config", "The hashtable or json configuration.", "", false, "false", "", "" ], [ "Credential", "When using the ServicePrincipal type, a Credential is required. The username is the App ID and Password is the App Password\nhttps://docs.microsoft.com/en-us/azure/active-directory/user-help/multi-factor-authentication-end-user-app-passwords", "", false, "false", "", "" ], [ "Tenant", "When using the ServicePrincipal or RenewableServicePrincipal types, a tenant name or ID is required. This field works with both.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027azure.tenantid\u0027)", "" ], [ "Thumbprint", "Thumbprint for connections to Azure MSI", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027azure.certificate.thumbprint\u0027)", "" ], [ "Store", "Store where the Azure MSI certificate is stored", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027azure.certificate.store\u0027)", "CurrentUser,LocalMachine" ], [ "EnableException", "By default in most of our commands, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis command, however, gifts you with \"sea of red\" exceptions, by default, because it is useful for advanced scripting.\nUsing this switch turns our \"nice by default\" feature on which makes errors into pretty warnings.", "", false, "false", "False", "" ] ], "Syntax": "New-DbaAzAccessToken [-Type] \u003cString\u003e [[-Subtype] \u003cString\u003e] [[-Config] \u003cObject\u003e] [[-Credential] \u003cPSCredential\u003e] [[-Tenant] \u003cString\u003e] [[-Thumbprint] \u003cString\u003e] [[-Store] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaClientAlias", "Description": "Creates/updates a SQL Server alias by altering HKLM:\\SOFTWARE\\Microsoft\\MSSQLServer\\Client", "Tags": "Alias", "Synopsis": "Creates/updates a sql alias for the specified server - mimics cliconfg.exe", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaClientAlias", "Availability": "Windows only", "Links": "https://dbatools.io/New-DbaClientAlias", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaClientAlias -ServerName sqlcluster\\sharepoint -Alias sp\nCreates a new TCP alias on the local workstation called sp, which points sqlcluster\\sharepoint\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaClientAlias -ServerName \u0027sqlcluster,14443\u0027 -Alias spinstance\nCreates a new TCP alias on the local workstation called spinstance, which points to sqlcluster, port 14443.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaClientAlias -ServerName sqlcluster\\sharepoint -Alias sp -Protocol NamedPipes\nCreates a new NamedPipes alias on the local workstation called sp, which points sqlcluster\\sharepoint", "Params": [ [ "ComputerName", "The target computer where the alias will be created", "", false, "false", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to remote computers using alternative credentials", "", false, "false", "", "" ], [ "ServerName", "The target SQL Server", "", true, "true (ByValue)", "", "" ], [ "Alias", "The alias to be created", "", true, "false", "", "" ], [ "Protocol", "The protocol for the connection, either TCPIP or NetBIOS. Defaults to TCPIP.", "", false, "false", "TCPIP", "TCPIP,NamedPipes" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaClientAlias [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-ServerName] \u003cDbaInstanceParameter\u003e [-Alias] \u003cString\u003e [[-Protocol] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaCmConnection", "Description": "Generates a connection object for use in remote computer management.\nThose objects are used for the purpose of cim/wmi queries, caching which protocol worked, optimizing performance and minimizing authentication errors.\n\nNew-DbaCmConnection will create a NEW object and overwrite any existing ones for the specified computer.\nFurthermore, information stored in the input beyond the computername will be discarded in favor of the new settings.\n\nUnless the connection cache has been disabled, all connections will automatically be registered in the cache, so no further action is necessary.\nThe output is primarily for information purposes, however it may be used to pass objects and circumvent the cache with those.\n\nNOTE: Generally, this function need not be used, as a first connection to a computer using any connecting function such as \"Get-DbaCmObject\" will automatically register a new default connection for it.\n\nThis function exists to be able to preconfigure connections.", "Tags": [ "ComputerManagement", "CIM" ], "Synopsis": "Generates a connection object for use in remote computer management.", "Alias": "", "CommandName": "New-DbaCmConnection", "Availability": "Windows only", "Links": "https://dbatools.io/New-DbaCmConnection", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaCmConnection -ComputerName sql2014 -UseWindowsCredentials -OverrideExplicitCredential -DisabledConnectionTypes CimRM\nReturns a new configuration object for connecting to the computer sql2014.\r\n- The current user credentials are set as valid\r\n- The connection is configured to ignore explicit credentials (so all connections use the windows credentials)\r\n- The connections will not try using CIM over WinRM\nUnless caching is globally disabled, this is automatically stored in the connection cache and will be applied automatically.\r\nIn that (the default) case, the output is for information purposes only and need not be used.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-Content computers.txt | New-DbaCmConnection -Credential $cred -CimWinRMOptions $options -DisableBadCredentialCache -OverrideExplicitCredential\nGathers a list of computers from a text file, then creates and registers connections for each of them, setting them to ...\r\n- use the credentials stored in $cred\r\n- use the options stored in $options when connecting using CIM over WinRM\r\n- not store credentials that are known to not work\r\n- to ignore explicitly specified credentials\nEssentially, this configures all connections to those computers to prefer failure with the specified credentials over using alternative credentials.", "Params": [ [ "ComputerName", "The computer to build the connection object for.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "The credential to register.", "", false, "false", "", "" ], [ "UseWindowsCredentials", "Whether using the default windows credentials is legit.\r\nNot setting this will not exclude using windows credentials, but only not pre-confirm them as working.", "", false, "false", "False", "" ], [ "OverrideExplicitCredential", "Setting this will enable the credential override.\r\nThe override will cause the system to ignore explicitly specified credentials, so long as known, good credentials are available.", "", false, "false", "False", "" ], [ "DisabledConnectionTypes", "Explicitly disable connection types.\r\nThese types will then not be used for connecting to the computer.", "", false, "false", "None", "" ], [ "DisableBadCredentialCache", "Will prevent the caching of credentials if set to true.", "", false, "false", "False", "" ], [ "DisableCimPersistence", "Will prevent Cim-Sessions to be reused.", "", false, "false", "False", "" ], [ "DisableCredentialAutoRegister", "Will prevent working credentials from being automatically cached", "", false, "false", "False", "" ], [ "EnableCredentialFailover", "Will enable automatic failing over to known to work credentials, when using bad credentials.\r\nBy default, passing bad credentials will cause the Computer Management functions to interrupt with a warning (Or exception if in silent mode).", "", false, "false", "False", "" ], [ "WindowsCredentialsAreBad", "Will prevent the windows credentials of the currently logged on user from being used for the remote connection.", "", false, "false", "False", "" ], [ "CimWinRMOptions", "Specify a set of options to use when connecting to the target computer using CIM over WinRM.\r\nUse \u0027New-CimSessionOption\u0027 to create such an object.", "", false, "false", "", "" ], [ "CimDCOMOptions", "Specify a set of options to use when connecting to the target computer using CIM over DCOM.\r\nUse \u0027New-CimSessionOption\u0027 to create such an object.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaCmConnection [-ComputerName \u003cDbaCmConnectionParameter[]\u003e] [-Credential \u003cPSCredential\u003e] [-OverrideExplicitCredential] [-DisabledConnectionTypes {None | CimRM | CimDCOM | Wmi | PowerShellRemoting}] [-DisableBadCredentialCache] [-DisableCimPersistence] [-DisableCredentialAutoRegister] [-EnableCredentialFailover] [-WindowsCredentialsAreBad] [-CimWinRMOptions \u003cWSManSessionOptions\u003e] [-CimDCOMOptions \u003cDComSessionOptions\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nNew-DbaCmConnection [-ComputerName \u003cDbaCmConnectionParameter[]\u003e] [-UseWindowsCredentials] [-OverrideExplicitCredential] [-DisabledConnectionTypes {None | CimRM | CimDCOM | Wmi | PowerShellRemoting}] [-DisableBadCredentialCache] [-DisableCimPersistence] [-DisableCredentialAutoRegister] [-EnableCredentialFailover] [-CimWinRMOptions \u003cWSManSessionOptions\u003e] [-CimDCOMOptions \u003cDComSessionOptions\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaComputerCertificate", "Description": "Creates a new computer certificate - self-signed or signed by an Active Directory CA, using the Web Server certificate.\n\nBy default, a key with a length of 1024 and a friendly name of the machines FQDN is generated.\n\nThis command was originally intended to help automate the process so that SSL certificates can be available for enforcing encryption on connections.\n\nIt makes a lot of assumptions - namely, that your account is allowed to auto-enroll and that you have permission to do everything it needs to do ;)\n\nReferences:\nhttps://www.itprotoday.com/sql-server/7-steps-ssl-encryption\nhttps://azurebi.jppp.org/2016/01/23/using-lets-encrypt-certificates-for-secure-sql-server-connections/\nhttps://blogs.msdn.microsoft.com/sqlserverfaq/2016/09/26/creating-and-registering-ssl-certificates/\n\nThe certificate is generated using AD\u0027s webserver SSL template on the client machine and pushed to the remote machine.", "Tags": "Certificate", "Synopsis": "Creates a new computer certificate useful for Forcing Encryption", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaComputerCertificate", "Availability": "Windows only", "Links": "https://dbatools.io/New-DbaComputerCertificate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaComputerCertificate\nCreates a computer certificate signed by the local domain CA for the local machine with the keylength of 1024.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaComputerCertificate -ComputerName Server1\nCreates a computer certificate signed by the local domain CA _on the local machine_ for server1 with the keylength of 1024.\nThe certificate is then copied to the new machine over WinRM and imported.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaComputerCertificate -ComputerName sqla, sqlb -ClusterInstanceName sqlcluster -KeyLength 4096\nCreates a computer certificate for sqlcluster, signed by the local domain CA, with the keylength of 4096.\nThe certificate is then copied to sqla _and_ sqlb over WinRM and imported.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eNew-DbaComputerCertificate -ComputerName Server1 -WhatIf\nShows what would happen if the command were run\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eNew-DbaComputerCertificate -SelfSigned\nCreates a self-signed certificate", "Params": [ [ "ComputerName", "The target SQL Server instance or instances. Defaults to localhost. If target is a cluster, you must also specify ClusterInstanceName (see below)", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to $ComputerName using alternative credentials.", "", false, "false", "", "" ], [ "CaServer", "Optional - the CA Server where the request will be sent to", "", false, "false", "", "" ], [ "CaName", "The properly formatted CA name of the corresponding CaServer", "", false, "false", "", "" ], [ "ClusterInstanceName", "When creating certs for a cluster, use this parameter to create the certificate for the cluster node name. Use ComputerName for each of the nodes.", "", false, "false", "", "" ], [ "SecurePassword", "Password to encrypt/decrypt private key for export to remote machine", "Password", false, "false", "", "" ], [ "FriendlyName", "The FriendlyName listed in the certificate. This defaults to the FQDN of the $ComputerName", "", false, "false", "SQL Server", "" ], [ "CertificateTemplate", "The domain\u0027s Certificate Template - WebServer by default.", "", false, "false", "WebServer", "" ], [ "KeyLength", "The length of the key - defaults to 1024", "", false, "false", "1024", "" ], [ "Store", "Certificate store - defaults to LocalMachine", "", false, "false", "LocalMachine", "" ], [ "Folder", "Certificate folder - defaults to My (Personal)", "", false, "false", "My", "" ], [ "Dns", "Specify the Dns entries listed in SAN. By default, it will be ComputerName + FQDN, or in the case of clusters, clustername + cluster FQDN.", "", false, "false", "", "" ], [ "SelfSigned", "Creates a self-signed certificate. All other parameters can still apply except CaServer and CaName because the command does not go and get the certificate signed.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaComputerCertificate [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-CaServer] \u003cString\u003e] [[-CaName] \u003cString\u003e] [[-ClusterInstanceName] \u003cString\u003e] [[-SecurePassword] \u003cSecureString\u003e] [[-FriendlyName] \u003cString\u003e] [[-CertificateTemplate] \u003cString\u003e] [[-KeyLength] \u003cInt32\u003e] [[-Store] \u003cString\u003e] [[-Folder] \u003cString\u003e] [[-Dns] \u003cString[]\u003e] [-SelfSigned] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaComputerCertificateSigningRequest", "Description": "Creates a new computer certificate signing request that is compatible with SQL Server.\n\nBy default, a key with a length of 1024 and a friendly name of the machines FQDN is generated.", "Tags": "Certificate", "Synopsis": "Creates a new computer certificate signing request. Useful for offline servers and Forcing Encryption.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaComputerCertificateSigningRequest", "Availability": "Windows only", "Links": "https://dbatools.io/New-DbaComputerCertificateSigningRequest", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaComputerCertificate\nCreates a computer certificate signing request for the local machine with the keylength of 1024.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaComputerCertificate -ComputerName Server1\nCreates a computer certificate signing request for server1 with the keylength of 1024.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaComputerCertificate -ComputerName sqla, sqlb -ClusterInstanceName sqlcluster -KeyLength 4096\nCreates a computer certificate signing request for sqlcluster with the keylength of 4096.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eNew-DbaComputerCertificate -ComputerName Server1 -WhatIf\nShows what would happen if the command were run", "Params": [ [ "ComputerName", "The target SQL Server instance or instances. Defaults to localhost. If target is a cluster, you must also specify ClusterInstanceName (see below)", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to $ComputerName using alternative credentials.", "", false, "false", "", "" ], [ "ClusterInstanceName", "When creating certs for a cluster, use this parameter to create the certificate for the cluster node name. Use ComputerName for each of the nodes.", "", false, "false", "", "" ], [ "Path", "The folder to export to.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "FriendlyName", "The FriendlyName listed in the certificate. This defaults to the FQDN of the $ComputerName", "", false, "false", "SQL Server", "" ], [ "KeyLength", "The length of the key - defaults to 1024", "", false, "false", "1024", "" ], [ "Dns", "Specify the Dns entries listed in SAN. By default, it will be ComputerName + FQDN, or in the case of clusters, clustername + cluster FQDN.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaComputerCertificateSigningRequest [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-ClusterInstanceName] \u003cString\u003e] [[-Path] \u003cString\u003e] [[-FriendlyName] \u003cString\u003e] [[-KeyLength] \u003cInt32\u003e] [[-Dns] \u003cString[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaConnectionString", "Description": "Builds or extracts a SQL Server Connection String. Note that dbatools-style syntax is used.\n\nSo you do not need to specify \"Data Source\", you can just specify -SqlInstance and -SqlCredential and we\u0027ll handle it for you.\n\nThis is the simplified PowerShell approach to connection string building. See examples for more info.\n\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", "Tags": [ "Connection", "Connect", "ConnectionString" ], "Synopsis": "Builds or extracts a SQL Server Connection String", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaConnectionString", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaConnectionString", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaConnectionString -SqlInstance sql2014\nCreates a connection string that connects using Windows Authentication\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eConnect-DbaInstance -SqlInstance sql2016 | New-DbaConnectionString\nBuilds a connected SMO object using Connect-DbaInstance then extracts and displays the connection string\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$wincred = Get-Credential ad\\sqladmin\nPS C:\\\u003e New-DbaConnectionString -SqlInstance sql2014 -Credential $wincred\nCreates a connection string that connects using alternative Windows credentials\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$sqlcred = Get-Credential sqladmin\nPS C:\\\u003e $server = New-DbaConnectionString -SqlInstance sql2014 -Credential $sqlcred\nLogin to sql2014 as SQL login sqladmin.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$connstring = New-DbaConnectionString -SqlInstance mydb.database.windows.net -SqlCredential me@myad.onmicrosoft.com -Database db\nCreates a connection string for an Azure Active Directory login to Azure SQL db. Output looks like this:\r\nData Source=TCP:mydb.database.windows.net,1433;Initial Catalog=db;User ID=me@myad.onmicrosoft.com;Password=fakepass;MultipleActiveResultSets=False;Connect \r\nTimeout=30;Encrypt=True;TrustServerCertificate=False;Application Name=\"dbatools PowerShell module - dbatools.io\";Authentication=\"Active Directory Password\"\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$server = New-DbaConnectionString -SqlInstance sql2014 -ClientName \"mah connection\"\nCreates a connection string that connects using Windows Authentication and uses the client name \"mah connection\". So when you open up profiler or use extended events, you can search for \"mah \r\nconnection\".\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$server = New-DbaConnectionString -SqlInstance sql2014 -AppendConnectionString \"Packet Size=4096;AttachDbFilename=C:\\MyFolder\\MyDataFile.mdf;User Instance=true;\"\nCreates a connection string that connects to sql2014 using Windows Authentication, then it sets the packet size (this can also be done via -PacketSize) and other connection attributes.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003e$server = New-DbaConnectionString -SqlInstance sql2014 -NetworkProtocol TcpIp -MultiSubnetFailover\nCreates a connection string with Windows Authentication that uses TCPIP and has MultiSubnetFailover enabled.\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003e$connstring = New-DbaConnectionString sql2016 -ApplicationIntent ReadOnly\nCreates a connection string with ReadOnly ApplicationIntent.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "ServerInstance,SqlServer,Server,DataSource", true, "true (ByValue)", "", "" ], [ "Credential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance. be it Windows or SQL Server. Windows users are determined by the existence of a backslash, so if you are intending to use an alternative Windows \r\nconnection instead of a SQL login, ensure it contains a backslash.", "SqlCredential", false, "false", "", "" ], [ "AccessToken", "Basically tells the connection string to ignore authentication. Does not include the AccessToken in the resulting connecstring.", "", false, "false", "", "" ], [ "ApplicationIntent", "Declares the application workload type when connecting to a server. Possible values are ReadOnly and ReadWrite.", "", false, "false", "", "ReadOnly,ReadWrite" ], [ "BatchSeparator", "By default, this is \"GO\"", "", false, "false", "", "" ], [ "ClientName", "By default, this command sets the client\u0027s ApplicationName property to \"dbatools PowerShell module - dbatools.io\". If you\u0027re doing anything that requires profiling, you can look for this client name. \r\nUsing -ClientName allows you to set your own custom client application name.", "", false, "false", "custom connection", "" ], [ "ConnectTimeout", "The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.\nValid values are greater than or equal to 0 and less than or equal to 2147483647.\nWhen opening a connection to a Azure SQL Database, set the connection timeout to 30 seconds.", "", false, "false", "0", "" ], [ "Database", "Database name", "", false, "false", "", "" ], [ "EncryptConnection", "When true, SQL Server uses SSL encryption for all data sent between the client and server if the server has a certificate installed. Recognized values are true, false, yes, and no. For more \r\ninformation, see Connection String Syntax.\nBeginning in .NET Framework 4.5, when TrustServerCertificate is false and Encrypt is true, the server name (or IP address) in a SQL Server SSL certificate must exactly match the server name (or IP \r\naddress) specified in the connection string. Otherwise, the connection attempt will fail. For information about support for certificates whose subject starts with a wildcard character (*), see \r\nAccepted wildcards used by server certificates for server authentication.", "", false, "false", "False", "" ], [ "FailoverPartner", "The name of the failover partner server where database mirroring is configured.\nIf the value of this key is \"\", then Initial Catalog must be present, and its value must not be \"\".\nThe server name can be 128 characters or less.\nIf you specify a failover partner but the failover partner server is not configured for database mirroring and the primary server (specified with the Server keyword) is not available, then the \r\nconnection will fail.\nIf you specify a failover partner and the primary server is not configured for database mirroring, the connection to the primary server (specified with the Server keyword) will succeed if the primary \r\nserver is available.", "", false, "false", "", "" ], [ "IsActiveDirectoryUniversalAuth", "Azure related", "", false, "false", "False", "" ], [ "LockTimeout", "Sets the time in seconds required for the connection to time out when the current transaction is locked.", "", false, "false", "0", "" ], [ "MaxPoolSize", "Sets the maximum number of connections allowed in the connection pool for this specific connection string.", "", false, "false", "0", "" ], [ "MinPoolSize", "Sets the minimum number of connections allowed in the connection pool for this specific connection string.", "", false, "false", "0", "" ], [ "MultipleActiveResultSets", "When used, an application can maintain multiple active result sets (MARS). When false, an application must process or cancel all result sets from one batch before it can execute any other batch on \r\nthat connection.", "", false, "false", "False", "" ], [ "MultiSubnetFailover", "If your application is connecting to an AlwaysOn availability group (AG) on different subnets, setting MultiSubnetFailover provides faster detection of and connection to the (currently) active \r\nserver. For more information about SqlClient support for Always On Availability Groups", "", false, "false", "False", "" ], [ "NetworkProtocol", "Connect explicitly using \u0027TcpIp\u0027,\u0027NamedPipes\u0027,\u0027Multiprotocol\u0027,\u0027AppleTalk\u0027,\u0027BanyanVines\u0027,\u0027Via\u0027,\u0027SharedMemory\u0027 and \u0027NWLinkIpxSpx\u0027", "", false, "false", "", "TcpIp,NamedPipes,Multiprotocol,AppleTalk,BanyanVines,Via,SharedMemory,NWLinkIpxSpx" ], [ "NonPooledConnection", "Request a non-pooled connection", "", false, "false", "False", "" ], [ "PacketSize", "Sets the size in bytes of the network packets used to communicate with an instance of SQL Server. Must match at server.", "", false, "false", "0", "" ], [ "PooledConnectionLifetime", "When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by \r\nConnection Lifetime. This is useful in clustered configurations to force load balancing between a running server and a server just brought online.\nA value of zero (0) causes pooled connections to have the maximum connection timeout.", "", false, "false", "0", "" ], [ "SqlExecutionModes", "The SqlExecutionModes enumeration contains values that are used to specify whether the commands sent to the referenced connection to the server are executed immediately or saved in a buffer.\nValid values include CaptureSql, ExecuteAndCaptureSql and ExecuteSql.", "", false, "false", "", "CaptureSql,ExecuteAndCaptureSql,ExecuteSql" ], [ "StatementTimeout", "Sets the number of seconds a statement is given to run before failing with a time-out error.", "", false, "false", "0", "" ], [ "TrustServerCertificate", "Sets a value that indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.", "", false, "false", "False", "" ], [ "WorkstationId", "Sets the name of the workstation connecting to SQL Server.", "", false, "false", "", "" ], [ "Legacy", "Use this switch to create a connection string using System.Data.SqlClient instead of Microsoft.Data.SqlClient.", "", false, "false", "False", "" ], [ "AppendConnectionString", "Appends to the current connection string. Note that you cannot pass authentication information using this method. Use -SqlInstance and, optionally, -SqlCredential to set authentication information.", "", false, "false", "", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaConnectionString [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-Credential] \u003cPSCredential\u003e] [[-AccessToken] \u003cString\u003e] [[-ApplicationIntent] \u003cString\u003e] [[-BatchSeparator] \u003cString\u003e] [[-ClientName] \u003cString\u003e] [[-ConnectTimeout] \u003cInt32\u003e] [[-Database] \u003cString\u003e] [-EncryptConnection] [[-FailoverPartner] \u003cString\u003e] [-IsActiveDirectoryUniversalAuth] [[-LockTimeout] \u003cInt32\u003e] [[-MaxPoolSize] \u003cInt32\u003e] [[-MinPoolSize] \u003cInt32\u003e] [-MultipleActiveResultSets] [-MultiSubnetFailover] [[-NetworkProtocol] \u003cString\u003e] [-NonPooledConnection] [[-PacketSize] \u003cInt32\u003e] [[-PooledConnectionLifetime] \u003cInt32\u003e] \r\n[[-SqlExecutionModes] \u003cString\u003e] [[-StatementTimeout] \u003cInt32\u003e] [-TrustServerCertificate] [[-WorkstationId] \u003cString\u003e] [-Legacy] [[-AppendConnectionString] \u003cString\u003e] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaConnectionStringBuilder", "Description": "Creates a Microsoft.Data.SqlClient.SqlConnectionStringBuilder from a connection string.", "Tags": [ "SqlBuild", "ConnectionString", "Connection" ], "Synopsis": "Returns a Microsoft.Data.SqlClient.SqlConnectionStringBuilder with the string specified", "Alias": "", "Author": "zippy1981 | Chrissy LeMaire (@cl)", "CommandName": "New-DbaConnectionStringBuilder", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaConnectionStringBuilder", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaConnectionStringBuilder\nReturns an empty ConnectionStringBuilder\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\"Data Source=localhost,1433;Initial Catalog=AlwaysEncryptedSample;UID=sa;PWD=alwaysB3Encrypt1ng;Application Name=Always Encrypted Sample MVC App;Column Encryption Setting=enabled\" | \r\nNew-DbaConnectionStringBuilder\nReturns a connection string builder that can be used to connect to the local sql server instance on the default port.", "Params": [ [ "ConnectionString", "A Connection String", "", false, "true (ByValue)", "", "" ], [ "ApplicationName", "The application name to tell SQL Server the connection is associated with.", "", false, "false", "dbatools Powershell Module", "" ], [ "DataSource", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "SqlInstance", false, "false", "", "" ], [ "SqlCredential", "Credential object used to connect to the SQL Server Instance as a different user. This can be a Windows or SQL Server account. Windows users are determined by the existence of a backslash, so if you \r\nare intending to use an alternative Windows connection instead of a SQL login, ensure it contains a backslash.", "", false, "false", "", "" ], [ "InitialCatalog", "The initial database on the server to connect to.", "Database", false, "false", "", "" ], [ "IntegratedSecurity", "Sets to use windows authentication.", "", false, "false", "False", "" ], [ "UserName", "Sql User Name to connect with. Consider using SqlCredential instead.", "", false, "false", "", "" ], [ "Password", "Password to use to connect with. Consider using SqlCredential instead.", "", false, "false", "", "" ], [ "MultipleActiveResultSets", "Enable Multiple Active Result Sets.", "MARS", false, "false", "False", "" ], [ "ColumnEncryptionSetting", "Enable Always Encrypted.", "AlwaysEncrypted", false, "false", "", "Enabled" ], [ "Legacy", "Use this switch to create a connection string using System.Data.SqlClient instead of Microsoft.Data.SqlClient.", "", false, "false", "False", "" ], [ "NonPooledConnection", "If this switch is enabled, a non-pooled connection will be requested.", "", false, "false", "False", "" ], [ "WorkstationId", "Set the Workstation Id that is associated with the connection.", "", false, "false", "$env:COMPUTERNAME", "" ] ], "Syntax": "New-DbaConnectionStringBuilder [[-ConnectionString] \u003cString[]\u003e] [[-ApplicationName] \u003cString\u003e] [[-DataSource] \u003cString\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-InitialCatalog] \u003cString\u003e] [-IntegratedSecurity] [[-UserName] \u003cString\u003e] [[-Password] \u003cString\u003e] [-MultipleActiveResultSets] [[-ColumnEncryptionSetting] \u003cString\u003e] [-Legacy] [-NonPooledConnection] [[-WorkstationId] \u003cString\u003e] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaCredential", "Description": "Creates a new credential", "Tags": [ "Certificate", "Credential" ], "Synopsis": "Creates a new SQL Server credential", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaCredential", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaCredential", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaCredential -SqlInstance Server1\nYou will be prompted to securely enter your password, then a credential will be created in the master database on server1 if it does not exist.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaCredential -SqlInstance Server1 -Confirm:$false\nSuppresses all prompts to install but prompts to securely enter your password and creates a credential on Server1.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$params = @{\n\u003e\u003eSqlInstance = \"Server1\"\r\n\u003e\u003eName = \"AzureBackupBlobStore\"\r\n\u003e\u003eIdentity = \"https://\u003cAzure Storage Account Name\u003e.blob.core.windows.net/\u003cBlob Container Name\u003e\"\r\n\u003e\u003eSecurePassword = (ConvertTo-SecureString \u0027\u003cAzure Storage Account Access Key\u003e\u0027 -AsPlainText -Force)\r\n\u003e\u003e}\r\nPS C:\\\u003e New-DbaCredential @params\nCreates a credential, \"AzureBackupBlobStore\", on Server1 using the Access Keys for Backup To URL. Identity must be the full URI for the blob container that will be the backup target. The \r\nSecurePassword supplied is one of the two Access Keys for the Azure Storage Account.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$sasParams = @{\n\u003e\u003eSqlInstance = \"server1\"\r\n\u003e\u003eName = \"https://\u003cazure storage account name\u003e.blob.core.windows.net/\u003cblob container\u003e\"\r\n\u003e\u003eIdentity = \"SHARED ACCESS SIGNATURE\"\r\n\u003e\u003eSecurePassword = (ConvertTo-SecureString \u0027\u003cShared Access Token\u003e\u0027 -AsPlainText -Force)\r\n\u003e\u003e}\r\nPS C:\\\u003e New-DbaCredential @sasParams\nCreate a credential on Server1 using a SAS token for Backup To URL. The Name is the full URI for the blob container that will be the backup target.\r\nThe SecurePassword will be the Shared Access Token (SAS), as a SecureString.", "Params": [ [ "SqlInstance", "The target SQL Server(s)", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "The Credential name", "", false, "false", "$Identity", "" ], [ "Identity", "The Credential Identity", "CredentialIdentity", true, "false", "", "" ], [ "SecurePassword", "Secure string used to authenticate the Credential Identity", "Password", false, "false", "", "" ], [ "MappedClassType", "Sets the class associated with the credential.", "", false, "false", "None", "CryptographicProvider,None" ], [ "ProviderName", "Sets the name of the provider", "", false, "false", "", "" ], [ "Force", "If credential exists, drop and recreate", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaCredential [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cObject[]\u003e] [-Identity] \u003cString[]\u003e [[-SecurePassword] \u003cSecureString\u003e] [[-MappedClassType] \u003cString\u003e] [[-ProviderName] \u003cString\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaCustomError", "Description": "This command provides a wrapper for the sp_addmessage system procedure that allows for user defined messages to be added to sys.messages.\n\nNote: See the remarks section of the documentation for sp_addmessage regarding the addition of non-English messages. The U.S. English message needs to be added first and the severity must be the same.", "Tags": [ "Error", "CustomError" ], "Synopsis": "Creates a user defined message in sys.messages. This command does not support Azure SQL Database.", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "New-DbaCustomError", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaCustomError", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaCustomError -SqlInstance sqldev01, sqldev02 -MessageID 70001 -Severity 16 -MessageText \"test\"\nCreates a new custom message on the sqldev01 and sqldev02 instances with ID 70001, severity 16, and text \"test\".\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaCustomError -SqlInstance sqldev01 -MessageID 70001 -Severity 16 -MessageText \"test\" -Language \"French\"\nCreates a new custom message on the sqldev01 instance for the french language with ID 70001, severity 16, and text \"test\".\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaCustomError -SqlInstance sqldev01 -MessageID 70001 -Severity 16 -MessageText \"test\" -WithLog\nCreates a new custom message on the sqldev01 instance with ID 70001, severity 16, text \"test\", and enables the log mechanism.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$server = Connect-DbaInstance sqldev01\nPS C:\\\u003e $newMessage = New-DbaCustomError -SqlInstance $server -MessageID 70000 -Severity 16 -MessageText \"test_70000\"\nCreates a new custom message on the sqldev01 instance with ID 70000, severity 16, and text \"test_70000\"\nTo modify the custom message at a later time the following can be done to change the severity from 16 to 20:\nPS C:\\\u003e $original = $server.UserDefinedMessages | Where-Object ID -eq 70000\r\nPS C:\\\u003e $messageID = $original.ID\r\nPS C:\\\u003e $severity = 20\r\nPS C:\\\u003e $text = $original.Text\r\nPS C:\\\u003e $language = $original.Language\r\nPS C:\\\u003e $removed = Remove-DbaCustomError -SqlInstance $server -MessageID 70000\r\nPS C:\\\u003e $alteredMessage = New-DbaCustomError -SqlInstance $server -MessageID $messageID -Severity $severity -MessageText $text -Language $language -WithLog\nThe resulting updated message object is available in $alteredMessage.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\r\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\r\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "MessageID", "An integer between 50001 and 2147483647.", "", false, "false", "0", "" ], [ "Severity", "Severity level between 1 and 25.", "", false, "false", "0", "" ], [ "MessageText", "Error message text with max length of 255 characters.", "", false, "false", "", "" ], [ "Language", "Language for this message. The valid values for Language are contained in the Name and Alias columns from sys.syslanguages.", "", false, "false", "English", "" ], [ "WithLog", "Always write this message to the Windows application log and the SQL Server Error Log when it occurs.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaCustomError [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-MessageID] \u003cInt32\u003e] [[-Severity] \u003cInt32\u003e] [[-MessageText] \u003cString\u003e] [[-Language] \u003cString\u003e] [-WithLog] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDacOption", "Description": "Creates a new Microsoft.SqlServer.Dac.DacExtractOptions/DacExportOptions object that can be used during DacPackage extract. Basically saves you the time from remembering the SMO assembly name ;)\n\nSee:\nhttps://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dac.dacexportoptions.aspx\nhttps://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dac.dacextractoptions.aspx\nfor more information", "Tags": [ "Migration", "Database", "Dacpac" ], "Synopsis": "Creates a new Microsoft.SqlServer.Dac.DacExtractOptions/DacExportOptions object depending on the chosen Type", "Alias": "", "Author": "Kirill Kravtsov (@nvarscar), nvarscar.wordpress.com", "CommandName": "New-DbaDacOption", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDacOption", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$options = New-DbaDacOption -Type Dacpac -Action Export\nPS C:\\\u003e $options.ExtractAllTableData = $true\r\nPS C:\\\u003e $options.CommandTimeout = 0\r\nPS C:\\\u003e Export-DbaDacPackage -SqlInstance sql2016 -Database DB1 -Options $options\nUses DacOption object to set the CommandTimeout to 0 then extracts the dacpac for SharePoint_Config on sql2016 to C:\\temp\\SharePoint_Config.dacpac including all table data.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$options = New-DbaDacOption -Type Dacpac -Action Publish\nPS C:\\\u003e $options.DeployOptions.DropObjectsNotInSource = $true\r\nPS C:\\\u003e Publish-DbaDacPackage -SqlInstance sql2016 -Database DB1 -Options $options -Path c:\\temp\\db.dacpac\nUses DacOption object to set Deployment Options and publish the db.dacpac dacpac file as DB1 on sql2016", "Params": [ [ "Type", "Selecting the type of the export: Dacpac (default) or Bacpac.", "", false, "false", "Dacpac", "Dacpac,Bacpac" ], [ "Action", "Choosing an intended action: Publish or Export.", "", true, "false", "", "Publish,Export" ], [ "PublishXml", "Specifies the publish profile which will include options and sqlCmdVariables.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDacOption [[-Type] \u003cString\u003e] [-Action] \u003cString\u003e [[-PublishXml] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDacProfile", "Description": "The New-DbaDacProfile command generates a standard publish profile xml file that can be used by the DacFx (this and everything else) to control the deployment of your dacpac\nThis generates a standard template XML which is enough to dpeloy a dacpac but it is highly recommended that you add additional options to the publish profile.\nIf you use Visual Studio you can open a publish.xml file and use the ui to edit the file -\nTo create a new file, right click on an SSDT project, choose \"Publish\" then \"Load Profile\" and load your profile or create a new one.\nOnce you have loaded it in Visual Studio, clicking advanced shows you the list of options available to you.\nFor a full list of options that you can add to the profile, google \"sqlpackage.exe command line switches\" or (https://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx)", "Tags": "Dacpac", "Synopsis": "Creates a new Publish Profile.", "Alias": "", "Author": "Richie lee (@richiebzzzt)", "CommandName": "New-DbaDacProfile", "Availability": "Windows only", "Links": "https://dbatools.io/New-DbaDacProfile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDacProfile -SqlInstance sql2017 -SqlCredential ad\\sqldba -Database WorldWideImporters -Path C:\\temp\nIn this example, a prompt will appear for alternative credentials, then a connection will be made to sql2017. Using that connection,\r\nthe ConnectionString will be extracted and used within the Publish Profile XML file which will be created at C:\\temp\\sql2017-WorldWideImporters-publish.xml\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaDacProfile -Database WorldWideImporters -Path C:\\temp -ConnectionString \"SERVER=(localdb)\\MSSQLLocalDB;Integrated Security=True;Database=master\"\nIn this example, no connections are made, and a Publish Profile XML would be created at C:\\temp\\localdb-MSSQLLocalDB-WorldWideImporters-publish.xml", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Alternatively, you can provide a ConnectionString.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database name you are targeting", "", true, "false", "", "" ], [ "Path", "The directory where you would like to save the profile xml file(s).", "", false, "false", "\"$home\\Documents\"", "" ], [ "ConnectionString", "The connection string to the database you are upgrading.\nAlternatively, you can provide a SqlInstance (and optionally SqlCredential) and the script will connect and generate the connectionstring.", "", false, "false", "", "" ], [ "PublishOptions", "Optional hashtable to set publish options. Key/value pairs in the hashtable get converted to strings of \"\u003ckey\u003evalue\u003c/key\u003e\".", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDacProfile [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [-Database] \u003cString[]\u003e [[-Path] \u003cString\u003e] [[-ConnectionString] \u003cString[]\u003e] [[-PublishOptions] \u003cHashtable\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDatabase", "Description": "This command creates a new database.\n\nIt allows creation with multiple files, and sets all growth settings to be fixed size rather than percentage growth. The autogrowth settings are obtained from the modeldev file in the model database when not supplied as command line arguments.\n\nThe generated database filenames take the form:\n\n\u003cdb name\u003e_PRIMARY\n\u003cdb name\u003e_Log\n\u003cdb name\u003e_MainData_1 (Secondary filegroup files)", "Tags": "Database", "Synopsis": "Creates a new database", "Alias": "", "Author": "Matthew Darwin (@evoDBA, naturalselectiondba.wordpress.com) | Chrissy LeMaire (@cl)", "CommandName": "New-DbaDatabase", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDatabase", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDatabase -SqlInstance sql1\nCreates a randomly named database (random-N) on instance sql1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaDatabase -SqlInstance sql1 -Name dbatools, dbachecks\nCreates a database named dbatools and a database named dbachecks on sql1\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaDatabase -SqlInstance sql1, sql2, sql3 -Name multidb, multidb2 -SecondaryFilesize 20 -SecondaryFileGrowth 20 -LogSize 20 -LogGrowth 20\nCreates two databases, multidb and multidb2, on 3 instances (sql1, sql2 and sql3) and sets the secondary data file size to 20MB, the file growth to 20MB and the log growth to 20MB for each\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eNew-DbaDatabase -SqlInstance sql1 -Name nondefault -DataFilePath M:\\Data -LogFilePath \u0027L:\\Logs with spaces\u0027 -SecondaryFileCount 2\nCreates a database named nondefault and places data files in in the M:\\data directory and log files in \"L:\\Logs with spaces\".\nCreates a secondary group with 2 files in the Secondary filegroup.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eNew-DbaDatabase -SqlInstance sql1 -Name newDb -LogSize 32 -LogMaxSize 512 -PrimaryFilesize 64 -PrimaryFileMaxSize 512 -SecondaryFilesize 64 -SecondaryFileMaxSize 512 -LogGrowth 32 \r\n-PrimaryFileGrowth 64 -SecondaryFileGrowth 64\nCreates a new database named newDb on the sql1 instance and sets the file sizes, max sizes, and growth as specified. The resulting filenames will take the form:\nnewDb_PRIMARY\r\nnewDb_Log\r\nnewDb_MainData_1 (Secondary filegroup files)", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "The name of the new database or databases to be created.", "Database", false, "false", "", "" ], [ "Collation", "The database collation, if not supplied the default server collation will be used.", "", false, "false", "", "" ], [ "RecoveryModel", "The recovery model for the database, if not supplied the recovery model from the model database will be used.\r\nValid options are: Simple, Full, BulkLogged.", "", false, "false", "", "Simple,Full,BulkLogged" ], [ "Owner", "The login that will be used as the database owner.", "", false, "false", "", "" ], [ "DataFilePath", "The location that data files will be placed, otherwise the default SQL Server data path will be used.", "", false, "false", "", "" ], [ "LogFilePath", "The location the log file will be placed, otherwise the default SQL Server log path will be used.", "", false, "false", "", "" ], [ "PrimaryFilesize", "The size in MB for the Primary file. If this is less than the primary file size for the model database, then the model size will be used instead.", "", false, "false", "0", "" ], [ "PrimaryFileGrowth", "The size in MB that the Primary file will autogrow by.", "", false, "false", "0", "" ], [ "PrimaryFileMaxSize", "The maximum permitted size in MB for the Primary File. If this is less than the primary file size for the model database, then the model size will be used instead.", "", false, "false", "0", "" ], [ "LogSize", "The size in MB that the Transaction log will be created.", "", false, "false", "0", "" ], [ "LogGrowth", "The amount in MB that the log file will be set to autogrow by.", "", false, "false", "0", "" ], [ "LogMaxSize", "The maximum permitted size in MB. If this is less than the log file size for the model database, then the model log size will be used instead.", "", false, "false", "0", "" ], [ "SecondaryFilesize", "The size in MB of the files to be added to the Secondary filegroup. Each file added will be created with this size setting.", "", false, "false", "0", "" ], [ "SecondaryFileGrowth", "The amount in MB that the Secondary files will be set to autogrow by. Use 0 for no growth allowed. Each file added will be created with this growth setting.", "", false, "false", "0", "" ], [ "SecondaryFileMaxSize", "The maximum permitted size in MB for the Secondary data files to grow to. Each file added will be created with this max size setting.", "", false, "false", "0", "" ], [ "SecondaryFileCount", "The number of files to create in the Secondary filegroup for the database.", "", false, "false", "0", "" ], [ "DefaultFileGroup", "Sets the default file group. Either primary or secondary.", "", false, "false", "", "Primary,Secondary" ], [ "DataFileSuffix", "The data file suffix. Defaults to \"_PRIMARY\"", "", false, "false", "_PRIMARY", "" ], [ "LogFileSuffix", "The log file suffix. Defaults to \"_Log\"", "", false, "false", "_Log", "" ], [ "SecondaryDataFileSuffix", "The secondary data file suffix. Defaults to \"_MainData\"", "", false, "false", "_MainData", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDatabase [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString[]\u003e] [[-Collation] \u003cString\u003e] [[-RecoveryModel] \u003cString\u003e] [[-Owner] \u003cString\u003e] [[-DataFilePath] \u003cString\u003e] [[-LogFilePath] \u003cString\u003e] [[-PrimaryFilesize] \u003cInt32\u003e] [[-PrimaryFileGrowth] \u003cInt32\u003e] [[-PrimaryFileMaxSize] \u003cInt32\u003e] [[-LogSize] \u003cInt32\u003e] [[-LogGrowth] \u003cInt32\u003e] [[-LogMaxSize] \u003cInt32\u003e] [[-SecondaryFilesize] \u003cInt32\u003e] [[-SecondaryFileGrowth] \u003cInt32\u003e] [[-SecondaryFileMaxSize] \u003cInt32\u003e] [[-SecondaryFileCount] \u003cInt32\u003e] [[-DefaultFileGroup] \u003cString\u003e] [[-DataFileSuffix] \u003cString\u003e] \r\n[[-LogFileSuffix] \u003cString\u003e] [[-SecondaryDataFileSuffix] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbAsymmetricKey", "Description": "Creates a new database asymmetric key. If no database is specified, the asymmetric key will be created in master.", "Tags": "asymmetrickey", "Synopsis": "Creates a new database asymmetric key", "Alias": "", "Author": "Stuart Moore (@napalmgram), stuart-moore.com", "CommandName": "New-DbaDbAsymmetricKey", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbAsymmetricKey", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDbAsymmetricKey -SqlInstance Server1\nYou will be prompted to securely enter your password, then an asymmetric key will be created in the master database on server1 if it does not exist.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaDbAsymmetricKey -SqlInstance Server1 -Database db1 -Confirm:$false\nSuppresses all prompts to install but prompts to securely enter your password and creates an asymmetric key in the \u0027db1\u0027 database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaDbAsymmetrickKey -SqlInstance Server1 -Database enctest -KeySourceType File -KeySource c:\\keys\\NewKey.snk -Name BackupKey -Owner KeyOwner\nInstalls the key pair held in NewKey.snk into the enctest database creating an AsymmetricKey called BackupKey, which will be owned by KeyOwner", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "Optional name to create the asymmetric key. Defaults to database name.", "", false, "false", "", "" ], [ "Database", "The database where the asymmetric key will be created. Defaults to master.", "", false, "false", "master", "" ], [ "SecurePassword", "Optional password - if no password is supplied, the password will be protected by the master key", "Password", false, "false", "", "" ], [ "Owner", "User within the database who will own the key. Defaults to the user creating the key if not specified. User must exist withing the database already", "", false, "false", "", "" ], [ "KeySource", "The path to the Executable, File or Assembly to be passed in.\r\nThe path is parsed by the SQL Server instance, so needs to visiable to the instance", "", false, "false", "", "" ], [ "KeySourceType", "The source of external keys loaded in, can be one of Executable, File or Assemnly\r\nWe do not currently support Provider", "", false, "false", "", "Executable,File,SqlAssembly" ], [ "InputObject", "Enables piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "Algorithm", "The algorithm used to generate the key. Can be one of RSA512, RSA1024, RSA1024, RSA2048, RSA3072 or RSA4096. If not specified RSA2048 is the default\r\nThis value will be ignored when KeySource is supplied, as the algorithm is embedded in the KeySource", "", false, "false", "Rsa2048", "Rsa4096,Rsa3072,Rsa2048,Rsa1024,Rsa512" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbAsymmetricKey [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString[]\u003e] [[-Database] \u003cString[]\u003e] [[-SecurePassword] \u003cSecureString\u003e] [[-Owner] \u003cString\u003e] [[-KeySource] \u003cString\u003e] [[-KeySourceType] \u003cString\u003e] [[-InputObject] \u003cDatabase[]\u003e] [[-Algorithm] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbCertificate", "Description": "Creates a new database certificate. If no database is specified, the certificate will be created in master.", "Tags": "Certificate", "Synopsis": "Creates a new database certificate", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaDbCertificate", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbCertificate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDbCertificate -SqlInstance Server1\nYou will be prompted to securely enter your password, then a certificate will be created in the master database on server1 if it does not exist.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaDbCertificate -SqlInstance Server1 -Database db1 -Confirm:$false\nSuppresses all prompts to install but prompts to securely enter your password and creates a certificate in the \u0027db1\u0027 database", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "Optional name to create the certificate. Defaults to database name.", "", false, "false", "", "" ], [ "Database", "The database where the certificate will be created. Defaults to master.", "", false, "false", "master", "" ], [ "Subject", "Optional subject to create the certificate.", "", false, "false", "", "" ], [ "StartDate", "Optional secure string used to create the certificate.", "", false, "false", "(Get-Date)", "" ], [ "ExpirationDate", "Optional secure string used to create the certificate.", "", false, "false", "$StartDate.AddYears(5)", "" ], [ "ActiveForServiceBrokerDialog", "Optional secure string used to create the certificate.", "", false, "false", "False", "" ], [ "SecurePassword", "Optional password - if no password is supplied, the password will be protected by the master key", "Password", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbCertificate [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString[]\u003e] [[-Database] \u003cString[]\u003e] [[-Subject] \u003cString[]\u003e] [[-StartDate] \u003cDateTime\u003e] [[-ExpirationDate] \u003cDateTime\u003e] [-ActiveForServiceBrokerDialog] [[-SecurePassword] \u003cSecureString\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbDataGeneratorConfig", "Description": "Generates a new data generation configuration file. This file is important to apply any data generation to a table in a database.\n\nRead more here:\nhttps://sachabarbs.wordpress.com/2018/06/11/bogus-simple-fake-data-tool/\nhttps://github.com/bchavez/Bogus", "Tags": [ "DataGeneration", "Database" ], "Synopsis": "Generates a new data generation configuration file.", "Alias": "", "Author": "Sander Stad (@sqlstad, sqlstad.nl)", "CommandName": "New-DbaDbDataGeneratorConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbDataGeneratorConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDbDataGeneratorConfig -SqlInstance SQLDB1 -Database DB1 -Path C:\\Temp\\clone\nProcess all tables and columns for database DB1 on instance SQLDB1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaDbDataGeneratorConfig -SqlInstance SQLDB1 -Database DB1 -Table Customer -Path C:\\Temp\\clone\nProcess only table Customer with all the columns", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Databases to process through", "", false, "false", "", "" ], [ "Table", "Tables to process. By default all the tables will be processed", "", false, "false", "", "" ], [ "ResetIdentity", "Resets the identity column for a table to it\u0027s starting value. By default it will continue with the next identity.", "", false, "false", "False", "" ], [ "TruncateTable", "Truncates the tabel befoe inserting the values", "", false, "false", "False", "" ], [ "Rows", "Amount of rows that need to be generated. The default is 1000.", "", false, "false", "1000", "" ], [ "Path", "Path where to save the generated JSON files.\r\nThe naming convention will be \"servername.databasename.tables.json\"", "", true, "false", "", "" ], [ "Force", "Forcefully execute commands when needed", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbDataGeneratorConfig [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Table] \u003cString[]\u003e] [-ResetIdentity] [-TruncateTable] [[-Rows] \u003cInt32\u003e] [-Path] \u003cString\u003e [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbFileGroup", "Description": "Creates a new filegroup for the specified database(s). The filegroup properties cannot be set on an empty filegroup, so it is necessary to add one or more files and then use the Set-DbaDbFileGroup command to set the filegroup properties.", "Tags": [ "Data", "Database", "File", "FileGroup", "Migration", "Partitioning", "Table" ], "Synopsis": "Creates a new empty filegroup.", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "New-DbaDbFileGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbFileGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDbFileGroup -SqlInstance sqldev1 -Database TestDb -FileGroup HRFG1\nCreates the HRFG1 filegroup on the TestDb database on the sqldev1 instance with the default options for the filegroup.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaDbFileGroup -SqlInstance sqldev1 -Database TestDb -FileGroup HRFG1 -FileGroupType FileStreamDataFileGroup\nCreates a filestream filegroup named HRFG1 on the TestDb database on the sqldev1 instance.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaDbFileGroup -SqlInstance sqldev1 -Database TestDb -FileGroup HRFG1 -FileGroupType MemoryOptimizedDataFileGroup\nCreates a MemoryOptimized data filegroup named HRFG1 on the TestDb database on the sqldev1 instance.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqldev1 -Database TestDb | New-DbaDbFileGroup -FileGroup HRFG1\nPasses in the TestDB database via pipeline and creates the HRFG1 filegroup on the TestDb database on the sqldev1 instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database(s).", "", false, "false", "", "" ], [ "FileGroup", "The name of the new filegroup.", "", false, "false", "", "" ], [ "FileGroupType", "The type of the file group. Possible values are \"FileStreamDataFileGroup\", \"MemoryOptimizedDataFileGroup\", \"RowsFileGroup\". The default is \"RowsFileGroup\".", "", false, "false", "RowsFileGroup", "FileStreamDataFileGroup,MemoryOptimizedDataFileGroup,RowsFileGroup" ], [ "InputObject", "Allows piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbFileGroup [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-FileGroup] \u003cString\u003e] [[-FileGroupType] \u003cString\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbMailAccount", "Description": "Creates a new database mail account", "Tags": "DbMail", "Synopsis": "Creates a new database mail account", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaDbMailAccount", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbMailAccount", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$account = New-DbaDbMailAccount -SqlInstance sql2017 -Name \u0027The DBA Team\u0027 -EmailAddress admin@ad.local -MailServer smtp.ad.local\nCreates a new db mail account with the email address admin@ad.local on sql2017 named \"The DBA Team\" using the smtp.ad.local mail server", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "The Name of the account to be created.", "", true, "false", "", "" ], [ "DisplayName", "Sets the name of the mail account that is displayed in messages.", "", false, "false", "$Name", "" ], [ "Description", "Sets the description of the purpose of the mail account.", "", false, "false", "", "" ], [ "EmailAddress", "Sets the e-mail address of the mail account.", "", true, "false", "", "" ], [ "ReplyToAddress", "Sets the e-mail address to which the mail account replies.", "", false, "false", "", "" ], [ "MailServer", "The name of the mail server.", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, the Mail Account will be created even if the mail server is not present.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbMailAccount [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Name] \u003cString\u003e [[-DisplayName] \u003cString\u003e] [[-Description] \u003cString\u003e] [-EmailAddress] \u003cString\u003e [[-ReplyToAddress] \u003cString\u003e] [[-MailServer] \u003cString\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbMailProfile", "Description": "Creates a new database mail profile, and optionally associates it to a database mail account", "Tags": "DbMail", "Synopsis": "Creates a new database mail profile", "Alias": "", "Author": "Ian Lanham (@ilanham)", "CommandName": "New-DbaDbMailProfile", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbMailProfile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$profile = New-DbaDbMailProfile -SqlInstance sql2017 -Name \u0027The DBA Team\u0027\nCreates a new db mail profile", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "The Name of the profile to be created.", "", true, "false", "", "" ], [ "Description", "Sets the description of the purpose of the mail profile.", "", false, "false", "", "" ], [ "MailAccountName", "Associates a db mail account to link to this db mail profile.", "", false, "false", "", "" ], [ "MailAccountPriority", "Sets the priority of the linked db mail account when linking to this db mail profile.", "", false, "false", "0", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbMailProfile [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Name] \u003cString\u003e [[-Description] \u003cString\u003e] [[-MailAccountName] \u003cString\u003e] [[-MailAccountPriority] \u003cInt32\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbMaskingConfig", "Description": "Generates a new data masking configuration file. This file is important to apply any data masking to the data in a database.\n\nNote that the following column and data types are not currently supported:\nIdentity\nForeignKey\nComputed\nHierarchyid\nGeography\nGeometry\nXml\n\nRead more here:\nhttps://sachabarbs.wordpress.com/2018/06/11/bogus-simple-fake-data-tool/\nhttps://github.com/bchavez/Bogus", "Tags": [ "Masking", "DataMasking" ], "Synopsis": "Generates a new data masking configuration file to be used with Invoke-DbaDbDataMasking", "Alias": "", "Author": "Sander Stad (@sqlstad, sqlstad.nl) | Chrissy LeMaire (@cl, netnerds.net)", "CommandName": "New-DbaDbMaskingConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbMaskingConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDbMaskingConfig -SqlInstance SQLDB1 -Database DB1 -Path C:\\Temp\\clone\nProcess all tables and columns for database DB1 on instance SQLDB1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaDbMaskingConfig -SqlInstance SQLDB1 -Database DB1 -Table Customer -Path C:\\Temp\\clone\nProcess only table Customer with all the columns\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaDbMaskingConfig -SqlInstance SQLDB1 -Database DB1 -Table Customer -Column City -Path C:\\Temp\\clone\nProcess only table Customer and only the column named \"City\"", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Databases to process through", "", false, "false", "", "" ], [ "Table", "Tables to process. By default all the tables will be processed", "", false, "false", "", "" ], [ "Column", "Columns to process. By default all the columns will be processed", "", false, "false", "", "" ], [ "Path", "Path where to save the generated JSON files.\r\nTh naming convention will be \"servername.databasename.tables.json\"", "", true, "false", "", "" ], [ "Locale", "Set the local to enable certain settings in the masking", "", false, "false", "en", "" ], [ "CharacterString", "The characters to use in string data. \u0027abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\u0027 by default", "", false, "false", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", "" ], [ "SampleCount", "Amount of rows to sample to make an assessment. The default is 100", "", false, "false", "100", "" ], [ "KnownNameFilePath", "Points to a file containing the custom known names", "", false, "false", "", "" ], [ "PatternFilePath", "Points to a file containing the custom patterns", "", false, "false", "", "" ], [ "ExcludeDefaultKnownName", "Excludes the default known names", "", false, "false", "False", "" ], [ "ExcludeDefaultPattern", "Excludes the default patterns", "", false, "false", "False", "" ], [ "Force", "Forcefully execute commands when needed", "", false, "false", "False", "" ], [ "InputObject", "Used for piping the values from Invoke-DbaDbPiiScan", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbMaskingConfig [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Table] \u003cString[]\u003e] [[-Column] \u003cString[]\u003e] [-Path] \u003cString\u003e [[-Locale] \u003cString\u003e] [[-CharacterString] \u003cString\u003e] [[-SampleCount] \u003cInt32\u003e] [[-KnownNameFilePath] \u003cString\u003e] [[-PatternFilePath] \u003cString\u003e] [-ExcludeDefaultKnownName] [-ExcludeDefaultPattern] [-Force] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbMasterKey", "Description": "Creates a new database master key. If no database is specified, the master key will be created in master.", "Tags": "Certificate", "Synopsis": "Creates a new database master key", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaDbMasterKey", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbMasterKey", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDbMasterKey -SqlInstance Server1\nYou will be prompted to securely enter your password, then a master key will be created in the master database on server1 if it does not exist.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaDbMasterKey -SqlInstance Server1 -Credential usernamedoesntmatter\nYou will be prompted by a credential interface to securely enter your password, then a master key will be created in the master database on server1 if it does not exist.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaDbMasterKey -SqlInstance Server1 -Database db1 -Confirm:$false\nSuppresses all prompts to install but prompts in th console to securely enter your password and creates a master key in the \u0027db1\u0027 database", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Credential", "Enables easy creation of a secure password.", "", false, "false", "", "" ], [ "Database", "The database where the master key will be created. Defaults to master.", "", false, "false", "master", "" ], [ "SecurePassword", "Secure string used to create the key.", "Password", false, "false", "", "" ], [ "InputObject", "Database object piped in from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbMasterKey [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-SecurePassword] \u003cSecureString\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbRole", "Description": "The New-DbaDbRole create new roles on database(s)/ instance(s) of SQL Server.", "Tags": [ "Role", "Database", "Security" ], "Synopsis": "Create new database roles for each database(s)/ instance(s) of SQL Server.", "Alias": "", "Author": "Cláudio Silva (@ClaudioESSilva), https://claudioessilva.eu", "CommandName": "New-DbaDbRole", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbRole", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDbRole -SqlInstance sql2017a -Database db1 -Role \u0027dbExecuter\u0027\nWill create a new role named dbExecuter within db1 on sql2017a instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Role", "The role(s) to create.", "", false, "false", "", "" ], [ "Owner", "The owner of the role. If not specified will assume the default dbo.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbRole [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-Role] \u003cString[]\u003e] [[-Owner] \u003cString\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbSchema", "Description": "Creates a new database schema and assigns an owner.", "Tags": [ "Data", "Database", "Migration", "Permission", "Security", "Schema", "Table", "User" ], "Synopsis": "Creates a new database schema and assigns an owner.", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "New-DbaDbSchema", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbSchema", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDbSchema -SqlInstance localhost -Database example1 -Schema TestSchema1\nCreates the TestSchema1 schema in the example1 database in the localhost instance. The dbo user will be the owner of the schema.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaDbSchema -SqlInstance localhost -Database example1 -Schema TestSchema1, TestSchema2 -SchemaOwner dbatools\nCreates the TestSchema1 and TestSchema2 schemas in the example1 database in the localhost instance and assigns the dbatools user as the owner of the schemas.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaDbSchema -SqlInstance localhost, localhost\\sql2017 -Database example1 -Schema TestSchema1, TestSchema2 -SchemaOwner dbatools\nCreates the TestSchema1 and TestSchema2 schemas in the example1 database in the localhost and localhost\\sql2017 instances and assigns the dbatools user as the owner of the schemas.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance localhost, localhost\\sql2017 -Database example1 | New-DbaDbSchema -Schema TestSchema1, TestSchema2 -SchemaOwner dbatools\nPasses in the example1 db via pipeline and creates the TestSchema1 and TestSchema2 schemas and assigns the dbatools user as the owner of the schemas.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database(s).", "", false, "false", "", "" ], [ "Schema", "The name(s) of the new schema(s)", "", false, "false", "", "" ], [ "SchemaOwner", "The name of the database user that will own the schema(s).", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbSchema [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Schema] \u003cString[]\u003e] [[-SchemaOwner] \u003cString\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbSequence", "Description": "Creates a sequence in the database(s) specified. SQL Server 2012 and higher are supported.", "Tags": [ "Data", "Sequence", "Table" ], "Synopsis": "Creates a sequence.", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "New-DbaDbSequence", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbSequence", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDbSequence -SqlInstance sqldev01 -Database TestDB -Name TestSequence -StartWith 10000 -IncrementBy 10\nCreates a new sequence TestSequence in the TestDB database on the sqldev01 instance. The sequence will start with 10000 and increment by 10.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaDbSequence -SqlInstance sqldev01 -Database TestDB -Name TestSequence -Cycle\nCreates a new sequence TestSequence in the TestDB database on the sqldev01 instance. The sequence will cycle the numbers.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqldev01 -Database TestDB | New-DbaDbSequence -Name TestSequence -Schema TestSchema -IntegerType bigint\nUsing a pipeline this command creates a new bigint sequence named TestSchema.TestSequence in the TestDB database on the sqldev01 instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database(s).", "", false, "false", "", "" ], [ "Name", "The name of the new sequence", "", true, "false", "", "" ], [ "Schema", "The name of the schema for the sequence. The default is dbo.", "", false, "false", "dbo", "" ], [ "IntegerType", "The integer type for the sequence. The default is bigint. User defined integer types can be used.", "", false, "false", "bigint", "" ], [ "StartWith", "The first value for the sequence to start with. The default is 1.", "", false, "false", "1", "" ], [ "IncrementBy", "The value to increment by. The default is 1.", "", false, "false", "1", "" ], [ "MinValue", "The minimum bound for the sequence.", "", false, "false", "0", "" ], [ "MaxValue", "The maximum bound for the sequence.", "", false, "false", "0", "" ], [ "Cycle", "Switch parameter that indicates if the sequence should cycle the values", "", false, "false", "False", "" ], [ "CacheSize", "The integer size of the cache. To specify NO CACHE for a sequence use -CacheSize 0. As noted in the Microsoft documentation if the cache size is not specified the Database Engine will select a size.", "", false, "false", "0", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbSequence [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [-Name] \u003cString\u003e [[-Schema] \u003cString\u003e] [[-IntegerType] \u003cString\u003e] [[-StartWith] \u003cInt64\u003e] [[-IncrementBy] \u003cInt64\u003e] [[-MinValue] \u003cInt64\u003e] [[-MaxValue] \u003cInt64\u003e] [-Cycle] [[-CacheSize] \u003cInt32\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbSnapshot", "Description": "Creates database snapshots without hassles", "Tags": [ "Snapshot", "Restore", "Database" ], "Synopsis": "Creates database snapshots", "Alias": "", "Author": "Simone Bizzotto (@niphold)", "CommandName": "New-DbaDbSnapshot", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbSnapshot", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDbSnapshot -SqlInstance sqlserver2014a -Database HR, Accounting\nCreates snapshot for HR and Accounting, returning a custom object displaying Server, Database, DatabaseCreated, SnapshotOf, SizeMB, DatabaseCreated, PrimaryFilePath, Status, Notes\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaDbSnapshot -SqlInstance sqlserver2014a -Database HR -Name HR_snap\nCreates snapshot named \"HR_snap\" for HR\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaDbSnapshot -SqlInstance sqlserver2014a -Database HR -NameSuffix \u0027fool_{0}_snap\u0027\nCreates snapshot named \"fool_HR_snap\" for HR\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eNew-DbaDbSnapshot -SqlInstance sqlserver2014a -Database HR, Accounting -Path F:\\snapshotpath\nCreates snapshots for HR and Accounting databases, storing files under the F:\\snapshotpath\\ dir\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2016 -Database df | New-DbaDbSnapshot\nCreates a snapshot for the database df on sql2016", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "AllDatabases", "Creates snapshot for all eligible databases", "", false, "false", "False", "" ], [ "Name", "The specific snapshot name you want to create. Works only if you target a single database. If you need to create multiple snapshot,\r\nyou must use the NameSuffix parameter", "", false, "false", "", "" ], [ "NameSuffix", "When you pass a simple string, it\u0027ll be appended to use it to build the name of the snapshot. By default snapshots are created with yyyyMMdd_HHmmss suffix\r\nYou can also pass a standard placeholder, in which case it\u0027ll be interpolated (e.g. \u0027{0}\u0027 gets replaced with the database name)", "", false, "false", "", "" ], [ "Path", "Snapshot files will be created here (by default the file structure will be created in the same folder as the base db)", "", false, "false", "", "" ], [ "Force", "Databases with Filestream FG can be snapshotted, but the Filestream FG is marked offline\r\nin the snapshot. To create a \"partial\" snapshot, you need to pass -Force explicitly\nNB: You can\u0027t then restore the Database from the newly-created snapshot.\r\nFor details, check https://msdn.microsoft.com/en-us/library/bb895334.aspx", "", false, "false", "False", "" ], [ "InputObject", "Allows Piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run", "wi", false, "false", "", "" ], [ "Confirm", "Prompts for confirmation of every step.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbSnapshot [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-AllDatabases] [[-Name] \u003cString\u003e] [[-NameSuffix] \u003cString\u003e] [[-Path] \u003cString\u003e] [-Force] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbSynonym", "Description": "The New-DbaDbSynonym creates new synonym on database(s) / instance(s) of SQL Server.", "Tags": [ "Synonym", "Database" ], "Synopsis": "Create new synonym for each database(s) / instance(s) of SQL Server.", "Alias": "", "Author": "Mikey Bronowski (@MikeyBronowski), https://bronowski.it", "CommandName": "New-DbaDbSynonym", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbSynonym", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDbSynonym -SqlInstance sql2017a -Database db1 -Synonym synObj1 -BaseObject Obj1\nWill create a new synonym named synObj1 in db1 database in dbo schema on sql2017a instance for Obj1 object in the same database.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaDbSynonym -SqlInstance sql2017a -Database db1 -Synonym synObj1 -BaseObject Obj1\nWill create a new synonym named synObj1 in db1 database in dbo schema on sql2017a instance for Obj1 object in the same database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaDbSynonym -SqlInstance sql2017a -Database db1 -Schema sch1 -Synonym synObj1 -BaseObject Obj1\nWill create a new synonym named synObj1 within dbo schema in db1 database on sql2017a instance for Obj1 object in the same database.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eNew-DbaDbSynonym -SqlInstance sql2017a -Database db1 -Schema sch1 -Synonym synObj1 -BaseObject Obj1 -BaseSchema bSch2\nWill create a new synonym named synObj1 within sch1 schema in db1 database on sql2017a instance for Obj1 object within bSch2 schema in the same database.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eNew-DbaDbSynonym -SqlInstance sql2017a -Database db1 -Schema sch1 -Synonym synObj1 -BaseObject Obj1 -BaseSchema bSch2 -BaseDatabase bDb3\nWill create a new synonym named synObj1 within sch1 schema in db1 database on sql2017a instance for Obj1 object within bSch2 schema in bDb3 database.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eNew-DbaDbSynonym -SqlInstance sql2017a -Database db1 -Schema sch1 -Synonym synObj1 -BaseObject Obj1 -BaseSchema bSch2 -BaseDatabase bDb3 -BaseServer bSrv4\nWill create a new synonym named synObj1 within sch1 schema in db1 database on sql2017a instance for Obj1 object within bSch2 schema in bDb3 database on bSrv4 linked server.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2017a -ExcludeSystem | New-DbaDbSynonym -Synonym synObj1 -BaseObject Obj1\nWill create a new synonym named synObj1 within dbo schema in all user databases on sql2017a instance for Obj1 object in the respective databases.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Synonym", "The synonym to create.", "", false, "false", "", "" ], [ "Schema", "The schema of the synonym. If not specified will assume the default dbo.", "", false, "false", "dbo", "" ], [ "BaseServer", "The linked server name. If specified then BaseDatabase and BaseSchema are required.", "", false, "false", "", "" ], [ "BaseDatabase", "The object parent database name. If specified then BaseSchema is required.", "", false, "false", "", "" ], [ "BaseSchema", "The object parent schema name.", "", false, "false", "", "" ], [ "BaseObject", "The object name. Can be table, view, stored procedure, function, etc.", "", true, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbSynonym [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-Synonym] \u003cString\u003e] [[-Schema] \u003cString\u003e] [[-BaseServer] \u003cString\u003e] [[-BaseDatabase] \u003cString\u003e] [[-BaseSchema] \u003cString\u003e] [-BaseObject] \u003cString\u003e [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbTable", "Description": "Creates a new table in a database", "Tags": "table", "Synopsis": "Creates a new table in a database", "Alias": "", "Author": "Chrissy LeMaire (@cl)", "CommandName": "New-DbaDbTable", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbTable", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$col = @{\n\u003e\u003e Name = \u0027test\u0027\r\n\u003e\u003e Type = \u0027varchar\u0027\r\n\u003e\u003e MaxLength = 20\r\n\u003e\u003e Nullable = $true\r\n\u003e\u003e }\r\nPS C:\\\u003e New-DbaDbTable -SqlInstance sql2017 -Database tempdb -Name testtable -ColumnMap $col\nCreates a new table on sql2017 in tempdb with the name testtable and one column\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e# Create collection\n\u003e\u003e $cols = @()\n\u003e\u003e # Add columns to collection\r\n\u003e\u003e $cols += @{\r\n\u003e\u003e Name = \u0027testId\u0027\r\n\u003e\u003e Type = \u0027int\u0027\r\n\u003e\u003e Identity = $true\r\n\u003e\u003e }\r\n\u003e\u003e $cols += @{\r\n\u003e\u003e Name = \u0027test\u0027\r\n\u003e\u003e Type = \u0027varchar\u0027\r\n\u003e\u003e MaxLength = 20\r\n\u003e\u003e Nullable = $true\r\n\u003e\u003e }\r\n\u003e\u003e $cols += @{\r\n\u003e\u003e Name = \u0027test2\u0027\r\n\u003e\u003e Type = \u0027int\u0027\r\n\u003e\u003e Nullable = $false\r\n\u003e\u003e }\r\n\u003e\u003e $cols += @{\r\n\u003e\u003e Name = \u0027test3\u0027\r\n\u003e\u003e Type = \u0027decimal\u0027\r\n\u003e\u003e MaxLength = 9\r\n\u003e\u003e Nullable = $true\r\n\u003e\u003e }\r\n\u003e\u003e $cols += @{\r\n\u003e\u003e Name = \u0027test4\u0027\r\n\u003e\u003e Type = \u0027decimal\u0027\r\n\u003e\u003e Precision = 8\r\n\u003e\u003e Scale = 2\r\n\u003e\u003e Nullable = $false\r\n\u003e\u003e }\r\n\u003e\u003e $cols += @{\r\n\u003e\u003e Name = \u0027test5\u0027\r\n\u003e\u003e Type = \u0027Nvarchar\u0027\r\n\u003e\u003e MaxLength = 50\r\n\u003e\u003e Nullable = $false\r\n\u003e\u003e Default = \u0027Hello\u0027\r\n\u003e\u003e DefaultName = \u0027DF_Name_test5\u0027\r\n\u003e\u003e }\r\n\u003e\u003e $cols += @{\r\n\u003e\u003e Name = \u0027test6\u0027\r\n\u003e\u003e Type = \u0027int\u0027\r\n\u003e\u003e Nullable = $false\r\n\u003e\u003e Default = \u00270\u0027\r\n\u003e\u003e }\r\n\u003e\u003e $cols += @{\r\n\u003e\u003e Name = \u0027test7\u0027\r\n\u003e\u003e Type = \u0027smallint\u0027\r\n\u003e\u003e Nullable = $false\r\n\u003e\u003e Default = 100\r\n\u003e\u003e }\r\n\u003e\u003e $cols += @{\r\n\u003e\u003e Name = \u0027test8\u0027\r\n\u003e\u003e Type = \u0027Nchar\u0027\r\n\u003e\u003e MaxLength = 3\r\n\u003e\u003e Nullable = $false\r\n\u003e\u003e Default = \u0027ABC\u0027\r\n\u003e\u003e }\r\n\u003e\u003e $cols += @{\r\n\u003e\u003e Name = \u0027test9\u0027\r\n\u003e\u003e Type = \u0027char\u0027\r\n\u003e\u003e MaxLength = 4\r\n\u003e\u003e Nullable = $false\r\n\u003e\u003e Default = \u0027XPTO\u0027\r\n\u003e\u003e }\r\n\u003e\u003e $cols += @{\r\n\u003e\u003e Name = \u0027test10\u0027\r\n\u003e\u003e Type = \u0027datetime\u0027\r\n\u003e\u003e Nullable = $false\r\n\u003e\u003e Default = \u0027GETDATE()\u0027\r\n\u003e\u003e }\nPS C:\\\u003e New-DbaDbTable -SqlInstance sql2017 -Database tempdb -Name testtable -ColumnMap $cols\nCreates a new table on sql2017 in tempdb with the name testtable and ten columns.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\n Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\n For MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database or databases where the table will be created", "", false, "false", "", "" ], [ "Name", "The name of the table", "", false, "false", "", "" ], [ "Schema", "The schema for the table, defaults to dbo", "", false, "false", "dbo", "" ], [ "ColumnMap", "Hashtable for easy column creation. See Examples for details", "", false, "false", "", "" ], [ "ColumnObject", "If you want to get fancy, you can build your own column objects and pass them in", "", false, "false", "", "" ], [ "AnsiNullsStatus", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "ChangeTrackingEnabled", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "DataSourceName", "No information provided by Microsoft", "", false, "false", "", "" ], [ "Durability", "No information provided by Microsoft", "", false, "false", "", "" ], [ "ExternalTableDistribution", "No information provided by Microsoft", "", false, "false", "", "" ], [ "FileFormatName", "No information provided by Microsoft", "", false, "false", "", "" ], [ "FileGroup", "No information provided by Microsoft", "", false, "false", "", "" ], [ "FileStreamFileGroup", "No information provided by Microsoft", "", false, "false", "", "" ], [ "FileStreamPartitionScheme", "No information provided by Microsoft", "", false, "false", "", "" ], [ "FileTableDirectoryName", "No information provided by Microsoft", "", false, "false", "", "" ], [ "FileTableNameColumnCollation", "No information provided by Microsoft", "", false, "false", "", "" ], [ "FileTableNamespaceEnabled", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "HistoryTableName", "No information provided by Microsoft", "", false, "false", "", "" ], [ "HistoryTableSchema", "No information provided by Microsoft", "", false, "false", "", "" ], [ "IsExternal", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "IsFileTable", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "IsMemoryOptimized", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "IsSystemVersioned", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "Location", "No information provided by Microsoft", "", false, "false", "", "" ], [ "LockEscalation", "No information provided by Microsoft", "", false, "false", "", "" ], [ "Owner", "No information provided by Microsoft", "", false, "false", "", "" ], [ "PartitionScheme", "No information provided by Microsoft", "", false, "false", "", "" ], [ "QuotedIdentifierStatus", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "RejectSampleValue", "No information provided by Microsoft", "", false, "false", "0", "" ], [ "RejectType", "No information provided by Microsoft", "", false, "false", "", "" ], [ "RejectValue", "No information provided by Microsoft", "", false, "false", "0", "" ], [ "RemoteDataArchiveDataMigrationState", "No information provided by Microsoft", "", false, "false", "", "" ], [ "RemoteDataArchiveEnabled", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "RemoteDataArchiveFilterPredicate", "No information provided by Microsoft", "", false, "false", "", "" ], [ "RemoteObjectName", "No information provided by Microsoft", "", false, "false", "", "" ], [ "RemoteSchemaName", "No information provided by Microsoft", "", false, "false", "", "" ], [ "RemoteTableName", "No information provided by Microsoft", "", false, "false", "", "" ], [ "RemoteTableProvisioned", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "ShardingColumnName", "No information provided by Microsoft", "", false, "false", "", "" ], [ "TextFileGroup", "No information provided by Microsoft", "", false, "false", "", "" ], [ "TrackColumnsUpdatedEnabled", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "HistoryRetentionPeriod", "No information provided by Microsoft", "", false, "false", "0", "" ], [ "HistoryRetentionPeriodUnit", "No information provided by Microsoft", "", false, "false", "", "" ], [ "DwTableDistribution", "No information provided by Microsoft", "", false, "false", "", "" ], [ "RejectedRowLocation", "No information provided by Microsoft", "", false, "false", "", "" ], [ "OnlineHeapOperation", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "LowPriorityMaxDuration", "No information provided by Microsoft", "", false, "false", "0", "" ], [ "DataConsistencyCheck", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "LowPriorityAbortAfterWait", "No information provided by Microsoft", "", false, "false", "", "" ], [ "MaximumDegreeOfParallelism", "No information provided by Microsoft", "", false, "false", "0", "" ], [ "IsNode", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "IsEdge", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "IsVarDecimalStorageFormatEnabled", "No information provided by Microsoft", "", false, "false", "False", "" ], [ "Passthru", "Don\u0027t create the table, just print the table script on the screen.", "", false, "false", "False", "" ], [ "InputObject", "Allows piped input from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbTable [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Name] \u003cString\u003e] [[-Schema] \u003cString\u003e] [[-ColumnMap] \u003cHashtable[]\u003e] [[-ColumnObject] \u003cColumn[]\u003e] [-AnsiNullsStatus] [-ChangeTrackingEnabled] [[-DataSourceName] \u003cString\u003e] [[-Durability] {SchemaOnly | SchemaAndData}] [[-ExternalTableDistribution] {Sharded | Replicated | RoundRobin | None}] [[-FileFormatName] \u003cString\u003e] [[-FileGroup] \u003cString\u003e] [[-FileStreamFileGroup] \u003cString\u003e] [[-FileStreamPartitionScheme] \u003cString\u003e] [[-FileTableDirectoryName] \u003cString\u003e] \r\n[[-FileTableNameColumnCollation] \u003cString\u003e] [-FileTableNamespaceEnabled] [[-HistoryTableName] \u003cString\u003e] [[-HistoryTableSchema] \u003cString\u003e] [-IsExternal] [-IsFileTable] [-IsMemoryOptimized] [-IsSystemVersioned] [[-Location] \u003cString\u003e] [[-LockEscalation] {Table | Disable | Auto}] [[-Owner] \u003cString\u003e] [[-PartitionScheme] \u003cString\u003e] [-QuotedIdentifierStatus] [[-RejectSampleValue] \u003cDouble\u003e] [[-RejectType] {Value | Percentage | None}] [[-RejectValue] \u003cDouble\u003e] [[-RemoteDataArchiveDataMigrationState] {Disabled | PausedOutbound | PausedInbound | Outbound | Inbound | Paused}] [-RemoteDataArchiveEnabled] \r\n[[-RemoteDataArchiveFilterPredicate] \u003cString\u003e] [[-RemoteObjectName] \u003cString\u003e] [[-RemoteSchemaName] \u003cString\u003e] [[-RemoteTableName] \u003cString\u003e] [-RemoteTableProvisioned] [[-ShardingColumnName] \u003cString\u003e] [[-TextFileGroup] \u003cString\u003e] [-TrackColumnsUpdatedEnabled] [[-HistoryRetentionPeriod] \u003cInt32\u003e] [[-HistoryRetentionPeriodUnit] {Day | Week | Month | Year | Undefined | Infinite}] [[-DwTableDistribution] {Undefined | None | Hash | Replicate | RoundRobin}] [[-RejectedRowLocation] \u003cString\u003e] [-OnlineHeapOperation] [[-LowPriorityMaxDuration] \u003cInt32\u003e] [-DataConsistencyCheck] [[-LowPriorityAbortAfterWait] \r\n{None | Blockers | Self}] [[-MaximumDegreeOfParallelism] \u003cInt32\u003e] [-IsNode] [-IsEdge] [-IsVarDecimalStorageFormatEnabled] [-Passthru] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbTransfer", "Description": "Returns an SMO Transfer object that controls the process of copying database objects from one database to another.\nDoes not perform any actions unless explicitly called with .TransferData() or piped into Invoke-DbaDbTransfer.", "Tags": "Migration", "Synopsis": "Creates a transfer object to clone objects from one database to another.", "Alias": "", "Author": "Kirill Kravtsov (@nvarscar)", "CommandName": "New-DbaDbTransfer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbTransfer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDbTransfer -SqlInstance sql1 -Destination sql2 -Database mydb -CopyAll Tables\nCreates a transfer object that, when invoked, would copy all tables from database sql1.mydb to sql2.mydb\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance sql1 -Database MyDb -Table a, b, c | New-DbaDbTransfer -SqlInstance sql1 -Destination sql2 -Database mydb\nCreates a transfer object to copy specific tables from database sql1.mydb to sql2.mydb", "Params": [ [ "SqlInstance", "Source SQL Server instance name.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "DestinationSqlInstance", "Destination Sql Server. You must have appropriate access to create objects on the target server.", "", false, "false", "", "" ], [ "DestinationSqlCredential", "Login to the source instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\r\nOnly SQL authentication is supported. When not specified, uses Trusted Authentication.", "", false, "false", "", "" ], [ "Database", "The database to copy the objects from.", "", false, "false", "", "" ], [ "DestinationDatabase", "The database to copy the objects to. If not specified, it is assumed to be same as the source database.", "", false, "false", "$Database", "" ], [ "BatchSize", "The BatchSize for the data copy defaults to 5000.", "", false, "false", "50000", "" ], [ "BulkCopyTimeOut", "Value in seconds for the BulkCopy operations timeout. The default is 30 seconds.", "", false, "false", "5000", "" ], [ "ScriptingOption", "Custom scripting rules, generated by New-DbaScriptingOption", "", false, "false", "", "" ], [ "InputObject", "Enables piping of database SMO objects into the command.", "", false, "true (ByValue)", "", "" ], [ "CopyAllObjects", "Transfer all objects of the source database", "", false, "false", "False", "" ], [ "CopyAll", "Object types to be transferred from a database. Allowed values:\r\nFullTextCatalogs\r\nFullTextStopLists\r\nSearchPropertyLists\r\nTables\r\nViews\r\nStoredProcedures\r\nUserDefinedFunctions\r\nUserDefinedDataTypes\r\nUserDefinedTableTypes\r\nPlanGuides\r\nRules\r\nDefaults\r\nUsers\r\nRoles\r\nPartitionSchemes\r\nPartitionFunctions\r\nXmlSchemaCollections\r\nSqlAssemblies\r\nUserDefinedAggregates\r\nUserDefinedTypes\r\nSchemas\r\nSynonyms\r\nSequences\r\nDatabaseTriggers\r\nDatabaseScopedCredentials\r\nExternalFileFormats\r\nExternalDataSources\r\nLogins\r\nExternalLibraries", "", false, "false", "", "FullTextCatalogs,FullTextStopLists,SearchPropertyLists,Tables,Views,StoredProcedures,UserDefinedFunctions,UserDefinedDataTypes,UserDefinedTableTypes,PlanGuides,Rules,Defaults,Users,Roles,PartitionSchemes,PartitionFunctions,XmlSchemaCollections,SqlAssemblies,UserDefinedAggregates,UserDefinedTypes,Schemas,Synonyms,Sequences,DatabaseTriggers,DatabaseScopedCredentials,ExternalFileFormats,ExternalDataSources,Logins,ExternalLibraries" ], [ "SchemaOnly", "Transfers only object schema.", "", false, "false", "False", "" ], [ "DataOnly", "Transfers only data without copying schema.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "New-DbaDbTransfer [[-SqlInstance] \u003cDbaInstanceParameter\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-DestinationSqlInstance] \u003cDbaInstanceParameter\u003e] [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString\u003e] [[-DestinationDatabase] \u003cString\u003e] [[-BatchSize] \u003cInt32\u003e] [[-BulkCopyTimeOut] \u003cInt32\u003e] [[-ScriptingOption] \u003cScriptingOptions\u003e] [[-InputObject] \u003cNamedSmoObject[]\u003e] [-CopyAllObjects] [[-CopyAll] \u003cString[]\u003e] [-SchemaOnly] [-DataOnly] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDbUser", "Description": "Creates a new user for a specified database with provided specifications.", "Tags": [ "Database", "User" ], "Synopsis": "Creates a new user for the specified database.", "Alias": "", "Author": "Frank Henninger (@osiris687)", "CommandName": "New-DbaDbUser", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDbUser", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDbUser -SqlInstance sqlserver2014 -Database DB1 -Login user1\nCreates a new sql user with login named user1 in the specified database.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaDbUser -SqlInstance sqlserver2014 -Database DB1 -Username user1\nCreates a new sql user without login named user1 in the specified database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaDbUser -SqlInstance sqlserver2014 -Database DB1 -Login Login1 -Username user1\nCreates a new sql user named user1 mapped to Login1 in the specified database.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Defaults to the default instance on localhost.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server. By default, system databases are excluded.", "", false, "false", "", "" ], [ "IncludeSystem", "If this switch is enabled, the user will be added to system databases.", "", false, "false", "False", "" ], [ "Login", "When specified, the user will be associated to this SQL login and have the same name as the Login.", "", false, "false", "", "" ], [ "Username", "When specified, the user will have this name.", "", false, "false", "", "" ], [ "Force", "If user exists, drop and recreate.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDbUser [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-IncludeSystem] [-Username \u003cString[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nNew-DbaDbUser [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-IncludeSystem] [-Login \u003cString\u003e] [-Username \u003cString[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDiagnosticAdsNotebook", "Description": "Creates a new Jupyter Notebook for use with Azure Data Studio, based on Glenn Berry\u0027s\npopular Diagnostic queries", "Tags": [ "Community", "GlennBerry", "Notebooks", "AzureDataStudio" ], "Synopsis": "Creates a new Diagnostic Jupyter Notebook for use with Azure Data Studio", "Alias": "", "Author": "Gianluca Sartori (@spaghettidba)", "CommandName": "New-DbaDiagnosticAdsNotebook", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDiagnosticAdsNotebook", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDiagnosticAdsNotebook -SqlInstance localhost -Path c:\\temp\\myNotebook.ipynb\nCreates a new Jupyter Notebook named \"myNotebook\" based on the version of diagnostic queries found at localhost\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaDiagnosticAdsNotebook -TargetVersion 2016SP2 -Path c:\\temp\\myNotebook.ipynb\nCreates a new Jupyter Notebook named \"myNotebook\" based on the version \"2016SP2\" of diagnostic queries\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaDiagnosticAdsNotebook -TargetVersion 2017 -Path c:\\temp\\myNotebook.ipynb -IncludeDatabaseSpecific\nCreates a new Jupyter Notebook named \"myNotebook\" based on the version \"2017\" of diagnostic queries, including database-specific queries", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Defaults to the default instance on localhost.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "TargetVersion", "If you are not creating the notebook for a specific instance of SQL Server, you can specify the version that you want to create the notebook for.\r\nMust be one of \"2005\", \"2008\", \"2008R2\", \"2012\", \"2014\", \"2016\", \"2016SP2\", \"2017\", \"2019\", \"AzureSQLDatabase\"", "", false, "false", "", "2005,2008,2008R2,2012,2014,2016,2016SP2,2017,2019,AzureSQLDatabase" ], [ "Path", "Specifies the output path of the Jupyter Notebook", "", true, "false", "", "" ], [ "IncludeDatabaseSpecific", "If this switch is enabled, the notebook will also include database-specific queries. Defaults to $false.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDiagnosticAdsNotebook [[-SqlInstance] \u003cDbaInstanceParameter\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-TargetVersion] \u003cString\u003e] [-Path] \u003cString\u003e [-IncludeDatabaseSpecific] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaDirectory", "Description": "Uses master.dbo.xp_create_subdir to create the path\nReturns $true if the path can be created, $false otherwise", "Tags": [ "Path", "Directory", "Folder" ], "Synopsis": "Creates new path as specified by the path variable", "Alias": "", "Author": "Stuart Moore", "CommandName": "New-DbaDirectory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaDirectory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaDirectory -SqlInstance sqlcluster -Path L:\\MSAS12.MSSQLSERVER\\OLAP\nIf the SQL Server instance sqlcluster can create the path L:\\MSAS12.MSSQLSERVER\\OLAP it will do and return $true, if not it will return $false.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$credential = Get-Credential\nPS C:\\\u003e New-DbaDirectory -SqlInstance sqlcluster -SqlCredential $credential -Path L:\\MSAS12.MSSQLSERVER\\OLAP\nIf the SQL Server instance sqlcluster can create the path L:\\MSAS12.MSSQLSERVER\\OLAP it will do and return $true, if not it will return $false. Uses a SqlCredential to connect", "Params": [ [ "SqlInstance", "The SQL Server you want to run the test on.", "", true, "false", "", "" ], [ "Path", "The Path to tests. Can be a file or directory.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaDirectory [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-Path] \u003cString\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaEndpoint", "Description": "Creates endpoints on a SQL Server instance.", "Tags": "Endpoint", "Synopsis": "Creates endpoints on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaEndpoint", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaEndpoint", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaEndpoint -SqlInstance localhost\\sql2017 -Type DatabaseMirroring\nCreates a database mirroring endpoint on localhost\\sql2017 which using the default port\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaEndpoint -SqlInstance localhost\\sql2017 -Type DatabaseMirroring -Port 5055\nCreates a database mirroring endpoint on localhost\\sql2017 which uses alternative port 5055\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaEndpoint -SqlInstance localhost\\sql2017 -Type DatabaseMirroring -IPAddress 192.168.0.15 -Port 5055\nCreates a database mirroring endpoint on localhost\\sql2017 which binds only on ipaddress 192.168.0.15 and port 5055", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "The name of the endpoint. Defaults to hadr_endpoint if type is DatabaseMirroring, has to be provided for other types.", "Endpoint", false, "false", "", "" ], [ "Type", "The type of endpoint. Defaults to DatabaseMirroring. Options: DatabaseMirroring, ServiceBroker, Soap, TSql", "", false, "false", "DatabaseMirroring", "DatabaseMirroring,ServiceBroker,Soap,TSql" ], [ "Protocol", "The type of protocol. Defaults to tcp. Options: Tcp, NamedPipes, Http, Via, SharedMemory", "", false, "false", "Tcp", "Tcp,NamedPipes,Http,Via,SharedMemory" ], [ "Role", "The type of role. Defaults to All. Options: All, None, Partner, Witness", "", false, "false", "All", "All,None,Partner,Witness" ], [ "EndpointEncryption", "Used to specify the state of encryption on the endpoint. Defaults to required.\r\nDisabled\r\nRequired\r\nSupported", "", false, "false", "Required", "Disabled,Required,Supported" ], [ "EncryptionAlgorithm", "Specifies an encryption algorithm used on an endpoint. Defaults to Aes.\nOptions are:\r\nAesRC4\r\nAes\r\nNone\r\nRC4\r\nRC4Aes", "", false, "false", "Aes", "Aes,AesRC4,None,RC4,RC4Aes" ], [ "Certificate", "Database certificate used for authentication.", "", false, "false", "", "" ], [ "IPAddress", "Specifies the IP address that the endpoint will listen on. The default is ALL. This means that the listener will accept a connection on any valid IP address.\nCurrently only IPv4 is supported by this command.", "", false, "false", "0.0.0.0", "" ], [ "Port", "Port for TCP. If one is not provided, it will be auto-generated.", "", false, "false", "0", "" ], [ "SslPort", "Port for SSL.", "", false, "false", "0", "" ], [ "Owner", "Owner of the endpoint. Defaults to sa.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaEndpoint [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString\u003e] [[-Type] \u003cString\u003e] [[-Protocol] \u003cString\u003e] [[-Role] \u003cString\u003e] [[-EndpointEncryption] \u003cString\u003e] [[-EncryptionAlgorithm] \u003cString\u003e] [[-Certificate] \u003cString\u003e] [[-IPAddress] \u003cIPAddress\u003e] [[-Port] \u003cInt32\u003e] [[-SslPort] \u003cInt32\u003e] [[-Owner] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaFirewallRule", "Description": "Creates a new inbound firewall rule for a SQL Server instance and adds the rule to the target computer.\n\nThis is basically a wrapper around New-NetFirewallRule executed at the target computer.\nSo this only works if New-NetFirewallRule works on the target computer.\n\nBoth DisplayName and Name are set to the same value, since DisplayName is required\nbut only Name uniquely defines the rule, thus avoiding duplicate rules with different settings.\nThe names and the group for all rules are fixed to be able to get them back with Get-DbaFirewallRule.\n\nThe functionality is currently limited. Help to extend the functionality is welcome.\n\nAs long as you can read this note here, there may be breaking changes in future versions.\nSo please review your scripts using this command after updating dbatools.\n\nThe firewall rule for the instance itself will have the following configuration (parameters for New-NetFirewallRule):\n DisplayName = \u0027SQL Server default instance\u0027 or \u0027SQL Server instance \u003cInstanceName\u003e\u0027\n Name = \u0027SQL Server default instance\u0027 or \u0027SQL Server instance \u003cInstanceName\u003e\u0027\n Group = \u0027SQL Server\u0027\n Enabled = \u0027True\u0027\n Direction = \u0027Inbound\u0027\n Protocol = \u0027TCP\u0027\n LocalPort = \u0027\u003cPort\u003e\u0027 (for instances with static port)\n Program = \u0027\u003cPath ending with MSSQL\\Binn\\sqlservr.exe\u003e\u0027 (for instances with dynamic port)\n\nThe firewall rule for the SQL Server Browser will have the following configuration (parameters for New-NetFirewallRule):\n DisplayName = \u0027SQL Server Browser\u0027\n Name = \u0027SQL Server Browser\u0027\n Group = \u0027SQL Server\u0027\n Enabled = \u0027True\u0027\n Direction = \u0027Inbound\u0027\n Protocol = \u0027UPD\u0027\n LocalPort = \u00271434\u0027", "Tags": [ "Firewall", "Network" ], "Synopsis": "Creates a new inbound firewall rule for a SQL Server instance and adds the rule to the target computer.", "Alias": "", "Author": "Andreas Jordan (@JordanOrdix), ordix.de", "CommandName": "New-DbaFirewallRule", "Availability": "Windows only", "Links": "https://dbatools.io/New-DbaFirewallRule", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaFirewallRule -SqlInstance SRV1, SRV1\\TEST\nAutomatically configures the needed firewall rules for both the default instance and the instance named TEST on SRV1.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eNew-DbaFirewallRule -SqlInstance SRV1, SRV1\\TEST -Configuration @{ Profile = \u0027Domain\u0027 }\nAutomatically configures the needed firewall rules for both the default instance and the instance named TEST on SRV1,\r\nbut configures the firewall rule for the domain profile only.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaFirewallRule -SqlInstance SRV1\\TEST -Type Engine -Force -Confirm:$false\nCreates or recreates the firewall rule for the instance TEST on SRV1. Does not prompt for confirmation.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "Credential", "Credential object used to connect to the Computer as a different user.", "", false, "false", "", "" ], [ "Type", "Creates firewall rules for the given type(s).\r\nValid values are:\r\n Engine - for the SQL Server instance\r\n Browser - for the SQL Server Browser\r\nIf this parameter is not used, the firewall rule for the SQL Server instance will be created\r\nand in case the instance is listening on a port other than 1433,\r\nalso the firewall rule for the SQL Server Browser will be created if not already in place.", "", false, "false", "", "Engine,Browser" ], [ "Configuration", "A hashtable with custom configuration parameters that are used when calling New-NetFirewallRule.\r\nThese will override the default settings.\r\nParameters Name, DisplayName and Group are not allowed here and will be silently ignored.\nhttps://docs.microsoft.com/en-us/powershell/module/netsecurity/new-netfirewallrule", "", false, "false", "", "" ], [ "Force", "If the rule to be created already exists, a warning is displayed.\r\nIf this switch is enabled, the rule will be deleted and created again.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaFirewallRule [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-Credential] \u003cPSCredential\u003e] [[-Type] \u003cString[]\u003e] [[-Configuration] \u003cHashtable\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaLogin", "Description": "Creates a new SQL Server login with provided specifications", "Tags": [ "Login", "Security" ], "Synopsis": "Creates a new SQL Server login", "Alias": "", "Author": "Kirill Kravtsov (@nvarscar)", "CommandName": "New-DbaLogin", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaLogin", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaLogin -SqlInstance Server1,Server2 -Login Newlogin\nYou will be prompted to securely enter the password for a login [Newlogin]. The login would be created on servers Server1 and Server2 with default parameters.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$securePassword = Read-Host \"Input password\" -AsSecureString\nPS C:\\\u003e New-DbaLogin -SqlInstance Server1\\sql1 -Login Newlogin -SecurePassword $securePassword -PasswordPolicyEnforced -PasswordExpirationEnabled\nCreates a login on Server1\\sql1 with a predefined password. The login will have password and expiration policies enforced onto it.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql1 -Login Oldlogin | New-DbaLogin -SqlInstance sql1 -LoginRenameHashtable @{Oldlogin = \u0027Newlogin\u0027} -Force -NewSid -Disabled:$false\nCopies a login [Oldlogin] to the same instance sql1 with the same parameters (including password). New login will have a new sid, a new name [Newlogin] and will not be disabled. Existing login \r\n[Newlogin] will be removed prior to creation.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql1 -Login Login1,Login2 | New-DbaLogin -SqlInstance sql2 -PasswordPolicyEnforced -PasswordExpirationEnabled -DefaultDatabase tempdb -Disabled\nCopies logins [Login1] and [Login2] from instance sql1 to instance sql2, but enforces password and expiration policies for the new logins. New logins will also have a default database set to [tempdb] \r\nand will be created in a disabled state.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eNew-DbaLogin -SqlInstance sql1 -Login domain\\user\nCreates a new Windows Authentication backed login on sql1. The login will be part of the public server role.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eNew-DbaLogin -SqlInstance sql1 -Login domain\\user1, domain\\user2 -DenyWindowsLogin\nCreates two new Windows Authentication backed login on sql1. The logins would be denied from logging in.", "Params": [ [ "SqlInstance", "The target SQL Server(s)", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Login", "The Login name(s)", "Name,LoginName", false, "false", "", "" ], [ "InputObject", "Takes the parameters required from a Login object that has been piped into the command", "", false, "true (ByValue)", "", "" ], [ "LoginRenameHashtable", "Pass a hash table into this parameter to change login names when piping objects into the procedure", "Rename", false, "false", "", "" ], [ "SecurePassword", "Secure string used to authenticate the Login", "Password", false, "false", "", "" ], [ "HashedPassword", "Hashed password string used to authenticate the Login", "Hash,PasswordHash", false, "false", "", "" ], [ "MapToCertificate", "Map the login to a certificate", "", false, "false", "", "" ], [ "MapToAsymmetricKey", "Map the login to an asymmetric key", "", false, "false", "", "" ], [ "MapToCredential", "Map the login to a credential", "", false, "false", "", "" ], [ "Sid", "Provide an explicit Sid that should be used when creating the account. Can be [byte[]] or hex [string] (\u00270xFFFF...\u0027)", "", false, "false", "", "" ], [ "DefaultDatabase", "Default database for the login", "DefaultDB", false, "false", "", "" ], [ "Language", "Login\u0027s default language", "", false, "false", "", "" ], [ "PasswordExpirationEnabled", "Enforces password expiration policy. Requires PasswordPolicyEnforced to be enabled. Can be $true or $false(default)", "Expiration,CheckExpiration", false, "false", "False", "" ], [ "PasswordPolicyEnforced", "Enforces password complexity policy. Can be $true or $false(default)", "Policy,CheckPolicy", false, "false", "False", "" ], [ "PasswordMustChange", "Enforces user must change password at next login.\r\nWhen specified will enforce PasswordExpirationEnabled and PasswordPolicyEnforced as they are required for the must change.", "MustChange", false, "false", "False", "" ], [ "Disabled", "Create the login in a disabled state", "Disable", false, "false", "False", "" ], [ "DenyWindowsLogin", "Create the login and deny Windows login ability", "", false, "false", "False", "" ], [ "NewSid", "Ignore sids from the piped login object to generate new sids on the server. Useful when copying login onto the same server", "", false, "false", "False", "" ], [ "Force", "If login exists, drop and recreate", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaLogin [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [[-Login] \u003cString[]\u003e] [-InputObject \u003cObject[]\u003e] [-LoginRenameHashtable \u003cHashtable\u003e] [[-SecurePassword] \u003cSecureString\u003e] [-MapToCredential \u003cString\u003e] [-Sid \u003cObject\u003e] [-DefaultDatabase \u003cString\u003e] [-Language \u003cString\u003e] [-PasswordExpirationEnabled] [-PasswordPolicyEnforced] [-PasswordMustChange] [-Disabled] [-DenyWindowsLogin] [-NewSid] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nNew-DbaLogin [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Login \u003cString[]\u003e] [-InputObject \u003cObject[]\u003e] [-LoginRenameHashtable \u003cHashtable\u003e] [-MapToAsymmetricKey \u003cString\u003e] [-MapToCredential \u003cString\u003e] [-Sid \u003cObject\u003e] [-Disabled] [-DenyWindowsLogin] [-NewSid] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nNew-DbaLogin [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Login \u003cString[]\u003e] [-InputObject \u003cObject[]\u003e] [-LoginRenameHashtable \u003cHashtable\u003e] [-MapToCertificate \u003cString\u003e] [-MapToCredential \u003cString\u003e] [-Sid \u003cObject\u003e] [-Disabled] [-DenyWindowsLogin] [-NewSid] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nNew-DbaLogin [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Login \u003cString[]\u003e] [-InputObject \u003cObject[]\u003e] [-LoginRenameHashtable \u003cHashtable\u003e] [-HashedPassword \u003cString\u003e] [-MapToCredential \u003cString\u003e] [-Sid \u003cObject\u003e] [-DefaultDatabase \u003cString\u003e] [-Language \u003cString\u003e] [-PasswordExpirationEnabled] [-PasswordPolicyEnforced] [-Disabled] [-DenyWindowsLogin] [-NewSid] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaScriptingOption", "Description": "Creates a new Microsoft.SqlServer.Management.Smo.ScriptingOptions object. Basically saves you the time from remembering the SMO assembly name ;)\n\nSee https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.scriptingoptions.aspx for more information", "Tags": [ "Migration", "Backup", "DR" ], "Synopsis": "Creates a new Microsoft.SqlServer.Management.Smo.ScriptingOptions object", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaScriptingOption", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaScriptingOption", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$options = New-DbaScriptingOption\nPS C:\\\u003e $options.ScriptDrops = $false\r\nPS C:\\\u003e $options.WithDependencies = $true\r\nPS C:\\\u003e Get-DbaAgentJob -SqlInstance sql2016 | Export-DbaScript -ScriptingOptionObject $options\nExports Agent Jobs with the Scripting Options ScriptDrops set to $false and WithDependencies set to true", "Params": [ ], "Syntax": "New-DbaScriptingOption [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaServerRole", "Description": "The New-DbaServerRole create new roles on instance(s) of SQL Server.", "Tags": [ "Role", "Database", "Security" ], "Synopsis": "Create new server-level roles.", "Alias": "", "Author": "Cláudio Silva (@ClaudioESSilva), https://claudioessilva.eu", "CommandName": "New-DbaServerRole", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaServerRole", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaServerRole -SqlInstance sql2017a -ServerRole \u0027dbExecuter\u0027 -Owner sa\nWill create a new server role named dbExecuter and grant ownership to the login sa on sql2017a instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "ServerRole", "Server-Level role to be created.", "", false, "false", "", "" ], [ "Owner", "The owner of the role. If not specified will assume the default dbo.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaServerRole [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-ServerRole] \u003cString[]\u003e] [[-Owner] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaServiceMasterKey", "Description": "Creates a new service master key in the master database.", "Tags": "Certificate", "Synopsis": "Creates a new service master key.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaServiceMasterKey", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaServiceMasterKey", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaServiceMasterKey -SqlInstance Server1\nYou will be prompted to securely enter your Service Key password, then a master key will be created in the master database on server1 if it does not exist.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Credential", "Enables easy creation of a secure password.", "", false, "false", "", "" ], [ "SecurePassword", "Secure string used to create the key.", "Password", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaServiceMasterKey [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [[-SecurePassword] \u003cSecureString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaSqlParameter", "Description": "Creates a new SQL parameter.", "Tags": "Query", "Synopsis": "Creates a new SQL parameter.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaSqlParameter", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaSqlParameter", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaSqlParameter -ParameterName json_result -SqlDbType NVarChar -Size -1 -Direction Output\nCreates a SqlParameter object that can be used with Invoke-DbaQuery\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$output = New-DbaSqlParameter -ParameterName json_result -SqlDbType NVarChar -Size -1 -Direction Output\nPS C:\\\u003e Invoke-DbaQuery -SqlInstance localhost -Database master -CommandType StoredProcedure -Query my_proc -SqlParameter $output\r\nPS C:\\\u003e $output.Value\nCreates an output parameter and uses it to invoke a stored procedure.", "Params": [ [ "CompareInfo", "Sets the CompareInfo object that defines how string comparisons should be performed for this parameter.", "", false, "false", "", "None,IgnoreCase,IgnoreNonSpace,IgnoreKanaType,IgnoreWidth,BinarySort2,BinarySort" ], [ "DbType", "Sets the SqlDbType of the parameter.", "", false, "false", "", "AnsiString,Binary,Byte,Boolean,Currency,Date,DateTime,Decimal,Double,Guid,Int16,Int32,Int64,Object,SByte,Single,String,Time,UInt16,UInt32,UInt64,VarNumeric,AnsiStringFixedLength,StringFixedLength,Xml,DateTime2,DateTimeOffset" ], [ "Direction", "Sets a value that indicates whether the parameter is input-only, output-only, bidirectional, or a stored procedure return value parameter.", "", false, "false", "", "Input,Output,InputOutput,ReturnValue" ], [ "ForceColumnEncryption", "Enforces encryption of a parameter when using Always Encrypted.\nIf SQL Server informs the driver that the parameter does not need to be encrypted, the query using the parameter will fail.\nThis property provides additional protection against security attacks that involve a compromised SQL Server providing incorrect encryption metadata to the client, which may lead to data disclosure.", "", false, "false", "False", "" ], [ "IsNullable", "Sets a value that indicates whether the parameter accepts null values.\nIsNullable is not used to validate the parameter\u0027s value and will not prevent sending or receiving a null value when executing a command.", "", false, "false", "False", "" ], [ "LocaleId", "Sets the locale identifier that determines conventions and language for a particular region.", "", false, "false", "0", "" ], [ "Offset", "Sets the offset to the Value property.", "", false, "false", "", "" ], [ "ParameterName", "Sets the name of the SqlParameter.", "Name", false, "false", "", "" ], [ "Precision", "Sets the maximum number of digits used to represent the Value property.", "", false, "false", "", "" ], [ "Scale", "Sets the number of decimal places to which Value is resolved.", "", false, "false", "", "" ], [ "Size", "Sets the maximum size, in bytes, of the data within the column.", "", false, "false", "0", "" ], [ "SourceColumn", "Sets the name of the source column mapped to the DataSet and used for loading or returning the Value.", "", false, "false", "", "" ], [ "SourceColumnNullMapping", "Sets a value which indicates whether the source column is nullable. This allows SqlCommandBuilder to correctly generate Update statements for nullable columns.", "", false, "false", "False", "" ], [ "SourceVersion", "Sets the DataRowVersion to use when you load Value.", "", false, "false", "", "Original,Current,Proposed,Default" ], [ "SqlDbType", "Sets the SqlDbType of the parameter.", "", false, "false", "", "BigInt,Binary,Bit,Char,DateTime,Decimal,Float,Image,Int,Money,NChar,NText,NVarChar,Real,UniqueIdentifier,SmallDateTime,SmallInt,SmallMoney,Text,Timestamp,TinyInt,VarBinary,VarChar,Variant,Xml,Udt,Structured,Date,Time,DateTime2,DateTimeOffset" ], [ "SqlValue", "Sets the value of the parameter as an SQL type.", "", false, "false", "", "" ], [ "TypeName", "Sets the type name for a table-valued parameter.", "", false, "false", "", "" ], [ "UdtTypeName", "Sets a string that represents a user-defined type as a parameter.", "", false, "false", "", "" ], [ "Value", "Sets the value of the parameter.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "New-DbaSqlParameter [[-CompareInfo] \u003cString\u003e] [[-DbType] \u003cString\u003e] [[-Direction] \u003cString\u003e] [-ForceColumnEncryption] [-IsNullable] [[-LocaleId] \u003cInt32\u003e] [[-Offset] \u003cString\u003e] [[-ParameterName] \u003cString\u003e] [[-Precision] \u003cString\u003e] [[-Scale] \u003cString\u003e] [[-Size] \u003cInt32\u003e] [[-SourceColumn] \u003cString\u003e] [-SourceColumnNullMapping] [[-SourceVersion] \u003cString\u003e] [[-SqlDbType] \u003cString\u003e] [[-SqlValue] \u003cString\u003e] [[-TypeName] \u003cString\u003e] [[-UdtTypeName] \u003cString\u003e] [[-Value] \u003cObject\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbatoolsSupportPackage", "Description": "This function creates an extensive debugging package that can help with reproducing and fixing issues.\n\nThe file will be created on the desktop (or in the home directory if $home/Desktop does not exist) by default and will contain quite a bit of information:\n- OS Information\n- Hardware Information (CPU, Ram, things like that)\n- .NET Information\n- PowerShell Information\n- Your input history\n- The In-Memory message log\n- The In-Memory error log\n- Screenshot of the console buffer (Basically, everything written in your current console, even if you have to scroll upwards to see it.", "Tags": [ "Module", "Support" ], "Synopsis": "Creates a package of troubleshooting information that can be used by dbatools to help debug issues.", "Alias": "", "Author": "Friedrich Weinmann (@FredWeinmann)", "CommandName": "New-DbatoolsSupportPackage", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbatoolsSupportPackage", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbatoolsSupportPackage\nCreates a large support pack in order to help us troubleshoot stuff.", "Params": [ [ "Path", "The folder where to place the output xml in.", "", false, "false", "\"$($env:USERPROFILE)\\Desktop\"", "" ], [ "Variables", "Name of additional variables to attach.\r\nThis allows you to add the content of variables to the support package, if you believe them to be relevant to the case.", "", false, "false", "", "" ], [ "PassThru", "Returns file object that was created during execution.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbatoolsSupportPackage [[-Path] \u003cString\u003e] [[-Variables] \u003cString[]\u003e] [-PassThru] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaXESession", "Description": "Creates a new XESession object - for the dogged (very manual, Import-DbaXESessionTemplate is recommended). See the following for more info:\n\nhttps://docs.microsoft.com/en-us/sql/relational-databases/extended-events/use-the-powershell-provider-for-extended-events", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Creates a new XESession object - for the dogged.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "New-DbaXESession", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaXESession", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$session = New-DbaXESession -SqlInstance sql2017 -Name XeSession_Test\nPS C:\\\u003e $event = $session.AddEvent(\"sqlserver.file_written\")\r\nPS C:\\\u003e $event.AddAction(\"package0.callstack\")\r\nPS C:\\\u003e $session.Create()\nReturns a new XE Session object from sql2017 then adds an event, an action then creates it.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "The Name of the session to be created.", "", true, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaXESession [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Name] \u003cString\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaXESmartCsvWriter", "Description": "This response type is used to write Extended Events to a CSV file.", "Tags": [ "ExtendedEvent", "XE", "XEvent", "SmartTarget" ], "Synopsis": "This response type is used to write Extended Events to a CSV file.", "Alias": "", "Author": "Chrissy LeMaire (@cl) | SmartTarget by Gianluca Sartori (@spaghettidba)", "CommandName": "New-DbaXESmartCsvWriter", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaXESmartCsvWriter", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$columns = \"cpu_time\", \"duration\", \"physical_reads\", \"logical_reads\", \"writes\", \"row_count\"\nPS C:\\\u003e $response = New-DbaXESmartCsvWriter -OutputFile c:\\temp\\workload.csv -OutputColumn $columns -OverWrite -Event \"sql_batch_completed\"\r\nPS C:\\\u003e Start-DbaXESmartTarget -SqlInstance localhost\\sql2017 -Session \"Profiler Standard\" -Responder $response\nWrites Extended Events to the file \"C:\\temp\\workload.csv\".", "Params": [ [ "OutputFile", "Specifies the path to the output CSV file.", "", true, "false", "", "" ], [ "Overwrite", "Specifies whether any existiting file should be overwritten or not.", "", false, "false", "False", "" ], [ "Event", "Specifies a list of events to be processed (with others being ignored. By default, all events are processed.", "", false, "false", "", "" ], [ "OutputColumn", "Specifies the list of columns to output from the events. XESmartTarget will capture in memory and write to the target table only the columns (fields or targets) that are present in this list.\nFields and actions are matched in a case-sensitive manner.\nExpression columns are supported. Specify a column with ColumnName AS Expression to add an expression column (Example: Total AS Reads + Writes)", "", false, "false", "", "" ], [ "Filter", "Specifies a filter expression in the same form as you would use in the WHERE clause of a SQL query.\nExample: duration \u003e 10000 AND cpu_time \u003e 10000", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaXESmartCsvWriter [-OutputFile] \u003cString\u003e [-Overwrite] [[-Event] \u003cString[]\u003e] [[-OutputColumn] \u003cString[]\u003e] [[-Filter] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaXESmartEmail", "Description": "This response type can be used to send an email each time an event is captured.", "Tags": [ "ExtendedEvent", "XE", "XEvent", "SmartTarget" ], "Synopsis": "This response type can be used to send an email each time an event is captured.", "Alias": "", "Author": "Chrissy LeMaire (@cl) | SmartTarget by Gianluca Sartori (@spaghettidba)", "CommandName": "New-DbaXESmartEmail", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaXESmartEmail", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$params = @{\n\u003e\u003e SmtpServer = \"smtp.ad.local\"\r\n\u003e\u003e To = \"admin@ad.local\"\r\n\u003e\u003e Sender = \"reports@ad.local\"\r\n\u003e\u003e Subject = \"Query executed\"\r\n\u003e\u003e Body = \"Query executed at {collection_time}\"\r\n\u003e\u003e Attachment = \"batch_text\"\r\n\u003e\u003e AttachmentFileName = \"query.sql\"\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e $emailresponse = New-DbaXESmartEmail @params\r\nPS C:\\\u003e Start-DbaXESmartTarget -SqlInstance sql2017 -Session querytracker -Responder $emailresponse\nSends an email each time a querytracker event is captured.", "Params": [ [ "SmtpServer", "Address of the SMTP server for outgoing mail.", "", true, "false", "", "" ], [ "Sender", "Sender\u0027s email address.", "", true, "false", "", "" ], [ "To", "Address of the To recipient(s).", "", true, "false", "", "" ], [ "Cc", "Address of the Cc recipient(s).", "", false, "false", "", "" ], [ "Bcc", "Address of the Bcc recipient(s).", "", false, "false", "", "" ], [ "Credential", "Credential object containing username and password used to authenticate on the SMTP server. When blank, no authentication is performed.", "", false, "false", "", "" ], [ "Subject", "Subject of the mail message. Accepts placeholders in the text.\nPlaceholders are in the form {PropertyName}, where PropertyName is one of the fields or actions available in the Event object.\nFor instance, a valid Subject in a configuration file looks like this: \"An event of name {Name} occurred at {collection_time}\"", "", true, "false", "", "" ], [ "Body", "Body of the mail message. The body can be static text or any property taken from the underlying event. See Subject for a description of how placeholders work.", "", true, "false", "", "" ], [ "Attachment", "Data to attach to the email message. At this time, it can be any of the fields/actions of the underlying event. The data from the field/action is attached to the message as an ASCII stream. A single \r\nattachment is supported.", "", false, "false", "", "" ], [ "AttachmentFileName", "File name to assign to the attachment.", "", false, "false", "", "" ], [ "PlainText", "If this switch is enabled, the email will be sent in plain text. By default, HTML formatting is used.", "", false, "false", "", "" ], [ "Event", "Each Response can be limited to processing specific events, while ignoring all the other ones. When this attribute is omitted, all events are processed.", "", false, "false", "", "" ], [ "Filter", "You can specify a filter expression by using this attribute. The filter expression is in the same form that you would use in a SQL query. For example, a valid example looks like this: duration \u003e \r\n10000 AND cpu_time \u003e 10000", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaXESmartEmail [-SmtpServer] \u003cString\u003e [-Sender] \u003cString\u003e [-To] \u003cString[]\u003e [[-Cc] \u003cString[]\u003e] [[-Bcc] \u003cString[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-Subject] \u003cString\u003e [-Body] \u003cString\u003e [[-Attachment] \u003cString\u003e] [[-AttachmentFileName] \u003cString\u003e] [[-PlainText] \u003cString\u003e] [[-Event] \u003cString[]\u003e] [[-Filter] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaXESmartQueryExec", "Description": "This response type executes a T-SQL command against a target database whenever an event is recorded.", "Tags": [ "ExtendedEvent", "XE", "XEvent", "SmartTarget" ], "Synopsis": "This response type executes a T-SQL command against a target database whenever an event is recorded.", "Alias": "", "Author": "Chrissy LeMaire (@cl) | SmartTarget by Gianluca Sartori (@spaghettidba)", "CommandName": "New-DbaXESmartQueryExec", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaXESmartQueryExec", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$response = New-DbaXESmartQueryExec -SqlInstance sql2017 -Database dbadb -Query \"update table set whatever = 1\"\nPS C:\\\u003e Start-DbaXESmartTarget -SqlInstance sql2017 -Session deadlock_tracker -Responder $response\nExecutes a T-SQL command against dbadb on sql2017 whenever a deadlock event is recorded.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the name of the database that contains the target table.", "", false, "false", "", "" ], [ "Query", "The T-SQL command to execute. This string can contain placeholders for properties taken from the events.\nPlaceholders are in the form {PropertyName}, where PropertyName is one of the fields or actions available in the Event object.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "Event", "Each Response can be limited to processing specific events, while ignoring all the other ones. When this attribute is omitted, all events are processed.", "", false, "false", "", "" ], [ "Filter", "You can specify a filter expression by using this attribute. The filter expression is in the same form that you would use in a SQL query. For example, a valid example looks like this: duration \u003e \r\n10000 AND cpu_time \u003e 10000", "", false, "false", "", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaXESmartQueryExec [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString\u003e] [[-Query] \u003cString\u003e] [-EnableException] [[-Event] \u003cString[]\u003e] [[-Filter] \u003cString\u003e] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaXESmartReplay", "Description": "This response type can be used to replay execution related events to a target SQL Server instance. The events that you can replay are of the type sql_batch_completed and rpc_completed: all other events are ignored.", "Tags": [ "ExtendedEvent", "XE", "XEvent", "SmartTarget" ], "Synopsis": "This response type can be used to replay execution related events to a target SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl) | SmartTarget by Gianluca Sartori (@spaghettidba)", "CommandName": "New-DbaXESmartReplay", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaXESmartReplay", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$response = New-DbaXESmartReplay -SqlInstance sql2017 -Database planning\nPS C:\\\u003e Start-DbaXESmartTarget -SqlInstance sql2016 -Session loadrelay -Responder $response\nReplays events from sql2016 on sql2017 in the planning database. Returns a PowerShell job object.\nTo see a list of all SmartTarget job objects, use Get-DbaXESmartTarget.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$response = New-DbaXESmartReplay -SqlInstance sql2017 -Database planning\nPS C:\\\u003e Start-DbaXESmartTarget -SqlInstance sql2017 -Session \u0027Profiler Standard\u0027 -Responder $response -NotAsJob\nReplays events from the \u0027Profiler Standard\u0027 session on sql2016 to sql2017\u0027s planning database. Does not run as a job so you can see the raw output.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Name of the initial catalog to connect to. Statements will be replayed by changing database to the same database where the event was originally captured, so this property only controls the initial \r\ndatabase to connect to.", "", false, "false", "", "" ], [ "Event", "Each Response can be limited to processing specific events, while ignoring all the other ones. When this attribute is omitted, all events are processed.", "", false, "false", "sql_batch_completed", "" ], [ "Filter", "Specifies a filter expression in the same form as you would use in the WHERE clause of a SQL query.\nExample: duration \u003e 10000 AND cpu_time \u003e 10000", "", false, "false", "", "" ], [ "DelaySeconds", "Specifies the duration of the delay in seconds.", "", false, "false", "0", "" ], [ "StopOnError", "If this switch is enabled, the replay will be stopped when the first error is encountered. By default, error messages are piped to the log and console output, and replay proceeds.", "", false, "false", "False", "" ], [ "ReplayIntervalSeconds", "Specifies the duration of the replay interval in seconds.", "", false, "false", "0", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaXESmartReplay [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString\u003e] [[-Event] \u003cString[]\u003e] [[-Filter] \u003cString\u003e] [[-DelaySeconds] \u003cInt32\u003e] [-StopOnError] [[-ReplayIntervalSeconds] \u003cInt32\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "New-DbaXESmartTableWriter", "Description": "This response type is used to write Extended Events to a database table. The events are temporarily stored in memory before being written to the database at regular intervals.\n\nThe target table can be created manually upfront or you can let the TableAppenderResponse create a target table based on the fields and actions available in the events captured.\n\nThe columns of the target table and the fields/actions of the events are mapped by name (case-sensitive).", "Tags": [ "ExtendedEvent", "XE", "XEvent", "SmartTarget" ], "Synopsis": "This response type is used to write Extended Events to a database table.", "Alias": "", "Author": "Chrissy LeMaire (@cl) | SmartTarget by Gianluca Sartori (@spaghettidba)", "CommandName": "New-DbaXESmartTableWriter", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/New-DbaXESmartTableWriter", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$columns = \"cpu_time\", \"duration\", \"physical_reads\", \"logical_reads\", \"writes\", \"row_count\", \"batch_text\"\nPS C:\\\u003e $response = New-DbaXESmartTableWriter -SqlInstance sql2017 -Database dbadb -Table deadlocktracker -OutputColumn $columns -Filter \"duration \u003e 10000\"\r\nPS C:\\\u003e Start-DbaXESmartTarget -SqlInstance sql2017 -Session deadlock_tracker -Responder $response\nWrites Extended Events to the deadlocktracker table in dbadb on sql2017.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the name of the database that contains the target table.", "", true, "false", "", "" ], [ "Table", "Specifies the name of the target table.", "", true, "false", "", "" ], [ "AutoCreateTargetTable", "If this switch is enabled, XESmartTarget will infer the definition of the target table from the columns captured in the Extended Events session.\nIf the target table already exists, it will not be recreated.", "", false, "false", "False", "" ], [ "UploadIntervalSeconds", "Specifies the number of seconds XESmartTarget will keep the events in memory before dumping them to the target table. The default is 10 seconds.", "", false, "false", "10", "" ], [ "Event", "Specifies a list of events to be processed (with others being ignored. By default, all events are processed.", "", false, "false", "", "" ], [ "OutputColumn", "Specifies the list of columns to output from the events. XESmartTarget will capture in memory and write to the target table only the columns (fields or targets) that are present in this list.\nFields and actions are matched in a case-sensitive manner.\nExpression columns are supported. Specify a column with ColumnName AS Expression to add an expression column (Example: Total AS Reads + Writes)", "", false, "false", "", "" ], [ "Filter", "Specifies a filter expression in the same form as you would use in the WHERE clause of a SQL query.\nExample: duration \u003e 10000 AND cpu_time \u003e 10000", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "New-DbaXESmartTableWriter [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Database] \u003cString\u003e [-Table] \u003cString\u003e [-AutoCreateTargetTable] [[-UploadIntervalSeconds] \u003cInt32\u003e] [[-Event] \u003cString[]\u003e] [[-OutputColumn] \u003cString[]\u003e] [[-Filter] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Publish-DbaDacPackage", "Description": "Publishes the dacpac taken from SSDT project or Export-DbaDacPackage. Changing the schema to match the dacpac and also to run any scripts in the dacpac (pre/post deploy scripts) or bacpac.", "Tags": [ "Migration", "Database", "Dacpac", "Bacpac" ], "Synopsis": "The Publish-DbaDacPackage command takes a dacpac or bacpac and publishes it to a database.", "Alias": "", "Author": "Richie lee (@richiebzzzt)", "CommandName": "Publish-DbaDacPackage", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Publish-DbaDacPackage", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$options = New-DbaDacOption -Type Dacpac -Action Publish\nPS C:\\\u003e $options.DeployOptions.DropObjectsNotInSource = $true\r\nPS C:\\\u003e Publish-DbaDacPackage -SqlInstance sql2016 -Database DB1 -DacOption $options -Path c:\\temp\\db.dacpac\nUses DacOption object to set Deployment Options and updates DB1 database on sql2016 from the db.dacpac dacpac file, dropping objects that are missing from source.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003ePublish-DbaDacPackage -SqlInstance sql2017 -Database WideWorldImporters -Path C:\\temp\\sql2016-WideWorldImporters.dacpac -PublishXml C:\\temp\\sql2016-WideWorldImporters-publish.xml -Confirm\nUpdates WideWorldImporters on sql2017 from the sql2016-WideWorldImporters.dacpac using the sql2016-WideWorldImporters-publish.xml publish profile. Prompts for confirmation.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eNew-DbaDacProfile -SqlInstance sql2016 -Database db2 -Path C:\\temp\nPS C:\\\u003e Export-DbaDacPackage -SqlInstance sql2016 -Database db2 | Publish-DbaDacPackage -PublishXml C:\\temp\\sql2016-db2-publish.xml -Database db1, db2 -SqlInstance sql2017\nCreates a publish profile at C:\\temp\\sql2016-db2-publish.xml, exports the .dacpac to $home\\Documents\\sql2016-db2.dacpac. Does not prompt for confirmation.\r\nthen publishes it to the sql2017 server database db2\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$loc = \"C:\\Users\\bob\\source\\repos\\Microsoft.Data.Tools.Msbuild\\lib\\net46\\Microsoft.SqlServer.Dac.dll\"\nPS C:\\\u003e Publish-DbaDacPackage -SqlInstance \"local\" -Database WideWorldImporters -Path C:\\temp\\WideWorldImporters.dacpac -PublishXml C:\\temp\\WideWorldImporters.publish.xml -DacFxPath $loc -Confirm\nPublishes the dacpac using a specific dacfx library. Prompts for confirmation.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003ePublish-DbaDacPackage -SqlInstance sql2017 -Database WideWorldImporters -Path C:\\temp\\sql2016-WideWorldImporters.dacpac -PublishXml C:\\temp\\sql2016-WideWorldImporters-publish.xml -ScriptOnly\nDoes not deploy the changes, but will generate the deployment script that would be executed against WideWorldImporters.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nOnly SQL authentication is supported. When not specified, uses Trusted Authentication.", "", false, "false", "", "" ], [ "Path", "Specifies the filesystem path to the DACPAC", "", true, "true (ByPropertyName)", "", "" ], [ "PublishXml", "Specifies the publish profile which will include options and sqlCmdVariables.", "", false, "false", "", "" ], [ "Database", "Specifies the name of the database being published.", "", true, "true (ByPropertyName)", "", "" ], [ "ConnectionString", "Specifies the connection string to the database you are upgrading. This is not required if SqlInstance is specified.", "", false, "false", "", "" ], [ "GenerateDeploymentReport", "If this switch is enabled, the publish XML report will be generated.", "", false, "false", "False", "" ], [ "ScriptOnly", "If this switch is enabled the publish script will be generated.", "", false, "false", "False", "" ], [ "Type", "Selecting the type of the export: Dacpac (default) or Bacpac.", "", false, "false", "Dacpac", "Dacpac,Bacpac" ], [ "OutputPath", "Specifies the filesystem path (directory) where output files will be generated.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "IncludeSqlCmdVars", "If this switch is enabled, SqlCmdVars in publish.xml will have their values overwritten.", "", false, "false", "False", "" ], [ "DacOption", "Export options for a corresponding export type. Can be created by New-DbaDacOption -Type Dacpac | Bacpac", "Option", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "DacFxPath", "Path to the dac dll. If this is omitted, then the version of dac dll which is packaged with dbatools is used.", "", false, "false", "", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Publish-DbaDacPackage [-SqlInstance \u003cDbaInstanceParameter[]\u003e] [-SqlCredential \u003cPSCredential\u003e] -Path \u003cString\u003e -Database \u003cString[]\u003e [-ConnectionString \u003cString[]\u003e] [-GenerateDeploymentReport] [-ScriptOnly] [-Type \u003cString\u003e] [-OutputPath \u003cString\u003e] [-IncludeSqlCmdVars] [-DacOption \u003cObject\u003e] [-EnableException] [-DacFxPath \u003cString\u003e] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nPublish-DbaDacPackage [-SqlInstance \u003cDbaInstanceParameter[]\u003e] [-SqlCredential \u003cPSCredential\u003e] -Path \u003cString\u003e [-PublishXml \u003cString\u003e] -Database \u003cString[]\u003e [-ConnectionString \u003cString[]\u003e] [-GenerateDeploymentReport] [-ScriptOnly] [-Type \u003cString\u003e] [-OutputPath \u003cString\u003e] [-IncludeSqlCmdVars] [-EnableException] [-DacFxPath \u003cString\u003e] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Read-DbaAuditFile", "Description": "Read Audit details from *.sqlaudit files.", "Tags": [ "ExtendedEvent", "Audit" ], "Synopsis": "Read Audit details from *.sqlaudit files.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Read-DbaAuditFile", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Read-DbaAuditFile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRead-DbaAuditFile -Path C:\\temp\\logins.sqlaudit\nReturns events from C:\\temp\\logins.sqlaudit.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-ChildItem C:\\temp\\audit\\*.sqlaudit | Read-DbaAuditFile\nReturns events from all .sqlaudit files in C:\\temp\\audit.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaInstanceAudit -SqlInstance sql2014 -Audit LoginTracker | Read-DbaAuditFile\nReads remote Audit details by accessing the file over the admin UNC share.", "Params": [ [ "Path", "The path to the *.sqlaudit file. This is relative to the computer executing the command. UNC paths are supported.", "FullName", true, "true (ByValue)", "", "" ], [ "Raw", "If this switch is enabled, the enumeration object will be returned.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Read-DbaAuditFile [-Path] \u003cObject[]\u003e [-Raw] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Read-DbaBackupHeader", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Read-DbaBackupHeader", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRead-DbaBackupHeader -SqlInstance sql2016 -Path S:\\backups\\mydb\\mydb.bak\nLogs into sql2016 using Windows authentication and reads the local file on sql2016, S:\\backups\\mydb\\mydb.bak.\nIf you are running this command on a workstation and connecting remotely, remember that sql2016 cannot access files on your own workstation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRead-DbaBackupHeader -SqlInstance sql2016 -Path \\\\nas\\sql\\backups\\mydb\\mydb.bak, \\\\nas\\sql\\backups\\otherdb\\otherdb.bak\nLogs into sql2016 and reads two backup files - mydb.bak and otherdb.bak. The SQL Server service account must have rights to read this file.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRead-DbaBackupHeader -SqlInstance . -Path C:\\temp\\myfile.bak -Simple\nLogs into the local workstation (or computer) and shows simplified output about C:\\temp\\myfile.bak. The SQL Server service account must have rights to read this file.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$backupinfo = Read-DbaBackupHeader -SqlInstance . -Path C:\\temp\\myfile.bak\nPS C:\\\u003e $backupinfo.FileList\nDisplays detailed information about each of the datafiles contained in the backupset.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eRead-DbaBackupHeader -SqlInstance . -Path C:\\temp\\myfile.bak -FileList\nAlso returns detailed information about each of the datafiles contained in the backupset.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e\"C:\\temp\\myfile.bak\", \"\\backupserver\\backups\\myotherfile.bak\" | Read-DbaBackupHeader -SqlInstance sql2016 | Where-Object { $_.BackupSize.Megabyte -gt 100 }\nReads the two files and returns only backups larger than 100 MB\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eGet-ChildItem \\\\nas\\sql\\*.bak | Read-DbaBackupHeader -SqlInstance sql2016\nGets a list of all .bak files on the \\\\nas\\sql share and reads the headers using the server named \"sql2016\". This means that the server, sql2016, must have read access to the \\\\nas\\sql share.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eRead-DbaBackupHeader -SqlInstance sql2016 -Path https://dbatoolsaz.blob.core.windows.net/azbackups/restoretime/restoretime_201705131850.bak -AzureCredential AzureBackupUser\nGets the backup header information from the SQL Server backup file stored at https://dbatoolsaz.blob.core.windows.net/azbackups/restoretime/restoretime_201705131850.bak on Azure", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Path", "Path to SQL Server backup file. This can be a full, differential or log backup file. Accepts valid filesystem paths and URLs.", "", true, "true (ByValue)", "", "" ], [ "Simple", "If this switch is enabled, fewer columns are returned, giving an easy overview.", "", false, "false", "False", "" ], [ "FileList", "If this switch is enabled, detailed information about the files within the backup is returned.", "", false, "false", "False", "" ], [ "AzureCredential", "Name of the SQL Server credential that should be used for Azure storage access.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. This avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because \r\nit basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Read-DbaBackupHeader [-SqlInstance] \u003cDbaInstanceParameter\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Path] \u003cObject[]\u003e [-Simple] [-FileList] [[-AzureCredential] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Read-DbaTraceFile", "Description": "Using the fn_trace_gettable function, a trace file is read and returned as a PowerShell object\n\nThis function returns the whole of the trace file. The information is presented in the format that the trace subsystem uses.", "Tags": [ "Security", "Trace" ], "Synopsis": "Reads SQL Server trace files", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Read-DbaTraceFile", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Read-DbaTraceFile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRead-DbaTraceFile -SqlInstance sql2016 -Database master, tempdb -Path C:\\traces\\big.trc\nReads the tracefile C:\\traces\\big.trc, stored on the sql2016 sql server. Filters only results that have master or tempdb as the DatabaseName.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRead-DbaTraceFile -SqlInstance sql2016 -Database master, tempdb -Path C:\\traces\\big.trc -TextData \u0027EXEC SP_PROCOPTION\u0027\nReads the tracefile C:\\traces\\big.trc, stored on the sql2016 sql server.\r\nFilters only results that have master or tempdb as the DatabaseName and that have \u0027EXEC SP_PROCOPTION\u0027 somewhere in the text.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRead-DbaTraceFile -SqlInstance sql2016 -Path C:\\traces\\big.trc -Where \"LinkedServerName = \u0027myls\u0027 and StartTime \u003e \u00275/30/2017 4:27:52 PM\u0027\"\nReads the tracefile C:\\traces\\big.trc, stored on the sql2016 sql server.\r\nFilters only results where LinkServerName = myls and StartTime is greater than \u00275/30/2017 4:27:52 PM\u0027.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaTrace -SqlInstance sql2014 | Read-DbaTraceFile\nReads every trace file on sql2014", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByPropertyName)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "true (ByPropertyName)", "", "" ], [ "Path", "Path to the trace file. This path is relative to the SQL Server instance.", "", false, "true (ByPropertyName)", "", "" ], [ "Database", "Search for results only with specific DatabaseName. Uses IN for comparisons.", "", false, "false", "", "" ], [ "Login", "Search for results only with specific Logins. Uses IN for comparisons.", "", false, "false", "", "" ], [ "Spid", "Search for results only with specific Spids. Uses IN for comparisons.", "", false, "false", "", "" ], [ "EventClass", "Search for results only with specific EventClasses. Uses IN for comparisons.", "", false, "false", "", "" ], [ "ObjectType", "Search for results only with specific ObjectTypes. Uses IN for comparisons.", "", false, "false", "", "" ], [ "ErrorId", "Search for results only with specific Errors. Filters \u0027Error in ($ErrorId)\u0027 Uses IN for comparisons.", "", false, "false", "", "" ], [ "EventSequence", "Search for results only with specific EventSequences. Uses IN for comparisons.", "", false, "false", "", "" ], [ "TextData", "Search for results only with specific TextData. Uses LIKE for comparisons.", "", false, "false", "", "" ], [ "ApplicationName", "Search for results only with specific ApplicationNames. Uses LIKE for comparisons.", "", false, "false", "", "" ], [ "ObjectName", "Search for results only with specific ObjectNames. Uses LIKE for comparisons.", "", false, "false", "", "" ], [ "Where", "Custom where clause - use without the word \"WHERE\". Here are the available columns:\nTextData\r\nBinaryData\r\nDatabaseID\r\nTransactionID\r\nLineNumber\r\nNTUserName\r\nNTDomainName\r\nHostName\r\nClientProcessID\r\nApplicationName\r\nLoginName\r\nSPID\r\nDuration\r\nStartTime\r\nEndTime\r\nReads\r\nWrites\r\nCPU\r\nPermissions\r\nSeverity\r\nEventSubClass\r\nObjectID\r\nSuccess\r\nIndexID\r\nIntegerData\r\nServerName\r\nEventClass\r\nObjectType\r\nNestLevel\r\nState\r\nError\r\nMode\r\nHandle\r\nObjectName\r\nDatabaseName\r\nFileName\r\nOwnerName\r\nRoleName\r\nTargetUserName\r\nDBUserName\r\nLoginSid\r\nTargetLoginName\r\nTargetLoginSid\r\nColumnPermissions\r\nLinkedServerName\r\nProviderName\r\nMethodName\r\nRowCounts\r\nRequestID\r\nXactSequence\r\nEventSequence\r\nBigintData1\r\nBigintData2\r\nGUID\r\nIntegerData2\r\nObjectID2\r\nType\r\nOwnerID\r\nParentName\r\nIsSystem\r\nOffset\r\nSourceDatabaseID\r\nSqlHandle\r\nSessionLoginName\r\nPlanHandle\r\nGroupID", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Read-DbaTraceFile [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Path] \u003cString[]\u003e] [[-Database] \u003cString[]\u003e] [[-Login] \u003cString[]\u003e] [[-Spid] \u003cInt32[]\u003e] [[-EventClass] \u003cString[]\u003e] [[-ObjectType] \u003cString[]\u003e] [[-ErrorId] \u003cInt32[]\u003e] [[-EventSequence] \u003cInt32[]\u003e] [[-TextData] \u003cString[]\u003e] [[-ApplicationName] \u003cString[]\u003e] [[-ObjectName] \u003cString[]\u003e] [[-Where] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Read-DbaTransactionLog", "Description": "Using the fn_dblog function, the live transaction log is read and returned as a PowerShell object\n\nThis function returns the whole of the log. The information is presented in the format that the logging subsystem uses.\n\nA soft limit of 0.5GB of log as been implemented. This is based on testing. This limit can be overridden\nat the users request, but please be aware that this may have an impact on your target databases and on the\nsystem running this function", "Tags": [ "Database", "Log", "LogFile" ], "Synopsis": "Reads the live Transaction log from specified SQL Server Database", "Alias": "", "Author": "Stuart Moore (@napalmgram), stuart-moore.com", "CommandName": "Read-DbaTransactionLog", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Read-DbaTransactionLog", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$Log = Read-DbaTransactionLog -SqlInstance sql2016 -Database MyDatabase\nWill read the contents of the transaction log of MyDatabase on SQL Server Instance sql2016 into the local PowerShell object $Log\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$Log = Read-DbaTransactionLog -SqlInstance sql2016 -Database MyDatabase -IgnoreLimit\nWill read the contents of the transaction log of MyDatabase on SQL Server Instance sql2016 into the local PowerShell object $Log, ignoring the recommendation of not returning more that 0.5GB of log", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Database to read the transaction log of", "", true, "false", "", "" ], [ "IgnoreLimit", "Switch to indicate that you wish to bypass the recommended limits of the function", "", false, "false", "False", "" ], [ "RowLimit", "Will limit the number of rows returned from the transaction log", "", false, "false", "0", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Read-DbaTransactionLog [-SqlInstance] \u003cDbaInstanceParameter\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Database] \u003cObject\u003e [-IgnoreLimit] [[-RowLimit] \u003cInt32\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Read-DbaXEFile", "Description": "Read XEvents from a *.xel or *.xem file.", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Read XEvents from a *.xel or *.xem file.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Read-DbaXEFile", "Availability": "Windows only", "Links": "https://dbatools.io/Read-DbaXEFile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRead-DbaXEFile -Path C:\\temp\\deadocks.xel\nReturns events from C:\\temp\\deadocks.xel.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-ChildItem C:\\temp\\xe\\*.xel | Read-DbaXEFile\nReturns events from all .xel files in C:\\temp\\xe.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance sql2014 -Session deadlocks | Read-DbaXEFile\nReads remote XEvents by accessing the file over the admin UNC share.", "Params": [ [ "Path", "The path to the *.xem or *.xem file. This is relative to the computer executing the command. UNC paths are supported.", "FullName", true, "true (ByValue)", "", "" ], [ "Raw", "If this switch is enabled, the Microsoft.SqlServer.XEvent.Linq.PublishedEvent enumeration object will be returned.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Read-DbaXEFile [-Path] \u003cObject[]\u003e [-Raw] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Register-DbatoolsConfig", "Description": "Registers an existing configuration object in registry.\nThis allows simple persisting of settings across powershell consoles.\nIt also can be used to generate a registry template, which can then be used to create policies.", "Tags": "Module", "Synopsis": "Registers an existing configuration object in registry.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Register-DbatoolsConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Register-DbatoolsConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbatoolsConfig message.style.* | Register-DbatoolsConfig\nRetrieves all configuration items that that start with message.style. and registers them in registry for the current user.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRegister-DbatoolsConfig -FullName \"message.consoleoutput.disable\" -Scope SystemDefault\nRetrieves the configuration item \"message.consoleoutput.disable\" and registers it in registry as the default setting for all users on this machine.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRegister-DbatoolsConfig -Module Message -Scope SystemMandatory\nRetrieves all configuration items of the module Message, then registers them in registry to enforce them for all users on the current system.", "Params": [ [ "Config", "The configuration object to write to registry.\r\nCan be retrieved using Get-DbatoolsConfig.", "", false, "true (ByValue)", "", "" ], [ "FullName", "The full name of the setting to be written to registry.", "", false, "true (ByValue)", "", "" ], [ "Module", "The name of the module, whose settings should be written to registry.", "", true, "false", "", "" ], [ "Name", "Default: \"*\"\r\nUsed in conjunction with the -Module parameter to restrict the number of configuration items written to registry.", "", false, "false", "*", "" ], [ "Scope", "Default: UserDefault\r\nWho will be affected by this export how? Current user or all? Default setting or enforced?\r\nLegal values: UserDefault, UserMandatory, SystemDefault, SystemMandatory", "", false, "false", "UserDefault", "" ], [ "EnableException", "This parameters disables user-friendly warnings and enables the throwing of exceptions.\r\nThis is less user friendly, but allows catching exceptions in calling scripts.", "", false, "false", "False", "" ] ], "Syntax": "Register-DbatoolsConfig [-Config \u003cConfig[]\u003e] [-FullName \u003cString[]\u003e] [-Scope {UserDefault | UserMandatory | SystemDefault | SystemMandatory | FileUserLocal | FileUserShared | FileSystem}] [-EnableException] [\u003cCommonParameters\u003e]\nRegister-DbatoolsConfig [-Module] \u003cString\u003e [[-Name] \u003cString\u003e] [-Scope {UserDefault | UserMandatory | SystemDefault | SystemMandatory | FileUserLocal | FileUserShared | FileSystem}] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaAgDatabase", "Description": "Removes a database from an availability group on a SQL Server instance.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Removes a database from an availability group on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaAgDatabase", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaAgDatabase", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaAgDatabase -SqlInstance sqlserver2012 -AvailabilityGroup ag1, ag2 -Confirm:$false\nRemoves all databases from the ag1 and ag2 availability groups on sqlserver2012. Does not prompt for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaAgDatabase -SqlInstance sqlserver2012 -AvailabilityGroup ag1 -Databsase pubs -Confirm:$false\nRemoves the pubs database from the ag1 availability group on sqlserver2012. Does not prompt for confirmation.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sqlserver2012 -AvailabilityGroup availabilitygroup1 | Remove-DbaAgDatabase\nRemoves the availability groups returned from the Get-DbaAvailabilityGroup function. Prompts for confirmation.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database or databases to remove.", "", false, "false", "", "" ], [ "AvailabilityGroup", "Only remove databases from specific availability groups.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaAgDatabase [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaAgentAlertCategory", "Description": "Remove-DbaAgentAlertCategory makes it possible to remove an alert category.\nInsure that the category you want to remove is not used with any alerts. If an alert uses this category it will be get the category [Uncategorized].", "Tags": [ "Agent", "Alert", "AlertCategory" ], "Synopsis": "Remove-DbaAgentAlertCategory removes an alert category.", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Remove-DbaAgentAlertCategory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaAgentAlertCategory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaAgentAlertCategory -SqlInstance sql1 -Category \u0027Category 1\u0027\nRemove the alert category Category 1 from the instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaAgentAlertCategory -SqlInstance sql1 -Category Category1, Category2, Category3\nRemove multiple alert categories from the instance.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaAgentAlertCategory -SqlInstance sql1, sql2, sql3 -Category Category1, Category2, Category3\nRemove multiple alert categories from the multiple instances.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Category", "The name of the category", "", false, "false", "", "" ], [ "Force", "The force parameter will ignore some errors in the parameters and assume defaults.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaAgentAlertCategory [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Category] \u003cString[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaAgentJob", "Description": "Remove-DbaAgentJob removes a job in the SQL Server Agent.", "Tags": [ "Agent", "Job" ], "Synopsis": "Remove-DbaAgentJob removes a job.", "Alias": "", "Author": "Sander Stad (@sqlstad, sqlstad.nl)", "CommandName": "Remove-DbaAgentJob", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaAgentJob", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaAgentJob -SqlInstance sql1 -Job Job1\nRemoves the job from the instance with the name Job1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGetDbaAgentJob -SqlInstance sql1 -Job Job1 | Remove-DbaAgentJob -KeepHistory\nRemoves the job but keeps the history\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaAgentJob -SqlInstance sql1 -Job Job1 -KeepUnusedSchedule\nRemoves the job but keeps the unused schedules\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eRemove-DbaAgentJob -SqlInstance sql1, sql2, sql3 -Job Job1\nRemoves the job from multiple servers", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "The name of the job. Can be null if the the job id is being used.", "", false, "false", "", "" ], [ "KeepHistory", "Specifies to keep the history for the job. By default history is deleted.", "", false, "false", "False", "" ], [ "KeepUnusedSchedule", "Specifies to keep the schedules attached to this job if they are not attached to any other job.\r\nBy default the unused schedule is deleted.", "", false, "false", "False", "" ], [ "Mode", "Default: Strict\r\nHow strict does the command take lesser issues?\r\nStrict: Interrupt if the job specified doesn\u0027t exist.\r\nLazy: Silently skip over jobs that don\u0027t exist.", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027message.mode.default\u0027 -Fallback \"Strict\")", "" ], [ "InputObject", "Accepts piped input from Get-DbaAgentJob", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaAgentJob [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Job] \u003cObject[]\u003e] [-KeepHistory] [-KeepUnusedSchedule] [[-Mode] {Strict | Lazy | Report}] [[-InputObject] \u003cJob[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaAgentJobCategory", "Description": "Remove-DbaAgentJobCategory makes it possible to remove a job category.\nBe assured that the category you want to remove is not used with other jobs. If another job uses this category it will be get the category [Uncategorized (Local)].", "Tags": [ "Agent", "Job", "JobCategory" ], "Synopsis": "Remove-DbaAgentJobCategory removes a job category.", "Alias": "", "Author": "Sander Stad (@sqlstad, sqlstad.nl)", "CommandName": "Remove-DbaAgentJobCategory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaAgentJobCategory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaAgentJobCategory -SqlInstance sql1 -Category \u0027Category 1\u0027\nRemove the job category Category 1 from the instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaAgentJobCategory -SqlInstance sql1 -Category Category1, Category2, Category3\nRemove multiple job categories from the instance.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaAgentJobCategory -SqlInstance sql1, sql2, sql3 -Category Category1, Category2, Category3\nRemove multiple job categories from the multiple instances.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Category", "The name of the category", "", false, "false", "", "" ], [ "Force", "The force parameter will ignore some errors in the parameters and assume defaults.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaAgentJobCategory [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Category] \u003cString[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaAgentJobStep", "Description": "Removes a job step from a SQL Server Agent job.", "Tags": [ "Agent", "Job", "JobStep" ], "Synopsis": "Removes a step from the specified SQL Agent job.", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Remove-DbaAgentJobStep", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaAgentJobStep", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaAgentJobStep -SqlInstance sql1 -Job Job1 -StepName Step1\nRemove \u0027Step1\u0027 from job \u0027Job1\u0027 on sql1.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaAgentJobStep -SqlInstance sql1 -Job Job1, Job2, Job3 -StepName Step1\nRemove the job step from multiple jobs.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaAgentJobStep -SqlInstance sql1, sql2, sql3 -Job Job1 -StepName Step1\nRemove the job step from the job on multiple servers.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003esql1, sql2, sql3 | Remove-DbaAgentJobStep -Job Job1 -StepName Step1\nRemove the job step from the job on multiple servers using pipeline.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "The name of the job.", "", true, "false", "", "" ], [ "StepName", "The name of the job step.", "", true, "false", "", "" ], [ "Mode", "Default: Strict\r\nHow strict does the command take lesser issues?\r\nStrict: Interrupt if the configuration already has the same value as the one specified.\r\nLazy: Silently skip over instances that already have this configuration at the specified value.", "", false, "false", "(Get-DbatoolsConfigValue -Name \u0027message.mode.default\u0027 -Fallback \"Strict\")", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaAgentJobStep [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Job] \u003cObject[]\u003e [-StepName] \u003cString\u003e [[-Mode] {Strict | Lazy | Report}] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaAgentOperator", "Description": "Drop an operator from SQL Agent.", "Tags": [ "Agent", "Operator" ], "Synopsis": "Removes a new operator on an instance.", "Alias": "", "Author": "Tracy Boggiano (@TracyBoggiano), databasesuperhero.com", "CommandName": "Remove-DbaAgentOperator", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaAgentOperator", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS:\\\u003eRemove-DbaAgentOperator -SqlInstance sql01 -Operator DBA\nThis removes an operator named DBA from the instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Operator", "Name of the operator in SQL Agent.", "", true, "false", "", "" ], [ "InputObject", "SMO Server Objects (pipeline input from Connect-DbaInstance)", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaAgentOperator [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [-Operator] \u003cString\u003e [[-InputObject] \u003cServer[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaAgentSchedule", "Description": "Removes the schedules that have passed through the pipeline.\n\nIf not used with a pipeline, Get-DbaAgentSchedule will be executed with the parameters provided\nand the returned schedules will be removed.", "Tags": [ "Agent", "Job", "Schedule" ], "Synopsis": "Removes job schedules.", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Remove-DbaAgentSchedule", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaAgentSchedule", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaAgentSchedule -SqlInstance sql1 -Schedule weekly\nRemove the schedule weekly.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaAgentSchedule -SqlInstance sql1 -Schedule weekly -Force\nRemove the schedule weekly even if the schedule is being used by jobs.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaAgentSchedule -SqlInstance sql1 -Schedule daily, weekly\nRemove multiple schedules.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eRemove-DbaAgentSchedule -SqlInstance sql1, sql2, sql3 -Schedule daily, weekly\nRemove the schedule on multiple servers for multiple schedules.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaAgentSchedule -SqlInstance sql1 -Schedule sched1, sched2, sched3 | Remove-DbaAgentSchedule\nRemove the schedules using a pipeline.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eRemove-DbaAgentSchedule -SqlInstance sql1, sql2, sql3 -ScheduleUid \u0027bf57fa7e-7720-4936-85a0-87d279db7eb7\u0027\nRemove the schedules using the schedule uid.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Schedule", "The name of the job schedule.\nPlease note that there can be several schedules with the same name. These differ then only in the Id or the ScheduleUid.", "Schedules,Name", false, "false", "", "" ], [ "ScheduleUid", "The unique identifier of the schedule.", "Uid", false, "false", "", "" ], [ "Id", "The Id of the schedule.", "", false, "false", "", "" ], [ "InputObject", "A collection of schedules (such as returned by Get-DbaAgentSchedule), to be removed.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "Force", "Remove the schedules even if they where used in one or more jobs.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaAgentSchedule [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Schedule \u003cString[]\u003e] [-ScheduleUid \u003cString[]\u003e] [-Id \u003cInt32[]\u003e] [-EnableException] [-Force] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRemove-DbaAgentSchedule -InputObject \u003cScheduleBase[]\u003e [-EnableException] [-Force] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaAgListener", "Description": "Removes a listener from an availability group on a SQL Server instance.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Removes a listener from an availability group on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaAgListener", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaAgListener", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaAgListener -SqlInstance sqlserver2012 -AvailabilityGroup ag1, ag2 -Confirm:$false\nRemoves the ag1 and ag2 availability groups on sqlserver2012. Does not prompt for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sqlserver2012 -AvailabilityGroup availabilitygroup1 | Remove-DbaAgListener\nRemoves the listeners returned from the Get-DbaAvailabilityGroup function. Prompts for confirmation.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Listener", "The listener or listeners to remove.", "", false, "false", "", "" ], [ "AvailabilityGroup", "Only remove listeners from specific availability groups.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaListener", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaAgListener [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Listener] \u003cString[]\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [[-InputObject] \u003cAvailabilityGroupListener[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaAgReplica", "Description": "Removes availability group replicas from availability groups.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Removes availability group replicas from availability groups.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaAgReplica", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaAgReplica", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaAgReplica -SqlInstance sql2017a -AvailabilityGroup SharePoint -Replica sp1\nRemoves the sp1 replica from the SharePoint ag on sql2017a. Prompts for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaAgReplica -SqlInstance sql2017a | Select-Object *\nReturns full object properties on all availability group replicas found on sql2017a", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "The specific availability group to query.", "", false, "false", "", "" ], [ "Replica", "The replica to remove.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaAgReplica.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaAgReplica [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [[-Replica] \u003cString[]\u003e] [[-InputObject] \u003cAvailabilityReplica[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaAvailabilityGroup", "Description": "Removes availability groups on a SQL Server instance.\n\nIf possible, remove the availability group only while connected to the server instance that hosts the primary replica.\nWhen the availability group is dropped from the primary replica, changes are allowed in the former primary databases (without high availability protection).\nDeleting an availability group from a secondary replica leaves the primary replica in the RESTORING state, and changes are not allowed on the databases.\n\nAvoid dropping an availability group when the Windows Server Failover Clustering (WSFC) cluster has no quorum.\nIf you must drop an availability group while the cluster lacks quorum, the metadata availability group that is stored in the cluster is not removed.\nAfter the cluster regains quorum, you will need to drop the availability group again to remove it from the WSFC cluster.\n\nFor more information: https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-availability-group-transact-sql", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Removes availability groups on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaAvailabilityGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaAvailabilityGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaAvailabilityGroup -SqlInstance sqlserver2012 -AllAvailabilityGroups\nRemoves all availability groups on the sqlserver2014 instance. Prompts for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaAvailabilityGroup -SqlInstance sqlserver2012 -AvailabilityGroup ag1, ag2 -Confirm:$false\nRemoves the ag1 and ag2 availability groups on sqlserver2012. Does not prompt for confirmation.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sqlserver2012 -AvailabilityGroup availabilitygroup1 | Remove-DbaAvailabilityGroup\nRemoves the availability groups returned from the Get-DbaAvailabilityGroup function. Prompts for confirmation.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "Only remove specific availability groups.", "", false, "false", "", "" ], [ "AllAvailabilityGroups", "Remove all availability groups on an instance.", "", false, "false", "False", "" ], [ "InputObject", "Enables piping from Get-DbaAvailabilityGroup.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaAvailabilityGroup [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [-AllAvailabilityGroups] [[-InputObject] \u003cAvailabilityGroup[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaBackup", "Description": "Removes SQL Server backups from disk.\n\nProvides 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 backups 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": "Removes SQL Server backups from disk.", "Alias": "", "Author": "Chris Sommer (@cjsommer), www.cjsommer.com", "CommandName": "Remove-DbaBackup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaBackup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaBackup -Path \u0027C:\\MSSQL\\SQL Backup\\\u0027 -BackupFileExtension trn -RetentionPeriod 48h\n\u0027*.trn\u0027 files in \u0027C:\\MSSQL\\SQL Backup\\\u0027 and all subdirectories that are more than 48 hours old will be removed.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaBackup -Path \u0027C:\\MSSQL\\SQL Backup\\\u0027 -BackupFileExtension trn -RetentionPeriod 48h -WhatIf\nSame as example #1, but doesn\u0027t actually remove any files. The function will instead show you what would be done.\r\nThis is useful when first experimenting with using the function.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaBackup -Path \u0027C:\\MSSQL\\Backup\\\u0027 -BackupFileExtension bak -RetentionPeriod 7d -CheckArchiveBit\n\u0027*.bak\u0027 files in \u0027C:\\MSSQL\\Backup\\\u0027 and all subdirectories that are more than 7 days old will be removed, but only if the files have been backed up to another location as verified by checking the \r\nArchive bit.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eRemove-DbaBackup -Path \u0027C:\\MSSQL\\Backup\\\u0027 -BackupFileExtension bak -RetentionPeriod 1w -RemoveEmptyBackupFolder\n\u0027*.bak\u0027 files in \u0027C:\\MSSQL\\Backup\\\u0027 and all subdirectories that are more than 1 week old will be removed. Any folders left empty will be removed as well.", "Params": [ [ "Path", "Specifies the name of the base level folder to search for backup files. Deletion of backup files will be recursive from this location.", "BackupFolder", true, "false", "", "" ], [ "BackupFileExtension", "Specifies the filename extension of the backup files you wish to remove (typically \u0027bak\u0027, \u0027trn\u0027 or \u0027log\u0027). Do not include the period.", "", true, "false", "", "" ], [ "RetentionPeriod", "Specifies the retention period for backup files. Correct format is ##U.\n## is the retention value and must be an integer value\r\nU signifies the units where the valid units are:\r\nh = hours\r\nd = days\r\nw = weeks\r\nm = months\nFormatting Examples:\r\n\u002748h\u0027 = 48 hours\r\n\u00277d\u0027 = 7 days\r\n\u00274w\u0027 = 4 weeks\r\n\u00271m\u0027 = 1 month", "", true, "false", "", "" ], [ "CheckArchiveBit", "If this switch is enabled, the filesystem Archive bit is checked before deletion. If this bit is set (which translates to \"it has not been backed up to another location yet\", the file won\u0027t be \r\ndeleted.", "", false, "false", "False", "" ], [ "RemoveEmptyBackupFolder", "If this switch is enabled, empty folders will be removed after the cleanup process is complete.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.i", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaBackup [-Path] \u003cString\u003e [-BackupFileExtension] \u003cString\u003e [-RetentionPeriod] \u003cString\u003e [-CheckArchiveBit] [-RemoveEmptyBackupFolder] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaClientAlias", "Description": "Removes a sql alias for the specified server by altering HKLM:\\SOFTWARE\\Microsoft\\MSSQLServer\\Client - mimics cliconfg.exe.", "Tags": "Alias", "Synopsis": "Removes a sql alias for the specified server - mimics cliconfg.exe", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaClientAlias", "Availability": "Windows only", "Links": "https://dbatools.io/Remove-DbaClientAlias", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaClientAlias -ComputerName workstationx -Alias sqlps\nRemoves the sqlps SQL client alias on workstationx\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaClientAlias | Remove-DbaClientAlias\nRemoves all SQL Server client aliases on the local computer", "Params": [ [ "ComputerName", "The target computer where the alias will be created.", "", false, "true (ByPropertyName)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to remote computers using alternative credentials", "", false, "false", "", "" ], [ "Alias", "The alias or array of aliases to be deleted", "AliasName", true, "true (ByPropertyName)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaClientAlias [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-Alias] \u003cString[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaCmConnection", "Description": "Removes connection objects from the connection cache used for remote computer management.", "Tags": [ "ComputerManagement", "CIM" ], "Synopsis": "Removes connection objects from the connection cache used for remote computer management.", "Alias": "", "Author": "Friedrich Weinmann (@FredWeinmann)", "CommandName": "Remove-DbaCmConnection", "Availability": "Windows only", "Links": "https://dbatools.io/Remove-DbaCmConnection", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaCmConnection -ComputerName sql2014\nRemoves the cached connection to the server sql2014 from the cache.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaCmConnection | Remove-DbaCmConnection\nClears the entire connection cache.", "Params": [ [ "ComputerName", "The target computer. Accepts both text as well as the output of Get-DbaCmConnection.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaCmConnection [-ComputerName] \u003cDbaCmConnectionParameter[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaComputerCertificate", "Description": "Removes a computer certificate from a local or remote compuer", "Tags": "Certificate", "Synopsis": "Removes a computer certificate - useful for removing easily certs from remote computers", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaComputerCertificate", "Availability": "Windows only", "Links": "https://dbatools.io/Remove-DbaComputerCertificate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaComputerCertificate -ComputerName Server1 -Thumbprint C2BBE81A94FEE7A26FFF86C2DFDAF6BFD28C6C94\nRemoves certificate with thumbprint C2BBE81A94FEE7A26FFF86C2DFDAF6BFD28C6C94 in the LocalMachine store on Server1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaComputerCertificate | Where-Object Thumbprint -eq E0A071E387396723C45E92D42B2D497C6A182340 | Remove-DbaComputerCertificate\nRemoves certificate using the pipeline\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaComputerCertificate -ComputerName Server1 -Thumbprint C2BBE81A94FEE7A26FFF86C2DFDAF6BFD28C6C94 -Store User -Folder My\nRemoves certificate with thumbprint C2BBE81A94FEE7A26FFF86C2DFDAF6BFD28C6C94 in the User\\My (Personal) store on Server1", "Params": [ [ "ComputerName", "The target computer. Defaults to localhost.", "", false, "false", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to $ComputerName using alternative credentials", "", false, "false", "", "" ], [ "Thumbprint", "The thumbprint of the certificate object", "", true, "true (ByPropertyName)", "", "" ], [ "Store", "Certificate store - defaults to LocalMachine (otherwise exceptions can be thrown on remote connections)", "", false, "false", "LocalMachine", "" ], [ "Folder", "Certificate folder", "", false, "false", "My", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaComputerCertificate [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-Thumbprint] \u003cString[]\u003e [[-Store] \u003cString\u003e] [[-Folder] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaCustomError", "Description": "This command provides a wrapper for the sp_dropmessage system procedure that allows for user defined messages to be removed from sys.messages.", "Tags": [ "Error", "CustomError" ], "Synopsis": "Removes a user defined message from sys.messages. This command does not support Azure SQL Database.", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "Remove-DbaCustomError", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaCustomError", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaCustomError -SqlInstance sqldev01, sqldev02 -MessageID 70001 -Language \"French\"\nRemoves the custom message on the sqldev01 and sqldev02 instances with ID 70001 and language French.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaCustomError -SqlInstance sqldev01, sqldev02 -MessageID 70001 -Language \"All\"\nRemoves all custom messages on the sqldev01 and sqldev02 instances with ID 70001.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$server = Connect-DbaInstance sqldev01\nPS C:\\\u003e $newMessage = New-DbaCustomError -SqlInstance $server -MessageID 70000 -Severity 16 -MessageText \"test_70000\"\nCreates a new custom message on the sqldev01 instance with ID 70000, severity 16, and text \"test_70000\"\nTo modify the custom message at a later time the following can be done to change the severity from 16 to 20:\nPS C:\\\u003e $original = $server.UserDefinedMessages | Where-Object ID -eq 70000\r\nPS C:\\\u003e $messageID = $original.ID\r\nPS C:\\\u003e $severity = 20\r\nPS C:\\\u003e $text = $original.Text\r\nPS C:\\\u003e $language = $original.Language\r\nPS C:\\\u003e $removed = Remove-DbaCustomError -SqlInstance $server -MessageID 70000\r\nPS C:\\\u003e $alteredMessage = New-DbaCustomError -SqlInstance $server -MessageID $messageID -Severity $severity -MessageText $text -Language $language -WithLog\nThe resulting updated message object is available in $alteredMessage.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\r\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\r\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "MessageID", "An integer between 50001 and 2147483647.", "", false, "false", "0", "" ], [ "Language", "Language for the message to be removed. The valid values for Language are contained in the Name and Alias columns from sys.syslanguages.", "", false, "false", "English", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaCustomError [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-MessageID] \u003cInt32\u003e] [[-Language] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDatabase", "Description": "Tries a bunch of different ways to remove a user created database or two or more.", "Tags": [ "Delete", "Databases" ], "Synopsis": "Drops a user database, hopefully even the really stuck ones.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaDatabase", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDatabase", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDatabase -SqlInstance sql2016 -Database containeddb\nPrompts then removes the database containeddb on SQL Server sql2016\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaDatabase -SqlInstance sql2016 -Database containeddb, mydb\nPrompts then removes the databases containeddb and mydb on SQL Server sql2016\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaDatabase -SqlInstance sql2016 -Database containeddb -Confirm:$false\nDoes not prompt and swiftly removes containeddb on SQL Server sql2016\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance server\\instance | Remove-DbaDatabase\nRemoves all the user databases from server\\instance\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance server\\instance | Remove-DbaDatabase -Confirm:$false\nRemoves all the user databases from server\\instance without any confirmation", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", true, "false", "", "" ], [ "InputObject", "A collection of databases (such as returned by Get-DbaDatabase), to be removed.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDatabase [-SqlCredential \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRemove-DbaDatabase -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] -Database \u003cObject[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRemove-DbaDatabase [-SqlCredential \u003cPSCredential\u003e] -InputObject \u003cDatabase[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDatabaseSafely", "Description": "Performs a DBCC CHECKDB on the database, backs up the database with Checksum and verify only to a final (golden) backup location, creates an Agent Job to restore from that backup, drops the database, runs the agent job to restore the database, performs a DBCC CHECKDB and drops the database.\n\nWith huge thanks to Grant Fritchey and his verify your backups video. Take a look, it\u0027s only 3 minutes long. http://sqlps.io/backuprant", "Tags": [ "Database", "Remove" ], "Synopsis": "Safely removes a SQL Database and creates an Agent Job to restore it.", "Alias": "", "Author": "Rob Sewell (@SQLDBAWithBeard), sqldbawithabeard.com", "CommandName": "Remove-DbaDatabaseSafely", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDatabaseSafely", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDatabaseSafely -SqlInstance \u0027Fade2Black\u0027 -Database RideTheLightning -BackupFolder \u0027C:\\MSSQL\\Backup\\Rationalised - DO NOT DELETE\u0027\nPerforms a DBCC CHECKDB on database RideTheLightning on server Fade2Black. If there are no errors, the database is backup to the folder C:\\MSSQL\\Backup\\Rationalised - DO NOT DELETE. Then, an Agent \r\njob to restore the database from that backup is created. The database is then dropped, the Agent job to restore it run, a DBCC CHECKDB run against the restored database, and then it is dropped again.\nAny DBCC errors will be written to your documents folder\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$Database = \u0027DemoNCIndex\u0027,\u0027RemoveTestDatabase\u0027\nPS C:\\\u003e Remove-DbaDatabaseSafely -SqlInstance \u0027Fade2Black\u0027 -Database $Database -BackupFolder \u0027C:\\MSSQL\\Backup\\Rationalised - DO NOT DELETE\u0027\nPerforms a DBCC CHECKDB on two databases, \u0027DemoNCIndex\u0027 and \u0027RemoveTestDatabase\u0027 on server Fade2Black. Then, an Agent job to restore each database from those backups is created. The databases are \r\nthen dropped, the Agent jobs to restore them run, a DBCC CHECKDB run against the restored databases, and then they are dropped again.\nAny DBCC errors will be written to your documents folder\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaDatabaseSafely -SqlInstance \u0027Fade2Black\u0027 -Destination JusticeForAll -Database RideTheLightning -BackupFolder \u0027\\\\BACKUPSERVER\\BACKUPSHARE\\MSSQL\\Rationalised - DO NOT DELETE\u0027\nPerforms a DBCC CHECKDB on database RideTheLightning on server Fade2Black. If there are no errors, the database is backup to the folder \\\\BACKUPSERVER\\BACKUPSHARE\\MSSQL\\Rationalised - DO NOT DELETE . \r\nThen, an Agent job is created on server JusticeForAll to restore the database from that backup is created. The database is then dropped on Fade2Black, the Agent job to restore it on JusticeForAll is \r\nrun, a DBCC CHECKDB run against the restored database, and then it is dropped from JusticeForAll.\nAny DBCC errors will be written to your documents folder\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eRemove-DbaDatabaseSafely -SqlInstance IronMaiden -Database $Database -Destination TheWildHearts -BackupFolder Z:\\Backups -NoDbccCheckDb -JobOwner \u0027THEBEARD\\Rob\u0027\nFor the databases $Database on the server IronMaiden a DBCC CHECKDB will not be performed before backing up the databases to the folder Z:\\Backups. Then, an Agent job is created on server \r\nTheWildHearts with a Job Owner of THEBEARD\\Rob to restore each database from that backup using the instance\u0027s default file paths. The database(s) is(are) then dropped on IronMaiden, the Agent job(s) \r\nrun, a DBCC CHECKDB run on the restored database(s), and then the database(s) is(are) dropped.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eRemove-DbaDatabaseSafely -SqlInstance IronMaiden -Database $Database -Destination TheWildHearts -BackupFolder Z:\\Backups\nThe databases $Database on the server IronMaiden will be backed up the to the folder Z:\\Backups. Then, an Agent job is created on server TheWildHearts with a Job Owner of THEBEARD\\Rob to restore each \r\ndatabase from that backup using the instance\u0027s default file paths. The database(s) is(are) then dropped on IronMaiden, the Agent job(s) run, a DBCC CHECKDB run on the restored database(s), and then \r\nthe database(s) is(are) dropped.\nIf there is a DBCC Error, the function will continue to perform rest of the actions and will create an Agent job with \u0027DBCCERROR\u0027 in the name and a Backup file with \u0027DBCCError\u0027 in the name.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies one or more databases to remove.", "", false, "false", "", "" ], [ "Destination", "If specified, Agent jobs will be created on this server. By default, the jobs will be created on the server specified by SqlInstance. You must have sysadmin access and the server must be SQL Server \r\n2000 or higher. The SQL Agent service will be started if it is not already running.", "", false, "false", "$SqlInstance", "" ], [ "DestinationCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "NoDbccCheckDb", "If this switch is enabled, the initial DBCC CHECK DB will be skipped. This will make the process quicker but will also allow you to create an Agent job that restores a database backup containing a \r\ncorrupt database.\nA second DBCC CHECKDB is performed on the restored database so you will still be notified BUT USE THIS WITH CARE.", "NoCheck", false, "false", "False", "" ], [ "BackupFolder", "Specifies the path to a folder where the final backups of the removed databases will be stored. If you are using separate source and destination servers, you must specify a UNC path such as \r\n\\\\SERVER1\\BACKUPSHARE\\", "", true, "false", "", "" ], [ "CategoryName", "Specifies the Category Name for the Agent job that is created for restoring the database(s). By default, the name is \"Rationalisation\".", "", false, "false", "Rationalisation", "" ], [ "JobOwner", "Specifies the name of the account which will own the Agent jobs. By default, sa is used.", "", false, "false", "", "" ], [ "AllDatabases", "If this switch is enabled, all user databases on the server will be removed. This is useful when decommissioning a server. You should use a Destination with this switch.", "", false, "false", "False", "" ], [ "BackupCompression", "If this switch is enabled, compression will be used for the backup regardless of the SQL Server instance setting. By default, the SQL Server instance setting for backup compression is used.", "", false, "false", "Default", "Default,On,Off" ], [ "ReuseSourceFolderStructure", "If this switch is enabled, the source folder structure will be used when restoring instead of using the destination instance default folder structure.", "", false, "false", "False", "" ], [ "Force", "If this switch is enabled, all actions will be performed even if DBCC errors are detected. An Agent job will be created with \u0027DBCCERROR\u0027 in the name and the backup file will have \u0027DBCC\u0027 in its name.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDatabaseSafely [-SqlInstance] \u003cDbaInstanceParameter\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-Destination] \u003cDbaInstanceParameter\u003e] [[-DestinationCredential] \u003cPSCredential\u003e] [-NoDbccCheckDb] [-BackupFolder] \u003cString\u003e [[-CategoryName] \u003cString\u003e] [[-JobOwner] \u003cString\u003e] [-AllDatabases] [[-BackupCompression] \u003cString\u003e] [-ReuseSourceFolderStructure] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbAsymmetricKey", "Description": "Deletes specified asymmetric key", "Tags": "asymmetrickey", "Synopsis": "Deletes specified asymmetric key", "Alias": "", "Author": "Stuart Moore (@napalmgram), stuart-moore.com", "CommandName": "Remove-DbaDbAsymmetricKey", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbAsymmetricKey", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbAsymmetricKey -SqlInstance Server1 -Database Enctest -Name AsCert1\nThe Asymmetric Key AsCert1 will be removed from the Enctest database on Instance Server1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbAsymmetricKey -SqlInstance Server1 -Database Enctest | Remove-DbaDbAsymmetricKey\nWill remove all the asymmetric keys found in the Enctrst databae on the Server1 instance", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "Name of the asymmetric key to be removed", "", false, "false", "", "" ], [ "Database", "The database from which the asymmetric key will be deleted.", "", false, "false", "master", "" ], [ "InputObject", "Allows passing in of AsymmetricKey objects from Get-DbaDbAsymmetricKey", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbAsymmetricKey [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString[]\u003e] [[-Database] \u003cString[]\u003e] [[-InputObject] \u003cAsymmetricKey[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbBackupRestoreHistory", "Description": "Reduces the size of the backup and restore history tables by deleting the entries for backup sets.\n\nCan be used at server level, in this case a retention period -KeepDays can be set (default is 30 days).\nCan also be used at database level, in this case the complete history for the database(s) is deleted.\n\nThe backup and restore history tables reside in the msdb database.\n\nTo periodically remove old data from backup and restore history tables it is recommended to schedule the agent job sp_delete_backuphistory from the\nSQL Server Maintenance Solution created by Ola Hallengren (https://ola.hallengren.com).", "Tags": "Delete", "Synopsis": "Reduces the size of the backup and restore history tables by deleting old entries for backup sets.", "Alias": "", "Author": "IJeb Reitsma", "CommandName": "Remove-DbaDbBackupRestoreHistory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbBackupRestoreHistory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbBackupRestoreHistory -SqlInstance sql2016\nPrompts for confirmation then deletes backup and restore history on SQL Server sql2016 older than 30 days (default period)\nPS C:\\\u003e Remove-DbaDbBackupRestoreHistory -SqlInstance sql2016 -KeepDays 100 -Confirm:$false\nRemove backup and restore history on SQL Server sql2016 older than 100 days. Does not prompt for confirmation.\nPS C:\\\u003e Remove-DbaDbBackupRestoreHistory -SqlInstance sql2016 -Database db1\nPrompts for confirmation then deletes all backup and restore history for database db1 on SQL Server sql2016\nPS C:\\\u003e Get-DbaDatabase -SqlInstance sql2016 | Remove-DbaDbBackupRestoreHistory -WhatIf\nRemove complete backup and restore history for all databases on SQL Server sql2016", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "KeepDays", "The number of days of history to keep. Defaults to 30 days.", "", false, "false", "0", "" ], [ "Database", "The database(s) to process. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbBackupRestoreHistory [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-KeepDays] \u003cInt32\u003e] [[-Database] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbCertificate", "Description": "Deletes specified database certificate", "Tags": "Certificate", "Synopsis": "Deletes specified database certificate", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaDbCertificate", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbCertificate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbCertificate -SqlInstance Server1\nThe certificate in the master database on server1 will be removed if it exists.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaDbCertificate -SqlInstance Server1 -Database db1 -Confirm:$false\nSuppresses all prompts to remove the certificate in the \u0027db1\u0027 database and drops the key.", "Params": [ [ "SqlInstance", "The SQL Server to create the certificates on.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database where the certificate will be removed.", "", false, "false", "", "" ], [ "Certificate", "The certificate that will be removed", "", false, "false", "", "" ], [ "InputObject", "Piped certificate objects", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbCertificate [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Certificate] \u003cString[]\u003e] [[-InputObject] \u003cCertificate[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbData", "Description": "This command truncates all the tables in a database. If there are foreign keys and/or views they are scripted out, then dropped before the truncate, and recreated after.", "Tags": [ "Role", "Database" ], "Synopsis": "Removes all the data from a database(s) for each instance(s) of SQL Server.", "Alias": "", "Author": "Jess Pomfret (@jpomfret), jesspomfret.com", "CommandName": "Remove-DbaDbData", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbData", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbData -SqlInstance localhost -Database dbname\nRemoves all data from the dbname database on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaDbData -SqlInstance mssql1 -ExcludeDatabase DBA -Confirm:$False\nRemoves all data from all databases on mssql1 except the DBA Database. Doesn\u0027t prompt for confirmation.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$svr = Connect-DbaInstance -SqlInstance mssql1\nPS C:\\\u003e $svr | Remove-DbaDbData -Database AdventureWorks2017\nRemoves all data from AdventureWorks2017 on the mssql1 SQL Server Instance, uses piped input from Connect-DbaInstance.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance mssql1 -Database AdventureWorks2017 | Remove-DbaDbData\nRemoves all data from AdventureWorks2017 on the mssql1 SQL Server Instance, uses piped input from Get-DbaDatabase.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server. If unspecified, all user databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "Path", "Specifies the directory where the file or files will be exported.\r\nWill default to Path.DbatoolsExport Configuration entry", "", false, "false", "(Get-DbatoolsConfigValue -FullName \u0027Path.DbatoolsExport\u0027)", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbData [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-InputObject] \u003cObject[]\u003e] [[-Path] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbFileGroup", "Description": "Removes the specified filegroup(s). It is required that the filegroup is empty before it can be removed.", "Tags": [ "Data", "Database", "File", "FileGroup", "Migration", "Partitioning", "Table" ], "Synopsis": "Removes the specified filegroup(s).", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "Remove-DbaDbFileGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbFileGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbFileGroup -SqlInstance sqldev1 -Database TestDb -FileGroup HRFG1\nRemoves the HRFG1 filegroup on the TestDb database on the sqldev1 instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqldev1 -Database TestDb | Remove-DbaDbFileGroup -FileGroup HRFG1\nPasses in the TestDB database from the sqldev1 instance and removes the HRFG1 filegroup.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbFileGroup -SqlInstance sqldev1 -Database TestDb -FileGroup HRFG1 | Remove-DbaDbFileGroup\nPasses in the HRFG1 filegroup from the TestDB database on the sqldev1 instance and removes the filegroup.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database(s).", "", false, "false", "", "" ], [ "FileGroup", "The name(s) of the filegroup(s).", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase and Get-DbaDbFileGroup.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbFileGroup [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-FileGroup] \u003cString[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbLogShipping", "Description": "The command Remove-DbaDbLogShipping will remove one or more databases from log shipping\n\nAfter running the command it will remove all the jobs, configurations set up for log shipping\n\nBy default the secondary database will NOT be removed.\nUse -RemoveSecondaryDatabase to make the command the secondary database", "Tags": "LogShipping", "Synopsis": "Remove-DbaDbLogShipping will remove one or more databases from log shipping", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Remove-DbaDbLogShipping", "Availability": "Windows only", "Links": "https://dbatools.io/Remove-DbaDbLogShipping", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbLogShipping -PrimarySqlInstance sql1 -SecondarySqlInstance sql2 -Database DB1\nRemove the log shipping for database DB1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaDbLogShipping -PrimarySqlInstance sql1 -Database DB1\nRemove the log shipping for database DB1 and let the command figure out the secondary instance\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaDbLogShipping -PrimarySqlInstance localhost -SecondarySqlInstance sql2 -Database DB1, DB2\nRemove the log shipping for multiple database\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eRemove-DbaDbLogShipping -PrimarySqlInstance localhost -SecondarySqlInstance localhost -Database DB2 -RemoveSecondaryDatabase\nRemove the log shipping for database DB2 and remove the database from the secondary instance", "Params": [ [ "PrimarySqlInstance", "Primary SQL Server instance which contains the primary database(s).\r\nYou must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "false", "", "" ], [ "SecondarySqlInstance", "Secondary SQL Server instance which contains the secondary database(s)\r\nYou must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", false, "false", "", "" ], [ "PrimarySqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "SecondarySqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Database to remove from log shipping.\nThis is the name of the database located on the primary instance", "", true, "true (ByValue)", "", "" ], [ "RemoveSecondaryDatabase", "By default the command will not remove the database from the secondary instance.\r\nUse this parameter to make the command remove that database", "", false, "false", "False", "" ], [ "EnableException", "Use this switch to disable any kind of verbose messages", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbLogShipping [-PrimarySqlInstance] \u003cDbaInstanceParameter\u003e [[-SecondarySqlInstance] \u003cDbaInstanceParameter\u003e] [[-PrimarySqlCredential] \u003cPSCredential\u003e] [[-SecondarySqlCredential] \u003cPSCredential\u003e] [-Database] \u003cObject[]\u003e [-RemoveSecondaryDatabase] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbMasterKey", "Description": "Deletes specified database master key", "Tags": [ "Certificate", "Masterkey" ], "Synopsis": "Deletes specified database master key", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaDbMasterKey", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbMasterKey", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbMasterKey -SqlInstance sql2017, sql2016 -Database pubs\nThe master key in the pubs database on sql2017 and sql2016 will be removed if it exists.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaDbMasterKey -SqlInstance sql2017 -Database db1 -Confirm:$false\nSuppresses all prompts to remove the master key in the \u0027db1\u0027 database and drops the key.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbMasterKey -SqlInstance sql2017 -Database db1 | Remove-DbaDbMasterKey -Confirm:$false\nSuppresses all prompts to remove the master key in the \u0027db1\u0027 database and drops the key.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database where the master key will be removed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "List of databases to exclude from clearing all master keys", "", false, "false", "", "" ], [ "All", "Purge the master keys from all databases on an instance", "", false, "false", "False", "" ], [ "InputObject", "Enables pipeline input from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbMasterKey [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [-All] [[-InputObject] \u003cMasterKey[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbMirror", "Description": "Removes database mirrors. Does not set databases in recovery to recovered.", "Tags": [ "Mirroring", "Mirror", "HA" ], "Synopsis": "Removes database mirrors.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaDbMirror", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbMirror", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbMirror -SqlInstance localhost -Database TestDB\nStops the database mirroring session for the TestDB on the localhost instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaDbMirror -SqlInstance localhost -Database TestDB1, TestDB2\nStops the database mirroring session for the TestDB1 and TestDB2 databases on the localhost instance.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance localhost -Database TestDB1, TestDB2 | Remove-DbaDbMirror\nStops the database mirroring session for the TestDB1 and TestDB2 databases on the localhost instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database.", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbMirror [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbMirrorMonitor", "Description": "Stops and deletes the mirroring monitor job for all the databases on the server instance.\n\nBasically executes sp_dbmmonitordropmonitoring.", "Tags": [ "Mirroring", "Mirror", "HA" ], "Synopsis": "Stops and deletes the mirroring monitor job for all the databases on the server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaDbMirrorMonitor", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbMirrorMonitor", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbMirrorMonitor -SqlInstance sql2008, sql2012\nStops and deletes the mirroring monitor job for all the databases on sql2008 and sql2012.", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbMirrorMonitor [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbOrphanUser", "Description": "Allows the removal of orphan users from one or more databases\n\nOrphaned users in SQL Server occur when a database user is based on a login in the master database, but the login no longer exists in master.\nThis can occur when the login is deleted, or when the database is moved to another server where the login does not exist.\n\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.\n\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.\n\nIf a login of the same name exists (which could be re-mapped with Repair-DbaDbOrphanUser) the drop will not be performed unless you specify the -Force parameter (only when calling from Repair-DbaDbOrphanUser.", "Tags": [ "Orphan", "Database", "Security", "Login" ], "Synopsis": "Drop orphan users with no existing login to map", "Alias": "", "Author": "Claudio Silva (@ClaudioESSilva) | Simone Bizzotto (@niphlod)", "CommandName": "Remove-DbaDbOrphanUser", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbOrphanUser", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbOrphanUser -SqlInstance sql2005\nFinds and drops all orphan users without matching Logins in all databases present on server \u0027sql2005\u0027.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaDbOrphanUser -SqlInstance sqlserver2014a -SqlCredential $cred\nFinds and drops all orphan users without matching Logins in all databases present on server \u0027sqlserver2014a\u0027. SQL Server authentication will be used in connecting to the server.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaDbOrphanUser -SqlInstance sqlserver2014a -Database db1, db2 -Force\nFinds and drops orphan users even if they have a matching Login on both db1 and db2 databases.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eRemove-DbaDbOrphanUser -SqlInstance sqlserver2014a -ExcludeDatabase db1, db2 -Force\nFinds and drops orphan users even if they have a matching Login from all databases except db1 and db2.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eRemove-DbaDbOrphanUser -SqlInstance sqlserver2014a -User OrphanUser\nRemoves user OrphanUser from all databases only if there is no matching login.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eRemove-DbaDbOrphanUser -SqlInstance sqlserver2014a -User OrphanUser -Force\nRemoves user OrphanUser from all databases even if they have a matching Login. Any schema that the user owns will change ownership to dbo.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server", "", false, "false", "", "" ], [ "User", "Specifies the list of users to remove.", "", false, "true (ByValue)", "", "" ], [ "Force", "If this switch is enabled:\r\nIf exists any schema which owner is the User, this will force the change of the owner to \u0027dbo\u0027.\r\nIf a login of the same name exists the drop will not be performed unless you specify this parameter.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbOrphanUser [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-User] \u003cObject[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbRole", "Description": "The Remove-DbaDbRole removes role(s) from database(s) for each instance(s) of SQL Server.", "Tags": [ "Role", "Database", "Security", "Login" ], "Synopsis": "Removes a database role from database(s) for each instance(s) of SQL Server.", "Alias": "", "Author": "Ben Miller (@DBAduck)", "CommandName": "Remove-DbaDbRole", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbRole", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbRole -SqlInstance localhost -Database dbname -Role \"customrole1\", \"customrole2\"\nRemoves roles customrole1 and customrole2 from the database dbname on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaDbRole -SqlInstance localhost, sql2016 -Database db1, db2 -Role role1, role2, role3\nRemoves role1,role2,role3 from db1 and db2 on the local and sql2016 SQL Server instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers = Get-Content C:\\servers.txt\nPS C:\\\u003e $servers | Remove-DbaDbRole -Database db1, db2 -Role role1\nRemoves role1 from db1 and db2 on the servers in C:\\servers.txt\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$roles = Get-DbaDbRole -SqlInstance localhost, sql2016 -Database db1, db2 -Role role1, role2, role3\nPS C:\\\u003e $roles | Remove-DbaDbRole\nRemoves role1,role2,role3 from db1 and db2 on the local and sql2016 SQL Server instances", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "Role", "The role(s) to process. If unspecified, all roles will be processed.", "", false, "false", "", "" ], [ "ExcludeRole", "The role(s) to exclude.", "", false, "false", "", "" ], [ "IncludeSystemDbs", "If this switch is enabled, roles can be removed from system databases.", "", false, "false", "False", "" ], [ "InputObject", "Enables piped input from Get-DbaDbRole or Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbRole [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-Role] \u003cString[]\u003e] [[-ExcludeRole] \u003cString[]\u003e] [-IncludeSystemDbs] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbRoleMember", "Description": "The Remove-DbaDbRoleMember removes users in a database from a database role or roles for each instance(s) of SQL Server.", "Tags": [ "Role", "Database", "Security", "Login" ], "Synopsis": "Removes a Database User from a database role for each instance(s) of SQL Server.", "Alias": "", "Author": "Ben Miller (@DBAduck)", "CommandName": "Remove-DbaDbRoleMember", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbRoleMember", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbRoleMember -SqlInstance localhost -Database mydb -Role db_owner -User user1\nRemoves user1 from the role db_owner in the database mydb on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaDbRoleMember -SqlInstance localhost, sql2016 -Role SqlAgentOperatorRole -User user1 -Database msdb\nRemoves user1 in servers localhost and sql2016 in the msdb database from the SqlAgentOperatorRole\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers = Get-Content C:\\servers.txt\nPS C:\\\u003e $servers | Remove-DbaDbRoleMember -Role SqlAgentOperatorRole -User user1 -Database msdb\nRemoves user1 from the SqlAgentOperatorRole in the msdb database in every server in C:\\servers.txt\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$db = Get-DbaDataabse -SqlInstance localhost -Database DEMODB\nPS C:\\\u003e $db | Remove-DbaDbRoleMember -Role \"db_datareader\",\"db_datawriter\" -User user1\nRemoves user1 in the database DEMODB on the server localhost from the roles db_datareader and db_datawriter\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$roles = Get-DbaDbRole -SqlInstance localhost -Role \"db_datareader\",\"db_datawriter\"\nPS C:\\\u003e $roles | Remove-DbaDbRoleMember -User user1", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "Role", "The role(s) to process.", "", false, "false", "", "" ], [ "User", "The user(s) to remove from the role(s) specified.", "", true, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaDbRole or Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbRoleMember [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Role] \u003cString[]\u003e] [-User] \u003cString[]\u003e [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbSchema", "Description": "Drops one or more schemas from the specified database(s). As noted in the remarks section of the documentation for DROP SCHEMA there must not be any objects in the schema.", "Tags": [ "Data", "Database", "Migration", "Permission", "Security", "Schema", "Table", "User" ], "Synopsis": "Drops one or more schemas from the specified database(s).", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "Remove-DbaDbSchema", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbSchema", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbSchema -SqlInstance sqldev01 -Database example1 -Schema TestSchema1\nRemoves the TestSchema1 schema in the example1 database in the sqldev01 instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqldev01, sqldev02 -Database example1 | Remove-DbaDbSchema -Schema TestSchema1, TestSchema2\nPasses in the example1 db via pipeline and removes the TestSchema1 and TestSchema2 schemas.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database(s).", "", false, "false", "", "" ], [ "Schema", "The name(s) of the schema(s)", "", true, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbSchema [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [-Schema] \u003cString[]\u003e [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbSequence", "Description": "Removes the sequences that have passed through the pipeline.\n\nIf not used with a pipeline, Get-DbaDbSequence will be executed with the parameters provided\nand the returned sequences will be removed.", "Tags": [ "Data", "Sequence", "Table" ], "Synopsis": "Removes sequences.", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "Remove-DbaDbSequence", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbSequence", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbSequence -SqlInstance sqldev01 -Database TestDB -Name TestSequence\nRemoves the sequence TestSequence in the TestDB database on the sqldev01 instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbSequence -SqlInstance SRV1 | Out-GridView -Title \u0027Select sequence(s) to drop\u0027 -OutputMode Multiple | Remove-DbaDbSequence\nUsing a pipeline this command gets all sequences on SRV1, lets the user select those to remove and then removes the selected sequences.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database(s).", "", false, "false", "", "" ], [ "Name", "The name(s) of the sequence(s).", "", false, "false", "", "" ], [ "Schema", "The name(s) of the schema for the sequence(s).", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaDbSequence.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.\r\nThis is the default. Use -Confirm:$false to suppress these prompts.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbSequence [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cString[]\u003e] [-Name \u003cString[]\u003e] [-Schema \u003cString[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRemove-DbaDbSequence -InputObject \u003cSequence[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbSnapshot", "Description": "Removes (drops) database snapshots from the server", "Tags": [ "Snapshot", "Database" ], "Synopsis": "Removes database snapshots", "Alias": "", "Author": "Simone Bizzotto (@niphold)", "CommandName": "Remove-DbaDbSnapshot", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbSnapshot", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbSnapshot -SqlInstance sql2014 -Snapshot HR_snap_20161201, HR_snap_20161101\nRemoves database snapshots named HR_snap_20161201 and HR_snap_20161101\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaDbSnapshot -SqlInstance sql2014 -Database HR, Accounting\nRemoves all database snapshots having HR and Accounting as base dbs\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbSnapshot -SqlInstance sql2014 -Database HR, Accounting | Remove-DbaDbSnapshot\nRemoves all database snapshots having HR and Accounting as base dbs\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eRemove-DbaDbSnapshot -SqlInstance sql2014 -Snapshot HR_snapshot, Accounting_snapshot\nRemoves HR_snapshot and Accounting_snapshot\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDbSnapshot -SqlInstance sql2016 | Where-Object SnapshotOf -like \u0027*dumpsterfire*\u0027 | Remove-DbaDbSnapshot\nRemoves all snapshots associated with databases that have dumpsterfire in the name\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaDbSnapshot -SqlInstance sql2016 | Out-GridView -PassThru | Remove-DbaDbSnapshot\nAllows the selection of snapshots on sql2016 to remove\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eRemove-DbaDbSnapshot -SqlInstance sql2014 -AllSnapshots\nRemoves all database snapshots from sql2014\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eRemove-DbaDbSnapshot -SqlInstance sql2014 -AllSnapshots -Confirm\nRemoves all database snapshots from sql2014 and prompts for each database", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Removes snapshots for only this specific base db", "", false, "false", "", "" ], [ "ExcludeDatabase", "Removes snapshots excluding this specific base dbs", "", false, "false", "", "" ], [ "Snapshot", "Restores databases from snapshot with this name only", "", false, "false", "", "" ], [ "InputObject", "Enables input from Get-DbaDbSnapshot", "", false, "true (ByValue)", "", "" ], [ "AllSnapshots", "Specifies that you want to remove all snapshots from the server", "", false, "false", "False", "" ], [ "Force", "Will forcibly kill all running queries that prevent the drop process.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run", "wi", false, "false", "", "" ], [ "Confirm", "Prompts for confirmation of every step.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbSnapshot [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-Snapshot] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-AllSnapshots] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbSynonym", "Description": "The Remove-DbaDbSynonym removes synonym(s) from database(s) / instance(s) of SQL Server.", "Tags": [ "Synonym", "Database" ], "Synopsis": "Removes synonym(s) from database(s) / instance(s) of SQL Server.", "Alias": "", "Author": "Mikey Bronowski (@MikeyBronowski), https://bronowski.it", "CommandName": "Remove-DbaDbSynonym", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbSynonym", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbSynonym -SqlInstance localhost -Database db1 -Synonym \"synonym1\", \"synonym2\"\nRemoves synonyms synonym1 and synonym2 from the database db1 on the local default SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaDbSynonym -SqlInstance localhost, sql2016 -Database db1, db2 -Synonym synonym1, synonym2, synonym3\nRemoves synonym1, synonym2, synonym3 from db1 and db2 on the local and sql2016 SQL Server instances\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$servers = Get-Content C:\\servers.txt\nPS C:\\\u003e $servers | Remove-DbaDbSynonym -Database db1, db2 -Synonym synonym1\nRemoves synonym1 from db1 and db2 on the servers in C:\\servers.txt\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$synonyms = Get-DbaDbSynonym -SqlInstance localhost, sql2016 -Database db1, db2 -Synonym synonym1, synonym2, synonym3\nPS C:\\\u003e $synonyms | Remove-DbaDbSynonym\nRemoves synonym1, synonym2, synonym3 from db1 and db2 on the local and sql2016 SQL Server instances", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "Schema", "The schema(s) to process. If unspecified, all schemas will be processed.", "", false, "false", "", "" ], [ "ExcludeSchema", "The schema(s) to exclude.", "", false, "false", "", "" ], [ "Synonym", "The synonym(s) to process. If unspecified, all synonyms will be processed.", "", false, "false", "", "" ], [ "ExcludeSynonym", "The synonym(s) to exclude.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaDbSynonym or Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbSynonym [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-Schema] \u003cString[]\u003e] [[-ExcludeSchema] \u003cString[]\u003e] [[-Synonym] \u003cString[]\u003e] [[-ExcludeSynonym] \u003cString[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbTableData", "Description": "This command does a batch delete of table data using the technique described by Aaron Bertrand here: https://sqlperformance.com/2013/03/io-subsystem/chunk-deletes. The main goal of this command is to ensure that the log file size is controlled while deleting data. This command can be used for doing both very large deletes or small deletes. Foreign keys are not temporarily removed, so the caller needs to perform deletes in the correct order with dependent tables or enable cascading deletes. When a database is using the full or bulk_logged recovery model this command will take log backups at the end of each batch if the -LogBackupPath or -AzureBaseUrl param is specified. If the database is using the simple recovery model then CHECKPOINTs will be performed for on-prem SQL Server databases. The object returned will contain metadata about the batch deletion process including the log backup details.\n\nThere are two categories of use cases for this command:\n1. Simplistic deletions from a table. In this scenario use the -Table and -BatchSize parameters. The DELETE statement is auto-generated by the this command.\n2. Complex deletions based on a join, where clause, or an order by clause. In this scenario use the -DeleteSql parameter to specify the DELETE statement.", "Tags": [ "Data", "Database", "Delete", "LogFile", "Performance", "Remove", "Space", "Table" ], "Synopsis": "Removes table data using a batch technique. Databases in both on-prem SQL Server and Azure SQL Database are supported.", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "Remove-DbaDbTableData", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbTableData", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbTableData -SqlInstance localhost -Database TestDb -Table dbo.Test -BatchSize 1000000 -LogBackupPath E:\\LogBackups -Confirm:$false\nRemoves all data from the dbo.Test table in the TestDb database on the local SQL instance. The deletes are dones in batches of 1000000 rows each and the log backups are written to E:\\LogBackups.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaDbTableData -SqlInstance localhost -Database TestDb -DeleteSql \"DELETE TOP (1000000) deleteFromTable FROM dbo.Test deleteFromTable LEFT JOIN dbo.Test2 b ON deleteFromTable.Id = b.Id\" \r\n-LogBackupPath E:\\LogBackups -Confirm:$false\nRemoves data from the dbo.Test table in the TestDb database on the local SQL instance. When specifying -DeleteSql the DELETE statement needs to specify the TOP (N) clause. In this example the deletes \r\nare done in batches of 1000000 rows each and the log backups are written to E:\\LogBackups.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaDbTableData -SqlInstance localhost -Database TestDb -Table dbo.Test -DeleteSql \"WITH ToDelete AS (SELECT TOP (1000000) Id FROM dbo.Test ORDER BY Id DESC;) DELETE FROM ToDelete;\" \r\n-LogBackupPath E:\\LogBackups -Confirm:$false\nRemoves data from the dbo.Test table based on the DELETE statement specified in the -DeleteSql. The deletes occur in the TestDb database on the local SQL instance. The deletes are dones in batches of \r\n1000000 rows each and the log backups are written to E:\\LogBackups.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance localhost -Database TestDb1, TestDb2 | Remove-DbaDbTableData -Table dbo.Test -BatchSize 1000000 -LogBackupPath E:\\LogBackups -Confirm:$false\nRemoves data from the dbo.Test table in the TestDb1 and TestDb2 databases on the local SQL instance. The deletes are dones in batches of 1000000 rows each and the log backups are written to \r\nE:\\LogBackups.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$server, $server2 | Remove-DbaDbTableData -Database TestDb -Table dbo.Test -BatchSize 1000000 -LogBackupPath E:\\LogBackups -Confirm:$false\nRemoves data from the dbo.Test table in the TestDb database on the SQL instances represented by $server and $server2. The deletes are dones in batches of 1000000 rows each and the log backups are \r\nwritten to E:\\LogBackups.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$server = Connect-DbaInstance -ConnectionString \"Data Source=TCP:yourserver.database.windows.net,1433;MultipleActiveResultSets=False;Connect \r\nTimeout=30;Encrypt=True;TrustServerCertificate=False;User Id=dbuser;Password=strongpassword;Database=TestDb\"\nRemove-DbaDbTableData -SqlInstance $server -Database TestDb -Table dbo.Test -BatchSize 1000000 -Confirm:$false\nRemoves data from the dbo.Test table in the TestDb database on the Azure SQL server yourserver.database.windows.net. The deletes are dones in batches of 1000000 rows. Log backups are managed by Azure \r\nSQL. Note: for Azure SQL databases error 40552 could occur for large batch deletions: \r\nhttps://docs.microsoft.com/en-us/azure/azure-sql/database/troubleshoot-common-errors-issues#error-40552-the-session-has-been-terminated-because-of-excessive-transaction-log-space-usage", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server. If unspecified, all user databases will be processed.", "", false, "false", "", "" ], [ "BatchSize", "The number of rows to delete per batch. This param is defaulted to 100000 and limited to a value between 1 and 1000000000 (1 billion). This param can only be used with the -Table param. If -DeleteSql \r\nis used the TOP (N) clause must be specified in the SQL DELETE string. Note: for Azure SQL databases error 40552 could occur for large batch deletions: \r\nhttps://docs.microsoft.com/en-us/azure/azure-sql/database/troubleshoot-common-errors-issues#error-40552-the-session-has-been-terminated-because-of-excessive-transaction-log-space-usage", "", false, "false", "100000", "" ], [ "Table", "The name of the table that data should be deleted. This param is required except when -DeleteSql is specified. When this param is used the -BatchSize param may also be used (or its default value).", "", false, "false", "", "" ], [ "DeleteSql", "A SQL DELETE statement to be used in the command\u0027s loop for more advanced scenarios such as deleting based on a join, using a where clause, or using an order by clause (or a combination of all of \r\nthose). It is required that the DELETE statement include the TOP (N) clause. See the example below. This param may be used instead of -Table and -BatchSize.", "", false, "false", "", "" ], [ "LogBackupPath", "The directory to store the log backups. This command creates log backups when the database is using the full or bulk_logged recovery models and is an on-prem SQL server instance. If this param is not \r\nprovided the command will not take log backups. This directory should be writeable by the SQL Server service account.", "", false, "false", "", "" ], [ "LogBackupTimeStampFormat", "By default the command timestamps the log backup files using the format yyyyMMddHHmm. The timestamp format should be defined using the Get-Date formats, because illegal formats will cause an error to \r\nbe thrown.", "", false, "false", "", "" ], [ "AzureBaseUrl", "Used for log backups. See https://dbatools.io/Backup-DbaDatabase for information on this parameter. This function invokes Backup-DbaDatabase with -AzureBaseUrl if it is provided.", "", false, "false", "", "" ], [ "AzureCredential", "Used for log backups. See https://dbatools.io/Backup-DbaDatabase for information on this parameter. This function invokes Backup-DbaDatabase with -AzureCredential if it is provided.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input of Microsoft.SqlServer.Management.Smo.Database, Microsoft.SqlServer.Management.Smo.Server, and Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter objects.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts for confirmation before executing any data modification operations.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbTableData [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-BatchSize] \u003cInt32\u003e] [[-Table] \u003cString\u003e] [[-DeleteSql] \u003cString\u003e] [[-LogBackupPath] \u003cString\u003e] [[-LogBackupTimeStampFormat] \u003cString\u003e] [[-AzureBaseUrl] \u003cString[]\u003e] [[-AzureCredential] \u003cString\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbUser", "Description": "If user is the owner of a schema with the same name and if if the schema does not have any underlying objects the schema will be\ndropped. If user owns more than one schema, the owner of the schemas that does not have the same name as the user, will be\nchanged to \u0027dbo\u0027. If schemas have underlying objects, you must specify the -Force parameter so the user can be dropped.", "Tags": [ "Database", "User", "Login", "Security" ], "Synopsis": "Drop database user", "Alias": "", "Author": "Doug Meyers (@dgmyrs)", "CommandName": "Remove-DbaDbUser", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbUser", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbUser -SqlInstance sqlserver2014 -User user1\nDrops user1 from all databases it exists in on server \u0027sqlserver2014\u0027.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaDbUser -SqlInstance sqlserver2014 -Database database1 -User user1\nDrops user1 from the database1 database on server \u0027sqlserver2014\u0027.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaDbUser -SqlInstance sqlserver2014 -ExcludeDatabase model -User user1\nDrops user1 from all databases it exists in on server \u0027sqlserver2014\u0027 except for the model database.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbUser sqlserver2014 | Where-Object Name -In \"user1\" | Remove-DbaDbUser\nDrops user1 from all databases it exists in on server \u0027sqlserver2014\u0027.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance..", "", false, "false", "", "" ], [ "Database", "Specifies the database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "User", "Specifies the list of users to remove.", "", true, "false", "", "" ], [ "InputObject", "Support piping from Get-DbaDbUser.", "", true, "true (ByValue)", "", "" ], [ "Force", "If enabled this will force the change of the owner to \u0027dbo\u0027 for any schema which owner is the User.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbUser [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] -User \u003cObject[]\u003e [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRemove-DbaDbUser -InputObject \u003cUser[]\u003e [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaDbView", "Description": "Removes a database view(s), with supported piping from Get-DbaDbView.", "Tags": [ "View", "Database" ], "Synopsis": "Removes a database view(s) from each database and SQL Server instance.", "Alias": "", "Author": "Mikey Bronowski (@MikeyBronowski), https://bronowski.it", "CommandName": "Remove-DbaDbView", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaDbView", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaDbView -SqlInstance localhost, sql2016 -Database db1, db2 -View view1, view2, view3\nRemoves view1, view2, view3 from db1 and db2 on the local and sql2016 SQL Server instances.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$views = Get-DbaDbView -SqlInstance localhost, sql2016 -Database db1, db2 -View view1, view2, view3\nPS C:\\\u003e $views | Remove-DbaDbView\nRemoves view1, view2, view3 from db1 and db2 on the local and sql2016 SQL Server instances.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database(s).", "", false, "false", "", "" ], [ "View", "The name(s) of the view(s).", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaDbView.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.\r\nThis is the default. Use -Confirm:$false to suppress these prompts.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaDbView [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cString[]\u003e] [-View \u003cString[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRemove-DbaDbView -InputObject \u003cView[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaEndpoint", "Description": "Removes endpoints from a SQL Server instance.", "Tags": "Endpoint", "Synopsis": "Removes endpoints from a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaEndpoint", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaEndpoint", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaEndpoint -SqlInstance sqlserver2012 -AllEndpoints\nRemoves all endpoints on the sqlserver2014 instance. Prompts for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaEndpoint -SqlInstance sqlserver2012 -Endpoint endpoint1,endpoint2 -Confirm:$false\nRemoves the endpoint1 and endpoint2 endpoints. Does not prompt for confirmation.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaEndpoint -SqlInstance sqlserver2012 -Endpoint endpoint1 | Remove-DbaEndpoint\nRemoves the endpoints returned from the Get-DbaEndpoint function. Prompts for confirmation.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Endpoint", "Only remove specific endpoints.", "", false, "false", "", "" ], [ "AllEndpoints", "Remove all endpoints on an instance.", "", false, "false", "False", "" ], [ "InputObject", "Enables piping from Get-Endpoint.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaEndpoint [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Endpoint] \u003cString[]\u003e] [-AllEndpoints] [[-InputObject] \u003cEndpoint[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaExtendedProperty", "Description": "Drops an extended property", "Tags": "extendedproperties", "Synopsis": "Drops an extended property", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaExtendedProperty", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaExtendedProperty", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance localhost -Database mydb | Get-DbaExtendedProperty -Name appversion | Remove-DbaExtendedProperty\nRemoves the appversion extended property from the mydb database\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance localhost -Database mydb -Table mytable | Get-DbaExtendedProperty -Name appversion | Remove-DbaExtendedProperty -Confirm:$false\nRemoves the appversion extended property on the mytable table of the mydb database and does not prompt for confirmation", "Params": [ [ "InputObject", "Enables piping from Get-DbaExtendedProperty", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaExtendedProperty [-InputObject] \u003cExtendedProperty[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaFirewallRule", "Description": "Removes firewall rules for SQL Server instances from the target computer.\nAs the group and the names of the firewall rules are fixed, this command\nonly works for rules created with New-DbaFirewallRule.\n\nThis is basically a wrapper around Remove-NetFirewallRule executed at the target computer.\nSo this only works if Remove-NetFirewallRule works on the target computer.\n\nThe functionality is currently limited. Help to extend the functionality is welcome.\n\nAs long as you can read this note here, there may be breaking changes in future versions.\nSo please review your scripts using this command after updating dbatools.", "Tags": [ "Firewall", "Network" ], "Synopsis": "Removes firewall rules for SQL Server instances from the target computer.", "Alias": "", "Author": "Andreas Jordan (@JordanOrdix), ordix.de", "CommandName": "Remove-DbaFirewallRule", "Availability": "Windows only", "Links": "https://dbatools.io/Remove-DbaFirewallRule", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaFirewallRule -SqlInstance SRV1\nRemoves the firewall rule for the default instance on SRV1.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaFirewallRule -SqlInstance SRV1\\SQL2016 -Type Engine, Browser\nRemoves the firewall rule for the instance SQL2016 on SRV1 and the firewall rule for the SQL Server Browser.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaFirewallRule -SqlInstance SRV1 -Type AllInstance | Where-Object Type -eq \u0027Engine\u0027 | Remove-DbaFirewallRule\nRemoves the firewall rules for all instance from SRV1. Leaves the firewall rule for the SQL Server Browser in place.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eRemove-DbaFirewallRule -SqlInstance SRV1 -Confirm:$false\nRemoves the firewall rule for the default instance on SRV1. Does not prompt for confirmation.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "Credential", "Credential object used to connect to the Computer as a different user.", "", false, "false", "", "" ], [ "Type", "Removes firewall rules for the given type(s).\r\nValid values are:\r\n Engine - for the SQL Server instance\r\n Browser - for the SQL Server Browser\r\n AllInstance - for all firewall rules on the target computer related to SQL Server\r\nThe default is \u0027Engine\u0027.\r\nAs the Browser might be needed by other instances, the firewall rule for the SQL Server Browser is\r\nnever removed with the firewall rule of the instance but only removed if \u0027Browser\u0027 is used.", "", false, "false", "Engine", "Engine,Browser,AllInstance" ], [ "InputObject", "The output object(s) from Get-DbaFirewallRule.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaFirewallRule [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-Credential \u003cPSCredential\u003e] [-Type \u003cString[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRemove-DbaFirewallRule -InputObject \u003cObject[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaLinkedServer", "Description": "Removes a linked server.", "Tags": [ "Security", "Server" ], "Synopsis": "Removes a linked server.", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "Remove-DbaLinkedServer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaLinkedServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaLinkedServer -SqlInstance sql01 -LinkedServer linkedServer1 -Confirm:$false\nRemoves the linked server \"linkedServer1\" from the sql01 instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$linkedServer1 = Get-DbaLinkedServer -SqlInstance sql01 -LinkedServer linkedServer1\nPS C:\\\u003e$linkedServer1 | Remove-DbaLinkedServer -Confirm:$false\nPasses in a linked server via pipeline and removes it from the sql01 instance.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eConnect-DbaInstance -SqlInstance sql01 | Remove-DbaLinkedServer -LinkedServer linkedServer1 -Confirm:$false\nRemoves the linked server \"linkedServer1\" from the sql01 instance, which is passed in via pipeline.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "LinkedServer", "The name(s) of the linked server(s).", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Connect-DbaInstance and Get-DbaLinkedServer.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaLinkedServer [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-LinkedServer] \u003cString[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaLogin", "Description": "Tries a bunch of different ways to remove a Login or two or more.", "Tags": [ "Delete", "Login" ], "Synopsis": "Drops a Login", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaLogin", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaLogin", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaLogin -SqlInstance sql2016 -Login mylogin\nPrompts then removes the Login mylogin on SQL Server sql2016\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaLogin -SqlInstance sql2016 -Login mylogin, yourlogin\nPrompts then removes the Logins mylogin and yourlogin on SQL Server sql2016\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaLogin -SqlInstance sql2016 -Login mylogin -Confirm:$false\nDoes not prompt and swiftly removes mylogin on SQL Server sql2016\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance server\\instance -Login yourlogin | Remove-DbaLogin\nRemoves mylogin on SQL Server server\\instance", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Allows you to login to servers using alternative credentials.", "", false, "false", "", "" ], [ "Login", "The Login(s) to process - this list is auto-populated from the server. If unspecified, all Logins will be processed.", "", true, "false", "", "" ], [ "InputObject", "A collection of Logins (such as returned by Get-DbaLogin), to be removed.", "", true, "true (ByValue)", "", "" ], [ "Force", "Kills any sessions associated with the login prior to drop", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaLogin [-SqlCredential \u003cPSCredential\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRemove-DbaLogin -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] -Login \u003cString[]\u003e [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRemove-DbaLogin [-SqlCredential \u003cPSCredential\u003e] -InputObject \u003cLogin[]\u003e [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaNetworkCertificate", "Description": "Removes the network certificate for SQL Server instance. This setting is found in Configuration Manager.", "Tags": "Certificate", "Synopsis": "Removes the network certificate for SQL Server instance", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaNetworkCertificate", "Availability": "Windows only", "Links": "https://dbatools.io/Remove-DbaNetworkCertificate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaNetworkCertificate\nRemoves the Network Certificate for the default instance (MSSQLSERVER) on localhost\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaNetworkCertificate -SqlInstance sql1\\SQL2008R2SP2\nRemoves the Network Certificate for the SQL2008R2SP2 instance on sql1\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaNetworkCertificate -SqlInstance localhost\\SQL2008R2SP2 -WhatIf\nShows what would happen if the command were run", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Defaults to localhost. If target is a cluster, you must also specify InstanceClusterName (see below)", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the computer (not sql instance) using alternative credentials.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaNetworkCertificate [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaPfDataCollectorCounter", "Description": "Removes a Performance Data Collector Counter.", "Tags": "PerfMon", "Synopsis": "Removes a Performance Data Collector Counter.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaPfDataCollectorCounter", "Availability": "Windows only", "Links": "https://dbatools.io/Remove-DbaPfDataCollectorCounter", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaPfDataCollectorCounter -ComputerName sql2017 -CollectorSet \u0027System Correlation\u0027 -Collector DataCollector01 -Counter \u0027\\LogicalDisk(*)\\Avg. Disk Queue Length\u0027\nPrompts for confirmation then removes the \u0027\\LogicalDisk(*)\\Avg. Disk Queue Length\u0027 counter within the DataCollector01 collector within the System Correlation collector set on sql2017.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorCounter | Out-GridView -PassThru | Remove-DbaPfDataCollectorCounter -Confirm:$false\nAllows you to select which counters you\u0027d like on localhost and does not prompt for confirmation.", "Params": [ [ "ComputerName", "The target computer. Defaults to localhost.", "", false, "false", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the target computer using alternative credentials. To use:\n$cred = Get-Credential, then pass $cred object to the -Credential parameter.", "", false, "false", "", "" ], [ "CollectorSet", "The name of the Collector Set to search.", "DataCollectorSet", false, "false", "", "" ], [ "Collector", "The name of the Collector to remove.", "DataCollector", false, "false", "", "" ], [ "Counter", "The name of the Counter - in the form of \u0027\\Processor(_Total)\\% Processor Time\u0027.", "Name", true, "true (ByPropertyName)", "", "" ], [ "InputObject", "Accepts the object output by Get-DbaPfDataCollectorSet via the pipeline.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaPfDataCollectorCounter [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-CollectorSet] \u003cString[]\u003e] [[-Collector] \u003cString[]\u003e] [-Counter] \u003cObject[]\u003e [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaPfDataCollectorSet", "Description": "Removes a Performance Monitor Data Collector Set. When removing data collector sets from the local instance, Run As Admin is required.", "Tags": "PerfMon", "Synopsis": "Removes a Performance Monitor Data Collector Set", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaPfDataCollectorSet", "Availability": "Windows only", "Links": "https://dbatools.io/Remove-DbaPfDataCollectorSet", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaPfDataCollectorSet\nPrompts for confirmation then removes all ready Collectors on localhost.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaPfDataCollectorSet -ComputerName sql2017 -Confirm:$false\nAttempts to remove all ready Collectors on localhost and does not prompt to confirm.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaPfDataCollectorSet -ComputerName sql2017, sql2016 -Credential ad\\sqldba -CollectorSet \u0027System Correlation\u0027\nPrompts for confirmation then removes the \u0027System Correlation\u0027 Collector on sql2017 and sql2016 using alternative credentials.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSet -CollectorSet \u0027System Correlation\u0027 | Remove-DbaPfDataCollectorSet\nRemoves the \u0027System Correlation\u0027 Collector.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSet -CollectorSet \u0027System Correlation\u0027 | Stop-DbaPfDataCollectorSet | Remove-DbaPfDataCollectorSet\nStops and removes the \u0027System Correlation\u0027 Collector.", "Params": [ [ "ComputerName", "The target computer. Defaults to localhost.", "", false, "false", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the target computer using alternative credentials. To use:\n$cred = Get-Credential, then pass $cred object to the -Credential parameter.", "", false, "false", "", "" ], [ "CollectorSet", "The name of the Collector Set to remove.", "DataCollectorSet", false, "false", "", "" ], [ "InputObject", "Accepts the object output by Get-DbaPfDataCollectorSet via the pipeline.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaPfDataCollectorSet [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-CollectorSet] \u003cString[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaRegServer", "Description": "Removes registered servers found in SQL Server Central Management Server (CMS).", "Tags": [ "RegisteredServer", "CMS" ], "Synopsis": "Removes registered servers found in SQL Server Central Management Server (CMS).", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaRegServer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaRegServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaRegServer -SqlInstance sql2012 -Group HR, Accounting\nRemoves all servers from the HR and Accounting groups on sql2012\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaRegServer -SqlInstance sql2012 -Group HR\\Development\nRemoves all servers from the HR and sub-group Development from the CMS on sql2012.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaRegServer -SqlInstance sql2012 -Confirm:$false\nRemoves all registered servers on sql2012 and turns off all prompting", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "Specifies one or more names to include. Name is the visible name in SSMS CMS interface (labeled Registered Server Name)", "", false, "false", "", "" ], [ "ServerName", "Specifies one or more server names to include. Server Name is the actual instance name (labeled Server Name)", "", false, "false", "", "" ], [ "Group", "Specifies one or more groups to include from SQL Server Central Management Server.", "", false, "false", "", "" ], [ "InputObject", "Allows results from Get-DbaRegServer to be piped in", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaRegServer [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString[]\u003e] [[-ServerName] \u003cString[]\u003e] [[-Group] \u003cString[]\u003e] [[-InputObject] \u003cRegisteredServer[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaRegServerGroup", "Description": "Returns an array of Server Groups found in the CMS.", "Tags": [ "RegisteredServer", "CMS" ], "Synopsis": "Gets list of Server Groups objects stored in SQL Server Central Management Server (CMS).", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaRegServerGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaRegServerGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaRegServerGroup -SqlInstance sql2012 -Group HR, Accounting\nRemoves the HR and Accounting groups on sql2012\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaRegServerGroup -SqlInstance sql2012 -Group HR\\Development -Confirm:$false\nRemoves the Development subgroup within the HR group on sql2012 and turns off all prompting", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Name", "Specifies one or more groups to include from SQL Server Central Management Server.", "Group", false, "false", "", "" ], [ "InputObject", "Allows results from Get-DbaRegServerGroup to be piped in", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaRegServerGroup [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Name] \u003cString[]\u003e] [[-InputObject] \u003cServerGroup[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaServerRole", "Description": "Deletes specified server-level role.", "Tags": [ "ServerRole", "Instance", "Security" ], "Synopsis": "Deletes specified server-level role.", "Alias": "", "Author": "Claudio Silva (@ClaudioESSilva), https://claudioessilva.com", "CommandName": "Remove-DbaServerRole", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaServerRole", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaServerRole -SqlInstance Server1 -ServerRole \u0027serverExecuter\u0027\nServer-role \u0027serverExecuter\u0027 on Server1 will be removed if it exists.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaServerRole -SqlInstance Server1 -ServerRole \u0027serverExecuter\u0027 -Confirm:$false\nSuppresses all prompts to remove the server-role \u0027serverExecuter\u0027 on \u0027Server1\u0027.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "ServerRole", "The server-role that will be removed.", "", false, "false", "", "" ], [ "InputObject", "Piped server-role objects.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaServerRole [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-ServerRole] \u003cString[]\u003e] [[-InputObject] \u003cServerRole[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "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 remove delegation to that service.\n\nIn order to run this function, the credential you provide must have write access to Active Directory.", "Tags": "SPN", "Synopsis": "Removes an SPN for a given service account in active directory and also removes delegation to the same SPN, if found", "Alias": "", "Author": "Drew Furgiuele (@pittfurg), http://www.port1433.com", "CommandName": "Remove-DbaSpn", "Availability": "Windows only", "Links": "https://dbatools.io/Remove-DbaSpn", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaSpn -SPN MSSQLSvc\\SQLSERVERA.domain.something -ServiceAccount domain\\account\nConnects to Active Directory and removes a provided SPN from the given account (and also the relative delegation)\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaSpn -SPN MSSQLSvc\\SQLSERVERA.domain.something -ServiceAccount domain\\account -EnableException\nConnects to Active Directory and removes a provided SPN from the given account, suppressing all error messages and throw exceptions that can be caught instead\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRemove-DbaSpn -SPN MSSQLSvc\\SQLSERVERA.domain.something -ServiceAccount domain\\account -Credential ad\\sqldba\nConnects to Active Directory and removes a provided SPN to the given account. Uses alternative account to connect to AD.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eTest-DbaSpn -ComputerName sql2005 | Where-Object { $_.isSet -eq $true } | Remove-DbaSpn -WhatIf\nShows what would happen trying to remove all set SPNs for sql2005 and the relative delegations\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eTest-DbaSpn -ComputerName sql2005 | Where-Object { $_.isSet -eq $true } | Remove-DbaSpn\nRemoves all set SPNs for sql2005 and the relative delegations", "Params": [ [ "SPN", "The SPN you want to remove", "RequiredSPN", true, "true (ByPropertyName)", "", "" ], [ "ServiceAccount", "The account you want the SPN remove from", "InstanceServiceAccount,AccountName", true, "true (ByPropertyName)", "", "" ], [ "Credential", "The credential you want to use to connect to Active Directory to make the changes", "", false, "true (ByPropertyName)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command was executed", "wi", false, "false", "", "" ], [ "Confirm", "Turns confirmations before changes on or off", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaSpn [-SPN] \u003cString\u003e [-ServiceAccount] \u003cString\u003e [[-Credential] \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaTrace", "Description": "Stops and closes the specified trace and deletes its definition from the server.", "Tags": [ "Security", "Trace" ], "Synopsis": "Stops and closes the specified trace and deletes its definition from the server.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaTrace", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaTrace", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaTrace -SqlInstance sql2008\nStops and removes all traces on sql2008\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaTrace -SqlInstance sql2008 -Id 1\nStops and removes all trace with ID 1 on sql2008\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaTrace -SqlInstance sql2008 | Out-GridView -PassThru | Remove-DbaTrace\nStops and removes selected traces on sql2008", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Id", "A list of trace ids.", "", false, "false", "", "" ], [ "InputObject", "Internal parameter for piping.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaTrace [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Id] \u003cInt32[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaXESession", "Description": "This script removes Extended Events sessions on a SQL Server instance.", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Removes Extended Events sessions.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Remove-DbaXESession", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaXESession", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRemove-DbaXESession -SqlInstance sql2012 -AllSessions\nRemoves all Extended Event Session on the sqlserver2014 instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRemove-DbaXESession -SqlInstance sql2012 -Session xesession1,xesession2\nRemoves the xesession1 and xesession2 Extended Event sessions.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance sql2017 | Remove-DbaXESession -Confirm:$false\nRemoves all sessions from sql2017, bypassing prompts.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance sql2012 -Session xesession1 | Remove-DbaXESession\nRemoves the sessions returned from the Get-DbaXESession function.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Session", "Specifies a list of Extended Events sessions to remove.", "Name,Sessions", true, "false", "", "" ], [ "AllSessions", "If this switch is enabled, all Extended Events sessions will be removed except the packaged sessions AlwaysOn_health, system_health, telemetry_xevents.", "", true, "false", "False", "" ], [ "InputObject", "Accepts a collection of XEsession objects as output by Get-DbaXESession.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaXESession [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] -Session \u003cObject[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRemove-DbaXESession [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] -AllSessions [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRemove-DbaXESession -InputObject \u003cSession[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Remove-DbaXESmartTarget", "Description": "Removes XESmartTarget PowerShell jobs.", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Removes XESmartTarget PowerShell jobs.", "Alias": "", "Author": "Chrissy LeMaire (@cl) | SmartTarget by Gianluca Sartori (@spaghettidba)", "CommandName": "Remove-DbaXESmartTarget", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Remove-DbaXESmartTarget", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaXESmartTarget | Remove-DbaXESmartTarget\nRemoves all XESmartTarget jobs.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaXESmartTarget | Where-Object Id -eq 2 | Remove-DbaXESmartTarget\nRemoves a specific XESmartTarget job.", "Params": [ [ "InputObject", "Specifies one or more XESmartTarget job objects as output by Get-DbaXESmartTarget.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Remove-DbaXESmartTarget [-InputObject] \u003cObject[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Rename-DbaDatabase", "Description": "Can change every database metadata that can be renamed.\nThe ultimate goal is choosing to have a default template to enforce in your environment\nso your naming convention for every bit can be put in place in no time.\nThe process is as follows (it follows the hierarchy of the entities):\n- database name is changed (optionally, forcing users out)\n- filegroup name(s) are changed accordingly\n- logical name(s) are changed accordingly\n- physical file(s) are changed accordingly\n- if Move is specified, the database will be taken offline and the move will initiate, then it will be taken online\n- if Move is not specified, the database remains online (unless SetOffline), and you are in charge of moving files\nIf any of the above fails, the process stops.\nPlease take a backup of your databases BEFORE using this, and remember to backup AFTER (also a FULL backup of master)\n\nIt returns an object for each database with all the renames done, plus hidden properties showing a \"human\" representation of them.\n\nIt\u0027s better you store the resulting object in a variable so you can inspect it in case of issues, e.g. \"$result = Rename-DbaDatabase .....\"\n\nTo get a grasp without worrying of what would happen under the hood, use \"Rename-DbaDatabase .... -Preview | Select-Object *\"", "Tags": [ "Database", "Rename" ], "Synopsis": "Changes database name, logical file names, file group names and physical file names (optionally handling the move). BETA VERSION.", "Alias": "", "Author": "Simone Bizzotto (@niphold)", "CommandName": "Rename-DbaDatabase", "Availability": "Windows only", "Links": "https://dbatools.io/Rename-DbaDatabase", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRename-DbaDatabase -SqlInstance sqlserver2014a -Database HR -DatabaseName HR2 -Preview | Select-Object *\nShows the detailed result set you\u0027ll get renaming the HR database to HR2 without doing anything\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRename-DbaDatabase -SqlInstance sqlserver2014a -Database HR -DatabaseName HR2\nRenames the HR database to HR2\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqlserver2014a -Database HR | Rename-DbaDatabase -DatabaseName HR2\nSame as before, but with a piped database (renames the HR database to HR2)\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eRename-DbaDatabase -SqlInstance sqlserver2014a -Database HR -DatabaseName \"dbatools_\u003cDBN\u003e\"\nRenames the HR database to dbatools_HR\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eRename-DbaDatabase -SqlInstance sqlserver2014a -Database HR -DatabaseName \"dbatools_\u003cDBN\u003e_\u003cDATE\u003e\"\nRenames the HR database to dbatools_HR_20170807 (if today is 07th Aug 2017)\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eRename-DbaDatabase -SqlInstance sqlserver2014a -Database HR -FileGroupName \"dbatools_\u003cFGN\u003e\"\nRenames every FileGroup within HR to \"dbatools_[the original FileGroup name]\"\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eRename-DbaDatabase -SqlInstance sqlserver2014a -Database HR -DatabaseName \"dbatools_\u003cDBN\u003e\" -FileGroupName \"\u003cDBN\u003e_\u003cFGN\u003e\"\nRenames the HR database to \"dbatools_HR\", then renames every FileGroup within to \"dbatools_HR_[the original FileGroup name]\"\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eRename-DbaDatabase -SqlInstance sqlserver2014a -Database HR -FileGroupName \"dbatools_\u003cDBN\u003e_\u003cFGN\u003e\"\nPS C:\\\u003e Rename-DbaDatabase -SqlInstance sqlserver2014a -Database HR -DatabaseName \"dbatools_\u003cDBN\u003e\"\nRenames the HR database to \"dbatools_HR\", then renames every FileGroup within to \"dbatools_HR_[the original FileGroup name]\"\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eRename-DbaDatabase -SqlInstance sqlserver2014a -Database HR -DatabaseName \"dbatools_\u003cDBN\u003e\" -FileName \"\u003cDBN\u003e_\u003cFGN\u003e_\u003cFNN\u003e\"\nRenames the HR database to \"dbatools_HR\" and then all filenames as \"dbatools_HR_[Name of the FileGroup]_[original_filename]\"\r\nThe db stays online (watch out!). You can then proceed manually to move/copy files by hand, set the db offline and then online again to finish the rename process\n-------------------------- EXAMPLE 10 --------------------------\nPS C:\\\u003eRename-DbaDatabase -SqlInstance sqlserver2014a -Database HR -DatabaseName \"dbatools_\u003cDBN\u003e\" -FileName \"\u003cDBN\u003e_\u003cFGN\u003e_\u003cFNN\u003e\" -SetOffline\nRenames the HR database to \"dbatools_HR\" and then all filenames as \"dbatools_HR_[Name of the FileGroup]_[original_filename]\"\r\nThe db is then set offline (watch out!). You can then proceed manually to move/copy files by hand and then set it online again to finish the rename process\n-------------------------- EXAMPLE 11 --------------------------\nPS C:\\\u003eRename-DbaDatabase -SqlInstance sqlserver2014a -Database HR -DatabaseName \"dbatools_\u003cDBN\u003e\" -FileName \"\u003cDBN\u003e_\u003cFGN\u003e_\u003cFNN\u003e\" -Move\nRenames the HR database to \"dbatools_HR\" and then all filenames as \"dbatools_HR_[Name of the FileGroup]_[original_filename]\"\r\nThe db is then set offline (watch out!). The function tries to do a simple rename and then sets the db online again to finish the rename process", "Params": [ [ "SqlInstance", "Target any number of instances, in order to return their build state.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Targets only specified databases", "", false, "false", "", "" ], [ "ExcludeDatabase", "Excludes only specified databases", "", false, "false", "", "" ], [ "AllDatabases", "If you want to apply the naming convention system wide, you need to pass this parameter", "", false, "false", "False", "" ], [ "DatabaseName", "Pass a template to rename the database name. Valid placeholders are:\r\n- \u003cDBN\u003e current database name\r\n- \u003cDATE\u003e date (yyyyMMdd)", "", false, "false", "", "" ], [ "FileGroupName", "Pass a template to rename file group name. Valid placeholders are:\r\n- \u003cFGN\u003e current filegroup name\r\n- \u003cDBN\u003e current database name\r\n- \u003cDATE\u003e date (yyyyMMdd)\r\nIf distinct names cannot be generated, a counter will be appended (0001, 0002, 0003, etc)", "", false, "false", "", "" ], [ "LogicalName", "Pass a template to rename logical name. Valid placeholders are:\r\n- \u003cFT\u003e file type (ROWS, LOG)\r\n- \u003cLGN\u003e current logical name\r\n- \u003cFGN\u003e current filegroup name\r\n- \u003cDBN\u003e current database name\r\n- \u003cDATE\u003e date (yyyyMMdd)\r\nIf distinct names cannot be generated, a counter will be appended (0001, 0002, 0003, etc)", "", false, "false", "", "" ], [ "FileName", "Pass a template to rename file name. Valid placeholders are:\r\n- \u003cFNN\u003e current file name (the basename, without directory nor extension)\r\n- \u003cFT\u003e file type (ROWS, LOG, MMO, FS)\r\n- \u003cLGN\u003e current logical name\r\n- \u003cFGN\u003e current filegroup name\r\n- \u003cDBN\u003e current database name\r\n- \u003cDATE\u003e date (yyyyMMdd)\r\nIf distinct names cannot be generated, a counter will be appended (0001, 0002, 0003, etc)", "", false, "false", "", "" ], [ "ReplaceBefore", "If you pass this switch, all upper level \"current names\" will be inspected and replaced BEFORE doing the\r\nrename according to the template in the current level (remember the hierarchy):\r\nLet\u0027s say you have a database named \"dbatools_HR\", composed by 3 files\r\n- dbatools_HR_Data.mdf\r\n- dbatools_HR_Index.ndf\r\n- dbatools_HR_log.ldf\r\nRename-DbaDatabase .... -Database \"dbatools_HR\" -DatabaseName \"dbatools_HRARCHIVE\" -FileName \u0027\u003cDBN\u003e\u003cFNN\u003e\u0027\r\nwould end up with this logic:\r\n- database --\u003e no placeholders specified\r\n- dbatools_HR to dbatools_HRARCHIVE\r\n- filenames placeholders specified\r\n\u003cDBN\u003e\u003cFNN\u003e --\u003e current database name + current filename\"\r\n- dbatools_HR_Data.mdf to dbatools_HRARCHIVEdbatools_HR_Data.mdf\r\n- dbatools_HR_Index.mdf to dbatools_HRARCHIVEdbatools_HR_Data.mdf\r\n- dbatools_HR_log.ldf to dbatools_HRARCHIVEdbatools_HR_log.ldf\r\nPassing this switch, instead, e.g.\r\nRename-DbaDatabase .... -Database \"dbatools_HR\" -DatabaseName \"dbatools_HRARCHIVE\" -FileName \u0027\u003cDBN\u003e\u003cFNN\u003e\u0027 -ReplaceBefore\r\nend up with this logic instead:\r\n- database --\u003e no placeholders specified\r\n- dbatools_HR to dbatools_HRARCHIVE\r\n- filenames placeholders specified,\r\n\u003cDBN\u003e\u003cFNN\u003e, plus -ReplaceBefore --\u003e current database name + replace OLD \"upper level\" names inside the current filename\r\n- dbatools_HR_Data.mdf to dbatools_HRARCHIVE_Data.mdf\r\n- dbatools_HR_Index.mdf to dbatools_HRARCHIVE_Data.mdf\r\n- dbatools_HR_log.ldf to dbatools_HRARCHIVE_log.ldf", "", false, "false", "False", "" ], [ "Force", "Kills any open session to be able to do renames.", "", false, "false", "False", "" ], [ "Move", "If you want this function to move files, else you\u0027re the one in charge of it.\r\nThis enables the same functionality as SetOffline, killing open transactions and putting the database\r\noffline, then do the actual rename and setting it online again afterwards", "", false, "false", "False", "" ], [ "SetOffline", "Kills any open session and sets the database offline to be able to move files", "", false, "false", "False", "" ], [ "Preview", "Shows the renames without performing any operation (recommended to find your way around this function parameters ;-) )", "", false, "false", "False", "" ], [ "InputObject", "Accepts piped database objects", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Rename-DbaDatabase -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-AllDatabases] [-DatabaseName \u003cString\u003e] [-FileGroupName \u003cString\u003e] [-LogicalName \u003cString\u003e] [-FileName \u003cString\u003e] [-ReplaceBefore] [-Force] [-Move] [-SetOffline] [-Preview] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRename-DbaDatabase [-SqlCredential \u003cPSCredential\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-AllDatabases] [-DatabaseName \u003cString\u003e] [-FileGroupName \u003cString\u003e] [-LogicalName \u003cString\u003e] [-FileName \u003cString\u003e] [-ReplaceBefore] [-Force] [-Move] [-SetOffline] [-Preview] -InputObject \u003cDatabase[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "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 specific user, this does it for you.\n\nRename-DbaLogin will rename logins and database mappings for a specified login if Force is specified.", "Tags": "Login", "Synopsis": "Rename-DbaLogin will rename logins", "Alias": "", "Author": "Mitchell Hamann (@SirCaptainMitch)", "CommandName": "Rename-DbaLogin", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Rename-DbaLogin", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRename-DbaLogin -SqlInstance localhost -Login DbaToolsUser -NewLogin captain\nSQL Login Example\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRename-DbaLogin -SqlInstance localhost -Login domain\\oldname -NewLogin domain\\newname\nChange the windowsuser login name.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRename-DbaLogin -SqlInstance localhost -Login dbatoolsuser -NewLogin captain -WhatIf\nWhatIf Example", "Params": [ [ "SqlInstance", "Source SQL Server.You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Login", "The current Login on the server - this list is auto-populated from the server.", "", true, "false", "", "" ], [ "NewLogin", "The new Login that you wish to use. If it is a windows user login, then the SID must match.", "", true, "false", "", "" ], [ "Force", "Will attempt to rename any associated database users.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts to confirm actions", "cf", false, "false", "", "" ] ], "Syntax": "Rename-DbaLogin [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Login] \u003cString\u003e [-NewLogin] \u003cString\u003e [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Repair-DbaDbMirror", "Description": "Attempts to repair a suspended mirroring database.\n\nRestarts the endpoints then sets the partner to resume. See this article for more info:\n\nhttp://www.sqlservercentral.com/blogs/vivekssqlnotes/2016/09/03/how-to-resume-suspended-database-mirroring-in-sql-server-/", "Tags": [ "Mirroring", "Mirror", "HA" ], "Synopsis": "Attempts to repair a suspended or paused mirroring database.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Repair-DbaDbMirror", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Repair-DbaDbMirror", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRepair-DbaDbMirror -SqlInstance sql2017 -Database pubs\nAttempts to repair the mirrored but suspended pubs database on sql2017.\r\nRestarts the endpoints then sets the partner to resume. Prompts for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2017 -Database pubs | Repair-DbaDbMirror -Confirm:$false\nAttempts to repair the mirrored but suspended pubs database on sql2017.\r\nRestarts the endpoints then sets the partner to resume. Does not prompt for confirmation.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database.", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Repair-DbaDbMirror [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Repair-DbaDbOrphanUser", "Description": "An orphan user is defined by a user that does not have a matching login (Login property = \"\").\n\nIf the matching login exists it must be:\nEnabled\nNot a system object\nNot locked\nHave the same name that user\n\nYou can drop users that does not have their matching login by specifying the parameter -RemoveNotExisting.", "Tags": "Orphan", "Synopsis": "Finds orphan users with existing login and remaps them.", "Alias": "", "Author": "Claudio Silva (@ClaudioESSilva) | Simone Bizzotto (@niphlod)", "CommandName": "Repair-DbaDbOrphanUser", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Repair-DbaDbOrphanUser", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRepair-DbaDbOrphanUser -SqlInstance sql2005\nFinds and repairs all orphan users of all databases present on server \u0027sql2005\u0027\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRepair-DbaDbOrphanUser -SqlInstance sqlserver2014a -SqlCredential $cred\nFinds and repair all orphan users in all databases present on server \u0027sqlserver2014a\u0027. SQL credentials are used to authenticate to the server.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRepair-DbaDbOrphanUser -SqlInstance sqlserver2014a -Database db1, db2\nFinds and repairs all orphan users in both db1 and db2 databases.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eRepair-DbaDbOrphanUser -SqlInstance sqlserver2014a -Database db1 -Users OrphanUser\nFinds and repairs user \u0027OrphanUser\u0027 in \u0027db1\u0027 database.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eRepair-DbaDbOrphanUser -SqlInstance sqlserver2014a -Users OrphanUser\nFinds and repairs user \u0027OrphanUser\u0027 on all databases\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eRepair-DbaDbOrphanUser -SqlInstance sqlserver2014a -RemoveNotExisting\nFinds all orphan users of all databases present on server \u0027sqlserver2014a\u0027. Removes all users that do not have matching Logins.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server", "", false, "false", "", "" ], [ "Users", "Specifies the list of usernames to repair.", "", false, "true (ByValue)", "", "" ], [ "RemoveNotExisting", "If this switch is enabled, all users that do not have a matching login will be dropped from the database.", "", false, "false", "False", "" ], [ "Force", "Forces alter schema to dbo owner so users can be dropped.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Repair-DbaDbOrphanUser [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-Users] \u003cObject[]\u003e] [-RemoveNotExisting] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Repair-DbaInstanceName", "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\nIf the automatically determined new name matches the old name, the command will not run.\n\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.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Repair-DbaInstanceName", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Repair-DbaInstanceName", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRepair-DbaInstanceName -SqlInstance sql2014\nChecks to see if the server name is updatable and changes the name with a number of prompts.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRepair-DbaInstanceName -SqlInstance sql2014 -AutoFix\nChecks to see if the server name is updatable and automatically performs the change. Replication or mirroring will be broken if necessary.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRepair-DbaInstanceName -SqlInstance sql2014 -AutoFix -Force\nChecks to see if the server name is updatable and automatically performs the change, bypassing most prompts and confirmations. Replication or mirroring will be broken if necessary.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AutoFix", "If this switch is enabled, the repair will be performed automatically.", "", false, "false", "False", "" ], [ "Force", "If this switch is enabled, most confirmation prompts will be skipped.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Repair-DbaInstanceName [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-AutoFix] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Reset-DbaAdmin", "Description": "This function allows administrators to regain access to local or remote SQL Servers by either resetting the sa password, adding the sysadmin role to existing login, or 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 using the /mReset-DbaAdmin parameter 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, Microsoft.Data.SqlClient and Get-WmiObject are used (as opposed to requiring the Failover Cluster Admin tools or SMO).\n\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", "Synopsis": "This function allows 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.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Reset-DbaAdmin", "Availability": "Windows only", "Links": "https://dbatools.io/Reset-DbaAdmin", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eReset-DbaAdmin -SqlInstance sqlcluster -SqlCredential sqladmin\nPrompts for password, then resets the \"sqladmin\" account password on sqlcluster.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eReset-DbaAdmin -SqlInstance sqlserver\\sqlexpress -Login ad\\administrator -Confirm:$false\nAdds the domain account \"ad\\administrator\" as a sysadmin to the SQL instance.\nIf the account already exists, it will be added to the sysadmin role.\nDoes not prompt for a password since it is not a SQL login. Does not prompt for confirmation since -Confirm is set to $false.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eReset-DbaAdmin -SqlInstance sqlserver\\sqlexpress -Login sqladmin -Force\nSkips restart confirmation, prompts for password, then adds a SQL Login \"sqladmin\" with sysadmin privileges.\r\nIf the account already exists, it will be added to the sysadmin role and the password will be reset.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. SQL Server must be 2005 and above, and can be a clustered or stand-alone instance.", "", true, "false", "", "" ], [ "SqlCredential", "Instead of using Login and SecurePassword, you can just pass in a credential object.", "", false, "false", "", "" ], [ "Login", "By default, the Login parameter is \"sa\" but any other SQL or Windows account can be specified. If a login does not currently exist, it will be added.\nWhen adding a Windows login to remote servers, ensure the SQL Server can add the login (ie, don\u0027t add WORKSTATION\\Admin to remoteserver\\instance. Domain users and Groups are valid input.", "", false, "false", "sa", "" ], [ "SecurePassword", "By default, if a SQL Login is detected, you will be prompted for a password. Use this to securely bypass the prompt.", "", false, "false", "", "" ], [ "Force", "If this switch is enabled, the Login(s) will be dropped and recreated on Destination. Logins that own Agent jobs cannot be dropped at this time.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Reset-DbaAdmin [-SqlInstance] \u003cDbaInstanceParameter\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Login] \u003cString\u003e] [[-SecurePassword] \u003cSecureString\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Reset-DbatoolsConfig", "Description": "This command can be used to revert a configuration item to the value it was initialized with.\nGenerally, this amounts to reverting it to its default value.\n\nIn order for a reset to be possible, two conditions must be met:\n- The setting must have been initialized.\n- The setting cannot have been enforced by policy.", "Tags": "Module", "Synopsis": "Reverts a configuration item to its default value.", "Alias": "", "Author": "Friedrich Weinmann (@FredWeinmann)", "CommandName": "Reset-DbatoolsConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Reset-DbatoolsConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eReset-DbatoolsConfig -Module MyModule\nResets all configuration items of the MyModule to default.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbatoolsConfig | Reset-DbatoolsConfig\nResets ALL configuration items to default.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eReset-DbatoolsConfig -FullName MyModule.Group.Setting1\nResets the configuration item named \u0027MyModule.Group.Setting1\u0027.", "Params": [ [ "ConfigurationItem", "A configuration object as returned by Get-DbatoolsConfig.", "", false, "true (ByValue)", "", "" ], [ "FullName", "The full name of the setting to reset, offering the maximum of precision.", "", false, "true (ByValue)", "", "" ], [ "Module", "The name of the module, from which configurations should be reset.\r\nUsed in conjunction with the -Name parameter to filter a specific set of items.", "", true, "false", "", "" ], [ "Name", "Used in conjunction with the -Module parameter to select which settings to reset using wildcard comparison.", "", false, "false", "*", "" ], [ "EnableException", "This parameters disables user-friendly warnings and enables the throwing of exceptions.\r\nThis is less user friendly, but allows catching exceptions in calling scripts.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Reset-DbatoolsConfig [-ConfigurationItem \u003cConfig[]\u003e] [-FullName \u003cString[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nReset-DbatoolsConfig -Module \u003cString\u003e [-Name \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "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\nMultiple protocols (e.g. WMI, CIM, etc) are attempted before giving up.\n\nImportant: Remember that FQDN doesn\u0027t always match \"ComputerName dot Domain\" as AD intends.\nThere are network setup (google \"disjoint domain\") where AD and DNS do not match.\n\"Full computer name\" (as reported by sysdm.cpl) is the only match between the two,\nand it matches the \"DNSHostName\" property of the computer object stored in AD.\nThis means that the notation of FQDN that matches \"ComputerName dot Domain\" is incorrect\nin those scenarios.\nIn other words, the \"suffix\" of the FQDN CAN be different from the AD Domain.\n\nThis cmdlet has been providing good results since its inception but for lack of useful\nnames some doubts may arise.\nLet this clear the doubts:\n- InputName: whatever has been passed in\n- ComputerName: hostname only\n- IPAddress: IP Address\n- DNSHostName: hostname only, coming strictly from DNS (as reported from the calling computer)\n- DNSDomain: domain only, coming strictly from DNS (as reported from the calling computer)\n- Domain: domain only, coming strictly from AD (i.e. the domain the ComputerName is joined to)\n- DNSHostEntry: Fully name as returned by DNS [System.Net.Dns]::GetHostEntry\n- FQDN: \"legacy\" notation of ComputerName \"dot\" Domain (coming from AD)\n- FullComputerName: Full name as configured from within the Computer (i.e. the only secure match between AD and DNS)\n\nSo, if you need to use something, go with FullComputerName, always, as it is the most correct in every scenario.", "Tags": [ "Network", "Resolve" ], "Synopsis": "Returns information about the network connection of the target computer including NetBIOS name, IP Address, domain name and fully qualified domain name (FQDN).", "Alias": "", "Author": "Klaas Vandenberghe (@PowerDBAKlaas) | Simone Bizzotto (@niphold)", "CommandName": "Resolve-DbaNetworkName", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Resolve-DbaNetworkName", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eResolve-DbaNetworkName -ComputerName sql2014\nReturns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, DNSDomain, Domain, DNSHostEntry, FQDN, DNSHostEntry for sql2014\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eResolve-DbaNetworkName -ComputerName sql2016, sql2014\nReturns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, DNSDomain, Domain, DNSHostEntry, FQDN, DNSHostEntry for sql2016 and sql2014\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sql2014 | Resolve-DbaNetworkName\nReturns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, DNSDomain, Domain, DNSHostEntry, FQDN, DNSHostEntry for all SQL Servers returned by Get-DbaRegServer\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sql2014, sql2016\\sqlexpress | Resolve-DbaNetworkName\nReturns a custom object displaying InputName, ComputerName, IPAddress, DNSHostName, DNSDomain, Domain, DNSHostEntry, FQDN, DNSHostEntry for all SQL Servers returned by Get-DbaRegServer", "Params": [ [ "ComputerName", "The target SQL Server instance or instances.\r\nThis can be the name of a computer, a SMO object, an IP address or a SQL Instance.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Turbo", "Resolves without accessing the server itself. Faster but may be less accurate because it relies on DNS only,\r\nso it may fail spectacularly for disjoin-domain setups. Also, everyone has its own DNS (i.e. results may vary\r\nchanging the computer where the function runs)", "FastParrot", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Resolve-DbaNetworkName [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-Turbo] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Resolve-DbaPath", "Description": "Resolves a path.\nWill try to resolve to paths including some basic path validation and resolution.\nWill fail if the path cannot be resolved (so an existing path must be reached at).", "Synopsis": "Resolves a path.", "Alias": "", "CommandName": "Resolve-DbaPath", "Availability": "Windows, Linux, macOS", "Links": null, "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eResolve-DbaPath -Path report.log -Provider FileSystem -NewChild -SingleItem\nEnsures the resolved path is a FileSystem path.\r\nThis will resolve to the current folder and the file report.log.\r\nWill not ensure the file exists or doesn\u0027t exist.\r\nIf the current path is in a different provider, it will throw an exception.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eResolve-DbaPath -Path ..\\*\nThis will resolve all items in the parent folder, whatever the current path or drive might be.", "Params": [ [ "Path", "The path to validate.", "", true, "true (ByValue)", "", "" ], [ "Provider", "Ensure the path is of the expected provider.\r\nAllows ensuring one does not operate in the wrong provider.\r\nCommon providers include the filesystem, the registry or the active directory.", "", false, "false", "", "" ], [ "SingleItem", "Ensure the path should resolve to a single path only.\r\nThis may - intentionally or not - trip up wildcard paths.", "", false, "false", "False", "" ], [ "NewChild", "Assumes one wishes to create a new child item.\r\nThe parent path will be resolved and must validate true.\r\nThe final leaf will be treated as a leaf item that does not exist yet.", "", false, "false", "False", "" ] ], "Syntax": "Resolve-DbaPath [-Path] \u003cString[]\u003e [[-Provider] \u003cString\u003e] [-SingleItem] [-NewChild] [\u003cCommonParameters\u003e]" }, { "Name": "Restart-DbaService", "Description": "Restarts the SQL Server related services on one or more computers. Will follow SQL Server service dependencies.\n\nRequires Local Admin rights on destination computer(s).", "Tags": [ "Service", "Instance", "Restart" ], "Synopsis": "Restarts SQL Server services on a computer.", "Alias": "", "Author": "Kirill Kravtsov (@nvarscar)", "CommandName": "Restart-DbaService", "Availability": "Windows only", "Links": "https://dbatools.io/Restart-DbaService", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRestart-DbaService -ComputerName sqlserver2014a\nRestarts the SQL Server related services on computer sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\u0027,\u0027sql3\u0027| Get-DbaService | Restart-DbaService\nGets the SQL Server related services on computers sql1, sql2 and sql3 and restarts them.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eRestart-DbaService -ComputerName sql1,sql2 -InstanceName MSSQLSERVER\nRestarts the SQL Server services related to the default instance MSSQLSERVER on computers sql1 and sql2.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eRestart-DbaService -ComputerName $MyServers -Type SSRS\nRestarts the SQL Server related services of type \"SSRS\" (Reporting Services) on computers in the variable MyServers.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eRestart-DbaService -ComputerName sql1 -Type Engine -Force\nRestarts SQL Server database engine services on sql1 forcing dependent SQL Server Agent services to restart as well.", "Params": [ [ "ComputerName", "The target SQL Server instance or instances.", "cn,host,Server", false, "false", "$env:COMPUTERNAME", "" ], [ "InstanceName", "Only affects services that belong to the specific instances.", "Instance", false, "false", "", "" ], [ "Type", "Use -Type to collect only services of the desired SqlServiceType.\r\nCan be one of the following: \"Agent\", \"Browser\", \"Engine\", \"FullText\", \"SSAS\", \"SSIS\", \"SSRS\", \"PolyBase\", \"Launchpad\"", "", false, "false", "", "Agent,Browser,Engine,FullText,SSAS,SSIS,SSRS,PolyBase,Launchpad" ], [ "InputObject", "A collection of services from Get-DbaService", "ServiceCollection", true, "true (ByValue)", "", "" ], [ "Timeout", "How long to wait for the start/stop request completion before moving on. Specify 0 to wait indefinitely.", "", false, "false", "60", "" ], [ "Credential", "Credential object used to connect to the computer as a different user.", "", false, "false", "", "" ], [ "Force", "Will stop dependent SQL Server agents when stopping Engine services.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the cmdlet runs. The cmdlet is not run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the cmdlet.", "cf", false, "false", "", "" ] ], "Syntax": "Restart-DbaService [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [-InstanceName \u003cString[]\u003e] [-Type \u003cString[]\u003e] [-Timeout \u003cInt32\u003e] [-Credential \u003cPSCredential\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRestart-DbaService [-InstanceName \u003cString[]\u003e] [-Type \u003cString[]\u003e] -InputObject \u003cObject[]\u003e [-Timeout \u003cInt32\u003e] [-Credential \u003cPSCredential\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Restore-DbaDatabase", "Description": "Upon being 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\nVarious means can be used to pass in a list of files to be considered. The default is to recursively scan the folder\npassed in.", "Tags": [ "DisasterRecovery", "Backup", "Restore" ], "Synopsis": "Restores a SQL Server Database from a set of backup files", "Alias": "", "Author": "Stuart Moore (@napalmgram), stuart-moore.com", "CommandName": "Restore-DbaDatabase", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Restore-DbaDatabase", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRestore-DbaDatabase -SqlInstance server1\\instance1 -Path \\\\server2\\backups\nScans all the backup files in \\\\server2\\backups, filters them and restores the database to server1\\instance1\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRestore-DbaDatabase -SqlInstance server1\\instance1 -Path \\\\server2\\backups -MaintenanceSolutionBackup -DestinationDataDirectory c:\\restores\nScans all the backup files in \\\\server2\\backups$ stored in an Ola Hallengren style folder structure,\r\nfilters them and restores the database to the c:\\restores folder on server1\\instance1\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-ChildItem c:\\SQLbackups1\\, \\\\server\\sqlbackups2 | Restore-DbaDatabase -SqlInstance server1\\instance1\nTakes the provided files from multiple directories and restores them on server1\\instance1\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$RestoreTime = Get-Date(\u002711:19 23/12/2016\u0027)\nPS C:\\\u003e Restore-DbaDatabase -SqlInstance server1\\instance1 -Path \\\\server2\\backups -MaintenanceSolutionBackup -DestinationDataDirectory c:\\restores -RestoreTime $RestoreTime\nScans all the backup files in \\\\server2\\backups stored in an Ola Hallengren style folder structure,\r\nfilters them and restores the database to the c:\\restores folder on server1\\instance1 up to 11:19 23/12/2016\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$result = Restore-DbaDatabase -SqlInstance server1\\instance1 -Path \\\\server2\\backups -DestinationDataDirectory c:\\restores -OutputScriptOnly\nPS C:\\\u003e $result | Out-File -Filepath c:\\scripts\\restore.sql\nScans all the backup files in \\\\server2\\backups, filters them and generate the T-SQL Scripts to restore the database to the latest point in time, and then stores the output in a file for later \r\nretrieval\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eRestore-DbaDatabase -SqlInstance server1\\instance1 -Path c:\\backups -DestinationDataDirectory c:\\DataFiles -DestinationLogDirectory c:\\LogFile\nScans all the files in c:\\backups and then restores them onto the SQL Server Instance server1\\instance1, placing data files\r\nc:\\DataFiles and all the log files into c:\\LogFiles\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eRestore-DbaDatabase -SqlInstance server1\\instance1 -Path http://demo.blob.core.windows.net/backups/dbbackup.bak -AzureCredential MyAzureCredential\nWill restore the backup held at http://demo.blob.core.windows.net/backups/dbbackup.bak to server1\\instance1. The connection to Azure will be made using the\r\ncredential MyAzureCredential held on instance Server1\\instance1\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eRestore-DbaDatabase -SqlInstance server1\\instance1 -Path http://demo.blob.core.windows.net/backups/dbbackup.bak\nWill attempt to restore the backups from http://demo.blob.core.windows.net/backups/dbbackup.bak if a SAS credential with the name http://demo.blob.core.windows.net/backups exists on server1\\instance1\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003e$File = Get-ChildItem c:\\backups, \\\\server1\\backups\nPS C:\\\u003e $File | Restore-DbaDatabase -SqlInstance Server1\\Instance -UseDestinationDefaultDirectories\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 Server\r\nfolder for those file types as defined on the target instance.\n-------------------------- EXAMPLE 10 --------------------------\nPS C:\\\u003e$files = Get-ChildItem C:\\dbatools\\db1\nPS C:\\\u003e $params = @{\r\n\u003e\u003e SqlInstance = \u0027server\\instance1\u0027\r\n\u003e\u003e DestinationFilePrefix = \u0027prefix\u0027\r\n\u003e\u003e DatabaseName =\u0027Restored\u0027\r\n\u003e\u003e RestoreTime = (get-date \"14:58:30 22/05/2017\")\r\n\u003e\u003e NoRecovery = $true\r\n\u003e\u003e WithReplace = $true\r\n\u003e\u003e StandbyDirectory = \u0027C:\\dbatools\\standby\u0027\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e $files | Restore-DbaDatabase @params\r\nPS C:\\\u003e Invoke-DbaQuery -SQLInstance server\\instance1 -Query \"select top 1 * from Restored.dbo.steps order by dt desc\"\r\nPS C:\\\u003e $params.RestoredTime = (get-date \"15:09:30 22/05/2017\")\r\nPS C:\\\u003e $params.NoRecovery = $false\r\nPS C:\\\u003e $params.Add(\"Continue\",$true)\r\nPS C:\\\u003e $files | Restore-DbaDatabase @params\r\nPS C:\\\u003e Invoke-DbaQuery -SQLInstance server\\instance1 -Query \"select top 1 * from restored.dbo.steps order by dt desc\"\r\nPS C:\\\u003e Restore-DbaDatabase -SqlInstance server\\instance1 -DestinationFilePrefix prefix -DatabaseName Restored -Continue -WithReplace\nIn this example we step through the backup files held in c:\\dbatools\\db1 folder.\r\nFirst we restore the database to a point in time in standby mode. This means we can check some details in the databases\r\nWe then roll it on a further 9 minutes to perform some more checks\r\nAnd finally we continue by rolling it all the way forward to the latest point in the backup.\r\nAt each step, only the log files needed to roll the database forward are restored.\n-------------------------- EXAMPLE 11 --------------------------\nPS C:\\\u003eRestore-DbaDatabase -SqlInstance server\\instance1 -Path c:\\backups -DatabaseName example1 -NoRecovery\nPS C:\\\u003e Restore-DbaDatabase -SqlInstance server\\instance1 -Recover -DatabaseName example1\nIn this example we restore example1 database with no recovery, and then the second call is to set the database to recovery.\n-------------------------- EXAMPLE 12 --------------------------\nPS C:\\\u003eGet-DbaDbBackupHistory - SqlInstance server\\instance1 -Database ProdFinance -Last | Restore-DbaDatabase -PageRestore\nPS C:\\\u003e $SuspectPage -PageRestoreTailFolder c:\\temp -TrustDbBackupHistory\nGets a list of Suspect Pages using Get-DbaSuspectPage. The uses Get-DbaDbBackupHistory and Restore-DbaDatabase to perform a restore of the suspect pages and bring them up to date\r\nIf server\\instance1 is Enterprise edition this will be done online, if not it will be performed offline\n-------------------------- EXAMPLE 13 --------------------------\nPS C:\\\u003e$BackupHistory = Get-DbaBackupInformation -SqlInstance sql2005 -Path \\\\backups\\sql2000\\ProdDb\nPS C:\\\u003e $BackupHistory | Restore-DbaDatabase -SqlInstance sql2000 -TrustDbBackupHistory\nDue to SQL Server 2000 not returning all the backup headers we cannot restore directly. As this is an issues with the SQL engine all we can offer is the following workaround\r\nThis will use a SQL Server instance \u003e 2000 to read the headers, and then pass them in to Restore-DbaDatabase as a BackupHistory object.\n-------------------------- EXAMPLE 14 --------------------------\nPS C:\\\u003eRestore-DbaDatabase -SqlInstance server1\\instance1 -Path \"C:\\Temp\\devops_prod_full.bak\" -DatabaseName \"DevOps_DEV\" -ReplaceDbNameInFile\nPS C:\\\u003e Rename-DbaDatabase -SqlInstance server1\\instance1 -Database \"DevOps_DEV\" -LogicalName \"\u003cDBN\u003e_\u003cFT\u003e\"\nThis will restore the database from the \"C:\\Temp\\devops_prod_full.bak\" file, with the new name \"DevOps_DEV\" and store the different physical files with the new name. It will use the system default \r\nconfigured data and log locations.\r\nAfter the restore the logical names of the database files will be renamed with the \"DevOps_DEV_ROWS\" for MDF/NDF and \"DevOps_DEV_LOG\" for LDF\n-------------------------- EXAMPLE 15 --------------------------\nPS C:\\\u003e$FileStructure = @{\n\u003e\u003e \u0027database_data\u0027 = \u0027C:\\Data\\database_data.mdf\u0027\r\n\u003e\u003e \u0027database_log\u0027 = \u0027C:\\Log\\database_log.ldf\u0027\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e Restore-DbaDatabase -SqlInstance server1 -Path \\\\ServerName\\ShareName\\File -DatabaseName database -FileMapping $FileStructure\nRestores \u0027database\u0027 to \u0027server1\u0027 and moves the files to new locations. The format for the $FileStructure HashTable is the file logical name as the Key, and the new location as the Value.\n-------------------------- EXAMPLE 16 --------------------------\nPS C:\\\u003e$filemap = Get-DbaDbFileMapping -SqlInstance sql2016 -Database test\nPS C:\\\u003e Get-ChildItem \\\\nas\\db\\backups\\test | Restore-DbaDatabase -SqlInstance sql2019 -Database test -FileMapping $filemap.FileMapping\nRestores test to sql2019 using the file structure built from the existing database on sql2016\n-------------------------- EXAMPLE 17 --------------------------\nPS C:\\\u003eRestore-DbaDatabase -SqlInstance server1 -Path \\\\ServerName\\ShareName\\File -DatabaseName database -DatabaseName database -StopMark OvernightStart -StopBefore -StopAfterDate Get-Date(\u002721:00 \r\n10/05/2020\u0027)\nRestores the backups from \\\\ServerName\\ShareName\\File as database, stops before the first \u0027OvernightStop\u0027 mark that occurs after \u002721:00 10/05/2020\u0027.\nNote that Date time needs to be specified in your local SQL Server culture", "Params": [ [ "SqlInstance", "The target SQL Server instance.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Path", "Path to SQL Server backup files.\nPaths passed in as strings will be scanned using the desired method, default is a recursive folder scan\r\nAccepts multiple paths separated by \u0027,\u0027\nOr it can consist of FileInfo objects, such as the output of Get-ChildItem or Get-Item. This allows you to work with\r\nyour own file structures as needed", "", true, "true (ByValue)", "", "" ], [ "DatabaseName", "Name to restore the database under.\r\nOnly works with a single database restore. If multiple database are found in the provided paths then we will exit", "Name", false, "true (ByValue)", "", "" ], [ "DestinationDataDirectory", "Path to restore the SQL Server backups to on the target instance.\r\nIf only this parameter is specified, then all database files (data and log) will be restored to this location", "", false, "false", "", "" ], [ "DestinationLogDirectory", "Path to restore the database log files to.\r\nThis parameter can only be specified alongside DestinationDataDirectory.", "", false, "false", "", "" ], [ "DestinationFileStreamDirectory", "Path to restore FileStream data to\r\nThis parameter can only be specified alongside DestinationDataDirectory", "", false, "false", "", "" ], [ "RestoreTime", "Specify a DateTime object to which you want the database restored to. Default is to the latest point available in the specified backups", "", false, "false", "(Get-Date).AddYears(1)", "" ], [ "NoRecovery", "Indicates if the databases should be recovered after last restore. Default is to recover", "", false, "false", "False", "" ], [ "WithReplace", "Switch indicated is the restore is allowed to replace an existing database.", "", false, "false", "False", "" ], [ "KeepReplication", "Indicates whether replication configuration should be restored as part of the database restore operation", "", false, "false", "False", "" ], [ "XpDirTree", "Switch that indicated file scanning should be performed by the SQL Server instance using xp_dirtree\r\nThis will scan recursively from the passed in path\r\nYou must have sysadmin role membership on the instance for this to work.", "", false, "false", "False", "" ], [ "NoXpDirRecurse", "If specified, prevents the XpDirTree process from recursing (its default behaviour)", "", false, "false", "False", "" ], [ "OutputScriptOnly", "Switch indicates that ONLY T-SQL scripts should be generated, no restore takes place\r\nDue to the limitations of SMO, this switch cannot be combined with VeriyOnly, and a warning will be raised if it is.", "", false, "false", "False", "" ], [ "VerifyOnly", "Switch indicate that restore should be verified.\r\nDue to the limitations of SMO, this switch cannot be combined with OutputScriptOnly, and a warning will be raised if it is.", "", false, "false", "False", "" ], [ "MaintenanceSolutionBackup", "Switch to indicate the backup files are in a folder structure as created by Ola Hallengreen\u0027s maintenance scripts.\r\nThis switch enables a faster check for suitable backups. Other options require all files to be read first to ensure we have an anchoring full backup. Because we can rely on specific locations for \r\nbackups performed with OlaHallengren\u0027s backup solution, we can rely on file locations.", "", false, "false", "False", "" ], [ "FileMapping", "A hashtable that can be used to move specific files to a location.\r\n`$FileMapping = @{\u0027DataFile1\u0027=\u0027c:\\restoredfiles\\Datafile1.mdf\u0027;\u0027DataFile3\u0027=\u0027d:\\DataFile3.mdf\u0027}`\r\nAnd files not specified in the mapping will be restored to their original location\r\nThis Parameter is exclusive with DestinationDataDirectory", "", false, "true (ByPropertyName)", "", "" ], [ "IgnoreLogBackup", "This switch tells the function to ignore transaction log backups. The process will restore to the latest full or differential backup point only", "", false, "false", "False", "" ], [ "IgnoreDiffBackup", "This switch tells the function to ignore differential backups. The process will restore to the latest full and onwards with transaction log backups only", "", false, "false", "False", "" ], [ "UseDestinationDefaultDirectories", "Switch that tells the restore to use the default Data and Log locations on the target server. If they don\u0027t exist, the function will try to create them", "", false, "false", "False", "" ], [ "ReuseSourceFolderStructure", "By default, databases will be migrated to the destination Sql Server\u0027s default data and log directories. You can override this by specifying -ReuseSourceFolderStructure.\r\nThe same structure on the SOURCE will be kept exactly, so consider this if you\u0027re migrating between different versions and use part of Microsoft\u0027s default Sql structure (MSSql12.INSTANCE, etc)\n*Note, to reuse destination folder structure, specify -WithReplace", "", false, "false", "False", "" ], [ "DestinationFilePrefix", "This value will be prefixed to ALL restored files (log and data). This is just a simple string prefix. If you want to perform more complex rename operations then please use the FileMapping parameter\nThis will apply to all file move options, except for FileMapping", "", false, "false", "", "" ], [ "RestoredDatabaseNamePrefix", "A string which will be prefixed to the start of the restore Database\u0027s Name\r\nUseful if restoring a copy to the same sql server for testing.", "", false, "false", "", "" ], [ "TrustDbBackupHistory", "This switch can be used when piping the output of Get-DbaDbBackupHistory or Backup-DbaDatabase into this command.\r\nIt allows the user to say that they trust that the output from those commands is correct, and skips the file header read portion of the process. This means a faster process, but at the risk of not \r\nknowing till halfway through the restore that something is wrong with a file.", "", false, "false", "False", "" ], [ "MaxTransferSize", "Parameter to set the unit of transfer. Values must be a multiple by 64kb", "", false, "false", "0", "" ], [ "BlockSize", "Specifies the block size to use. Must be one of 0.5kb,1kb,2kb,4kb,8kb,16kb,32kb or 64kb\r\nCan be specified in bytes\r\nRefer to https://msdn.microsoft.com/en-us/library/ms178615.aspx for more detail", "", false, "false", "0", "" ], [ "BufferCount", "Number of I/O buffers to use to perform the operation.\r\nRefer to https://msdn.microsoft.com/en-us/library/ms178615.aspx for more detail", "", false, "false", "0", "" ], [ "DirectoryRecurse", "If specified the specified directory will be recursed into (overriding the default behaviour)", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "StandbyDirectory", "If a directory is specified the database(s) will be restored into a standby state, with the standby file placed into this directory (which must exist, and be writable by the target Sql Server \r\ninstance)", "", false, "false", "", "" ], [ "Continue", "If specified we will to attempt to recover more transaction log backups onto database(s) in Recovering or Standby states\r\nWhen specified, WithReplace will be set to true", "", false, "false", "False", "" ], [ "ExecuteAs", "If value provided the restore will be executed under this login\u0027s context. The login must exist, and have the relevant permissions to perform the restore", "", false, "false", "", "" ], [ "AzureCredential", "The name of the SQL Server credential to be used if restoring from an Azure hosted backup using Storage Access Keys\r\nIf a backup path beginning http is passed in and this parameter is not specified then if a credential with a name matching the URL", "", false, "false", "", "" ], [ "ReplaceDbNameInFile", "If switch set and occurrence of the original database\u0027s name in a data or log file will be replace with the name specified in the DatabaseName parameter", "", false, "false", "False", "" ], [ "DestinationFileSuffix", "This value will be suffixed to ALL restored files (log and data). This is just a simple string suffix. If you want to perform more complex rename operations then please use the FileMapping parameter\nThis will apply to all file move options, except for FileMapping", "", false, "false", "", "" ], [ "Recover", "If set will perform recovery on the indicated database", "", false, "false", "False", "" ], [ "KeepCDC", "Indicates whether CDC information should be restored as part of the database", "", false, "false", "False", "" ], [ "GetBackupInformation", "Passing a string value into this parameter will cause a global variable to be created holding the output of Get-DbaBackupInformation", "", false, "false", "", "" ], [ "StopAfterGetBackupInformation", "Switch which will cause the function to exit after returning GetBackupInformation", "", false, "false", "False", "" ], [ "SelectBackupInformation", "Passing a string value into this parameter will cause a global variable to be created holding the output of Select-DbaBackupInformation", "", false, "false", "", "" ], [ "StopAfterSelectBackupInformation", "Switch which will cause the function to exit after returning SelectBackupInformation", "", false, "false", "False", "" ], [ "FormatBackupInformation", "Passing a string value into this parameter will cause a global variable to be created holding the output of Format-DbaBackupInformation", "", false, "false", "", "" ], [ "StopAfterFormatBackupInformation", "Switch which will cause the function to exit after returning FormatBackupInformation", "", false, "false", "False", "" ], [ "TestBackupInformation", "Passing a string value into this parameter will cause a global variable to be created holding the output of Test-DbaBackupInformation", "", false, "false", "", "" ], [ "StopAfterTestBackupInformation", "Switch which will cause the function to exit after returning TestBackupInformation", "", false, "false", "False", "" ], [ "PageRestore", "Passes in an object from Get-DbaSuspectPages containing suspect pages from a single database.\r\nSetting this Parameter will cause an Online Page restore if the target Instance is Enterprise Edition, or offline if not.\r\nThis will involve taking a tail log backup, so you must check your restore chain once it has completed", "", true, "false", "", "" ], [ "PageRestoreTailFolder", "This parameter passes in a location for the tail log backup required for page level restore", "", true, "false", "", "" ], [ "StopBefore", "Switch to indicate the restore should stop before StopMark occurs, default is to stop when mark is created.", "", false, "false", "False", "" ], [ "StopMark", "Marked point in the transaction log to stop the restore at (Mark is created via BEGIN TRANSACTION \r\n(https://docs.microsoft.com/en-us/sql/t-sql/language-elements/begin-transaction-transact-sql?view=sql-server-ver15))", "", false, "false", "", "" ], [ "StopAfterDate", "By default the restore will stop at the first occurence of StopMark found in the chain, passing a datetime where will cause it to stop the first StopMark atfer that datetime", "", false, "false", "(Get-Date \u002701/01/1971\u0027)", "" ], [ "StatementTimeout", "Timeout in minutes. Defaults to infinity (restores can take a while.)", "", false, "false", "0", "" ], [ "WhatIf", "Shows what would happen if the command would execute, but does not actually perform the command", "wi", false, "false", "", "" ], [ "Confirm", "Prompts to confirm certain actions", "cf", false, "false", "", "" ] ], "Syntax": "Restore-DbaDatabase -SqlInstance \u003cDbaInstanceParameter\u003e [-SqlCredential \u003cPSCredential\u003e] -Path \u003cObject[]\u003e [-DatabaseName \u003cObject[]\u003e] [-DestinationDataDirectory \u003cString\u003e] [-DestinationLogDirectory \u003cString\u003e] [-DestinationFileStreamDirectory \u003cString\u003e] [-RestoreTime \u003cDateTime\u003e] [-NoRecovery] [-WithReplace] [-KeepReplication] [-XpDirTree] [-NoXpDirRecurse] [-OutputScriptOnly] [-VerifyOnly] [-MaintenanceSolutionBackup] [-FileMapping \u003cHashtable\u003e] [-IgnoreLogBackup] [-IgnoreDiffBackup] [-UseDestinationDefaultDirectories] [-ReuseSourceFolderStructure] [-DestinationFilePrefix \u003cString\u003e] \r\n[-RestoredDatabaseNamePrefix \u003cString\u003e] [-TrustDbBackupHistory] [-MaxTransferSize \u003cInt32\u003e] [-BlockSize \u003cInt32\u003e] [-BufferCount \u003cInt32\u003e] [-DirectoryRecurse] [-EnableException] [-StandbyDirectory \u003cString\u003e] [-Continue] [-ExecuteAs \u003cString\u003e] [-AzureCredential \u003cString\u003e] [-ReplaceDbNameInFile] [-DestinationFileSuffix \u003cString\u003e] [-KeepCDC] [-GetBackupInformation \u003cString\u003e] [-StopAfterGetBackupInformation] [-SelectBackupInformation \u003cString\u003e] [-StopAfterSelectBackupInformation] [-FormatBackupInformation \u003cString\u003e] [-StopAfterFormatBackupInformation] [-TestBackupInformation \u003cString\u003e] \r\n[-StopAfterTestBackupInformation] [-StopBefore] [-StopMark \u003cString\u003e] [-StopAfterDate \u003cDateTime\u003e] [-StatementTimeout \u003cInt32\u003e] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRestore-DbaDatabase -SqlInstance \u003cDbaInstanceParameter\u003e [-SqlCredential \u003cPSCredential\u003e] -Path \u003cObject[]\u003e [-DatabaseName \u003cObject[]\u003e] [-OutputScriptOnly] [-TrustDbBackupHistory] [-MaxTransferSize \u003cInt32\u003e] [-BlockSize \u003cInt32\u003e] [-BufferCount \u003cInt32\u003e] [-EnableException] [-AzureCredential \u003cString\u003e] [-GetBackupInformation \u003cString\u003e] [-StopAfterGetBackupInformation] [-SelectBackupInformation \u003cString\u003e] [-StopAfterSelectBackupInformation] [-FormatBackupInformation \u003cString\u003e] [-StopAfterFormatBackupInformation] [-TestBackupInformation \u003cString\u003e] [-StopAfterTestBackupInformation] -PageRestore \u003cObject\u003e \r\n-PageRestoreTailFolder \u003cString\u003e [-StopBefore] [-StopMark \u003cString\u003e] [-StopAfterDate \u003cDateTime\u003e] [-StatementTimeout \u003cInt32\u003e] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nRestore-DbaDatabase -SqlInstance \u003cDbaInstanceParameter\u003e [-SqlCredential \u003cPSCredential\u003e] [-DatabaseName \u003cObject[]\u003e] [-OutputScriptOnly] [-EnableException] [-AzureCredential \u003cString\u003e] [-Recover] [-GetBackupInformation \u003cString\u003e] [-StopAfterGetBackupInformation] [-SelectBackupInformation \u003cString\u003e] [-StopAfterSelectBackupInformation] [-FormatBackupInformation \u003cString\u003e] [-StopAfterFormatBackupInformation] [-TestBackupInformation \u003cString\u003e] [-StopAfterTestBackupInformation] [-StopBefore] [-StopMark \u003cString\u003e] [-StopAfterDate \u003cDateTime\u003e] [-StatementTimeout \u003cInt32\u003e] [-WhatIf] [-Confirm] \r\n[\u003cCommonParameters\u003e]" }, { "Name": "Restore-DbaDbCertificate", "Description": "Imports certificates from.cer files using SMO.", "Tags": [ "Migration", "Certificate" ], "Synopsis": "Imports certificates from .cer files using SMO.", "Alias": "", "Author": "Jess Pomfret (@jpomfret), jesspomfret.com", "CommandName": "Restore-DbaDbCertificate", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Restore-DbaDbCertificate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$securepass = Get-Credential usernamedoesntmatter | Select-Object -ExpandProperty Password\nPS C:\\\u003e Restore-DbaDbCertificate -SqlInstance Server1 -Path \\\\Server1\\Certificates -DecryptionPassword $securepass\nRestores all the certificates in the specified path, password is used to both decrypt and encrypt the private key.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRestore-DbaDbCertificate -SqlInstance Server1 -Path \\\\Server1\\Certificates\\DatabaseTDE.cer -DecryptionPassword (Get-Credential usernamedoesntmatter).Password\nRestores the DatabaseTDE certificate to Server1 and uses the MasterKey to encrypt the private key.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Path", "The Path the contains the certificate and private key files. The path can be a directory or a specific certificate.", "FullName", true, "true (ByValue)", "", "" ], [ "EncryptionPassword", "If specified this will be used to encrypt the private key.", "", false, "false", "", "" ], [ "Database", "The database where the certificate imports into. Defaults to master.", "", false, "false", "master", "" ], [ "DecryptionPassword", "Secure string used to decrypt the private key.", "Password,SecurePassword", false, "false", "(Read-Host \"Password\" -AsSecureString)", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Restore-DbaDbCertificate [-SqlInstance] \u003cDbaInstanceParameter\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Path] \u003cObject[]\u003e [[-EncryptionPassword] \u003cSecureString\u003e] [[-Database] \u003cString\u003e] [[-DecryptionPassword] \u003cSecureString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Restore-DbaDbSnapshot", "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": [ "Snapshot", "Backup", "Restore", "Database" ], "Synopsis": "Restores databases from snapshots", "Alias": "", "Author": "Simone Bizzotto (@niphold)", "CommandName": "Restore-DbaDbSnapshot", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Restore-DbaDbSnapshot", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRestore-DbaDbSnapshot -SqlInstance sql2014 -Database HR, Accounting\nRestores HR and Accounting databases using the latest snapshot available\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRestore-DbaDbSnapshot -SqlInstance sql2014 -Database HR -Force\nRestores HR database from latest snapshot and kills any active connections in the database on sql2014.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbSnapshot -SqlInstance sql2016 -Database HR | Restore-DbaDbSnapshot -Force\nRestores HR database from latest snapshot and kills any active connections in the database on sql2016.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDbSnapshot -SqlInstance sql2016 | Out-GridView -PassThru | Restore-DbaDbSnapshot\nAllows the selection of snapshots on sql2016 to restore\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eRestore-DbaDbSnapshot -SqlInstance sql2014 -Snapshot HR_snap_20161201, Accounting_snap_20161101\nRestores databases from snapshots named HR_snap_20161201 and Accounting_snap_20161101", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Restores from the last snapshot databases with this names only. You can pass either Databases or Snapshots", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Snapshot", "Restores databases from snapshots with this names only. You can pass either Databases or Snapshots", "", false, "false", "", "" ], [ "InputObject", "Allows piping from other Snapshot commands", "", false, "true (ByValue)", "", "" ], [ "Force", "If restoring from a snapshot involves dropping any other snapshot, you need to explicitly\r\nuse -Force to let this command delete the ones not involved in the restore process.\r\nAlso, -Force will forcibly kill all running queries that prevent the restore process.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run", "wi", false, "false", "", "" ], [ "Confirm", "Prompts for confirmation of every step.", "cf", false, "false", "", "" ] ], "Syntax": "Restore-DbaDbSnapshot [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-Snapshot] \u003cObject[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Resume-DbaAgDbDataMovement", "Description": "Resumes data movement for an availability group database on a SQL Server instance.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Resumes data movement for an availability group database on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Resume-DbaAgDbDataMovement", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Resume-DbaAgDbDataMovement", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eResume-DbaAgDbDataMovement -SqlInstance sql2017a -AvailabilityGroup ag1 -Database db1, db2\nResumes data movement on db1 and db2 to ag1 on sql2017a. Prompts for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgDatabase -SqlInstance sql2017a, sql2019 | Out-GridView -Passthru | Resume-DbaAgDbDataMovement -Confirm:$false\nResumes data movement on the selected availability group databases. Does not prompt for confirmation.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "The availability group where the database movement will be resumed.", "", false, "false", "", "" ], [ "Database", "The database or databases to resume movement upon.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaAgDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Resume-DbaAgDbDataMovement [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString\u003e] [[-Database] \u003cString[]\u003e] [[-InputObject] \u003cAvailabilityDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Revoke-DbaAgPermission", "Description": "Revokes endpoint and availability group permissions to a login.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Revokes endpoint and availability group permissions to a login.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Revoke-DbaAgPermission", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Revoke-DbaAgPermission", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eRevoke-DbaAgPermission -SqlInstance sql2017a -Type AvailabilityGroup -AvailabilityGroup SharePoint -Login ad\\spservice -Permission CreateAnyDatabase\nRemoves CreateAnyDatabase permissions from ad\\spservice on the SharePoint availability group on sql2017a. Does not prompt for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eRevoke-DbaAgPermission -SqlInstance sql2017a -Type AvailabilityGroup -AvailabilityGroup ag1, ag2 -Login ad\\spservice -Permission CreateAnyDatabase -Confirm\nRemoves CreateAnyDatabase permissions from ad\\spservice on the ag1 and ag2 availability groups on sql2017a. Prompts for confirmation.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance sql2017a | Out-GridView -Passthru | Revoke-DbaAgPermission -Type EndPoint\nRevokes the selected logins Connect permissions on the DatabaseMirroring endpoint for sql2017a.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Login", "The login or logins to modify.", "", false, "false", "", "" ], [ "AvailabilityGroup", "Only modify specific availability groups.", "", false, "false", "", "" ], [ "Type", "Specify type: Endpoint or AvailabilityGroup. Endpoint will modify the DatabaseMirror endpoint type.", "", true, "false", "", "Endpoint,AvailabilityGroup" ], [ "Permission", "Revokes one or more permissions:\r\n Alter\r\n Connect\r\n Control\r\n CreateAnyDatabase\r\n CreateSequence\r\n Delete\r\n Execute\r\n Impersonate\r\n Insert\r\n Receive\r\n References\r\n Select\r\n Send\r\n TakeOwnership\r\n Update\r\n ViewChangeTracking\r\n ViewDefinition\nConnect is default.", "", false, "false", "Connect", "Alter,Connect,Control,CreateAnyDatabase,CreateSequence,Delete,Execute,Impersonate,Insert,Receive,References,Select,Send,TakeOwnership,Update,ViewChangeTracking,ViewDefinition" ], [ "InputObject", "Enables piping from Get-DbaLogin.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Revoke-DbaAgPermission [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Login] \u003cString[]\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [-Type] \u003cString[]\u003e [[-Permission] \u003cString[]\u003e] [[-InputObject] \u003cLogin[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Save-DbaDiagnosticQueryScript", "Description": "The dbatools module will have the diagnostic queries pre-installed. Use this only to update to a more recent version or specific versions.\n\nThis function is mainly used by Invoke-DbaDiagnosticQuery, but can also be used independently to download the Glenn Berry DMV scripts.\n\nUse this function to pre-download the scripts from a device with an Internet connection.\n\nThe function Invoke-DbaDiagnosticQuery will try to download these scripts automatically, but it obviously needs an internet connection to do that.", "Tags": [ "Community", "GlennBerry" ], "Synopsis": "Save-DbaDiagnosticQueryScript downloads the most recent version of all Glenn Berry DMV scripts", "Alias": "", "Author": "Andre Kamman (@AndreKamman), https://andrekamman.com", "CommandName": "Save-DbaDiagnosticQueryScript", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Save-DbaDiagnosticQueryScript", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSave-DbaDiagnosticQueryScript -Path c:\\temp\nDownloads the most recent version of all Glenn Berry DMV scripts to the specified location.\r\nIf Path is not specified, the \"My Documents\" location will be used.", "Params": [ [ "Path", "Specifies the path to the output", "", false, "false", "[Environment]::GetFolderPath(\"mydocuments\")", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Save-DbaDiagnosticQueryScript [[-Path] \u003cFileInfo\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Save-DbaKbUpdate", "Description": "Downloads patches from Microsoft", "Tags": [ "Update", "Patching", "Install" ], "Synopsis": "Downloads patches from Microsoft", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Save-DbaKbUpdate", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Save-DbaKbUpdate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSave-DbaKbUpdate -Name KB4057119\nDownloads KB4057119 to the current directory. This works for SQL Server or any other KB.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaKbUpdate -Name KB4057119 -Simple | Out-GridView -Passthru | Save-DbaKbUpdate\nDownloads the selected files from KB4057119 to the current directory.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSave-DbaKbUpdate -Name KB4057119, 4057114 -Path C:\\temp\nDownloads KB4057119 and the x64 version of KB4057114 to C:\\temp. This works for SQL Server or any other KB.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSave-DbaKbUpdate -Name KB4057114 -Architecture All -Path C:\\temp\nDownloads the x64 version of KB4057114 and the x86 version of KB4057114 to C:\\temp. This works for SQL Server or any other KB.", "Params": [ [ "Name", "The KB name or number. For example, KB4057119 or 4057119.", "", false, "false", "", "" ], [ "Path", "The directory to save the file.", "", false, "false", ".", "" ], [ "FilePath", "The exact file name to save to, otherwise, it uses the name given by the webserver", "", false, "false", "", "" ], [ "Architecture", "Defaults to x64. Can be x64, x86, ia64 or \"All\"", "", false, "false", "x64", "x64,x86,ia64,All" ], [ "InputObject", "Enables piping from Get-DbaKbUpdate", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Save-DbaKbUpdate [[-Name] \u003cString[]\u003e] [[-Path] \u003cString\u003e] [[-FilePath] \u003cString\u003e] [[-Architecture] \u003cString\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Select-DbaBackupInformation", "Description": "Select-DbaBackupInformation filters out a subset of backups from the dbatools backup history object with parameters supplied.", "Tags": [ "Backup", "Restore" ], "Synopsis": "Select a subset of backups from a dbatools backup history object", "Alias": "", "Author": "Stuart Moore (@napalmgram), stuart-moore.com", "CommandName": "Select-DbaBackupInformation", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Select-DbaBackupInformation", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$Backups = Get-DbaBackupInformation -SqlInstance Server1 -Path \\\\server1\\backups$\nPS C:\\\u003e $FilteredBackups = $Backups | Select-DbaBackupInformation -RestoreTime (Get-Date).AddHours(-1)\nReturns all backups needed to restore all the backups in \\\\server1\\backups$ to 1 hour ago\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$Backups = Get-DbaBackupInformation -SqlInstance Server1 -Path \\\\server1\\backups$\nPS C:\\\u003e $FilteredBackups = $Backups | Select-DbaBackupInformation -RestoreTime (Get-Date).AddHours(-1) -DatabaseName ProdFinance\nReturns all the backups needed to restore Database ProdFinance to an hour ago\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$Backups = Get-DbaBackupInformation -SqlInstance Server1 -Path \\\\server1\\backups$\nPS C:\\\u003e $FilteredBackups = $Backups | Select-DbaBackupInformation -RestoreTime (Get-Date).AddHours(-1) -IgnoreLogs\nReturns all the backups in \\\\server1\\backups$ to restore to as close prior to 1 hour ago as can be managed with only full and differential backups\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$Backups = Get-DbaBackupInformation -SqlInstance Server1 -Path \\\\server1\\backups$\nPS C:\\\u003e $FilteredBackups = $Backups | Select-DbaBackupInformation -RestoreTime (Get-Date).AddHours(-1) -IgnoreDiffs\nReturns all the backups in \\\\server1\\backups$ to restore to 1 hour ago using only Full and Diff backups.", "Params": [ [ "BackupHistory", "A dbatools.BackupHistory object containing backup history records", "", true, "true (ByValue)", "", "" ], [ "RestoreTime", "The point in time you want to restore to", "", false, "false", "(Get-Date).addmonths(1)", "" ], [ "IgnoreLogs", "This switch will cause Log Backups to be ignored. So will restore to the last Full or Diff backup only", "", false, "false", "False", "" ], [ "IgnoreDiffs", "This switch will cause Differential backups to be ignored. Unless IgnoreLogs is specified, restore to point in time will still occur, just using all available log backups", "", false, "false", "False", "" ], [ "DatabaseName", "A string array of Database Names that you want to filter to", "", false, "false", "", "" ], [ "ServerName", "A string array of Server Names that you want to filter", "", false, "false", "", "" ], [ "ContinuePoints", "The Output of Get-RestoreContinuableDatabase while provides \u0027Database\u0027,redo_start_lsn,\u0027FirstRecoveryForkID\u0027 values. Used to filter backups to continue a restore on a database\r\nSets IgnoreDiffs, and also filters databases to only those within the ContinuePoints object, or the ContinuePoints object AND DatabaseName if both specified", "", false, "false", "", "" ], [ "LastRestoreType", "The Output of Get-DbaDbRestoreHistory -last\r\nThis is used to check the last type of backup to a database to see if a differential backup can be restored", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Select-DbaBackupInformation [-BackupHistory] \u003cObject\u003e [[-RestoreTime] \u003cDateTime\u003e] [-IgnoreLogs] [-IgnoreDiffs] [[-DatabaseName] \u003cString[]\u003e] [[-ServerName] \u003cString[]\u003e] [[-ContinuePoints] \u003cObject\u003e] [[-LastRestoreType] \u003cObject\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Select-DbaDbSequenceNextValue", "Description": "Selects the next value from a sequence.", "Tags": [ "Data", "Sequence", "Table" ], "Synopsis": "Selects the next value from a sequence.", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "Select-DbaDbSequenceNextValue", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Select-DbaDbSequenceNextValue", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSelect-DbaDbSequenceNextValue -SqlInstance sqldev01 -Database TestDB -Name TestSequence\nSelects the next value from the sequence TestSequence in the TestDB database on the sqldev01 instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqldev01 -Database TestDB | Select-DbaDbSequenceNextValue -Name TestSequence -Schema TestSchema\nUsing a pipeline this command selects the next value from the sequence TestSchema.TestSequence in the TestDB database on the sqldev01 instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database.", "", false, "false", "", "" ], [ "Name", "The name of the sequence.", "", true, "false", "", "" ], [ "Schema", "The name of the schema for the sequence. The default is dbo.", "", false, "false", "dbo", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Select-DbaDbSequenceNextValue [[-SqlInstance] \u003cDbaInstanceParameter\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString\u003e] [-Name] \u003cString\u003e [[-Schema] \u003cString\u003e] [[-InputObject] \u003cDatabase\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Select-DbaObject", "Description": null, "Synopsis": "\r\nSelect-DbaObject [[-Property] \u003cDbaSelectParameter[]\u003e] [[-Alias] \u003cSelectAliasParameter[]\u003e] [[-ScriptProperty] \u003cSelectScriptPropertyParameter[]\u003e] [[-ScriptMethod] \u003cSelectScriptMethodParameter[]\u003e] [-InputObject \u003cpsobject\u003e] [-ExcludeProperty \u003cstring[]\u003e] [-ExpandProperty \u003cstring\u003e] [-Unique] [-Last \u003cint\u003e] [-First \u003cint\u003e] [-Skip \u003cint\u003e] [-Wait] [-ShowProperty \u003cstring[]\u003e] [-ShowExcludeProperty \u003cstring[]\u003e] [-TypeName \u003cstring\u003e] [-KeepInputObject] [\u003cCommonParameters\u003e]\r\n\r\nSelect-DbaObject [[-Property] \u003cDbaSelectParameter[]\u003e] [[-Alias] \u003cSelectAliasParameter[]\u003e] [[-ScriptProperty] \u003cSelectScriptPropertyParameter[]\u003e] [[-ScriptMethod] \u003cSelectScriptMethodParameter[]\u003e] [-InputObject \u003cpsobject\u003e] [-ExcludeProperty \u003cstring[]\u003e] [-ExpandProperty \u003cstring\u003e] [-Unique] [-SkipLast \u003cint\u003e] [-ShowProperty \u003cstring[]\u003e] [-ShowExcludeProperty \u003cstring[]\u003e] [-TypeName \u003cstring\u003e] [-KeepInputObject] [\u003cCommonParameters\u003e]\r\n\r\nSelect-DbaObject [-InputObject \u003cpsobject\u003e] [-Unique] [-Wait] [-Index \u003cint[]\u003e] [-ShowProperty \u003cstring[]\u003e] [-ShowExcludeProperty \u003cstring[]\u003e] [-TypeName \u003cstring\u003e] [-KeepInputObject] [\u003cCommonParameters\u003e]\r\n", "Alias": "", "CommandName": "Select-DbaObject", "Availability": "Windows, Linux, macOS", "Links": null, "Examples": "", "Params": [ [ "Alias", "", "", false, "false", null, "" ], [ "ExcludeProperty", "", "", false, "false", null, "" ], [ "ExpandProperty", "", "", false, "false", null, "" ], [ "First", "", "", false, "false", null, "" ], [ "Index", "", "", false, "false", null, "" ], [ "InputObject", "", "", false, "true (ByValue)", null, "" ], [ "KeepInputObject", "", "", false, "false", null, "" ], [ "Last", "", "", false, "false", null, "" ], [ "Property", "", "", false, "false", null, "" ], [ "ScriptMethod", "", "", false, "false", null, "" ], [ "ScriptProperty", "", "", false, "false", null, "" ], [ "ShowExcludeProperty", "", "", false, "false", null, "" ], [ "ShowProperty", "", "", false, "false", null, "" ], [ "Skip", "", "", false, "false", null, "" ], [ "SkipLast", "", "", false, "false", null, "" ], [ "TypeName", "", "", false, "false", null, "" ], [ "Unique", "", "", false, "false", null, "" ], [ "Wait", "", "", false, "false", null, "" ] ], "Syntax": "syntaxItem \r\n---------- \r\n{@{name=Select-DbaObject; CommonParameters=True; WorkflowCommonParameters=False; parameter=System.Object[]}, @{name=Select-DbaObject; CommonParameters=True; WorkflowCommonParameters=False; parameter=System.Object[]}, @{name=Select-DbaObject; CommonParameters=True; WorkflowCommonParameters=False; parameter=System.Object[]}}" }, { "Name": "Set-DbaAgentAlert", "Description": "Set-DbaAgentAlert updates an alert in the SQL Server Agent with parameters supplied.", "Tags": [ "Agent", "Alert" ], "Synopsis": "Set-DbaAgentAlert updates the status of a SQL Agent Alert.", "Alias": "", "Author": "Garry Bargsley (@gbargsley), garrybargsley.com", "CommandName": "Set-DbaAgentAlert", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaAgentAlert", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaAgentAlert -SqlInstance sql1 -Alert \u0027Severity 025: Fatal Error\u0027 -Disabled\nChanges the alert to disabled.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaAgentAlert -SqlInstance sql1 -Alert \u0027Severity 025: Fatal Error\u0027, \u0027Error Number 825\u0027, \u0027Error Number 824\u0027 -Enabled\nChanges multiple alerts to enabled.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaAgentAlert -SqlInstance sql1, sql2, sql3 -Alert \u0027Severity 025: Fatal Error\u0027, \u0027Error Number 825\u0027, \u0027Error Number 824\u0027 -Enabled\nChanges multiple alerts to enabled on multiple servers.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaAgentAlert -SqlInstance sql1 -Alert \u0027Severity 025: Fatal Error\u0027 -Disabled -WhatIf\nDoesn\u0027t Change the alert but shows what would happen.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Alert", "The name of the alert.", "", false, "false", "", "" ], [ "NewName", "The new name for the alert.", "", false, "false", "", "" ], [ "Enabled", "Enabled the alert.", "", false, "false", "False", "" ], [ "Disabled", "Disabled the alert.", "", false, "false", "False", "" ], [ "Force", "The force parameter will ignore some errors in the parameters and assume defaults.", "", false, "false", "False", "" ], [ "InputObject", "Enables piping alert objects", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaAgentAlert [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Alert] \u003cObject[]\u003e] [[-NewName] \u003cString\u003e] [-Enabled] [-Disabled] [-Force] [[-InputObject] \u003cAlert[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaAgentJob", "Description": "Set-DbaAgentJob updates a job in the SQL Server Agent with parameters supplied.", "Tags": [ "Agent", "Job" ], "Synopsis": "Set-DbaAgentJob updates a job.", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Set-DbaAgentJob", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaAgentJob", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaAgentJob sql1 -Job Job1 -Disabled\nChanges the job to disabled\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaAgentJob sql1 -Job Job1 -OwnerLogin user1\nChanges the owner of the job\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaAgentJob -SqlInstance sql1 -Job Job1 -EventLogLevel OnSuccess\nChanges the job and sets the notification to write to the Windows Application event log on success\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaAgentJob -SqlInstance sql1 -Job Job1 -EmailLevel OnFailure -EmailOperator dba\nChanges the job and sets the notification to send an e-mail to the e-mail operator\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eSet-DbaAgentJob -SqlInstance sql1 -Job Job1, Job2, Job3 -Enabled\nChanges multiple jobs to enabled\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eSet-DbaAgentJob -SqlInstance sql1, sql2, sql3 -Job Job1, Job2, Job3 -Enabled\nChanges multiple jobs to enabled on multiple servers\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eSet-DbaAgentJob -SqlInstance sql1 -Job Job1 -Description \u0027Just another job\u0027 -Whatif\nDoesn\u0027t Change the job but shows what would happen.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eSet-DbaAgentJob -SqlInstance sql1, sql2, sql3 -Job \u0027Job One\u0027 -Description \u0027Job One\u0027\nChanges a job with the name \"Job1\" on multiple servers to have another description\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003esql1, sql2, sql3 | Set-DbaAgentJob -Job Job1 -Description \u0027Job One\u0027\nChanges a job with the name \"Job1\" on multiple servers to have another description using pipe line", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "The name of the job.", "", false, "false", "", "" ], [ "Schedule", "Schedule to attach to job. This can be more than one schedule.", "", false, "false", "", "" ], [ "ScheduleId", "Schedule ID to attach to job. This can be more than one schedule ID.", "", false, "false", "", "" ], [ "NewName", "The new name for the job.", "", false, "false", "", "" ], [ "Enabled", "Enabled the job.", "", false, "false", "False", "" ], [ "Disabled", "Disabled the job", "", false, "false", "False", "" ], [ "Description", "The description of the job.", "", false, "false", "", "" ], [ "StartStepId", "The identification number of the first step to execute for the job.", "", false, "false", "0", "" ], [ "Category", "The category of the job.", "", false, "false", "", "" ], [ "OwnerLogin", "The name of the login that owns the job.", "", false, "false", "", "" ], [ "EventLogLevel", "Specifies when to place an entry in the Microsoft Windows application log for this job.\r\nAllowed values 0, \"Never\", 1, \"OnSuccess\", 2, \"OnFailure\", 3, \"Always\"\r\nThe text value van either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "", "0,Never,1,OnSuccess,2,OnFailure,3,Always" ], [ "EmailLevel", "Specifies when to send an e-mail upon the completion of this job.\r\nAllowed values 0, \"Never\", 1, \"OnSuccess\", 2, \"OnFailure\", 3, \"Always\"\r\nThe text value van either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "", "0,Never,1,OnSuccess,2,OnFailure,3,Always" ], [ "NetsendLevel", "Specifies when to send a network message upon the completion of this job.\r\nAllowed values 0, \"Never\", 1, \"OnSuccess\", 2, \"OnFailure\", 3, \"Always\"\r\nThe text value van either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "", "0,Never,1,OnSuccess,2,OnFailure,3,Always" ], [ "PageLevel", "Specifies when to send a page upon the completion of this job.\r\nAllowed values 0, \"Never\", 1, \"OnSuccess\", 2, \"OnFailure\", 3, \"Always\"\r\nThe text value van either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "", "0,Never,1,OnSuccess,2,OnFailure,3,Always" ], [ "EmailOperator", "The e-mail name of the operator to whom the e-mail is sent when EmailLevel is reached.", "", false, "false", "", "" ], [ "NetsendOperator", "The name of the operator to whom the network message is sent.", "", false, "false", "", "" ], [ "PageOperator", "The name of the operator to whom a page is sent.", "", false, "false", "", "" ], [ "DeleteLevel", "Specifies when to delete the job.\r\nAllowed values 0, \"Never\", 1, \"OnSuccess\", 2, \"OnFailure\", 3, \"Always\"\r\nThe text value van either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "", "0,Never,1,OnSuccess,2,OnFailure,3,Always" ], [ "Force", "The force parameter will ignore some errors in the parameters and assume defaults.", "", false, "false", "False", "" ], [ "InputObject", "Enables piping job objects", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaAgentJob [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Job] \u003cObject[]\u003e] [[-Schedule] \u003cObject[]\u003e] [[-ScheduleId] \u003cInt32[]\u003e] [[-NewName] \u003cString\u003e] [-Enabled] [-Disabled] [[-Description] \u003cString\u003e] [[-StartStepId] \u003cInt32\u003e] [[-Category] \u003cString\u003e] [[-OwnerLogin] \u003cString\u003e] [[-EventLogLevel] \u003cObject\u003e] [[-EmailLevel] \u003cObject\u003e] [[-NetsendLevel] \u003cObject\u003e] [[-PageLevel] \u003cObject\u003e] [[-EmailOperator] \u003cString\u003e] [[-NetsendOperator] \u003cString\u003e] [[-PageOperator] \u003cString\u003e] [[-DeleteLevel] \u003cObject\u003e] [-Force] [[-InputObject] \u003cJob[]\u003e] [-EnableException] [-WhatIf] [-Confirm] \r\n[\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaAgentJobCategory", "Description": "Set-DbaAgentJobCategory makes it possible to change a job category.", "Tags": [ "Agent", "Job", "JobCategory" ], "Synopsis": "Set-DbaAgentJobCategory changes a job category.", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Set-DbaAgentJobCategory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaAgentJobCategory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaAgentJobCategory -SqlInstance sql1 -Category \u0027Category 1\u0027 -NewName \u0027Category 2\u0027\nChange the name of the category from \u0027Category 1\u0027 to \u0027Category 2\u0027.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaAgentJobCategory -SqlInstance sql1, sql2 -Category Category1, Category2 -NewName cat1, cat2\nRename multiple jobs in one go on multiple servers.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Category", "The name of the category", "", false, "false", "", "" ], [ "NewName", "New name of the job category", "", false, "false", "", "" ], [ "Force", "The force parameter will ignore some errors in the parameters and assume defaults.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaAgentJobCategory [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Category] \u003cString[]\u003e] [[-NewName] \u003cString[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaAgentJobOutputFile", "Description": "Sets the Output File for a step of an agent job with the Job Names and steps provided dynamically if required", "Tags": [ "Agent", "Job", "SqlAgent" ], "Synopsis": "Set the output file for a step within an Agent job.", "Alias": "", "Author": "Rob Sewell, https://sqldbawithabeard.com", "CommandName": "Set-DbaAgentJobOutputFile", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaAgentJobOutputFile", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaAgentJobOutputFile -SqlInstance SERVERNAME -Job \u0027The Agent Job\u0027 -OutPutFile E:\\Logs\\AgentJobStepOutput.txt\nSets the Job step for The Agent job on SERVERNAME to E:\\Logs\\AgentJobStepOutput.txt", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue, ByPropertyName)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance. be it Windows or SQL Server. Windows users are determined by the existence of a backslash, so if you are intending to use an alternative Windows \r\nconnection instead of a SQL login, ensure it contains a backslash.", "", false, "true (ByValue, ByPropertyName)", "", "" ], [ "Job", "The job to process - this list is auto-populated from the server.", "", false, "false", "", "" ], [ "Step", "The Agent Job Step to provide Output File Path for. Also available dynamically", "", false, "true (ByValue, ByPropertyName)", "", "" ], [ "OutputFile", "The Full Path to the New Output file", "", true, "true (ByValue, ByPropertyName)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaAgentJobOutputFile [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Job \u003cObject[]\u003e] [-Step \u003cObject[]\u003e] -OutputFile \u003cString\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaAgentJobOwner", "Description": "This function alters SQL Agent Job ownership to match a specified login if their current owner does not match the target login.\n\nBy default, the target login will be \u0027sa\u0027,\nbut the the user may specify a different login for ownership.\n\nThis be applied to all local (non MultiServer) jobs or only to a select collection of jobs.\n\nBest practice reference: https://www.itprotoday.com/sql-server-tip-assign-ownership-jobs-sysadmin-account\n\nIf the \u0027sa\u0027 account was renamed, the new name will be used.", "Tags": [ "Agent", "Job" ], "Synopsis": "Sets SQL Agent job owners with a desired login if jobs do not match that owner.", "Alias": "", "Author": "Michael Fal (@Mike_Fal), http://mikefal.net", "CommandName": "Set-DbaAgentJobOwner", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaAgentJobOwner", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaAgentJobOwner -SqlInstance localhost\nSets SQL Agent Job owner to sa on all jobs where the owner does not match sa.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaAgentJobOwner -SqlInstance localhost -Login DOMAIN\\account\nSets SQL Agent Job owner to \u0027DOMAIN\\account\u0027 on all jobs where the owner does not match \u0027DOMAIN\\account\u0027. Note\r\nthat Login must be a valid security principal that exists on the target server.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaAgentJobOwner -SqlInstance localhost -Job job1, job2\nSets SQL Agent Job owner to \u0027sa\u0027 on the job1 and job2 jobs if their current owner does not match \u0027sa\u0027.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e\u0027sqlserver\u0027,\u0027sql2016\u0027 | Set-DbaAgentJobOwner\nSets SQL Agent Job owner to sa on all jobs where the owner does not match sa on both sqlserver and sql2016.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance vmsql | Where-Object OwnerLoginName -eq login1 | Set-DbaAgentJobOwner -TargetLogin login2 | Out-Gridview\nSets SQL Agent Job owner to login2 where their current owner is login1 on instance vmsql. Send result to gridview.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "Specifies the job(s) to process. Options for this list are auto-populated from the server. If unspecified, all jobs will be processed.", "Jobs", false, "false", "", "" ], [ "ExcludeJob", "Specifies the job(s) to exclude from processing. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaAgentJob", "", false, "true (ByValue)", "", "" ], [ "Login", "Specifies the login that you wish check for ownership. This defaults to \u0027sa\u0027 or the sysadmin name if sa was renamed. This must be a valid security principal which exists on the target server.", "TargetLogin", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaAgentJobOwner [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Job] \u003cObject[]\u003e] [[-ExcludeJob] \u003cObject[]\u003e] [[-InputObject] \u003cJob[]\u003e] [[-Login] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaAgentJobStep", "Description": "Set-DbaAgentJobStep updates a job step in the SQL Server Agent with parameters supplied.\n\nNote: ActiveScripting (ActiveX scripting) was discontinued in SQL Server 2016: https://docs.microsoft.com/en-us/sql/database-engine/discontinued-database-engine-functionality-in-sql-server", "Tags": [ "Agent", "Job", "JobStep" ], "Synopsis": "Set-DbaAgentJobStep updates a job step.", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Set-DbaAgentJobStep", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaAgentJobStep", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaAgentJobStep -SqlInstance sql1 -Job Job1 -StepName Step1 -NewName Step2\nChanges the name of the step in \"Job1\" with the name Step1 to Step2\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaAgentJobStep -SqlInstance sql1 -Job Job1 -StepName Step1 -Database msdb\nChanges the database of the step in \"Job1\" with the name Step1 to msdb\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaAgentJobStep -SqlInstance sql1 -Job Job1, Job2 -StepName Step1 -Database msdb\nChanges job steps in multiple jobs with the name Step1 to msdb\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaAgentJobStep -SqlInstance sql1, sql2, sql3 -Job Job1, Job2 -StepName Step1 -Database msdb\nChanges job steps in multiple jobs on multiple servers with the name Step1 to msdb\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eSet-DbaAgentJobStep -SqlInstance sql1, sql2, sql3 -Job Job1 -StepName Step1 -Database msdb\nChanges the database of the step in \"Job1\" with the name Step1 to msdb for multiple servers\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003esql1, sql2, sql3 | Set-DbaAgentJobStep -Job Job1 -StepName Step1 -Database msdb\nChanges the database of the step in \"Job1\" with the name Step1 to msdb for multiple servers using pipeline\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$jobStep = @{\nSqlInstance = sqldev01\r\n Job = dbatools1\r\n StepName = \"Step 2\"\r\n Subsystem = \"CmdExec\"\r\n Command = \"enter command text here\"\r\n CmdExecSuccessCode = 0\r\n OnSuccessAction = \"GoToStep\"\r\n OnSuccessStepId = 1\r\n OnFailAction = \"GoToStep\"\r\n OnFailStepId = 1\r\n Database = TestDB\r\n RetryAttempts = 2\r\n RetryInterval = 5\r\n OutputFileName = \"logCmdExec.txt\"\r\n Flag = [Microsoft.SqlServer.Management.Smo.Agent.JobStepFlags]::AppendAllCmdExecOutputToJobHistory\r\n ProxyName = \"dbatoolsci_proxy_1\"\r\n Force = $true\r\n }\nPS C:\\\u003e$newJobStep = Set-DbaAgentJobStep @jobStep\nUpdates or creates a new job step named Step 2 in the dbatools1 job on the sqldev01 instance. The subsystem is set to CmdExec and uses a proxy.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "The name of the job or the job object itself.", "", false, "false", "", "" ], [ "StepName", "The name of the step.", "", false, "false", "", "" ], [ "NewName", "The new name for the step in case it needs to be renamed.", "", false, "false", "", "" ], [ "Subsystem", "The subsystem used by the SQL Server Agent service to execute command.\r\nAllowed values \u0027ActiveScripting\u0027,\u0027AnalysisCommand\u0027,\u0027AnalysisQuery\u0027,\u0027CmdExec\u0027,\u0027Distribution\u0027,\u0027LogReader\u0027,\u0027Merge\u0027,\u0027PowerShell\u0027,\u0027QueueReader\u0027,\u0027Snapshot\u0027,\u0027Ssis\u0027,\u0027TransactSql\u0027", "", false, "false", "", "ActiveScripting,AnalysisCommand,AnalysisQuery,CmdExec,Distribution,LogReader,Merge,PowerShell,QueueReader,Snapshot,Ssis,TransactSql" ], [ "SubsystemServer", "The subsystems AnalysisScripting, AnalysisCommand, AnalysisQuery require a server.", "", false, "false", "", "" ], [ "Command", "The commands to be executed by the SQLServerAgent service through the subsystem.", "", false, "false", "", "" ], [ "CmdExecSuccessCode", "The value returned by a CmdExec subsystem command to indicate that command executed successfully.", "", false, "false", "0", "" ], [ "OnSuccessAction", "The action to perform if the step succeeds.\r\nAllowed values \"QuitWithSuccess\" (default), \"QuitWithFailure\", \"GoToNextStep\", \"GoToStep\".\r\nThe text value van either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "", "QuitWithSuccess,QuitWithFailure,GoToNextStep,GoToStep" ], [ "OnSuccessStepId", "The ID of the step in this job to execute if the step succeeds and OnSuccessAction is \"GoToNextStep\".", "", false, "false", "0", "" ], [ "OnFailAction", "The action to perform if the step fails.\r\nAllowed values \"QuitWithSuccess\" (default), \"QuitWithFailure\", \"GoToNextStep\", \"GoToStep\".\r\nThe text value van either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "", "QuitWithSuccess,QuitWithFailure,GoToNextStep,GoToStep" ], [ "OnFailStepId", "The ID of the step in this job to execute if the step fails and OnFailAction is \"GoToNextStep\".", "", false, "false", "0", "" ], [ "Database", "The name of the database in which to execute a Transact-SQL step.", "", false, "false", "", "" ], [ "DatabaseUser", "The name of the user account to use when executing a Transact-SQL step.", "", false, "false", "", "" ], [ "RetryAttempts", "The number of retry attempts to use if this step fails.", "", false, "false", "0", "" ], [ "RetryInterval", "The amount of time in minutes between retry attempts.", "", false, "false", "0", "" ], [ "OutputFileName", "The name of the file in which the output of this step is saved.", "", false, "false", "", "" ], [ "Flag", "Sets the flag(s) for the job step.\nFlag Description\r\n----------------------------------------------------------------------------\r\nAppendAllCmdExecOutputToJobHistory Job history, including command output, is appended to the job history file.\r\nAppendToJobHistory Job history is appended to the job history file.\r\nAppendToLogFile Job history is appended to the SQL Server log file.\r\nAppendToTableLog Job history is appended to a log table.\r\nLogToTableWithOverwrite Job history is written to a log table, overwriting previous contents.\r\nNone Job history is not appended to a file.\r\nProvideStopProcessEvent Job processing is stopped.", "", false, "false", "", "AppendAllCmdExecOutputToJobHistory,AppendToJobHistory,AppendToLogFile,AppendToTableLog,LogToTableWithOverwrite,None,ProvideStopProcessEvent" ], [ "ProxyName", "The name of the proxy that the job step runs as.", "", false, "false", "", "" ], [ "InputObject", "Allows pipeline input from Connect-DbaInstance.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "Force", "The force parameter will ignore some errors in the parameters and assume defaults.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaAgentJobStep [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Job] \u003cObject[]\u003e] [[-StepName] \u003cString\u003e] [[-NewName] \u003cString\u003e] [[-Subsystem] \u003cString\u003e] [[-SubsystemServer] \u003cString\u003e] [[-Command] \u003cString\u003e] [[-CmdExecSuccessCode] \u003cInt32\u003e] [[-OnSuccessAction] \u003cString\u003e] [[-OnSuccessStepId] \u003cInt32\u003e] [[-OnFailAction] \u003cString\u003e] [[-OnFailStepId] \u003cInt32\u003e] [[-Database] \u003cString\u003e] [[-DatabaseUser] \u003cString\u003e] [[-RetryAttempts] \u003cInt32\u003e] [[-RetryInterval] \u003cInt32\u003e] [[-OutputFileName] \u003cString\u003e] [[-Flag] \u003cString[]\u003e] [[-ProxyName] \u003cString\u003e] [[-InputObject] \u003cServer[]\u003e] \r\n[-EnableException] [-Force] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaAgentOperator", "Description": "Updates/modifies agent operators on an instance.", "Tags": [ "Agent", "Operator" ], "Synopsis": "Updates/modifies agent operators on an instance.", "Alias": "", "Author": "Tracy Boggiano (@TracyBoggiano), databasesuperhero.com", "CommandName": "Set-DbaAgentOperator", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaAgentOperator", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS:\\\u003eSet-DbaAgentOperator -SqlInstance sql01 -Operator DBA -EmailAddress operator@operator.com -PagerDay Everyday\nThis sets the operator named DBA with the above email address with default values to alerts everyday for all hours of the day.\n-------------------------- EXAMPLE 2 --------------------------\nPS:\\\u003eSet-DbaAgentOperator -SqlInstance sql01 -Operator DBA -EmailAddress operator@operator.com -NetSendAddress dbauser1 -PagerAddress dbauser1@pager.dbatools.io -PagerDay Everyday -SaturdayStartTime \r\n070000 -SaturdayEndTime 180000 -SundayStartTime 080000 -SundayEndTime 170000 -WeekdayStartTime 060000 -WeekdayEndTime 190000\nCreates a new operator named DBA on the sql01 instance with email address operator@operator.com, net send address of dbauser1, pager address of dbauser1@pager.dbatools.io, page day as every day, \r\nSaturday start time of 7am, Saturday end time of 6pm, Sunday start time of 8am, Sunday end time of 5pm, Weekday start time of 6am, and Weekday end time of 7pm.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Operator", "Name of the operator in SQL Agent.", "", false, "false", "", "" ], [ "Name", "The new name of the agent operator.", "", false, "false", "", "" ], [ "EmailAddress", "The email address the SQL Agent will use to email alerts to the operator.", "", false, "false", "", "" ], [ "NetSendAddress", "The net send address the SQL Agent will use for the operator to net send alerts.", "", false, "false", "", "" ], [ "PagerAddress", "The pager email address the SQL Agent will use to send alerts to the oeprator.", "", false, "false", "", "" ], [ "PagerDay", "Defines what days the pager portion of the operator will be used. The default is \u0027Everyday\u0027. Valid parameters\r\nare \u0027EveryDay\u0027, \u0027Weekdays\u0027, \u0027Weekend\u0027, \u0027Sunday\u0027, \u0027Monday\u0027, \u0027Tuesday\u0027, \u0027Wednesday\u0027, \u0027Thursday\u0027, \u0027Friday\u0027, and\r\n\u0027Saturday\u0027.", "", false, "false", "", "EveryDay,Weekdays,Weekend,Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday" ], [ "SaturdayStartTime", "This a string that takes the Saturday Pager Start Time.", "", false, "false", "", "" ], [ "SaturdayEndTime", "This a string that takes the Saturday Pager End Time.", "", false, "false", "", "" ], [ "SundayStartTime", "This a string that takes the Sunday Pager Start Time.", "", false, "false", "", "" ], [ "SundayEndTime", "This a string that takes the Sunday Pager End Time.", "", false, "false", "", "" ], [ "WeekdayStartTime", "This a string that takes the Weekdays Pager Start Time.", "", false, "false", "", "" ], [ "WeekdayEndTime", "This a string that takes the Weekdays Pager End Time.", "", false, "false", "", "" ], [ "IsFailsafeOperator", "If this switch is enabled, this operator will be your failsafe operator and replace the one that existed before.", "", false, "false", "False", "" ], [ "FailsafeNotificationMethod", "Defines the notification method for the failsafe oeprator. Value must be NotifyMail or NotifyPager.\r\nThe default is NotifyEmail.", "", false, "false", "NotifyEmail", "" ], [ "InputObject", "SMO Server Objects (pipeline input from Connect-DbaInstance)", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaAgentOperator [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Operator] \u003cString[]\u003e] [[-Name] \u003cString\u003e] [[-EmailAddress] \u003cString\u003e] [[-NetSendAddress] \u003cString\u003e] [[-PagerAddress] \u003cString\u003e] [[-PagerDay] \u003cString\u003e] [[-SaturdayStartTime] \u003cString\u003e] [[-SaturdayEndTime] \u003cString\u003e] [[-SundayStartTime] \u003cString\u003e] [[-SundayEndTime] \u003cString\u003e] [[-WeekdayStartTime] \u003cString\u003e] [[-WeekdayEndTime] \u003cString\u003e] [-IsFailsafeOperator] [[-FailsafeNotificationMethod] \u003cString\u003e] [[-InputObject] \u003cOperator[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaAgentSchedule", "Description": "Set-DbaAgentSchedule will help update a schedule for a job. It does not attach the schedule to a job.", "Tags": [ "Agent", "Job", "JobStep" ], "Synopsis": "Set-DbaAgentSchedule updates a schedule in the msdb database.", "Alias": "", "Author": "Sander Stad (@sqlstad, sqlstad.nl)", "CommandName": "Set-DbaAgentSchedule", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaAgentSchedule", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaAgentSchedule -SqlInstance sql1 -Job Job1 -ScheduleName daily -Enabled\nChanges the schedule for Job1 with the name \u0027daily\u0027 to enabled\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaAgentSchedule -SqlInstance sql1 -Job Job1 -ScheduleName daily -NewName weekly -FrequencyType Weekly -FrequencyInterval Monday, Wednesday, Friday\nChanges the schedule for Job1 with the name daily to have a new name weekly\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaAgentSchedule -SqlInstance sql1 -Job Job1, Job2, Job3 -ScheduleName daily -StartTime \u0027230000\u0027\nChanges the start time of the schedule for Job1 to 11 PM for multiple jobs\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaAgentSchedule -SqlInstance sql1, sql2, sql3 -Job Job1 -ScheduleName daily -Enabled\nChanges the schedule for Job1 with the name daily to enabled on multiple servers\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003esql1, sql2, sql3 | Set-DbaAgentSchedule -Job Job1 -ScheduleName daily -Enabled\nChanges the schedule for Job1 with the name \u0027daily\u0027 to enabled on multiple servers using pipe line", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "The name of the job that has the schedule.", "", true, "true (ByValue)", "", "" ], [ "ScheduleName", "The name of the schedule.", "", true, "true (ByValue)", "", "" ], [ "NewName", "The new name for the schedule.", "", false, "false", "", "" ], [ "Enabled", "Set the schedule to enabled.", "", false, "false", "False", "" ], [ "Disabled", "Set the schedule to disabled.", "", false, "false", "False", "" ], [ "FrequencyType", "A value indicating when a job is to be executed.\nAllowed values: \u0027Once\u0027, \u0027OneTime\u0027, \u0027Daily\u0027, \u0027Weekly\u0027, \u0027Monthly\u0027, \u0027MonthlyRelative\u0027, \u0027AgentStart\u0027, \u0027AutoStart\u0027, \u0027IdleComputer\u0027, \u0027OnIdle\u0027\nThe following synonyms provide flexibility to the allowed values for this function parameter:\r\nOnce=OneTime\r\nAgentStart=AutoStart\r\nIdleComputer=OnIdle\nIf force is used the default will be \"Once\".", "", false, "false", "", "Once,OneTime,Daily,Weekly,Monthly,MonthlyRelative,AgentStart,AutoStart,IdleComputer,OnIdle,1,4,8,16,32,64,128" ], [ "FrequencyInterval", "The days that a job is executed\nAllowed values for FrequencyType \u0027Daily\u0027: EveryDay or a number between 1 and 365.\r\nAllowed values for FrequencyType \u0027Weekly\u0027: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Weekdays, Weekend or EveryDay.\r\nAllowed values for FrequencyType \u0027Monthly\u0027: Numbers 1 to 31 for each day of the month.\nIf \"Weekdays\", \"Weekend\" or \"EveryDay\" is used it over writes any other value that has been passed before.\nIf force is used the default will be 1.", "", false, "false", "", "" ], [ "FrequencySubdayType", "Specifies the units for the subday FrequencyInterval.\r\nAllowed values are 1, \"Time\", 2, \"Seconds\", 4, \"Minutes\", 8 or \"Hours\"", "", false, "false", "", "1,Time,2,Seconds,4,Minutes,8,Hours" ], [ "FrequencySubdayInterval", "The number of subday type periods to occur between each execution of a job.", "", false, "false", "0", "" ], [ "FrequencyRelativeInterval", "A job\u0027s occurrence of FrequencyInterval in each month, if FrequencyType is 32 (MonthlyRelative).", "", false, "false", "", "Unused,First,Second,Third,Fourth,Last" ], [ "FrequencyRecurrenceFactor", "The number of weeks or months between the scheduled execution of a job. FrequencyRecurrenceFactor is used only if FrequencyType is 8, \"Weekly\", 16, \"Monthly\", 32 or \"MonthlyRelative\".", "", false, "false", "0", "" ], [ "StartDate", "The date on which execution of a job can begin.", "", false, "false", "", "" ], [ "EndDate", "The date on which execution of a job can stop.", "", false, "false", "", "" ], [ "StartTime", "The time on any day to begin execution of a job. Format HHMMSS / 24 hour clock.\r\nExample: \u0027010000\u0027 for 01:00:00 AM.\r\nExample: \u0027140000\u0027 for 02:00:00 PM.", "", false, "false", "", "" ], [ "EndTime", "The time on any day to end execution of a job. Format HHMMSS / 24 hour clock.\r\nExample: \u0027010000\u0027 for 01:00:00 AM.\r\nExample: \u0027140000\u0027 for 02:00:00 PM.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "Force", "The force parameter will ignore some errors in the parameters and assume defaults.\r\nIt will also remove the any present schedules with the same name for the specific job.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaAgentSchedule [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Job] \u003cObject[]\u003e [-ScheduleName] \u003cString\u003e [[-NewName] \u003cString\u003e] [-Enabled] [-Disabled] [[-FrequencyType] \u003cObject\u003e] [[-FrequencyInterval] \u003cObject[]\u003e] [[-FrequencySubdayType] \u003cObject\u003e] [[-FrequencySubdayInterval] \u003cInt32\u003e] [[-FrequencyRelativeInterval] \u003cObject\u003e] [[-FrequencyRecurrenceFactor] \u003cInt32\u003e] [[-StartDate] \u003cString\u003e] [[-EndDate] \u003cString\u003e] [[-StartTime] \u003cString\u003e] [[-EndTime] \u003cString\u003e] [-EnableException] [-Force] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaAgentServer", "Description": "Set-DbaAgentServer updates properties in the SQL Server Server with parameters supplied.", "Tags": [ "Agent", "Server" ], "Synopsis": "Set-DbaAgentServer updates properties of a SQL Agent Server.", "Alias": "", "Author": "Cláudio Silva (@claudioessilva), https://claudioessilva.com", "CommandName": "Set-DbaAgentServer", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaAgentServer", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaAgentServer -SqlInstance sql1 -MaximumHistoryRows 10000 -MaximumJobHistoryRows 100\nChanges the job history retention to 10000 rows with an maximum of 100 rows per job.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaAgentServer -SqlInstance sql1 -CpuPolling Enabled\nEnable the CPU Polling configurations.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaAgentServer -SqlInstance sql1, sql2, sql3 -AgentLogLevel \u0027Errors, Warnings\u0027\nSet the agent log level to Errors and Warnings on multiple servers.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaAgentServer -SqlInstance sql1 -CpuPolling Disabled\nDisable the CPU Polling configurations.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eSet-DbaAgentServer -SqlInstance sql1 -MaximumJobHistoryRows 1000 -MaximumHistoryRows 10000\nSet the max history limitations. This is the equivalent to calling: EXEC msdb.dbo.sp_set_sqlagent_properties @jobhistory_max_rows=10000, @jobhistory_max_rows_per_job=1000\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eSet-DbaAgentServer -SqlInstance sql1 -MaximumJobHistoryRows 0 -MaximumHistoryRows -1\nDisable the max history limitations. This is the equivalent to calling: EXEC msdb.dbo.sp_set_sqlagent_properties @jobhistory_max_rows=-1, @jobhistory_max_rows_per_job=0", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "InputObject", "Enables piping agent server objects", "", false, "true (ByValue)", "", "" ], [ "AgentLogLevel", "Specifies the agent log level.\r\nAllowed values 1, \"Errors\", 2, \"Warnings\", 3, \"Errors, Warnings\", 4, \"Informational\", 5, \"Errors, Informational\", 6, \"Warnings, Informational\", 7, \"All\"\r\nThe text value can either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "", "1,Errors,2,Warnings,3,Errors, Warnings,4,Informational,5,Errors, Informational,6,Warnings, Informational,7,All" ], [ "AgentMailType", "Specifies the agent mail type.\r\nAllowed values 0, \"SqlAgentMail\", 1, \"DatabaseMail\"\r\nThe text value can either be lowercase, uppercase or something in between as long as the text is correct.", "", false, "false", "", "0,SqlAgentMail,1,DatabaseMail" ], [ "AgentShutdownWaitTime", "The Agent Shutdown Wait Time value of the server agent. The accepted value range is between 5 and 600.", "", false, "false", "0", "" ], [ "DatabaseMailProfile", "The Database Mail Profile to be used. Must exists on database mail profiles.", "", false, "false", "", "" ], [ "ErrorLogFile", "Error log file location", "", false, "false", "", "" ], [ "IdleCpuDuration", "Idle CPU Duration value to be used. The accepted value range is between 20 and 86400.", "", false, "false", "0", "" ], [ "IdleCpuPercentage", "Idle CPU Percentage value to be used. The accepted value range is between 10 and 100.", "", false, "false", "0", "" ], [ "CpuPolling", "Enable or Disable the Polling.\r\nAllowed values Enabled, Disabled", "", false, "false", "", "Enabled,Disabled" ], [ "LocalHostAlias", "The value for Local Host Alias configuration", "", false, "false", "", "" ], [ "LoginTimeout", "The value for Login Timeout configuration. The accepted value range is between 5 and 45.", "", false, "false", "0", "" ], [ "MaximumHistoryRows", "Indicates the Maximum job history log size (in rows). The acceptable value range is between 2 and 999999. To turn off the job history limitations use the value -1 and specify 0 for \r\nMaximumJobHistoryRows. See the example listed below.", "", false, "false", "0", "" ], [ "MaximumJobHistoryRows", "Indicates the Maximum job history rows per job. The acceptable value range is between 2 and 999999. To turn off the job history limitations use the value 0 and specify -1 for MaximumHistoryRows. See \r\nthe example listed below.", "", false, "false", "0", "" ], [ "NetSendRecipient", "The Net send recipient value", "", false, "false", "", "" ], [ "ReplaceAlertTokens", "Enable or Disable the Token replacement property.\r\nAllowed values Enabled, Disabled", "", false, "false", "", "Enabled,Disabled" ], [ "SaveInSentFolder", "Enable or Disable the copy of the sent messages is save in the Sent Items folder.\r\nAllowed values Enabled, Disabled", "", false, "false", "", "Enabled,Disabled" ], [ "SqlAgentAutoStart", "Enable or Disable the SQL Agent Auto Start.\r\nAllowed values Enabled, Disabled", "", false, "false", "", "Enabled,Disabled" ], [ "SqlAgentMailProfile", "The SQL Server Agent Mail Profile to be used. Must exists on database mail profiles.", "", false, "false", "", "" ], [ "SqlAgentRestart", "Enable or Disable the SQL Agent Restart.\r\nAllowed values Enabled, Disabled", "", false, "false", "", "Enabled,Disabled" ], [ "SqlServerRestart", "Enable or Disable the SQL Server Restart.\r\nAllowed values Enabled, Disabled", "", false, "false", "", "Enabled,Disabled" ], [ "WriteOemErrorLog", "Enable or Disable the Write OEM Error Log.\r\nAllowed values Enabled, Disabled", "", false, "false", "", "Enabled,Disabled" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaAgentServer [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-InputObject] \u003cJobServer[]\u003e] [[-AgentLogLevel] \u003cObject\u003e] [[-AgentMailType] \u003cObject\u003e] [[-AgentShutdownWaitTime] \u003cInt32\u003e] [[-DatabaseMailProfile] \u003cString\u003e] [[-ErrorLogFile] \u003cString\u003e] [[-IdleCpuDuration] \u003cInt32\u003e] [[-IdleCpuPercentage] \u003cInt32\u003e] [[-CpuPolling] \u003cString\u003e] [[-LocalHostAlias] \u003cString\u003e] [[-LoginTimeout] \u003cInt32\u003e] [[-MaximumHistoryRows] \u003cInt32\u003e] [[-MaximumJobHistoryRows] \u003cInt32\u003e] [[-NetSendRecipient] \u003cString\u003e] [[-ReplaceAlertTokens] \u003cString\u003e] [[-SaveInSentFolder] \u003cString\u003e] \r\n[[-SqlAgentAutoStart] \u003cString\u003e] [[-SqlAgentMailProfile] \u003cString\u003e] [[-SqlAgentRestart] \u003cString\u003e] [[-SqlServerRestart] \u003cString\u003e] [[-WriteOemErrorLog] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaAgListener", "Description": "Sets a listener property for an availability group on a SQL Server instance.\n\nBasically, only the port is settable at this time, so this command updates the listener port.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Sets a listener property for an availability group on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Set-DbaAgListener", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaAgListener", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaAgListener -SqlInstance sql2017 -AvailabilityGroup SharePoint -Port 14333\nChanges the port for the SharePoint AG Listener on sql2017. Prompts for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgListener -SqlInstance sql2017 | Out-GridView -Passthru | Set-DbaAgListener -Port 1433 -Confirm:$false\nChanges the port for selected AG listeners to 1433. Does not prompt for confirmation.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "The Availability Group to which a property will be changed.", "", false, "false", "", "" ], [ "Listener", "Modify only specific listeners.", "", false, "false", "", "" ], [ "Port", "Sets the port number used to communicate with the availability group.", "", true, "false", "0", "" ], [ "InputObject", "Enables piping from Get-DbaAvailabilityGroup", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaAgListener [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [[-Listener] \u003cString[]\u003e] [-Port] \u003cInt32\u003e [[-InputObject] \u003cAvailabilityGroupListener[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaAgReplica", "Description": "Sets the properties for a replica to an availability group on a SQL Server instance.\n\nAutomatically creates a database mirroring endpoint if required.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Sets the properties for a replica to an availability group on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Set-DbaAgReplica", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaAgReplica", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaAgReplica -SqlInstance sql2016 -Replica sql2016 -AvailabilityGroup SharePoint -BackupPriority 5000\nSets the backup priority to 5000 for the sql2016 replica for the SharePoint availability group on sql2016\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgReplica -SqlInstance sql2016 | Out-GridView -Passthru | Set-DbaAgReplica -BackupPriority 5000\nSets the backup priority to 5000 for the selected availability groups.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "The availability group of the replica.", "", false, "false", "", "" ], [ "Replica", "The replicas to modify.", "", false, "false", "", "" ], [ "AvailabilityMode", "Sets the availability mode of the availability group replica. Options are: AsynchronousCommit and SynchronousCommit. SynchronousCommit is default.", "", false, "false", "", "AsynchronousCommit,SynchronousCommit" ], [ "FailoverMode", "Sets the failover mode of the availability group replica. Options are Automatic and Manual.", "", false, "false", "", "Automatic,Manual,External" ], [ "BackupPriority", "Sets the backup priority availability group replica. Default is 50.", "", false, "false", "0", "" ], [ "ConnectionModeInPrimaryRole", "Sets the connection intent modes of an Availability Replica in primary role.", "", false, "false", "", "AllowAllConnections,AllowReadWriteConnections" ], [ "ConnectionModeInSecondaryRole", "Sets the connection modes of an Availability Replica in secondary role.", "", false, "false", "", "AllowAllConnections,AllowNoConnections,AllowReadIntentConnectionsOnly,No,Read-intent only,Yes" ], [ "SeedingMode", "Specifies how the secondary replica will be initially seeded.\nAutomatic enables direct seeding. This method will seed the secondary replica over the network. This method does not require you to backup and restore a copy of the primary database on the replica.\nManual requires you to create a backup of the database on the primary replica and manually restore that backup on the secondary replica.", "", false, "false", "", "Automatic,Manual" ], [ "SessionTimeout", "How many seconds an availability replica waits for a ping response from a connected replica before considering the connection to have failed.", "", false, "false", "0", "" ], [ "EndpointUrl", "The endpoint URL.", "", false, "false", "", "" ], [ "ReadonlyRoutingConnectionUrl", "Sets the read only routing connection url for the availability replica.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaAgReplica.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaAgReplica [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString\u003e] [[-Replica] \u003cString\u003e] [[-AvailabilityMode] \u003cString\u003e] [[-FailoverMode] \u003cString\u003e] [[-BackupPriority] \u003cInt32\u003e] [[-ConnectionModeInPrimaryRole] \u003cString\u003e] [[-ConnectionModeInSecondaryRole] \u003cString\u003e] [[-SeedingMode] \u003cString\u003e] [[-SessionTimeout] \u003cInt32\u003e] [[-EndpointUrl] \u003cString\u003e] [[-ReadonlyRoutingConnectionUrl] \u003cString\u003e] [[-InputObject] \u003cAvailabilityReplica\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaAvailabilityGroup", "Description": "Sets availability group properties on a SQL Server instance.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Sets availability group properties on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Set-DbaAvailabilityGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaAvailabilityGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sql2016 | Set-DbaAvailabilityGroup -DtcSupportEnabled\nEnables DTC for all availability groups on sql2016\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sql2016 -AvailabilityGroup AG1 | Set-DbaAvailabilityGroup -DtcSupportEnabled:$false\nDisables DTC support for the availability group AG1\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaAvailabilityGroup -SqlInstance sql2016 -AvailabilityGroup AG1 -DtcSupportEnabled:$false\nDisables DTC support for the availability group AG1", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "Only set specific availability group properties.", "", false, "false", "", "" ], [ "AllAvailabilityGroups", "Set properties for all availability group on an instance.", "", false, "false", "False", "" ], [ "DtcSupportEnabled", "Enables DtcSupport.", "", false, "false", "False", "" ], [ "ClusterType", "Cluster type of the Availability Group. Only supported in SQL Server 2017 and above.\r\nOptions include: External, Wsfc or None.", "", false, "false", "", "External,Wsfc,None" ], [ "AutomatedBackupPreference", "Specifies how replicas in the primary role are treated in the evaluation to pick the desired replica to perform a backup.", "", false, "false", "", "None,Primary,Secondary,SecondaryOnly" ], [ "FailureConditionLevel", "Specifies the different conditions that can trigger an automatic failover in Availability Group.", "", false, "false", "", "OnAnyQualifiedFailureCondition,OnCriticalServerErrors,OnModerateServerErrors,OnServerDown,OnServerUnresponsive" ], [ "HealthCheckTimeout", "This setting used to specify the length of time, in milliseconds, that the SQL Server resource DLL should wait for information returned by the sp_server_diagnostics stored procedure before reporting \r\nthe Always On Failover Cluster Instance (FCI) as unresponsive.\nChanges that are made to the timeout settings are effective immediately and do not require a restart of the SQL Server resource.\nDefaults is 30000 (30 seconds).", "", false, "false", "0", "" ], [ "BasicAvailabilityGroup", "Indicates whether the availability group is basic. Basic availability groups like pumpkin spice and uggs.\nhttps://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/basic-availability-groups-always-on-availability-groups", "", false, "false", "False", "" ], [ "DatabaseHealthTrigger", "Indicates whether the availability group triggers the database health.", "", false, "false", "False", "" ], [ "IsDistributedAvailabilityGroup", "Indicates whether the availability group is distributed.", "", false, "false", "False", "" ], [ "InputObject", "Enables piping from Get-DbaAvailabilityGroup.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaAvailabilityGroup [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString[]\u003e] [-AllAvailabilityGroups] [-DtcSupportEnabled] [[-ClusterType] \u003cString\u003e] [[-AutomatedBackupPreference] \u003cString\u003e] [[-FailureConditionLevel] \u003cString\u003e] [[-HealthCheckTimeout] \u003cInt32\u003e] [-BasicAvailabilityGroup] [-DatabaseHealthTrigger] [-IsDistributedAvailabilityGroup] [[-InputObject] \u003cAvailabilityGroup[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaCmConnection", "Description": "Configures a connection object for use in remote computer management.\nThis function will either create new records for computers that have no connection registered so far, or it will configure existing connections if already present.\n\nAs such it can be handy in making bulk-edits on connections or manually adjusting some settings.", "Tags": [ "ComputerManagement", "CIM" ], "Synopsis": "Configures a connection object for use in remote computer management.", "Alias": "", "Author": "Friedrich Weinmann (@FredWeinmann)", "CommandName": "Set-DbaCmConnection", "Availability": "Windows only", "Links": "https://dbatools.io/Set-DbaCmConnection", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaCmConnection sql2014 | Set-DbaCmConnection -ClearBadCredential -UseWindowsCredentials\nRetrieves the already existing connection to sql2014, removes the list of not working credentials and configures it to default to the credentials of the logged on user.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaCmConnection | Set-DbaCmConnection -RemoveBadCredential $cred\nRemoves the credentials stored in $cred from all connections\u0027 list of \"known to not work\" credentials.\r\nHandy to update changes in privilege.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaCmConnection | Export-Clixml .\\connections.xml\nPS C:\\\u003e Import-Clixml .\\connections.xml | Set-DbaCmConnection -ResetConfiguration\nAt first, the current cached connections are stored in an xml file. At a later time - possibly in the profile when starting the console again - those connections are imported again and applied again \r\nto the connection cache.\nIn this example, the configuration settings will also be reset, since after re-import those will be set to explicit, rather than deriving them from the global settings.\r\nIn many cases, using the default settings is desirable. For specific settings, use New-DbaCmConnection as part of the profile in order to explicitly configure a connection.", "Params": [ [ "ComputerName", "The computer to build the connection object for.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "The credential to register.", "", false, "false", "", "" ], [ "UseWindowsCredentials", "Whether using the default windows credentials is legit.\r\nNot setting this will not exclude using windows credentials, but only not pre-confirm them as working.", "", false, "false", "False", "" ], [ "OverrideExplicitCredential", "Setting this will enable the credential override.\r\nThe override will cause the system to ignore explicitly specified credentials, so long as known, good credentials are available.", "", false, "false", "False", "" ], [ "OverrideConnectionPolicy", "Setting this will configure the connection policy override.\r\nBy default, global configurations enforce, which connection type is available at all and which is disabled.", "", false, "false", "False", "" ], [ "DisabledConnectionTypes", "Explicitly disable connection types.\r\nThese types will then not be used for connecting to the computer.", "", false, "false", "None", "" ], [ "DisableBadCredentialCache", "Will prevent the caching of credentials if set to true.", "", false, "false", "False", "" ], [ "DisableCimPersistence", "Will prevent Cim-Sessions to be reused.", "", false, "false", "False", "" ], [ "DisableCredentialAutoRegister", "Will prevent working credentials from being automatically cached", "", false, "false", "False", "" ], [ "EnableCredentialFailover", "Will enable automatic failing over to known to work credentials, when using bad credentials.\r\nBy default, passing bad credentials will cause the Computer Management functions to interrupt with a warning (Or exception if in silent mode).", "", false, "false", "False", "" ], [ "WindowsCredentialsAreBad", "Will prevent the windows credentials of the currently logged on user from being used for the remote connection.", "", false, "false", "False", "" ], [ "CimWinRMOptions", "Specify a set of options to use when connecting to the target computer using CIM over WinRM.\r\nUse \u0027New-CimSessionOption\u0027 to create such an object.", "", false, "false", "", "" ], [ "CimDCOMOptions", "Specify a set of options to use when connecting to the target computer using CIM over DCOM.\r\nUse \u0027New-CimSessionOption\u0027 to create such an object.", "", false, "false", "", "" ], [ "AddBadCredential", "Adds credentials to the bad credential cache.\r\nThese credentials will not be used when connecting to the target remote computer.", "", false, "false", "", "" ], [ "RemoveBadCredential", "Removes credentials from the bad credential cache.", "", false, "false", "", "" ], [ "ClearBadCredential", "Clears the cache of credentials that didn\u0027t worked.\r\nWill be applied before adding entries to the credential cache.", "", false, "false", "False", "" ], [ "ClearCredential", "Clears the cache of credentials that worked.\r\nWill be applied before adding entries to the credential cache.", "", false, "false", "False", "" ], [ "ResetCredential", "Resets all credential-related caches:\r\n- Clears bad credential cache\r\n- Removes last working credential\r\n- Un-Confirms the windows credentials as working\r\n- Un-Confirms the windows credentials as not working\nAutomatically implies the parameters -ClearCredential and -ClearBadCredential. Using them together is redundant.\r\nWill be applied before adding entries to the credential cache.", "", false, "false", "False", "" ], [ "ResetConnectionStatus", "Restores all connection status to default, as if no connection protocol had ever been tested.", "", false, "false", "False", "" ], [ "ResetConfiguration", "Restores the configuration back to system default.\r\nConfiguration elements are the basic behavior controlling settings, such as whether to cache bad credentials, etc.\r\nThese can be configured globally using the dbatools configuration system and overridden locally on a per-connection basis.\r\nFor a list of all available settings, use \"Get-DbatoolsConfig -Module ComputerManagement\".", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaCmConnection [-ComputerName \u003cDbaCmConnectionParameter[]\u003e] [-Credential \u003cPSCredential\u003e] [-OverrideExplicitCredential] [-OverrideConnectionPolicy] [-DisabledConnectionTypes {None | CimRM | CimDCOM | Wmi | PowerShellRemoting}] [-DisableBadCredentialCache] [-DisableCimPersistence] [-DisableCredentialAutoRegister] [-EnableCredentialFailover] [-WindowsCredentialsAreBad] [-CimWinRMOptions \u003cWSManSessionOptions\u003e] [-CimDCOMOptions \u003cDComSessionOptions\u003e] [-AddBadCredential \u003cPSCredential[]\u003e] [-RemoveBadCredential \u003cPSCredential[]\u003e] [-ClearBadCredential] [-ClearCredential] [-ResetCredential] \r\n[-ResetConnectionStatus] [-ResetConfiguration] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nSet-DbaCmConnection [-ComputerName \u003cDbaCmConnectionParameter[]\u003e] [-UseWindowsCredentials] [-OverrideExplicitCredential] [-OverrideConnectionPolicy] [-DisabledConnectionTypes {None | CimRM | CimDCOM | Wmi | PowerShellRemoting}] [-DisableBadCredentialCache] [-DisableCimPersistence] [-DisableCredentialAutoRegister] [-EnableCredentialFailover] [-CimWinRMOptions \u003cWSManSessionOptions\u003e] [-CimDCOMOptions \u003cDComSessionOptions\u003e] [-AddBadCredential \u003cPSCredential[]\u003e] [-RemoveBadCredential \u003cPSCredential[]\u003e] [-ClearBadCredential] [-ClearCredential] [-ResetCredential] [-ResetConnectionStatus] \r\n[-ResetConfiguration] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaDbCompatibility", "Description": "Sets the current database compatibility level for all databases on a server or list of databases passed in to the function.", "Tags": [ "Compatibility", "Database" ], "Synopsis": "Sets the compatibility level for SQL Server databases.", "Alias": "", "Author": "Garry Bargsley, http://blog.garrybargsley.com/", "CommandName": "Set-DbaDbCompatibility", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaDbCompatibility", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaDbCompatibility -SqlInstance localhost\\sql2017\nChanges database compatibility level for all user databases on server localhost\\sql2017 that have a Compatibility level that do not match\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaDbCompatibility -SqlInstance localhost\\sql2017 -TargetCompatibility 12\nChanges database compatibility level for all user databases on server localhost\\sql2017 to Version120\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaDbCompatibility -SqlInstance localhost\\sql2017 -Database Test -TargetCompatibility 12\nChanges database compatibility level for database Test on server localhost\\sql2017 to Version 120", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "SqlLogin to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance..", "", false, "false", "", "" ], [ "Database", "The database or databases to process. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "Compatibility", "The target compatibility level version. Same format as returned by Get-DbaDbCompatibility\r\nVersion90 = SQL Server 2005\r\nVersion100 = SQL Server 2008\r\nVersion110 = SQL Server 2012\r\nVersion120 = SQL Server 2014\r\nVersion130 = SQL Server 2016\r\nVersion140 = SQL Server 2017\r\nVersion150 = SQL Server 2019", "", false, "false", "", "" ], [ "TargetCompatibility", "Deprecated parameter. Please use Compatibility instead.\nThe target compatibility level version. This is an int and follows Microsoft\u0027s versioning:\n9 = SQL Server 2005\r\n10 = SQL Server 2008\r\n11 = SQL Server 2012\r\n12 = SQL Server 2014\r\n13 = SQL Server 2016\r\n14 = SQL Server 2017\r\n15 = SQL Server 2019", "", false, "false", "0", "9,10,11,12,13,14,15" ], [ "InputObject", "A collection of databases (such as returned by Get-DbaDatabase)", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run", "wi", false, "false", "", "" ], [ "Confirm", "Prompts for confirmation of every step. For example:\nAre you sure you want to perform this action?\r\nPerforming the operation \"Update database\" on target \"pubs on SQL2016\\VNEXT\".\r\n[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is \"Y\"):", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaDbCompatibility [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Compatibility] {Version60 | Version65 | Version70 | Version80 | Version90 | Version100 | Version110 | Version120 | Version130 | Version140 | Version150}] [[-TargetCompatibility] \u003cInt32\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaDbCompression", "Description": "This function sets the appropriate compression recommendation, determined either by using the Tiger Team\u0027s query or set to the CompressionType parameter.\n\nRemember Uptime is critical for the Tiger Team query, the longer uptime, the more accurate the analysis is.\nYou would probably be best if you utilized Get-DbaUptime first, before running this command.\n\nSet-DbaDbCompression script derived from GitHub and the tigertoolbox\n(https://github.com/Microsoft/tigertoolbox/tree/master/Evaluate-Compression-Gains)", "Tags": [ "Compression", "Table", "Database" ], "Synopsis": "Sets tables and indexes with preferred compression setting.", "Alias": "", "Author": "Jason Squires (@js_0505), jstexasdba@gmail.com", "CommandName": "Set-DbaDbCompression", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaDbCompression", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaDbCompression -SqlInstance localhost -MaxRunTime 60 -PercentCompression 25\nSet the compression run time to 60 minutes and will start the compression of tables/indexes that have a difference of 25% or higher between current and recommended.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaDbCompression -SqlInstance ServerA -Database DBName -CompressionType Page -Table table1, table2\nUtilizes Page compression for tables table1 and table2 in DBName on ServerA with no time limit.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaDbCompression -SqlInstance ServerA -Database DBName -PercentCompression 25 | Out-GridView\nWill compress tables/indexes within the specified database that would show any % improvement with compression and with no time limit. The results will be piped into a nicely formatted GridView.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$testCompression = Test-DbaDbCompression -SqlInstance ServerA -Database DBName\nPS C:\\\u003e Set-DbaDbCompression -SqlInstance ServerA -Database DBName -InputObject $testCompression\nGets the compression suggestions from Test-DbaDbCompression into a variable, this can then be reviewed and passed into Set-DbaDbCompression.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Set-DbaDbCompression -SqlInstance ServerA -ExcludeDatabase Database -SqlCredential $cred -MaxRunTime 60 -PercentCompression 25\nSet the compression run time to 60 minutes and will start the compression of tables/indexes for all databases except the specified excluded database. Only objects that have a difference of 25% or \r\nhigher between current and recommended will be compressed.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$servers = \u0027Server1\u0027,\u0027Server2\u0027\nPS C:\\\u003e foreach ($svr in $servers) {\r\n\u003e\u003e Set-DbaDbCompression -SqlInstance $svr -MaxRunTime 60 -PercentCompression 25 | Export-Csv -Path C:\\temp\\CompressionAnalysisPAC.csv -Append\r\n\u003e\u003e }\nSet the compression run time to 60 minutes and will start the compression of tables/indexes across all listed servers that have a difference of 25% or higher between current and recommended. Output \r\nof command is exported to a csv.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto populated from the server.", "", false, "false", "", "" ], [ "Table", "The table(s) to process. If unspecified, all tables will be processed.", "", false, "false", "", "" ], [ "CompressionType", "Control the compression type applied. Default is \u0027Recommended\u0027 which uses the Tiger Team query to use the most appropriate setting per object. Other option is to compress all objects to either Row or \r\nPage.", "", false, "false", "Recommended", "Recommended,Page,Row,None" ], [ "MaxRunTime", "Will continue to alter tables and indexes for the given amount of minutes.", "", false, "false", "0", "" ], [ "PercentCompression", "Will only work on the tables/indexes that have the calculated savings at and higher for the given number provided.", "", false, "false", "0", "" ], [ "InputObject", "Takes the output of Test-DbaDbCompression as an object and applied compression based on those recommendations.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaDbCompression [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-Table] \u003cString[]\u003e] [[-CompressionType] \u003cString\u003e] [[-MaxRunTime] \u003cInt32\u003e] [[-PercentCompression] \u003cInt32\u003e] [[-InputObject] \u003cObject\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaDbFileGroup", "Description": "Sets the options for a filegroup for the specified database(s).", "Tags": [ "Data", "Database", "File", "FileGroup", "Migration", "Partitioning", "Table" ], "Synopsis": "Sets the options for a filegroup.", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "Set-DbaDbFileGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaDbFileGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaDbFileGroup -SqlInstance sqldev1 -Database TestDb -FileGroup HRFG1 -Default -AutoGrowAllFiles\nSets the HRFG1 filegroup to auto grow all files and makes it the default filegroup on the TestDb database on the sqldev1 instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaDbFileGroup -SqlInstance sqldev1 -Database TestDb -FileGroup HRFG1 -AutoGrowAllFiles:$false\nSets the HRFG1 filegroup to not auto grow all files on the TestDb database on the sqldev1 instance.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaDbFileGroup -SqlInstance sqldev1 -Database TestDb -FileGroup HRFG1 -ReadOnly\nSets the HRFG1 filegroup to read only on the TestDb database on the sqldev1 instance.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaDbFileGroup -SqlInstance sqldev1 -Database TestDb -FileGroup HRFG1 -ReadOnly:$false\nSets the HRFG1 filegroup to read/write on the TestDb database on the sqldev1 instance.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqldev1 -Database TestDb | Set-DbaDbFileGroup -FileGroup HRFG1 -AutoGrowAllFiles\nPasses in the TestDB database from the sqldev1 instance and sets the HRFG1 filegroup to auto grow all files.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaDbFileGroup -SqlInstance sqldev1 -Database TestDb -FileGroup HRFG1 | Set-DbaDbFileGroup -AutoGrowAllFiles\nPasses in the HRFG1 filegroup from the TestDB database on the sqldev1 instance and sets it to auto grow all files.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database(s).", "", false, "false", "", "" ], [ "FileGroup", "The name(s) of the filegroup(s).", "", false, "false", "", "" ], [ "Default", "Specifies if the filegroup should be the default. Only one filegroup in a database can be specified as the default.", "", false, "false", "False", "" ], [ "ReadOnly", "Specifies the filegroup should be readonly. To change the filegroup to readwrite use -ReadOnly:$false", "", false, "false", "False", "" ], [ "AutoGrowAllFiles", "Specifies the filegroup should auto grow all files if one file has met the threshold to auto grow. To revert this setting use -AutoGrowAllFiles:$false", "", false, "false", "False", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase and Get-DbaDbFileGroup.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaDbFileGroup [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-FileGroup] \u003cString[]\u003e] [-Default] [-ReadOnly] [-AutoGrowAllFiles] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaDbFileGrowth", "Description": "Sets databases to a non-default growth and growth type. 64MB by default.\n\nTo get the file growth, use Get-DbaDbFile.", "Tags": "Database", "Synopsis": "Sets databases to a non-default growth and growth type. 64MB by default.\n\nTo get the file growth, use Get-DbaDbFile.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Set-DbaDbFileGrowth", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaDbFileGrowth", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaDbFileGrowth -SqlInstance sql2016 -Database test -GrowthType GB -Growth 1\nSets the test database on sql2016 to a growth of 1GB\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2016 -Database test | Set-DbaDbFileGrowth -GrowthType GB -Growth 1\nSets the test database on sql2016 to a growth of 1GB\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDatabase | Set-DbaDbFileGrowth -SqlInstance sql2017, sql2016, sql2012\nSets all database files on sql2017, sql2016, sql2012 to 64MB.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaDbFileGrowth -SqlInstance sql2017, sql2016, sql2012 -Database test -WhatIf\nShows what would happen if the command were executed", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The name of the target databases", "", false, "false", "", "" ], [ "GrowthType", "The growth type, MB by default - valid values are MB, KB, GB or TB.", "", false, "false", "MB", "KB,MB,GB,TB" ], [ "Growth", "The growth value. 64 by default.", "", false, "false", "64", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaDbFileGrowth [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-GrowthType] \u003cString\u003e] [[-Growth] \u003cInt32\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaDbIdentity", "Description": "Use the command DBCC CHECKIDENT to check and if necessary update the current identity value of a table and return results\nCan update an individual table via the ReSeedValue and RESEED option of DBCC CHECKIDENT\n\nRead more:\n - https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-checkident-transact-sql", "Tags": "DBCC", "Synopsis": "Checks and updates the current identity value via DBCC CHECKIDENT", "Alias": "", "Author": "Patrick Flynn (@sqllensman)", "CommandName": "Set-DbaDbIdentity", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaDbIdentity", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaDbIdentity -SqlInstance SQLServer2017 -Database AdventureWorks2014 -Table \u0027Production.ScrapReason\u0027\nConnects to AdventureWorks2014 on instance SqlServer2017 using Windows Authentication and runs the command DBCC CHECKIDENT(\u0027Production.ScrapReason\u0027) to return the current identity value.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e \u0027Sql1\u0027,\u0027Sql2/sqlexpress\u0027 | Set-DbaDbIdentity -SqlCredential $cred -Database AdventureWorks2014 -Table \u0027Production.ScrapReason\u0027\nConnects to AdventureWorks2014 on instances Sql1 and Sql2/sqlexpress using sqladmin credential and runs the command DBCC CHECKIDENT(\u0027Production.ScrapReason\u0027) to return the current identity value.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$query = \"Select Schema_Name(t.schema_id) +\u0027.\u0027 + t.name as TableName from sys.columns c INNER JOIN sys.tables t on t.object_id = c.object_id WHERE is_identity = 1\"\nPS C:\\\u003e $IdentityTables = Invoke-DbaQuery -SqlInstance SQLServer2017 -Database AdventureWorks2014 -Query $query\r\nPS C:\\\u003e foreach ($tbl in $IdentityTables) {\r\nPS C:\\\u003e Set-DbaDbIdentity -SqlInstance SQLServer2017 -Database AdventureWorks2014 -Table $tbl.TableName\r\nPS C:\\\u003e }\nChecks the current identity value for all tables with an Identity in the AdventureWorks2014 database on the SQLServer2017 and, if it is needed, changes the identity value.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.\r\nOnly one database should be specified when using a RESEED value", "", false, "false", "", "" ], [ "Table", "The table(s) for which to check the current identity value.\r\nOnly one table should be specified when using a RESEED value", "", false, "false", "", "" ], [ "ReSeedValue", "The new reseed value to be used to set as the current identity value.", "", false, "false", "0", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the cmdlet runs. The cmdlet is not run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the cmdlet.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaDbIdentity [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Table] \u003cString[]\u003e] [[-ReSeedValue] \u003cInt32\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaDbMirror", "Description": "Sets properties of database mirrors.", "Tags": [ "Mirroring", "Mirror", "HA" ], "Synopsis": "Sets properties of database mirrors.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Set-DbaDbMirror", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaDbMirror", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaDbMirror -SqlInstance sql2005 -Database dbatools -Partner TCP://SQL2008.ad.local:5374\nPrompts for confirmation then sets the partner to TCP://SQL2008.ad.local:5374 for the database \"dbtools\"\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaDbMirror -SqlInstance sql2005 -Database dbatools -Witness TCP://SQL2012.ad.local:5502 -Confirm:$false\nDoes not prompt for confirmation and sets the witness to TCP://SQL2012.ad.local:5502 for the database \"dbtools\"\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2005 | Out-GridView -PassThru | Set-DbaDbMirror -SafetyLevel Full -Confirm:$false\nSets the safety level to Full for databases selected from a grid view. Does not prompt for confirmation.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaDbMirror -SqlInstance sql2005 -Database dbatools -State Suspend -Confirm:$false\nDoes not prompt for confirmation and sets the state to suspend for the database \"dbtools\"", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database.", "", false, "false", "", "" ], [ "Partner", "Sets the partner Fully Qualified Domain Name.", "", false, "false", "", "" ], [ "Witness", "Sets the witness Fully Qualified Domain Name.", "", false, "false", "", "" ], [ "SafetyLevel", "Sets the mirroring safety level.", "", false, "false", "", "Full,Off,None" ], [ "State", "Sets the mirror state.", "", false, "false", "", "ForceFailoverAndAllowDataLoss,Failover,RemoveWitness,Resume,Suspend,Off" ], [ "InputObject", "Allows piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaDbMirror [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-Partner] \u003cString\u003e] [[-Witness] \u003cString\u003e] [[-SafetyLevel] \u003cString\u003e] [[-State] \u003cString\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaDbOwner", "Description": "This function will alter database ownership 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 function 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", "Tags": [ "Database", "Owner", "DbOwner" ], "Synopsis": "Sets database owners with a desired login if databases do not match that owner.", "Alias": "", "Author": "Michael Fal (@Mike_Fal), http://mikefal.net", "CommandName": "Set-DbaDbOwner", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaDbOwner", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaDbOwner -SqlInstance localhost\nSets database owner to \u0027sa\u0027 on all databases where the owner does not match \u0027sa\u0027.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaDbOwner -SqlInstance localhost -TargetLogin DOMAIN\\account\nSets the database owner to DOMAIN\\account on all databases where the owner does not match DOMAIN\\account.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaDbOwner -SqlInstance sqlserver -Database db1, db2\nSets database owner to \u0027sa\u0027 on the db1 and db2 databases if their current owner does not match \u0027sa\u0027.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$db = Get-DbaDatabase -SqlInstance localhost -Database db1, db2\nPS C:\\\u003e $db | Set-DbaDbOwner -TargetLogin DOMAIN\\account\nSets database owner to \u0027sa\u0027 on the db1 and db2 databases if their current owner does not match \u0027sa\u0027.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "TargetLogin", "Specifies the login that you wish check for ownership. This defaults to \u0027sa\u0027 or the sysadmin name if sa was renamed. This must be a valid security principal which exists on the target server.", "Login", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaDbOwner [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [[-TargetLogin] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaDbQueryStoreOption", "Description": "Configure Query Store settings for a specific or multiple databases.", "Tags": "QueryStore", "Synopsis": "Configure Query Store settings for a specific or multiple databases.", "Alias": "", "Author": "Enrico van de Laar (@evdlaar) | Tracy Boggiano ( @TracyBoggiano )", "CommandName": "Set-DbaDbQueryStoreOption", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaDbQueryStoreOption", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaDbQueryStoreOption -SqlInstance ServerA\\SQL -State ReadWrite -FlushInterval 600 -CollectionInterval 10 -MaxSize 100 -CaptureMode All -CleanupMode Auto -StaleQueryThreshold 100 \r\n-AllDatabases\nConfigure the Query Store settings for all user databases in the ServerA\\SQL Instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaDbQueryStoreOption -SqlInstance ServerA\\SQL -FlushInterval 600\nOnly configure the FlushInterval setting for all Query Store databases in the ServerA\\SQL Instance.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaDbQueryStoreOption -SqlInstance ServerA\\SQL -Database AdventureWorks -State ReadWrite -FlushInterval 600 -CollectionInterval 10 -MaxSize 100 -CaptureMode all -CleanupMode Auto \r\n-StaleQueryThreshold 100\nConfigure the Query Store settings for the AdventureWorks database in the ServerA\\SQL Instance.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaDbQueryStoreOption -SqlInstance ServerA\\SQL -Exclude AdventureWorks -State ReadWrite -FlushInterval 600 -CollectionInterval 10 -MaxSize 100 -CaptureMode all -CleanupMode Auto \r\n-StaleQueryThreshold 100\nConfigure the Query Store settings for all user databases except the AdventureWorks database in the ServerA\\SQL Instance.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "SqlLogin to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance..", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "AllDatabases", "Run command against all user databases", "", false, "false", "False", "" ], [ "State", "Set the state of the Query Store. Valid options are \"ReadWrite\", \"ReadOnly\" and \"Off\".", "", false, "false", "", "ReadWrite,ReadOnly,Off" ], [ "FlushInterval", "Set the flush to disk interval of the Query Store in seconds.", "", false, "false", "0", "" ], [ "CollectionInterval", "Set the runtime statistics collection interval of the Query Store in minutes.", "", false, "false", "0", "" ], [ "MaxSize", "Set the maximum size of the Query Store in MB.", "", false, "false", "0", "" ], [ "CaptureMode", "Set the query capture mode of the Query Store. Valid options are \"Auto\" and \"All\".", "", false, "false", "", "Auto,All,None,Custom" ], [ "CleanupMode", "Set the query cleanup mode policy. Valid options are \"Auto\" and \"Off\".", "", false, "false", "", "Auto,Off" ], [ "StaleQueryThreshold", "Set the stale query threshold in days.", "", false, "false", "0", "" ], [ "MaxPlansPerQuery", "Set the max plans per query captured and kept.", "", false, "false", "0", "" ], [ "WaitStatsCaptureMode", "Set wait stats capture on or off.", "", false, "false", "", "On,Off" ], [ "CustomCapturePolicyExecutionCount", "Set the custom capture policy execution count. Only available in SQL Server 2019 and above.", "", false, "false", "0", "" ], [ "CustomCapturePolicyTotalCompileCPUTimeMS", "Set the custom capture policy total compile CPU time. Only available in SQL Server 2019 and above.", "", false, "false", "0", "" ], [ "CustomCapturePolicyTotalExecutionCPUTimeMS", "Set the custom capture policy total execution CPU time. Only available in SQL Server 2019 and above.", "", false, "false", "0", "" ], [ "CustomCapturePolicyStaleThresholdHours", "Set the custom capture policy stale threshold. Only available in SQL Server 2019 and above.", "", false, "false", "0", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run", "wi", false, "false", "", "" ], [ "Confirm", "Prompts for confirmation of every step. For example:\nAre you sure you want to perform this action?\r\nPerforming the operation \"Changing Desired State\" on target \"pubs on SQL2016\\VNEXT\".\r\n[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is \"Y\"):", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaDbQueryStoreOption [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-AllDatabases] [[-State] \u003cString[]\u003e] [[-FlushInterval] \u003cInt64\u003e] [[-CollectionInterval] \u003cInt64\u003e] [[-MaxSize] \u003cInt64\u003e] [[-CaptureMode] \u003cString[]\u003e] [[-CleanupMode] \u003cString[]\u003e] [[-StaleQueryThreshold] \u003cInt64\u003e] [[-MaxPlansPerQuery] \u003cInt64\u003e] [[-WaitStatsCaptureMode] \u003cString[]\u003e] [[-CustomCapturePolicyExecutionCount] \u003cInt64\u003e] [[-CustomCapturePolicyTotalCompileCPUTimeMS] \u003cInt64\u003e] [[-CustomCapturePolicyTotalExecutionCPUTimeMS] \u003cInt64\u003e] \r\n[[-CustomCapturePolicyStaleThresholdHours] \u003cInt64\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaDbRecoveryModel", "Description": "Set-DbaDbRecoveryModel sets the Recovery Model for all databases except TEMPDB.", "Tags": [ "RecoveryModel", "Database" ], "Synopsis": "Set-DbaDbRecoveryModel sets the Recovery Model.", "Alias": "", "Author": "Viorel Ciucu (@viorelciucu), https://www.cviorel.com", "CommandName": "Set-DbaDbRecoveryModel", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaDbRecoveryModel", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaDbRecoveryModel -SqlInstance sql2014 -RecoveryModel BulkLogged -Database model -Confirm:$true -Verbose\nSets the Recovery Model to BulkLogged for database [model] on SQL Server instance sql2014. User is requested to confirm the action.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2014 -Database TestDB | Set-DbaDbRecoveryModel -RecoveryModel Simple -Confirm:$false\nSets the Recovery Model to Simple for database [TestDB] on SQL Server instance sql2014. Confirmation is not required.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaDbRecoveryModel -SqlInstance sql2014 -RecoveryModel Simple -Database TestDB -Confirm:$false\nSets the Recovery Model to Simple for database [TestDB] on SQL Server instance sql2014. Confirmation is not required.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaDbRecoveryModel -SqlInstance sql2014 -RecoveryModel Simple -AllDatabases -Confirm:$false\nSets the Recovery Model to Simple for ALL user and system databases (except TEMPDB) on SQL Server instance sql2014. Runs without asking for confirmation.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eSet-DbaDbRecoveryModel -SqlInstance sql2014 -RecoveryModel BulkLogged -Database TestDB1, TestDB2 -Confirm:$false -Verbose\nSets the Recovery Model to BulkLogged for [TestDB1] and [TestDB2] databases on SQL Server instance sql2014. Runs without asking for confirmation.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "RecoveryModel", "Recovery Model to be set. Valid options are \u0027Simple\u0027, \u0027Full\u0027, \u0027BulkLogged\u0027\nDetails about the recovery models can be found here:\r\nhttps://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/recovery-models-sql-server", "", true, "false", "", "Simple,Full,BulkLogged" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. if unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "AllDatabases", "This is a parameter that was included for safety, so you don\u0027t accidentally set options on all databases without specifying", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "InputObject", "A collection of databases (such as returned by Get-DbaDatabase)", "", true, "true (ByValue)", "", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts for confirmation. For example:\nAre you sure you want to perform this action?\r\nPerforming the operation \"ALTER DATABASE [model] SET RECOVERY Full\" on target \"[model] on WERES14224\".\r\n[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is \"Y\"):", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaDbRecoveryModel [-SqlCredential \u003cPSCredential\u003e] -RecoveryModel \u003cString\u003e [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-AllDatabases] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nSet-DbaDbRecoveryModel -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] -RecoveryModel \u003cString\u003e [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-AllDatabases] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nSet-DbaDbRecoveryModel [-SqlCredential \u003cPSCredential\u003e] -RecoveryModel \u003cString\u003e [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-AllDatabases] [-EnableException] -InputObject \u003cDatabase[]\u003e [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaDbSchema", "Description": "Updates the owner for one or more schemas.", "Tags": [ "Data", "Database", "Migration", "Permission", "Security", "Schema", "Table", "User" ], "Synopsis": "Updates the owner for one or more schemas.", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "Set-DbaDbSchema", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaDbSchema", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaDbSchema -SqlInstance sqldev01 -Database example1 -Schema TestSchema1 -SchemaOwner dbatools\nUpdates the TestSchema1 schema in the example1 database in the sqldev01 instance. The dbatools user will be the new owner of the schema.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqldev01, sqldev02 -Database example1 | Set-DbaDbSchema -Schema TestSchema1, TestSchema2 -SchemaOwner dbatools\nPasses in the example1 db via pipeline and updates the TestSchema1 and TestSchema2 schemas and assigns the dbatools user as the owner of the schemas.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database(s).", "", false, "false", "", "" ], [ "Schema", "The name(s) of the schema(s)", "", true, "false", "", "" ], [ "SchemaOwner", "The name of the database user that will own the schema(s).", "", true, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaDbSchema [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [-Schema] \u003cString[]\u003e [-SchemaOwner] \u003cString\u003e [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaDbSequence", "Description": "Modifies a sequence in the database(s) specified.", "Tags": [ "Data", "Sequence", "Table" ], "Synopsis": "Modifies a sequence.", "Alias": "", "Author": "Adam Lancaster https://github.com/lancasteradam", "CommandName": "Set-DbaDbSequence", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaDbSequence", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaDbSequence -SqlInstance sqldev01 -Database TestDB -Name TestSequence -RestartWith 10000 -IncrementBy 10\nModifies the sequence TestSequence in the TestDB database on the sqldev01 instance. The sequence will restart with 10000 and increment by 10.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqldev01 -Database TestDB | Set-DbaDbSequence -Name TestSequence -Schema TestSchema -Cycle\nUsing a pipeline this command modifies the sequence named TestSchema.TestSequence in the TestDB database on the sqldev01 instance. The sequence will now cycle the sequence values.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function\r\nto be executed against multiple SQL Server instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The target database(s).", "", false, "false", "", "" ], [ "Name", "The name of the new sequence", "", true, "false", "", "" ], [ "Schema", "The name of the schema for the sequence. The default is dbo.", "", false, "false", "dbo", "" ], [ "RestartWith", "The first value for the sequence to restart with.", "", false, "false", "0", "" ], [ "IncrementBy", "The value to increment by.", "", false, "false", "0", "" ], [ "MinValue", "The minimum bound for the sequence.", "", false, "false", "0", "" ], [ "MaxValue", "The maximum bound for the sequence.", "", false, "false", "0", "" ], [ "Cycle", "Switch that indicates if the sequence should cycle the values", "", false, "false", "False", "" ], [ "CacheSize", "The integer size of the cache. To specify NO CACHE for a sequence use -CacheSize 0. As noted in the Microsoft documentation if the cache size is not specified the Database Engine will select a size.", "", false, "false", "0", "" ], [ "InputObject", "Allows piping from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaDbSequence [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [-Name] \u003cString\u003e [[-Schema] \u003cString\u003e] [[-RestartWith] \u003cInt64\u003e] [[-IncrementBy] \u003cInt64\u003e] [[-MinValue] \u003cInt64\u003e] [[-MaxValue] \u003cInt64\u003e] [-Cycle] [[-CacheSize] \u003cInt32\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaDbState", "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", "Tags": [ "Database", "State" ], "Synopsis": "Sets various options for databases, hereby called \"states\"", "Alias": "", "Author": "Simone Bizzotto (@niphold)", "CommandName": "Set-DbaDbState", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaDbState", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaDbState -SqlInstance sqlserver2014a -Database HR -Offline\nSets the HR database as OFFLINE\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaDbState -SqlInstance sqlserver2014a -AllDatabases -Exclude HR -ReadOnly -Force\nSets all databases of the sqlserver2014a instance, except for HR, as READ_ONLY\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDbState -SqlInstance sql2016 | Where-Object Status -eq \u0027Offline\u0027 | Set-DbaDbState -Online\nFinds all offline databases and sets them to online\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaDbState -SqlInstance sqlserver2014a -Database HR -SingleUser\nSets the HR database as SINGLE_USER\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eSet-DbaDbState -SqlInstance sqlserver2014a -Database HR -SingleUser -Force\nSets the HR database as SINGLE_USER, dropping all other connections (and rolling back open transactions)\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sqlserver2014a -Database HR | Set-DbaDbState -SingleUser -Force\nGets the databases from Get-DbaDatabase, and sets them as SINGLE_USER, dropping all other connections (and rolling back open transactions)", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "true (ByPropertyName)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. if unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "AllDatabases", "This is a parameter that was included for safety, so you don\u0027t accidentally set options on all databases without specifying", "", false, "false", "False", "" ], [ "ReadOnly", "RW Option : Sets the database as READ_ONLY", "", false, "false", "False", "" ], [ "ReadWrite", "RW Option : Sets the database as READ_WRITE", "", false, "false", "False", "" ], [ "Online", "Status Option : Sets the database as ONLINE", "", false, "false", "False", "" ], [ "Offline", "Status Option : Sets the database as OFFLINE", "", false, "false", "False", "" ], [ "Emergency", "Status Option : Sets the database as EMERGENCY", "", false, "false", "False", "" ], [ "Detached", "Status Option : Detaches the database", "", false, "false", "False", "" ], [ "SingleUser", "Access Option : Sets the database as SINGLE_USER", "", false, "false", "False", "" ], [ "RestrictedUser", "Access Option : Sets the database as RESTRICTED_USER", "", false, "false", "False", "" ], [ "MultiUser", "Access Option : Sets the database as MULTI_USER", "", false, "false", "False", "" ], [ "Force", "For most options, this translates to instantly rolling back any open transactions\r\nthat may be stopping the process.\r\nFor -Detached it is required to break mirroring and Availability Groups", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "InputObject", "Accepts piped database objects", "", true, "true (ByValue)", "", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaDbState [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-AllDatabases] [-ReadOnly] [-ReadWrite] [-Online] [-Offline] [-Emergency] [-Detached] [-SingleUser] [-RestrictedUser] [-MultiUser] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nSet-DbaDbState -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-AllDatabases] [-ReadOnly] [-ReadWrite] [-Online] [-Offline] [-Emergency] [-Detached] [-SingleUser] [-RestrictedUser] [-MultiUser] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nSet-DbaDbState [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-AllDatabases] [-ReadOnly] [-ReadWrite] [-Online] [-Offline] [-Emergency] [-Detached] [-SingleUser] [-RestrictedUser] [-MultiUser] [-Force] [-EnableException] -InputObject \u003cPSObject[]\u003e [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaEndpoint", "Description": "Sets endpoint properties on a SQL Server instance.", "Tags": "Endpoint", "Synopsis": "Sets endpoint properties on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Set-DbaEndpoint", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaEndpoint", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaEndpoint -SqlInstance sql2016 -AllEndpoints -Owner sa\nSets all endpoint owners to sa on sql2016\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaEndpoint -SqlInstance sql2016 -Endpoint ep1 | Set-DbaEndpoint -Type TSql\nChanges the endpoint type to Tsql on endpoint ep1", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Endpoint", "Only set specific endpoint properties.", "", false, "false", "", "" ], [ "Owner", "Change the endpoint owner.", "", false, "false", "", "" ], [ "Type", "Change the endpoint type. Options: DatabaseMirroring, ServiceBroker, Soap, TSql", "", false, "false", "", "DatabaseMirroring,ServiceBroker,Soap,TSql" ], [ "AllEndpoints", "Set all endpoint properties on an instance.", "", false, "false", "False", "" ], [ "InputObject", "Enables piping from Get-Endpoint.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaEndpoint [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Endpoint] \u003cString[]\u003e] [[-Owner] \u003cString\u003e] [[-Type] \u003cString\u003e] [-AllEndpoints] [[-InputObject] \u003cEndpoint[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaErrorLogConfig", "Description": "Sets the number of log files configured on all versions, and size in KB in SQL Server 2012+ and above.\n\nTo set the Path to the ErrorLog, use Set-DbaStartupParameter -ErrorLog. Note that this command requires\nremote, administrative access to the Windows/WMI server, similar to SQL Configuration Manager.", "Tags": [ "Instance", "ErrorLog" ], "Synopsis": "Set the configuration for the ErrorLog on a given SQL Server instance", "Alias": "", "Author": "Shawn Melton (@wsmelton), https://wsmelton.github.com", "CommandName": "Set-DbaErrorLogConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaErrorLogConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaErrorLogConfig -SqlInstance sql2017,sql2014 -LogCount 25\nSets the number of error log files to 25 on sql2017 and sql2014\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaErrorLogConfig -SqlInstance sql2014 -LogSize 102400\nSets the size of the error log file, before it rolls over, to 102400 KB (100 MB) on sql2014\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaErrorLogConfig -SqlInstance sql2012 -LogCount 25 -LogSize 500\nSets the number of error log files to 25 and size before it will roll over to 500 KB on sql2012", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances", "", true, "true (ByPropertyName)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "LogCount", "Integer value between 6 and 99 for setting the number of error log files to keep for SQL Server instance.", "", false, "false", "0", "" ], [ "LogSize", "Integer value for the size in KB that you want the error log file to grow. This is feature only in SQL Server 2012 and higher. When the file reaches that limit SQL Server will roll the error log over.", "", false, "false", "0", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaErrorLogConfig [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-LogCount] \u003cInt32\u003e] [[-LogSize] \u003cInt32\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaExtendedProperty", "Description": "Set extended property values\n\nYou can set extended properties on all these different types of objects:\n\nAggregate\nAssembly\nColumn\nConstraint\nContract\nDatabase\nEvent Notification\nFilegroup\nFunction\nIndex\nLogical File Name\nMessage Type\nParameter\nPartition Function\nPartition Scheme\nProcedure\nQueue\nRemote Service Binding\nRoute\nRule\nSchema\nService\nSynonym\nTable\nTrigger\nType\nView\nXml Schema Collection", "Tags": "extendedproperties", "Synopsis": "Set extended property values", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Set-DbaExtendedProperty", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaExtendedProperty", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance localhost -Database mydb | Get-DbaExtendedProperty -Name appversion | Set-DbaExtendedProperty -Value \"1.1.0\"\nSets the value of appversion to 1.1.0 on the mydb database\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDbTable -SqlInstance localhost -Database mydb -Table mytable | Get-DbaExtendedProperty -Name appversion | Set-DbaExtendedProperty -Value \"1.1.0\"\nSets the value of appversion to 1.1.0 on the mytable table of the mydb database", "Params": [ [ "InputObject", "Enables piping from Get-DbaExtendedProperty", "", true, "true (ByValue)", "", "" ], [ "Value", "The new value for the extended property", "", true, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaExtendedProperty [-InputObject] \u003cExtendedProperty[]\u003e [-Value] \u003cString\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaExtendedProtection", "Description": "Set the Extended Protection setting of the SQL Server network configuration.\n\nThis setting requires access to the Windows Server and not the SQL Server instance. The setting is found in SQL Server Configuration Manager under the properties of SQL Server Network Configuration \u003e Protocols for \"InstanceName\".", "Tags": [ "Instance", "Security" ], "Synopsis": "Set the Extended Protection setting of the SQL Server network configuration.", "Alias": "", "Author": "Cláudio Silva (@claudioessilva), https://claudioessilva.eu", "CommandName": "Set-DbaExtendedProtection", "Availability": "Windows only", "Links": "https://dbatools.io/Set-DbaExtendedProtection", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaExtendedProtection\nSet Extended Protection of SQL Engine on the default (MSSQLSERVER) instance on localhost to \"Off\". Requires (and checks for) RunAs admin.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaExtendedProtection -Value Required\nSet Extended Protection of SQL Engine on the default (MSSQLSERVER) instance on localhost to \"Required\". Requires (and checks for) RunAs admin.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaExtendedProtection -SqlInstance sql01\\SQL2008R2SP2\nSet Extended Protection of SQL Engine for the SQL2008R2SP2 on sql01 to \"Off\". Uses Windows Credentials to both connect and modify the registry.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaExtendedProtection -SqlInstance sql01\\SQL2008R2SP2 -Value Allowed\nSet Extended Protection of SQL Engine for the SQL2008R2SP2 on sql01 to \"Allowed\". Uses Windows Credentials to both connect and modify the registry.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eSet-DbaExtendedProtection -SqlInstance sql01\\SQL2008R2SP2 -WhatIf\nShows what would happen if the command were executed.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to the computer (not SQL Server instance) using alternative Windows credentials", "", false, "false", "", "" ], [ "Value", "Posible values are Off, Allowed and Always.", "", false, "false", "Off", "0,Off,1,Allowed,2,Required" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaExtendedProtection [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-Value] \u003cObject\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaLogin", "Description": "Set-DbaLogin will enable you to change the password, unlock, rename, disable or enable, deny or grant login privileges to the login. It\u0027s also possible to add or remove server roles from the login.", "Tags": "Login", "Synopsis": "Set-DbaLogin makes it possible to make changes to one or more logins.\nSQL Azure DB is not supported.", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Set-DbaLogin", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaLogin", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$SecurePassword = ConvertTo-SecureString \"PlainTextPassword\" -AsPlainText -Force\nPS C:\\\u003e $cred = New-Object System.Management.Automation.PSCredential (\"username\", $SecurePassword)\r\nPS C:\\\u003e Set-DbaLogin -SqlInstance sql1 -Login login1 -SecurePassword $cred -Unlock -MustChange\nSet the new password for login1 using a credential, unlock the account and set the option\r\nthat the user must change password at next logon.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaLogin -SqlInstance sql1 -Login login1 -Enable\nEnable the login\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaLogin -SqlInstance sql1 -Login login1, login2, login3, login4 -Enable\nEnable multiple logins\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaLogin -SqlInstance sql1, sql2, sql3 -Login login1, login2, login3, login4 -Enable\nEnable multiple logins on multiple instances\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eSet-DbaLogin -SqlInstance sql1 -Login login1 -Disable\nDisable the login\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eSet-DbaLogin -SqlInstance sql1 -Login login1 -DenyLogin\nDeny the login to connect to the instance\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eSet-DbaLogin -SqlInstance sql1 -Login login1 -GrantLogin\nGrant the login to connect to the instance\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eSet-DbaLogin -SqlInstance sql1 -Login login1 -PasswordPolicyEnforced\nEnforces the password policy on a login\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eSet-DbaLogin -SqlInstance sql1 -Login login1 -PasswordPolicyEnforced:$false\nDisables enforcement of the password policy on a login\n-------------------------- EXAMPLE 10 --------------------------\nPS C:\\\u003eSet-DbaLogin -SqlInstance sql1 -Login test -AddRole serveradmin\nAdd the server role \"serveradmin\" to the login\n-------------------------- EXAMPLE 11 --------------------------\nPS C:\\\u003eSet-DbaLogin -SqlInstance sql1 -Login test -RemoveRole bulkadmin\nRemove the server role \"bulkadmin\" to the login\n-------------------------- EXAMPLE 12 --------------------------\nPS C:\\\u003e$login = Get-DbaLogin -SqlInstance sql1 -Login test\nPS C:\\\u003e $login | Set-DbaLogin -Disable\nDisable the login from the pipeline\n-------------------------- EXAMPLE 13 --------------------------\nPS C:\\\u003eSet-DbaLogin -SqlInstance sql1 -Login login1 -DefaultDatabase master\nSet the default database to master on a login\n-------------------------- EXAMPLE 14 --------------------------\nPS C:\\\u003eSet-DbaLogin -SqlInstance sql1 -Login login1 -Unlock -Force\nUnlocks the login1 on the sql1 instance using the technique described at https://www.mssqltips.com/sqlservertip/2758/how-to-unlock-a-sql-login-without-resetting-the-password/", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Login", "The login that needs to be changed", "", false, "false", "", "" ], [ "SecurePassword", "The new password for the login This can be either a credential or a secure string.", "Password", false, "false", "", "" ], [ "DefaultDatabase", "Default database for the login", "DefaultDB", false, "false", "", "" ], [ "Unlock", "Switch to unlock an account. This can be used in conjunction with the -SecurePassword or -Force parameters.\r\nThe default is false.", "", false, "false", "False", "" ], [ "MustChange", "Does the user need to change his/her password. This will only be used in conjunction with the -SecurePassword parameter.\r\nIt is required that the login have both PasswordPolicyEnforced (check_policy) and PasswordExpirationEnabled (check_expiration) enabled for the login. See the Microsoft documentation for ALTER LOGIN \r\nfor more details.\r\nThe default is false.", "", false, "false", "False", "" ], [ "NewName", "The new name for the login.", "", false, "false", "", "" ], [ "Disable", "Disable the login", "", false, "false", "False", "" ], [ "Enable", "Enable the login", "", false, "false", "False", "" ], [ "DenyLogin", "Deny access to SQL Server", "", false, "false", "False", "" ], [ "GrantLogin", "Grant access to SQL Server", "", false, "false", "False", "" ], [ "PasswordPolicyEnforced", "Enable the password policy on the login (check_policy = ON). This option must be enabled in order for -PasswordExpirationEnabled to be used.", "", false, "false", "False", "" ], [ "PasswordExpirationEnabled", "Enable the password expiration check on the login (check_expiration = ON). In order to enable this option the PasswordPolicyEnforced (check_policy) must also be enabled for the login.", "", false, "false", "False", "" ], [ "AddRole", "Add one or more server roles to the login\r\nThe following roles can be used \"bulkadmin\", \"dbcreator\", \"diskadmin\", \"processadmin\", \"public\", \"securityadmin\", \"serveradmin\", \"setupadmin\", \"sysadmin\".", "", false, "false", "", "bulkadmin,dbcreator,diskadmin,processadmin,public,securityadmin,serveradmin,setupadmin,sysadmin" ], [ "RemoveRole", "Remove one or more server roles to the login\r\nThe following roles can be used \"bulkadmin\", \"dbcreator\", \"diskadmin\", \"processadmin\", \"public\", \"securityadmin\", \"serveradmin\", \"setupadmin\", \"sysadmin\".", "", false, "false", "", "bulkadmin,dbcreator,diskadmin,processadmin,public,securityadmin,serveradmin,setupadmin,sysadmin" ], [ "InputObject", "Allows logins to be piped in from Get-DbaLogin", "", false, "true (ByValue)", "", "" ], [ "Force", "This switch is used with -Unlock to unlock a login without providing a password. This command will temporarily disable and enable the policy settings as described at \r\nhttps://www.mssqltips.com/sqlservertip/2758/how-to-unlock-a-sql-login-without-resetting-the-password/.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaLogin [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Login] \u003cString[]\u003e] [[-SecurePassword] \u003cObject\u003e] [[-DefaultDatabase] \u003cString\u003e] [-Unlock] [-MustChange] [[-NewName] \u003cString\u003e] [-Disable] [-Enable] [-DenyLogin] [-GrantLogin] [-PasswordPolicyEnforced] [-PasswordExpirationEnabled] [[-AddRole] \u003cString[]\u003e] [[-RemoveRole] \u003cString[]\u003e] [[-InputObject] \u003cLogin[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "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.\n\nYou can set MaxDop database scoped configurations if the server is version 2016 or higher", "Tags": [ "MaxDop", "SpConfigure" ], "Synopsis": "Sets SQL Server maximum degree of parallelism (Max DOP), then displays information relating to SQL Server Max DOP configuration settings. Works on SQL Server 2005 and higher.", "Alias": "", "Author": "Claudio Silva (@claudioessilva)", "CommandName": "Set-DbaMaxDop", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaMaxDop", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaMaxDop -SqlInstance sql2008, sql2012\nSets Max DOP to the recommended value for servers sql2008 and sql2012.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaMaxDop -SqlInstance sql2014 -MaxDop 4\nSets Max DOP to 4 for server sql2014.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaMaxDop -SqlInstance sql2008 | Set-DbaMaxDop\nGets the recommended Max DOP from Test-DbaMaxDop and applies it to to sql2008.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaMaxDop -SqlInstance sql2016 -Database db1\nSet recommended Max DOP for database db1 on server sql2016.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eSet-DbaMaxDop -SqlInstance sql2016 -AllDatabases\nSet recommended Max DOP for all databases on server sql2016.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Defaults to localhost.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies one or more databases to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies one or more databases to exclude from processing. Options for this list are auto-populated from the server", "", false, "false", "", "" ], [ "MaxDop", "Specifies the Max DOP value to set.", "", false, "false", "-1", "" ], [ "InputObject", "If Test-SqlMaxDop has been executed prior to this function, the results may be passed in via this parameter.", "", false, "true (ByValue)", "", "" ], [ "AllDatabases", "If this switch is enabled, Max DOP will be set on all databases. This switch is only useful on SQL Server 2016 and higher.", "All", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the cmdlet runs. The cmdlet is not run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the cmdlet.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaMaxDop [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-MaxDop] \u003cInt32\u003e] [[-InputObject] \u003cPSObject\u003e] [-AllDatabases] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "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.", "Tags": [ "MaxMemory", "Memory" ], "Synopsis": "Sets SQL Server \u0027Max Server Memory\u0027 configuration setting to a new value then displays information this setting.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Set-DbaMaxMemory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaMaxMemory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaMaxMemory sqlserver1\nSet max memory to the recommended on just one server named \"sqlserver1\"\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaMaxMemory -SqlInstance sqlserver1 -Max 2048\nExplicitly set max memory to 2048 on just one server, \"sqlserver1\"\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlserver | Test-DbaMaxMemory | Where-Object { $_.MaxValue -gt $_.Total } | Set-DbaMaxMemory\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.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Max", "Specifies the max megabytes (MB)", "", false, "false", "0", "" ], [ "InputObject", "A InputObject returned by Test-DbaMaxMemory", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the cmdlet runs. The cmdlet is not run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the cmdlet.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaMaxMemory [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Max] \u003cInt32\u003e] [[-InputObject] \u003cPSObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaNetworkCertificate", "Description": "Sets the network certificate for SQL Server instance. This setting is found in Configuration Manager.\n\nThis command also grants read permissions for the service account on the certificate\u0027s private key.\n\nReferences:\nhttps://www.itprotoday.com/sql-server/7-steps-ssl-encryption\nhttps://azurebi.jppp.org/2016/01/23/using-lets-encrypt-certificates-for-secure-sql-server-connections/\nhttps://blogs.msdn.microsoft.com/sqlserverfaq/2016/09/26/creating-and-registering-ssl-certificates/", "Tags": "Certificate", "Synopsis": "Sets the network certificate for SQL Server instance", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Set-DbaNetworkCertificate", "Availability": "Windows only", "Links": "https://dbatools.io/Set-DbaNetworkCertificate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eNew-DbaComputerCertificate | Set-DbaNetworkCertificate -SqlInstance localhost\\SQL2008R2SP2\nCreates and imports a new certificate signed by an Active Directory CA on localhost then sets the network certificate for the SQL2008R2SP2 to that newly created certificate.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaNetworkCertificate -SqlInstance sql1\\SQL2008R2SP2 -Thumbprint 1223FB1ACBCA44D3EE9640F81B6BA14A92F3D6E2\nSets the network certificate for the SQL2008R2SP2 instance to the certificate with the thumbprint of 1223FB1ACBCA44D3EE9640F81B6BA14A92F3D6E2 in LocalMachine\\My on sql1", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Defaults to localhost.", "ComputerName", false, "true (ByPropertyName)", "", "" ], [ "Credential", "Allows you to login to the computer (not sql instance) using alternative credentials.", "", false, "true (ByPropertyName)", "", "" ], [ "Certificate", "The target certificate object", "", true, "true (ByValue)", "", "" ], [ "Thumbprint", "The thumbprint of the target certificate", "", true, "true (ByPropertyName)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaNetworkCertificate [-SqlInstance \u003cDbaInstanceParameter[]\u003e] [-Credential \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nSet-DbaNetworkCertificate [-SqlInstance \u003cDbaInstanceParameter[]\u003e] [-Credential \u003cPSCredential\u003e] -Certificate \u003cX509Certificate2\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nSet-DbaNetworkCertificate [-SqlInstance \u003cDbaInstanceParameter[]\u003e] [-Credential \u003cPSCredential\u003e] -Thumbprint \u003cString\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaNetworkConfiguration", "Description": "Sets the network configuration of a SQL Server instance.\n\nParameters are available for typical tasks like enabling or disabling a protocol or switching between dynamic and static ports.\nThe object returned by Get-DbaNetworkConfiguration can be used to adjust settings of the properties\nand then passed to this command via pipeline or -InputObject parameter.\n\nA change to the network configuration with SQL Server requires a restart to take effect,\nsupport for this can be done via the RestartService parameter.\n\nRemote SQL WMI is used by default, with PS Remoting used as a fallback.\n\nFor a detailed explanation of the different properties see the documentation at:\nhttps://docs.microsoft.com/en-us/sql/tools/configuration-manager/sql-server-network-configuration", "Tags": "SQLWMI", "Synopsis": "Sets the network configuration of a SQL Server instance.", "Alias": "", "Author": "Andreas Jordan (@JordanOrdix), ordix.de", "CommandName": "Set-DbaNetworkConfiguration", "Availability": "Windows only", "Links": "https://dbatools.io/Set-DbaNetworkConfiguration", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaNetworkConfiguration -SqlInstance sql2016 -EnableProtocol SharedMemory -RestartService\nEnsures that the shared memory network protocol for the default instance on sql2016 is enabled.\r\nRestarts the service if needed.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaNetworkConfiguration -SqlInstance sql2016\\test -StaticPortForIPAll 14331, 14332 -RestartService\nEnsures that the TCP/IP network protocol is enabled and configured to use the ports 14331 and 14332 for all IP addresses.\r\nRestarts the service if needed.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$netConf = Get-DbaNetworkConfiguration -SqlInstance sqlserver2014a\nPS C:\\\u003e $netConf.TcpIpProperties.KeepAlive = 60000\r\nPS C:\\\u003e $netConf | Set-DbaNetworkConfiguration -RestartService -Confirm:$false\nChanges the value of the KeepAlive property for the default instance on sqlserver2014a and restarts the service.\r\nDoes not prompt for confirmation.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "Credential", "Credential object used to connect to the Computer as a different user.", "", false, "false", "", "" ], [ "EnableProtocol", "Enables one of the following network protocols: SharedMemory, NamedPipes, TcpIp.", "", false, "false", "", "SharedMemory,NamedPipes,TcpIp" ], [ "DisableProtocol", "Disables one of the following network protocols: SharedMemory, NamedPipes, TcpIp.", "", false, "false", "", "SharedMemory,NamedPipes,TcpIp" ], [ "DynamicPortForIPAll", "Configures the instance to listen on a dynamic port for all IP addresses.\r\nWill enable the TCP/IP protocol if needed.\r\nWill set TcpIpProperties.ListenAll to $true if needed.\r\nWill reset the last used dynamic port if already set.", "", false, "false", "False", "" ], [ "StaticPortForIPAll", "Configures the instance to listen on one or more static ports for all IP addresses.\r\nWill enable the TCP/IP protocol if needed.\r\nWill set TcpIpProperties.ListenAll to $true if needed.", "", false, "false", "", "" ], [ "RestartService", "Every change to the network configuration needs a service restart to take effect.\r\nThis switch will force a restart of the service if the network configuration has changed.", "", false, "false", "False", "" ], [ "InputObject", "The output object from Get-DbaNetworkConfiguration.\r\nGet-DbaNetworkConfiguration has to be run with -OutputType Full (default) to get the complete object.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaNetworkConfiguration [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-Credential \u003cPSCredential\u003e] [-EnableProtocol \u003cString\u003e] [-DisableProtocol \u003cString\u003e] [-DynamicPortForIPAll] [-StaticPortForIPAll \u003cInt32[]\u003e] [-RestartService] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nSet-DbaNetworkConfiguration [-Credential \u003cPSCredential\u003e] [-RestartService] -InputObject \u003cObject[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaPowerPlan", "Description": "Sets the SQL Server OS\u0027s Power Plan. Defaults to High Performance which is best practice.\n\nIf your organization uses a different power plan that is considered best practice, specify -PowerPlan.\n\nReferences:\nhttps://support.microsoft.com/en-us/kb/2207548\nhttp://www.sqlskills.com/blogs/glenn/windows-power-plan-effects-on-newer-intel-processors/", "Tags": [ "PowerPlan", "OS", "Configure" ], "Synopsis": "Sets the SQL Server OS\u0027s Power Plan.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Set-DbaPowerPlan", "Availability": "Windows only", "Links": "https://dbatools.io/Set-DbaPowerPlan", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaPowerPlan -ComputerName sql2017\nSets the Power Plan to High Performance. Skips it if its already set.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027Server1\u0027, \u0027Server2\u0027 | Set-DbaPowerPlan -PowerPlan Balanced\nSets the Power Plan to Balanced for Server1 and Server2. Skips it if its already set.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$cred = Get-Credential \u0027Domain\\User\u0027\nPS C:\\\u003e Set-DbaPowerPlan -ComputerName sql2017 -Credential $cred\nConnects using alternative Windows credential and sets the Power Plan to High Performance. Skips it if its already set.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaPowerPlan -ComputerName sqlcluster -PowerPlan \u0027Maximum Performance\u0027\nSets the Power Plan to \"Maximum Performance\". Skips it if its already set.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaPowerPlan -ComputerName oldserver | Set-DbaPowerPlan -ComputerName newserver1, newserver2\nUses the Power Plan of oldserver as best practice and sets the Power Plan of newserver1 and newserver2 accordingly.", "Params": [ [ "ComputerName", "The server(s) to set the Power Plan on.", "", true, "true (ByValue, ByPropertyName)", "", "" ], [ "Credential", "Specifies a PSCredential object to use in authenticating to the server(s), instead of the current user account.", "", false, "true (ByPropertyName)", "", "" ], [ "PowerPlan", "If your organization uses a different Power Plan that\u0027s considered best practice, specify it here.\r\nUse Get-DbaPowerPlan -List to get all available Power Plans on a computer.", "CustomPowerPlan,RecommendedPowerPlan", false, "true (ByPropertyName)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaPowerPlan [-ComputerName] \u003cDbaInstanceParameter[]\u003e [[-Credential] \u003cPSCredential\u003e] [[-PowerPlan] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaPrivilege", "Description": "Adds the SQL Service account to 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", "Synopsis": "Adds the SQL Service account to local privileges on one or more computers.", "Alias": "", "Author": "Klaas Vandenberghe ( @PowerDBAKlaas )", "CommandName": "Set-DbaPrivilege", "Availability": "Windows only", "Links": "https://dbatools.io/Set-DbaPrivilege", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaPrivilege -ComputerName sqlserver2014a -Type LPIM,IFI\nAdds the SQL Service account(s) on computer sqlserver2014a to the local privileges \u0027SeManageVolumePrivilege\u0027 and \u0027SeLockMemoryPrivilege\u0027.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\u0027,\u0027sql3\u0027 | Set-DbaPrivilege -Type IFI\nAdds the SQL Service account(s) on computers sql1, sql2 and sql3 to the local privilege \u0027SeManageVolumePrivilege\u0027.", "Params": [ [ "ComputerName", "The target SQL Server instance or instances.", "cn,host,Server", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Credential object used to connect to the computer as a different user.", "", false, "false", "", "" ], [ "Type", "Use this to choose the privilege(s) to which you want to add the SQL Service account.\r\nAccepts \u0027IFI\u0027, \u0027LPIM\u0027, \u0027BatchLogon\u0027, and/or \u0027SecAudit\u0027 for local privileges \u0027Instant File Initialization\u0027, \u0027Lock Pages in Memory\u0027, \u0027Logon as Batch\u0027, and \u0027Generate Security Audits\u0027.", "", true, "false", "", "IFI,LPIM,BatchLogon,SecAudit" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "User", "If provided, will add requested permissions to this account instead of the the account under which the SQL service is running.", "", false, "false", "", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaPrivilege [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-Type] \u003cString[]\u003e [-EnableException] [[-User] \u003cString\u003e] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaSpConfigure", "Description": "This function changes the configured value for sp_configure settings. If the setting is dynamic this setting will be used, otherwise the user will be warned that a restart of SQL is required.\nThis is designed to be safe and will not allow for configurations to be set outside of the defined configuration min and max values.\nWhile it is possible to set below the min, or above the max this can cause serious problems with SQL Server (including startup failures), and so is not permitted.", "Tags": "SpConfigure", "Synopsis": "Changes the server level system configuration (sys.configuration/sp_configure) value for a given configuration", "Alias": "", "Author": "Nic Cain, https://sirsql.net/", "CommandName": "Set-DbaSpConfigure", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaSpConfigure", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaSpConfigure -SqlInstance localhost -Name ScanForStartupProcedures -Value 1\nAdjusts the Scan for startup stored procedures configuration value to 1 and notifies the user that this requires a SQL restart to take effect\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaSpConfigure -SqlInstance sql2017, sql2014 -Name XPCmdShellEnabled, IsSqlClrEnabled | Set-DbaSpConfigure -Value $false\nSets the values for XPCmdShellEnabled and IsSqlClrEnabled on sql2017 and sql2014 to False\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaSpConfigure -SqlInstance localhost -Name XPCmdShellEnabled -Value 1\nAdjusts the xp_cmdshell configuration value to 1.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaSpConfigure -SqlInstance localhost -Name XPCmdShellEnabled -Value 1 -WhatIf\nReturns information on the action that would be performed. No actual change will be made.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a\r\ncollection and receive pipeline input", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Value", "The new value for the configuration", "NewValue,NewConfig", false, "false", "0", "" ], [ "Name", "The name of the configuration to be set -- Configs is auto-populated for tabbing convenience.", "Config,ConfigName", false, "false", "", "" ], [ "InputObject", "Piped objects from Get-DbaSpConfigure", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaSpConfigure [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Value] \u003cInt32\u003e] [[-Name] \u003cString[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "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 is added, the function will also set delegation to that service, unless -NoDelegation is specified. In order to run this function, the credential you provide must have write access to Active Directory.\n\nNote: This function supports -WhatIf", "Tags": "SPN", "Synopsis": "Sets an SPN for a given service account in active directory (and also enables delegation to the same SPN by default)", "Alias": "", "Author": "Drew Furgiuele (@pittfurg), http://www.port1433.com", "CommandName": "Set-DbaSpn", "Availability": "Windows only", "Links": "https://dbatools.io/Set-DbaSpn", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaSpn -SPN MSSQLSvc/SQLSERVERA.domain.something -ServiceAccount domain\\account\nPS C:\\\u003e Set-DbaSpn -SPN MSSQLSvc/SQLSERVERA.domain.something -ServiceAccount domain\\account -EnableException\nConnects to Active Directory and adds a provided SPN to the given account.\r\nConnects to Active Directory and adds a provided SPN to the given account, suppressing all error messages and throw exceptions that can be caught instead\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaSpn -SPN MSSQLSvc/SQLSERVERA.domain.something -ServiceAccount domain\\account -Credential ad\\sqldba\nConnects to Active Directory and adds a provided SPN to the given account. Uses alternative account to connect to AD.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaSpn -SPN MSSQLSvc/SQLSERVERA.domain.something -ServiceAccount domain\\account -NoDelegation\nConnects to Active Directory and adds a provided SPN to the given account, without the delegation.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eTest-DbaSpn -ComputerName sql2016 | Where-Object { $_.isSet -eq $false } | Set-DbaSpn\nSets all missing SPNs for sql2016\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eTest-DbaSpn -ComputerName sql2016 | Where-Object { $_.isSet -eq $false } | Set-DbaSpn -WhatIf\nDisplays what would happen trying to set all missing SPNs for sql2016", "Params": [ [ "SPN", "The SPN you want to add", "RequiredSPN", true, "true (ByPropertyName)", "", "" ], [ "ServiceAccount", "The account you want the SPN added to", "InstanceServiceAccount,AccountName", true, "true (ByPropertyName)", "", "" ], [ "Credential", "The credential you want to use to connect to Active Directory to make the changes", "", false, "true (ByPropertyName)", "", "" ], [ "NoDelegation", "Skips setting the delegation", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command was executed", "wi", false, "false", "", "" ], [ "Confirm", "Turns confirmations before changes on or off", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaSpn [-SPN] \u003cString\u003e [-ServiceAccount] \u003cString\u003e [[-Credential] \u003cPSCredential\u003e] [-NoDelegation] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaStartupParameter", "Description": "Modifies the startup parameters for a specified SQL Server Instance\n\nFor full details of what each parameter does, please refer to this MSDN article - https://msdn.microsoft.com/en-us/library/ms190737(v=sql.105).aspx", "Tags": [ "Startup", "Parameter", "Configure" ], "Synopsis": "Sets the Startup Parameters for a SQL Server instance", "Alias": "", "Author": "Stuart Moore (@napalmgram), stuart-moore.com", "CommandName": "Set-DbaStartupParameter", "Availability": "Windows only", "Links": "https://dbatools.io/Set-DbaStartupParameter", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaStartupParameter -SqlInstance server1\\instance1 -SingleUser\nWill configure the SQL Instance server1\\instance1 to startup up in Single User mode at next startup\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaStartupParameter -SqlInstance sql2016 -IncreasedExtents\nWill configure the SQL Instance sql2016 to IncreasedExtents = True (-E)\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaStartupParameter -SqlInstance sql2016 -IncreasedExtents:$false -WhatIf\nShows what would happen if you attempted to configure the SQL Instance sql2016 to IncreasedExtents = False (no -E)\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaStartupParameter -SqlInstance server1\\instance1 -TraceFlag 8032,8048\nThis will append Trace Flags 8032 and 8048 to the startup parameters\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eSet-DbaStartupParameter -SqlInstance sql2016 -SingleUser:$false -TraceFlagOverride\nThis will remove all trace flags and set SingleUser to false\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eSet-DbaStartupParameter -SqlInstance server1\\instance1 -SingleUser -TraceFlag 8032,8048 -TraceFlagOverride\nThis will set Trace Flags 8032 and 8048 to the startup parameters, removing any existing Trace Flags\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eSet-DbaStartupParameter -SqlInstance sql2016 -SingleUser:$false -TraceFlagOverride -Offline\nThis will remove all trace flags and set SingleUser to false from an offline instance\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eSet-DbaStartupParameter -SqlInstance sql2016 -ErrorLog c:\\Sql\\ -Offline\nThis will attempt to change the ErrorLog path to c:\\sql\\. However, with the offline switch this will not happen. To force it, use the -Force switch like so:\nSet-DbaStartupParameter -SqlInstance sql2016 -ErrorLog c:\\Sql\\ -Offline -Force\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003e$StartupConfig = Get-DbaStartupParameter -SqlInstance server1\\instance1\nPS C:\\\u003e Set-DbaStartupParameter -SqlInstance server1\\instance1 -SingleUser -NoLoggingToWinEvents\r\nPS C:\\\u003e #Restart your SQL instance with the tool of choice\r\nPS C:\\\u003e #Do Some work\r\nPS C:\\\u003e Set-DbaStartupParameter -SqlInstance server1\\instance1 -StartupConfig $StartupConfig\r\nPS C:\\\u003e #Restart your SQL instance with the tool of choice and you\u0027re back to normal\nIn this example we take a copy of the existing startup configuration of server1\\instance1\nWe then change the startup parameters ahead of some work\nAfter the work has been completed, we can push the original startup parameters back to server1\\instance1 and resume normal operation", "Params": [ [ "SqlInstance", "The SQL Server instance to be modified\nIf the Sql Instance is offline path parameters will be ignored as we cannot test the instance\u0027s access to the path. If you want to force this to work then please use the Force switch", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Credential", "Windows Credential with permission to log on to the server running the SQL instance", "", false, "false", "", "" ], [ "MasterData", "Path to the data file for the Master database\nWill be ignored if SqlInstance is offline or the Offline switch is set. To override this behaviour use the Force switch. This is to ensure you understand the risk as we cannot validate the path if \r\nthe instance is offline", "", false, "false", "", "" ], [ "MasterLog", "Path to the log file for the Master database\nWill be ignored if SqlInstance is offline or the Offline switch is set. To override this behaviour use the Force switch. This is to ensure you understand the risk as we cannot validate the path if \r\nthe instance is offline", "", false, "false", "", "" ], [ "ErrorLog", "Path to the SQL Server error log file\nWill be ignored if SqlInstance is offline or the Offline switch is set. To override this behaviour use the Force switch. This is to ensure you understand the risk as we cannot validate the path if \r\nthe instance is offline", "", false, "false", "", "" ], [ "TraceFlag", "A comma separated list of TraceFlags to be applied at SQL Server startup\r\nBy default these will be appended to any existing trace flags set", "", false, "false", "", "" ], [ "CommandPromptStart", "Shortens startup time when starting SQL Server from the command prompt. Typically, the SQL Server Database Engine starts as a service by calling the Service Control Manager.\r\nBecause the SQL Server Database Engine does not start as a service when starting from the command prompt", "", false, "false", "False", "" ], [ "MinimalStart", "Starts an instance of SQL Server with minimal configuration. This is useful if the setting of a configuration value (for example, over-committing memory) has\r\nprevented the server from starting. Starting SQL Server in minimal configuration mode places SQL Server in single-user mode", "", false, "false", "False", "" ], [ "MemoryToReserve", "Specifies an integer number of megabytes (MB) of memory that SQL Server will leave available for memory allocations within the SQL Server process,\r\nbut outside the SQL Server memory pool. The memory outside of the memory pool is the area used by SQL Server for loading items such as extended procedure .dll files,\r\nthe OLE DB providers referenced by distributed queries, and automation objects referenced in Transact-SQL statements. The default is 256 MB.", "", false, "false", "0", "" ], [ "SingleUser", "Start Sql Server in single user mode", "", false, "false", "False", "" ], [ "SingleUserDetails", "The username for single user", "", false, "false", "", "" ], [ "NoLoggingToWinEvents", "Don\u0027t use Windows Application events log", "", false, "false", "False", "" ], [ "StartAsNamedInstance", "Allows you to start a named instance of SQL Server", "", false, "false", "False", "" ], [ "DisableMonitoring", "Disables the following monitoring features:\nSQL Server performance monitor counters\r\nKeeping CPU time and cache-hit ratio statistics\r\nCollecting information for the DBCC SQLPERF command\r\nCollecting information for some dynamic management views\r\nMany extended-events event points\n** Warning *\\* When you use the -x startup option, the information that is available for you to diagnose performance and functional problems with SQL Server is greatly reduced.", "", false, "false", "False", "" ], [ "IncreasedExtents", "Increases the number of extents that are allocated for each file in a file group.", "", false, "false", "False", "" ], [ "TraceFlagOverride", "Overrides the default behaviour and replaces any existing trace flags. If not trace flags specified will just remove existing ones", "", false, "false", "False", "" ], [ "StartupConfig", "Pass in a previously saved SQL Instance startup config\r\nusing this parameter will set TraceFlagOverride to true, so existing Trace Flags will be overridden", "", false, "false", "", "" ], [ "Offline", "Setting this switch will try perform the requested actions without connect to the SQL Server Instance, this will speed things up if you know the Instance is offline.\nWhen working offline, path inputs (MasterData, MasterLog and ErrorLog) will be ignored, unless Force is specified", "", false, "false", "False", "" ], [ "Force", "By default we test the values passed in via MasterData, MasterLog, ErrorLog", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaStartupParameter [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [[-MasterData] \u003cString\u003e] [[-MasterLog] \u003cString\u003e] [[-ErrorLog] \u003cString\u003e] [[-TraceFlag] \u003cString[]\u003e] [-CommandPromptStart] [-MinimalStart] [[-MemoryToReserve] \u003cInt32\u003e] [-SingleUser] [[-SingleUserDetails] \u003cString\u003e] [-NoLoggingToWinEvents] [-StartAsNamedInstance] [-DisableMonitoring] [-IncreasedExtents] [-TraceFlagOverride] [[-StartupConfig] \u003cObject\u003e] [-Offline] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaTcpPort", "Description": "This function changes the TCP port used by the specified SQL Server.\n\nBe aware that the Database Engine begins listening on a new port only when restarted. So you have to restart the Database Engine that the new settings become effective.", "Tags": [ "Service", "Port", "TCP", "Configure" ], "Synopsis": "Changes the TCP port used by the specified SQL Server.", "Alias": "", "Author": "@H0s0n77", "CommandName": "Set-DbaTcpPort", "Availability": "Windows only", "Links": "https://dbatools.io/Set-DbaTcpPort", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaTcpPort -SqlInstance sql2017 -Port 1433\nSets the port number 1433 for all IP Addresses on the default instance on sql2017. Prompts for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaTcpPort -SqlInstance winserver\\sqlexpress -IpAddress 192.168.1.22 -Port 1433 -Confirm:$false\nSets the port number 1433 for IP 192.168.1.22 on the sqlexpress instance on winserver. Does not prompt for confirmation.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaTcpPort -SqlInstance sql2017, sql2019 -port 1337 -Credential ad\\dba\nSets the port number 1337 for all IP Addresses on SqlInstance sql2017 and sql2019 using the credentials for ad\\dba. Prompts for confirmation.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "Credential", "Credential object used to connect to the Windows server itself as a different user (like SQL Configuration Manager).", "", false, "false", "", "" ], [ "Port", "TCPPort that SQLService should listen on.", "", true, "false", "0", "" ], [ "IpAddress", "Ip address to which the change should apply, if omitted allip (0.0.0.0) will be changed with the new port number.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaTcpPort [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-Credential] \u003cPSCredential\u003e] [-Port] \u003cInt32\u003e [[-IpAddress] \u003cIPAddress[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbaTempDbConfig", "Description": "Calculates tempdb size and file configurations based on passed parameters, calculated values, and Microsoft best practices. User must declare SQL Server to be configured and total data file size as mandatory values. Function then calculates the number of data files based on logical cores on the target host and create evenly sized data files based on the total data size declared by the user.\n\nOther parameters can adjust the settings as the user desires (such as different file paths, number of data files, and log file size). No functions that shrink or delete data files are performed. If you wish to do this, you will need to resize tempdb so that it is \"smaller\" than what the function will size it to before running the function.", "Tags": [ "Tempdb", "Configuration" ], "Synopsis": "Sets tempdb data and log files according to best practices.", "Alias": "", "Author": "Michael Fal (@Mike_Fal), http://mikefal.net", "CommandName": "Set-DbaTempDbConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbaTempDbConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbaTempDbConfig -SqlInstance localhost -DataFileSize 1000\nCreates tempdb with a number of data files equal to the logical cores where each file is equal to 1000MB divided by the number of logical cores, with a log file of 250MB.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSet-DbaTempDbConfig -SqlInstance localhost -DataFileSize 1000 -DataFileCount 8\nCreates tempdb with 8 data files, each one sized at 125MB, with a log file of 250MB.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSet-DbaTempDbConfig -SqlInstance localhost -DataFileSize 1000 -OutputScriptOnly\nProvides a SQL script output to configure tempdb according to the passed parameters.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eSet-DbaTempDbConfig -SqlInstance localhost -DataFileSize 1000 -DisableGrowth\nDisables the growth for the data and log files.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eSet-DbaTempDbConfig -SqlInstance localhost -DataFileSize 1000 -OutputScriptOnly\nReturns the T-SQL script representing tempdb configuration.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "DataFileCount", "Specifies the number of data files to create. If this number is not specified, the number of logical cores of the host will be used.", "", false, "false", "0", "" ], [ "DataFileSize", "Specifies the total data file size in megabytes. This is distributed across the total number of data files.", "", true, "false", "0", "" ], [ "LogFileSize", "Specifies the log file size in megabytes. If not specified, no change will be made.", "", false, "false", "0", "" ], [ "DataFileGrowth", "Specifies the growth amount for the data file(s) in megabytes. The default is 512 MB.", "", false, "false", "512", "" ], [ "LogFileGrowth", "Specifies the growth amount for the log file in megabytes. The default is 512 MB.", "", false, "false", "512", "" ], [ "DataPath", "Specifies the filesystem path(s) in which to create the tempdb data files. If not specified, current tempdb location will be used.", "", false, "false", "", "" ], [ "LogPath", "Specifies the filesystem path in which to create the tempdb log file. If not specified, current tempdb location will be used.", "", false, "false", "", "" ], [ "OutFile", "Specifies the filesystem path into which the generated T-SQL script will be saved.", "", false, "false", "", "" ], [ "OutputScriptOnly", "If this switch is enabled, only the T-SQL script to change the tempdb configuration is created and output.", "", false, "false", "False", "" ], [ "DisableGrowth", "If this switch is enabled, the tempdb files will be configured to not grow. This overrides -DataFileGrowth and -LogFileGrowth.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Set-DbaTempDbConfig [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-DataFileCount] \u003cInt32\u003e] [-DataFileSize] \u003cInt32\u003e [[-LogFileSize] \u003cInt32\u003e] [[-DataFileGrowth] \u003cInt32\u003e] [[-LogFileGrowth] \u003cInt32\u003e] [[-DataPath] \u003cString[]\u003e] [[-LogPath] \u003cString\u003e] [[-OutFile] \u003cString\u003e] [-OutputScriptOnly] [-DisableGrowth] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Set-DbatoolsConfig", "Description": null, "Synopsis": "\r\nSet-DbatoolsConfig [-FullName] \u003cstring\u003e [[-Value] \u003cObject\u003e] [-Description \u003cstring\u003e] [-Validation \u003cstring\u003e] [-Handler \u003cscriptblock\u003e] [-Hidden] [-Default] [-Initialize] [-SimpleExport] [-ModuleExport] [-DisableValidation] [-DisableHandler] [-PassThru] [-Register] [-EnableException] [\u003cCommonParameters\u003e]\r\n\r\nSet-DbatoolsConfig [-FullName] \u003cstring\u003e -PersistedValue \u003cstring\u003e [-PersistedType \u003cConfigurationValueType\u003e] [-Description \u003cstring\u003e] [-Validation \u003cstring\u003e] [-Handler \u003cscriptblock\u003e] [-Hidden] [-Default] [-Initialize] [-SimpleExport] [-ModuleExport] [-DisableValidation] [-DisableHandler] [-PassThru] [-Register] [-EnableException] [\u003cCommonParameters\u003e]\r\n\r\nSet-DbatoolsConfig [[-Module] \u003cstring\u003e] [-Name] \u003cstring\u003e [[-Value] \u003cObject\u003e] [-Description \u003cstring\u003e] [-Validation \u003cstring\u003e] [-Handler \u003cscriptblock\u003e] [-Hidden] [-Default] [-Initialize] [-SimpleExport] [-ModuleExport] [-DisableValidation] [-DisableHandler] [-PassThru] [-Register] [-EnableException] [\u003cCommonParameters\u003e]\r\n", "Alias": "", "CommandName": "Set-DbatoolsConfig", "Availability": "Windows, Linux, macOS", "Links": null, "Examples": "", "Params": [ [ "Default", "", "", false, "false", null, "" ], [ "Description", "", "", false, "false", null, "" ], [ "DisableHandler", "", "", false, "false", null, "" ], [ "DisableValidation", "", "", false, "false", null, "" ], [ "EnableException", "", "", false, "false", null, "" ], [ "FullName", "", "", true, "false", null, "" ], [ "Handler", "", "", false, "false", null, "" ], [ "Hidden", "", "", false, "false", null, "" ], [ "Initialize", "", "", false, "false", null, "" ], [ "Module", "", "", false, "false", null, "" ], [ "ModuleExport", "", "", false, "false", null, "" ], [ "Name", "", "", true, "false", null, "" ], [ "PassThru", "", "", false, "false", null, "" ], [ "PersistedType", "", "", false, "false", null, "" ], [ "PersistedValue", "", "", true, "false", null, "" ], [ "Register", "", "", false, "false", null, "" ], [ "SimpleExport", "", "", false, "false", null, "" ], [ "Validation", "", "", false, "false", null, "" ], [ "Value", "", "", false, "false", null, "" ] ], "Syntax": "syntaxItem \r\n---------- \r\n{@{name=Set-DbatoolsConfig; CommonParameters=True; WorkflowCommonParameters=False; parameter=System.Object[]}, @{name=Set-DbatoolsConfig; CommonParameters=True; WorkflowCommonParameters=False; parameter=System.Object[]}, @{name=Set-DbatoolsConfig; CommonParameters=True; WorkflowCommonParameters=False; parameter=System.Object[]}}" }, { "Name": "Set-DbatoolsPath", "Description": "Configures or updates a path under a name.\nThe path can be persisted using the \"-Register\" command.\nPaths setup like this can be retrieved using Get-DbatoolsPath.", "Synopsis": "Configures or updates a path under a name.", "Alias": "", "CommandName": "Set-DbatoolsPath", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Set-DbatoolsPath", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSet-DbatoolsPath -Name \u0027temp\u0027 -Path \u0027C:\\temp\u0027\nConfigures C:\\temp as the current temp path. (does not override $env:temp !)", "Params": [ [ "Name", "Name the path should be stored under.", "", true, "false", "", "" ], [ "Path", "The path that should be returned under the name.", "", true, "false", "", "" ], [ "Register", "Registering a path in order for it to persist across sessions.", "", true, "false", "False", "" ], [ "Scope", "The configuration scope it should be registered under.\r\nDefaults to UserDefault.\r\nConfiguration scopes are the default locations configurations are being stored at.", "", false, "false", "UserDefault", "" ] ], "Syntax": "Set-DbatoolsPath -Name \u003cString\u003e -Path \u003cString\u003e [\u003cCommonParameters\u003e]\nSet-DbatoolsPath -Name \u003cString\u003e -Path \u003cString\u003e -Register [-Scope {UserDefault | UserMandatory | SystemDefault | SystemMandatory | FileUserLocal | FileUserShared | FileSystem}] [\u003cCommonParameters\u003e]" }, { "Name": "Show-DbaDbList", "Description": "Shows a list of databases in a GUI. Returns a string holding the name of the selected database. Hitting cancel returns null.", "Tags": [ "Database", "FileSystem" ], "Synopsis": "Shows a list of databases in a GUI.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Show-DbaDbList", "Availability": "Windows only", "Links": "https://dbatools.io/Show-DbaDbList", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eShow-DbaDbList -SqlInstance sqlserver2014a\nShows a GUI list of databases using Windows Authentication to connect to the SQL Server. Returns a string of the selected database.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eShow-DbaDbList -SqlInstance sqlserver2014a -SqlCredential $cred\nShows a GUI list of databases using SQL credentials to connect to the SQL Server. Returns a string of the selected database.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eShow-DbaDbList -SqlInstance sqlserver2014a -DefaultDb master\nShows a GUI list of databases using Windows Authentication to connect to the SQL Server. The \"master\" database will be selected when the lists shows. Returns a string of the selected database.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances..", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Title", "Title of the window being displayed. Default is \"Select Database\".", "", false, "false", "Select Database", "" ], [ "Header", "Header text displayed above the database listing. Default is \"Select the database:\".", "", false, "false", "Select the database:", "" ], [ "DefaultDb", "Specify a database to have selected when the window appears.", "", false, "false", "", "" ], [ "EnableException", "By default in most of our commands, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis command, however, gifts you with \"sea of red\" exceptions, by default, because it is useful for advanced scripting.\nUsing this switch turns our \"nice by default\" feature on which makes errors into pretty warnings.", "", false, "false", "False", "" ] ], "Syntax": "Show-DbaDbList [-SqlInstance] \u003cDbaInstanceParameter\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Title] \u003cString\u003e] [[-Header] \u003cString\u003e] [[-DefaultDb] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Show-DbaInstanceFileSystem", "Description": "Similar to the remote file system popup you see when browsing a remote SQL Server in SQL Server Management Studio, this function allows you to traverse the remote SQL Server\u0027s file structure.\n\nShow-DbaInstanceFileSystem 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", "FileSystem" ], "Synopsis": "Shows file system on remote SQL Server in a local GUI and returns the selected directory name", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Show-DbaInstanceFileSystem", "Availability": "Windows only", "Links": "https://dbatools.io/Show-DbaInstanceFileSystem", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eShow-DbaInstanceFileSystem -SqlInstance sql2017\nShows a list of databases using Windows Authentication to connect to the SQL Server. Returns a string of the selected path.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eShow-DbaInstanceFileSystem -SqlInstance sql2017 -SqlCredential $cred\nShows a list of databases using SQL credentials to connect to the SQL Server. Returns a string of the selected path.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Defaults to localhost.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Show-DbaInstanceFileSystem [-SqlInstance] \u003cDbaInstanceParameter\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Start-DbaAgentJob", "Description": "This command starts a job then returns connected SMO object for SQL Agent Job information for each instance(s) of SQL Server.", "Tags": [ "Job", "Agent" ], "Synopsis": "Starts a running SQL Server Agent Job.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Start-DbaAgentJob", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Start-DbaAgentJob", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eStart-DbaAgentJob -SqlInstance localhost\nStarts all running SQL Agent Jobs on the local SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance sql2016 -Job cdc.DBWithCDC_capture | Start-DbaAgentJob\nStarts the cdc.DBWithCDC_capture SQL Agent Job on sql2016\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eStart-DbaAgentJob -SqlInstance sql2016 -Job cdc.DBWithCDC_capture\nStarts the cdc.DBWithCDC_capture SQL Agent Job on sql2016\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$servers | Find-DbaAgentJob -IsFailed | Start-DbaAgentJob\nRestarts all failed jobs on all servers in the $servers collection\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eStart-DbaAgentJob -SqlInstance sql2016 -AllJobs\nStart all the jobs\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eStart-DbaAgentJob -SqlInstance sql2016 -Job @(\u0027Job1\u0027, \u0027Job2\u0027, \u0027Job3\u0027) -Wait\nThis is a serialized approach to submitting jobs and waiting for each job to continue the next.\r\nStarts Job1, waits for completion of Job1\r\nStarts Job2, waits for completion of Job2\r\nStarts Job3, Waits for completion of Job3\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eStart-DbaAgentJob -SqlInstance sql2016 -Job @(\u0027Job1\u0027, \u0027Job2\u0027, \u0027Job3\u0027) -Wait -Parallel\nThis is a parallel approach to submitting all jobs and waiting for them all to complete.\r\nStarts Job1, starts Job2, starts Job3 and waits for completion of Job1, Job2, and Job3.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eStart-DbaAgentJob -SqlInstance sql2016 -Job JobWith5Steps -StepName Step4\nStarts the JobWith5Steps SQL Agent Job at step Step4.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "The job(s) to process - this list is auto-populated from the server. If unspecified, all jobs will be processed.", "", false, "false", "", "" ], [ "StepName", "The step name to start the job at, will default to the step configured by the job.", "", false, "false", "", "" ], [ "ExcludeJob", "The job(s) to exclude - this list is auto-populated from the server.", "", false, "false", "", "" ], [ "InputObject", "Internal parameter that enables piping", "", true, "true (ByValue)", "", "" ], [ "AllJobs", "Retrieve all the jobs", "", false, "false", "False", "" ], [ "Wait", "Wait for output until the job has started", "", false, "false", "False", "" ], [ "Parallel", "Works in conjunction with the Wait switch. Be default, when passing the Wait switch, each job is started one at a time and waits for completion\r\nbefore starting the next job. The Parallel switch will change the behavior to start all jobs at once, and wait for all jobs to complete .", "", false, "false", "False", "" ], [ "WaitPeriod", "Wait period in seconds to use when -Wait is used", "", false, "false", "3", "" ], [ "SleepPeriod", "Period in milliseconds to wait after a job has started", "", false, "false", "300", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Start-DbaAgentJob [-SqlCredential \u003cPSCredential\u003e] [-Job \u003cString[]\u003e] [-StepName \u003cString\u003e] [-ExcludeJob \u003cString[]\u003e] [-AllJobs] [-Wait] [-Parallel] [-WaitPeriod \u003cInt32\u003e] [-SleepPeriod \u003cInt32\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nStart-DbaAgentJob -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Job \u003cString[]\u003e] [-StepName \u003cString\u003e] [-ExcludeJob \u003cString[]\u003e] [-AllJobs] [-Wait] [-Parallel] [-WaitPeriod \u003cInt32\u003e] [-SleepPeriod \u003cInt32\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nStart-DbaAgentJob [-SqlCredential \u003cPSCredential\u003e] [-Job \u003cString[]\u003e] [-StepName \u003cString\u003e] [-ExcludeJob \u003cString[]\u003e] -InputObject \u003cJob[]\u003e [-AllJobs] [-Wait] [-Parallel] [-WaitPeriod \u003cInt32\u003e] [-SleepPeriod \u003cInt32\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Start-DbaEndpoint", "Description": "Starts endpoints on a SQL Server instance.", "Tags": "Endpoint", "Synopsis": "Starts endpoints on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Start-DbaEndpoint", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Start-DbaEndpoint", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eStart-DbaEndpoint -SqlInstance sqlserver2012 -AllEndpoints\nStarts all endpoints on the sqlserver2014 instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eStart-DbaEndpoint -SqlInstance sqlserver2012 -Endpoint endpoint1,endpoint2 -SqlCredential sqladmin\nLogs into sqlserver2012 using alternative credentials and starts the endpoint1 and endpoint2 endpoints.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-Endpoint -SqlInstance sqlserver2012 -Endpoint endpoint1 | Start-DbaEndpoint\nStarts the endpoints returned from the Get-Endpoint function.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Endpoint", "Only start specific endpoints.", "", false, "false", "", "" ], [ "AllEndpoints", "Start all endpoints on an instance.", "", false, "false", "False", "" ], [ "InputObject", "Enables piping from Get-Endpoint.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Start-DbaEndpoint [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Endpoint] \u003cString[]\u003e] [-AllEndpoints] [[-InputObject] \u003cEndpoint[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Start-DbaMigration", "Description": "Start-DbaMigration 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 to exclude support databases such as ReportServerTempDB (Use -IncludeSupportDbs for this). Use -Exclude Databases to skip.\nAll logins. Use -Exclude Logins to skip.\nAll database mail objects. Use -Exclude DatabaseMail\nAll credentials. Use -Exclude Credentials to skip.\nAll objects within the Job Server (SQL Agent). Use -Exclude AgentServer to skip.\nAll linked servers. Use -Exclude LinkedServers to skip.\nAll groups and servers within Central Management Server. Use -Exclude CentralManagementServer to skip.\nAll SQL Server configuration objects (everything in sp_configure). Use -Exclude SpConfigure to skip.\nAll user objects in system databases. Use -Exclude SysDbUserObjects to skip.\nAll system triggers. Use -Exclude SystemTriggers to skip.\nAll system backup devices. Use -Exclude BackupDevices to skip.\nAll Audits. Use -Exclude Audits to skip.\nAll Endpoints. Use -Exclude Endpoints to skip.\nAll Extended Events. Use -Exclude ExtendedEvents to skip.\nAll Policy Management objects. Use -Exclude PolicyManagement to skip.\nAll Resource Governor objects. Use -Exclude ResourceGovernor to skip.\nAll Server Audit Specifications. Use -Exclude ServerAuditSpecifications to skip.\nAll Custom Errors (User Defined Messages). Use -Exclude CustomErrors to skip.\nAll Data Collector collection sets. Does not configure the server. Use -Exclude DataCollector to skip.\nAll startup procedures. Use -Exclude StartupProcedures 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.", "Tags": "Migration", "Synopsis": "Migrates SQL Server *ALL* databases, logins, database mail profiles/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 Exclude or use the other functions available within the dbatools module.", "Alias": "Start-SqlMigration", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Start-DbaMigration", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Start-DbaMigration", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eStart-DbaMigration -Source sqlserver\\instance -Destination sqlcluster -DetachAttach\nAll databases, logins, job objects and sp_configure options will be migrated from sqlserver\\instance to sqlcluster. Databases will be migrated using the detach/copy files/attach method. Dbowner will \r\nbe updated. User passwords, SIDs, database roles and server roles will be migrated along with the login.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$params = @{\n\u003e\u003e Source = \"sqlcluster\"\r\n\u003e\u003e Destination = \"sql2016\"\r\n\u003e\u003e SourceSqlCredential = $scred\r\n\u003e\u003e DestinationSqlCredential = $cred\r\n\u003e\u003e SharedPath = \"\\\\fileserver\\share\\sqlbackups\\Migration\"\r\n\u003e\u003e BackupRestore = $true\r\n\u003e\u003e ReuseSourceFolderStructure = $true\r\n\u003e\u003e Force = $true\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e Start-DbaMigration @params -Verbose\nUtilizes splatting technique to set all the needed parameters. This will migrate databases using the backup/restore method. It will also include migration of the logins, database mail configuration, \r\ncredentials, SQL Agent, Central Management Server, and SQL Server global configuration.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eStart-DbaMigration -Verbose -Source sqlcluster -Destination sql2016 -DetachAttach -Reattach -SetSourceReadonly\nMigrates databases using detach/copy/attach. Reattach at source and set source databases read-only. Also migrates everything else.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$PSDefaultParameters = @{\n\u003e\u003e \"dbatools:Source\" = \"sqlcluster\"\r\n\u003e\u003e \"dbatools:Destination\" = \"sql2016\"\r\n\u003e\u003e }\r\n\u003e\u003e\r\nPS C:\\\u003e Start-DbaMigration -Verbose -Exclude Databases, Logins\nUtilizes the PSDefaultParameterValues system variable, and sets the Source and Destination parameters for any function in the module that has those parameter names. This prevents the need from \r\npassing them in constantly.\r\nThe execution of the function will migrate everything but logins and databases.", "Params": [ [ "Source", "Source SQL Server.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You may specify multiple servers.\nNote that when using -BackupRestore with multiple servers, the backup will only be performed once and backups will be deleted at the end.\nWhen using -DetachAttach with multiple servers, -Reattach must be specified.", "", false, "false", "", "" ], [ "DetachAttach", "If this switch is enabled, the the detach/copy/attach method is used to perform database migrations. No files are deleted on Source. If the destination attachment fails, the source database will be \r\nreattached. File copies are performed over administrative shares (\\\\server\\x$\\mssql) using BITS. If a database is being mirrored, the mirror will be broken prior to migration.", "", false, "false", "False", "" ], [ "Reattach", "If this switch is enabled, all databases are reattached to Source after a DetachAttach migration is complete.", "", false, "false", "False", "" ], [ "BackupRestore", "If this switch is enabled, the Copy-Only backup and restore method is used to perform database migrations. You must specify -SharedPath with a valid UNC format as well (\\\\server\\share).", "", false, "false", "False", "" ], [ "SharedPath", "Specifies the network location for the backup files. The SQL Server service accounts on both Source and Destination must have read/write permission to access this location.", "", false, "false", "", "" ], [ "WithReplace", "If this switch is enabled, databases are restored from backup using WITH REPLACE. This is useful if you want to stage some complex file paths.", "", false, "false", "False", "" ], [ "NoRecovery", "If this switch is enabled, databases will be left in the No Recovery state to enable further backups to be added.", "", false, "false", "False", "" ], [ "SetSourceReadOnly", "If this switch is enabled, all migrated databases will be set to ReadOnly on the source instance prior to detach/attach \u0026 backup/restore. If -Reattach is specified, the database is set to read-only \r\nafter reattaching.", "", false, "false", "False", "" ], [ "ReuseSourceFolderStructure", "If this switch is enabled, the data and log directory structures on Source will be kept on Destination. Otherwise, databases will be migrated to Destination\u0027s default data and log directories.\nConsider this if you\u0027re migrating between different versions and use part of Microsoft\u0027s default SQL structure (MSSQL12.INSTANCE, etc.).", "", false, "false", "False", "" ], [ "IncludeSupportDbs", "If this switch is enabled, the ReportServer, ReportServerTempDb, SSIDb, and distribution databases will be migrated if they exist. A logfile named $SOURCE-$DESTINATION-$date-Sqls.csv will be written \r\nto the current directory. Requires -BackupRestore or -DetachAttach.", "", false, "false", "False", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Exclude", "Exclude one or more objects to migrate\nDatabases\r\nLogins\r\nAgentServer\r\nCredentials\r\nLinkedServers\r\nSpConfigure\r\nCentralManagementServer\r\nDatabaseMail\r\nSysDbUserObjects\r\nSystemTriggers\r\nBackupDevices\r\nAudits\r\nEndpoints\r\nExtendedEvents\r\nPolicyManagement\r\nResourceGovernor\r\nServerAuditSpecifications\r\nCustomErrors\r\nDataCollector\r\nStartupProcedures\r\nAgentServerProperties", "", false, "false", "", "Databases,Logins,AgentServer,Credentials,LinkedServers,SpConfigure,CentralManagementServer,DatabaseMail,SysDbUserObjects,SystemTriggers,BackupDevices,Audits,Endpoints,ExtendedEvents,PolicyManagement,ResourceGovernor,ServerAuditSpecifications,CustomErrors,DataCollector,StartupProcedures,AgentServerProperties" ], [ "DisableJobsOnDestination", "If this switch is enabled, migrated SQL Agent jobs will be disabled on the destination instance.", "", false, "false", "False", "" ], [ "DisableJobsOnSource", "If this switch is enabled, SQL Agent jobs will be disabled on the source instance.", "", false, "false", "False", "" ], [ "ExcludeSaRename", "If this switch is enabled, the sa account will not be renamed on the destination instance to match the source.", "", false, "false", "False", "" ], [ "UseLastBackup", "Use the last full, diff and logs instead of performing backups. Note that the backups must exist in a location accessible by all destination servers, such a network share.", "", false, "false", "False", "" ], [ "KeepCDC", "Indicates whether CDC information should be copied as part of the database", "", false, "false", "False", "" ], [ "KeepReplication", "Indicates whether replication configuration should be copied as part of the database copy operation", "", false, "false", "False", "" ], [ "Continue", "If specified, will to attempt to restore transaction log backups on top of existing database(s) in Recovering or Standby states. Only usable with -UseLastBackup", "", false, "false", "False", "" ], [ "Force", "If migrating users, forces drop and recreate of SQL and Windows logins.\r\nIf migrating databases, deletes existing databases with matching names.\r\nIf using -DetachAttach, -Force will break mirrors and drop dbs from Availability Groups.\nFor other migration objects, it will just drop existing items and readd, if -force is supported within the underlying function.", "", false, "false", "False", "" ], [ "AzureCredential", "Name of the AzureCredential if SharedPath is Azure page blob", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Start-DbaMigration [[-Source] \u003cDbaInstanceParameter\u003e] [[-Destination] \u003cDbaInstanceParameter[]\u003e] [-DetachAttach] [-Reattach] [-BackupRestore] [[-SharedPath] \u003cString\u003e] [-WithReplace] [-NoRecovery] [-SetSourceReadOnly] [-ReuseSourceFolderStructure] [-IncludeSupportDbs] [[-SourceSqlCredential] \u003cPSCredential\u003e] [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Exclude] \u003cString[]\u003e] [-DisableJobsOnDestination] [-DisableJobsOnSource] [-ExcludeSaRename] [-UseLastBackup] [-KeepCDC] [-KeepReplication] [-Continue] [-Force] [[-AzureCredential] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] \r\n[\u003cCommonParameters\u003e]" }, { "Name": "Start-DbaPfDataCollectorSet", "Description": "Starts Performance Monitor Data Collector Set.", "Tags": "PerfMon", "Synopsis": "Starts Performance Monitor Data Collector Set.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Start-DbaPfDataCollectorSet", "Availability": "Windows only", "Links": "https://dbatools.io/Start-DbaPfDataCollectorSet", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eStart-DbaPfDataCollectorSet\nAttempts to start all ready Collectors on localhost.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eStart-DbaPfDataCollectorSet -ComputerName sql2017\nAttempts to start all ready Collectors on localhost.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eStart-DbaPfDataCollectorSet -ComputerName sql2017, sql2016 -Credential ad\\sqldba -CollectorSet \u0027System Correlation\u0027\nStarts the \u0027System Correlation\u0027 Collector on sql2017 and sql2016 using alternative credentials.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSet -CollectorSet \u0027System Correlation\u0027 | Start-DbaPfDataCollectorSet\nStarts the \u0027System Correlation\u0027 Collector.", "Params": [ [ "ComputerName", "The target computer. Defaults to localhost.", "", false, "false", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to $ComputerName using alternative credentials. To use:\n$cred = Get-Credential, then pass $cred object to the -Credential parameter.", "", false, "false", "", "" ], [ "CollectorSet", "The name of the Collector Set to start.", "DataCollectorSet", false, "false", "", "" ], [ "InputObject", "Accepts the object output by Get-DbaPfDataCollectorSet via the pipeline.", "", false, "true (ByValue)", "", "" ], [ "NoWait", "If this switch is enabled, the collector is started and the results are returned immediately.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Start-DbaPfDataCollectorSet [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-CollectorSet] \u003cString[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-NoWait] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Start-DbaService", "Description": "Starts the SQL Server related services on one or more computers. Will follow SQL Server service dependencies.\n\nRequires Local Admin rights on destination computer(s).", "Tags": [ "Service", "SqlServer", "Instance", "Connect" ], "Synopsis": "Starts SQL Server services on a computer.", "Alias": "", "Author": "Kirill Kravtsov (@nvarscar)", "CommandName": "Start-DbaService", "Availability": "Windows only", "Links": "https://dbatools.io/Start-DbaService", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eStart-DbaService -ComputerName sqlserver2014a\nStarts the SQL Server related services on computer sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\u0027,\u0027sql3\u0027| Get-DbaService | Start-DbaService\nGets the SQL Server related services on computers sql1, sql2 and sql3 and starts them.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eStart-DbaService -ComputerName sql1,sql2 -Instance MSSQLSERVER\nStarts the SQL Server services related to the default instance MSSQLSERVER on computers sql1 and sql2.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eStart-DbaService -ComputerName $MyServers -Type SSRS\nStarts the SQL Server related services of type \"SSRS\" (Reporting Services) on computers in the variable MyServers.", "Params": [ [ "ComputerName", "The target SQL Server instance or instances.", "cn,host,Server", false, "false", "$env:COMPUTERNAME", "" ], [ "InstanceName", "Only affects services that belong to the specific instances.", "Instance", false, "false", "", "" ], [ "Type", "Use -Type to collect only services of the desired SqlServiceType.\r\nCan be one of the following: \"Agent\",\"Browser\",\"Engine\",\"FullText\",\"SSAS\",\"SSIS\",\"SSRS\"", "", false, "false", "", "Agent,Browser,Engine,FullText,SSAS,SSIS,SSRS" ], [ "InputObject", "A collection of services from Get-DbaService", "ServiceCollection", true, "true (ByValue)", "", "" ], [ "Timeout", "How long to wait for the start/stop request completion before moving on. Specify 0 to wait indefinitely.", "", false, "false", "60", "" ], [ "Credential", "Credential object used to connect to the computer as a different user.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the cmdlet runs. The cmdlet is not run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the cmdlet.", "cf", false, "false", "", "" ] ], "Syntax": "Start-DbaService [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [-InstanceName \u003cString[]\u003e] [-Type \u003cString[]\u003e] [-Timeout \u003cInt32\u003e] [-Credential \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nStart-DbaService [-InstanceName \u003cString[]\u003e] [-Type \u003cString[]\u003e] -InputObject \u003cObject[]\u003e [-Timeout \u003cInt32\u003e] [-Credential \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Start-DbaTrace", "Description": "Starts SQL Server traces", "Tags": [ "Security", "Trace" ], "Synopsis": "Starts SQL Server traces", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Start-DbaTrace", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Start-DbaTrace", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eStart-DbaTrace -SqlInstance sql2008\nStarts all traces on sql2008\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eStart-DbaTrace -SqlInstance sql2008 -Id 1\nStarts all trace with ID 1 on sql2008\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaTrace -SqlInstance sql2008 | Out-GridView -PassThru | Start-DbaTrace\nStarts selected traces on sql2008", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Id", "A list of trace ids", "", false, "false", "", "" ], [ "InputObject", "Internal parameter for piping", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Start-DbaTrace [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Id] \u003cInt32[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Start-DbaXESession", "Description": "This script starts Extended Events sessions on a SQL Server instance.", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Starts Extended Events sessions.", "Alias": "", "Author": "Doug Meyers", "CommandName": "Start-DbaXESession", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Start-DbaXESession", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eStart-DbaXESession -SqlInstance sqlserver2012 -AllSessions\nStarts all Extended Event Session on the sqlserver2014 instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eStart-DbaXESession -SqlInstance sqlserver2012 -Session xesession1,xesession2\nStarts the xesession1 and xesession2 Extended Event sessions.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eStart-DbaXESession -SqlInstance sqlserver2012 -Session xesession1,xesession2 -StopAt (Get-Date).AddMinutes(30)\nStarts the xesession1 and xesession2 Extended Event sessions and stops them in 30 minutes.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eStart-DbaXESession -SqlInstance sqlserver2012 -Session AlwaysOn_health -StartAt (Get-Date).AddMinutes(1)\nStarts the AlwaysOn_health Extended Event sessions in 1 minute. The command will return immediately.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance sqlserver2012 -Session xesession1 | Start-DbaXESession\nStarts the sessions returned from the Get-DbaXESession function.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Session", "Only start specific Extended Events sessions.", "Sessions", true, "false", "", "" ], [ "StartAt", "Specifies a datetime at which the session will be started. This is done via a self-deleting schedule.\r\nThe command returns immediately and returns the affected sessions in their current state.", "", false, "false", "", "" ], [ "StopAt", "Specifies a datetime at which the session will be stopped. This is done via a self-deleting schedule.", "", false, "false", "", "" ], [ "AllSessions", "Start all Extended Events sessions on an instance, ignoring the packaged sessions: AlwaysOn_health, system_health, telemetry_xevents.", "", true, "false", "False", "" ], [ "InputObject", "Internal parameter to support piping from Get-DbaXESession", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Start-DbaXESession [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] -Session \u003cObject[]\u003e [-StartAt \u003cDateTime\u003e] [-StopAt \u003cDateTime\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nStart-DbaXESession [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-StartAt \u003cDateTime\u003e] [-StopAt \u003cDateTime\u003e] -AllSessions [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nStart-DbaXESession [-StartAt \u003cDateTime\u003e] [-StopAt \u003cDateTime\u003e] -InputObject \u003cSession[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Start-DbaXESmartTarget", "Description": "XESmartTarget offers the ability to set up complex actions in response to Extended Events captured in sessions, without writing a single line of code.\n\nSee more at https://github.com/spaghettidba/XESmartTarget/wiki", "Tags": [ "ExtendedEvent", "XE", "XEvent", "SmartTarget" ], "Synopsis": "XESmartTarget runs as a client application for an Extended Events session running on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl) | SmartTarget by Gianluca Sartori (@spaghettidba)", "CommandName": "Start-DbaXESmartTarget", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Start-DbaXESmartTarget", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$response = New-DbaXESmartQueryExec -SqlInstance sql2017 -Database dbadb -Query \"update table set whatever = 1\"\nPS C:\\\u003eStart-DbaXESmartTarget -SqlInstance sql2017 -Session deadlock_tracker -Responder $response\nExecutes a T-SQL command against dbadb on sql2017 whenever a deadlock event is recorded.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$response = New-DbaXESmartQueryExec -SqlInstance sql2017 -Database dbadb -Query \"update table set whatever = 1\"\nPS C:\\\u003e$params = @{\r\n\u003e\u003e SmtpServer = \"smtp.ad.local\"\r\n\u003e\u003e To = \"admin@ad.local\"\r\n\u003e\u003e Sender = \"reports@ad.local\"\r\n\u003e\u003e Subject = \"Query executed\"\r\n\u003e\u003e Body = \"Query executed at {collection_time}\"\r\n\u003e\u003e Attachment = \"batch_text\"\r\n\u003e\u003e AttachmentFileName = \"query.sql\"\r\n\u003e\u003e }\r\nPS C:\\\u003e $emailresponse = New-DbaXESmartEmail @params\r\nPS C:\\\u003e Start-DbaXESmartTarget -SqlInstance sql2017 -Session querytracker -Responder $response, $emailresponse\nExecutes a T-SQL command against dbadb on sql2017 and sends an email whenever a querytracker event is recorded.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$columns = \"cpu_time\", \"duration\", \"physical_reads\", \"logical_reads\", \"writes\", \"row_count\", \"batch_text\"\nPS C:\\\u003e $response = New-DbaXESmartTableWriter -SqlInstance sql2017 -Database dbadb -Table deadlocktracker -OutputColumns $columns -Filter \"duration \u003e 10000\"\r\nPS C:\\\u003e Start-DbaXESmartTarget -SqlInstance sql2017 -Session deadlock_tracker -Responder $response\nWrites Extended Events to the deadlocktracker table in dbadb on sql2017.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the name of the database that contains the target table.", "", false, "false", "", "" ], [ "Session", "Name of the Extended Events session to attach to.\nYou can monitor a single session with an instance of XESmartTarget. In case you need to perform action on multiple sessions, run an additional instance of XESmartTarget, with its own configuration \r\nfile.", "", true, "false", "", "" ], [ "FailOnProcessingError", "If this switch is enabled, the a processing error will trigger a failure.", "", false, "false", "False", "" ], [ "Responder", "The list of responses can include zero or more Response objects, each to be configured by specifying values for their public members.", "", false, "false", "", "" ], [ "Template", "Path to the dbatools built-in templates", "", false, "false", "", "" ], [ "NotAsJob", "If this switch is enabled, output will be sent to screen indefinitely. BY default, a job will be run in the background.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Start-DbaXESmartTarget [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString\u003e] [-Session] \u003cString\u003e [-FailOnProcessingError] [[-Responder] \u003cObject[]\u003e] [[-Template] \u003cString[]\u003e] [-NotAsJob] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Stop-DbaAgentJob", "Description": "This command stops a job then returns connected SMO object for SQL Agent Job information for each instance(s) of SQL Server.", "Tags": [ "Job", "Agent" ], "Synopsis": "Stops a running SQL Server Agent Job.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Stop-DbaAgentJob", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Stop-DbaAgentJob", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eStop-DbaAgentJob -SqlInstance localhost\nStops all running SQL Agent Jobs on the local SQL Server instance\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgentJob -SqlInstance sql2016 -Job cdc.DBWithCDC_capture | Stop-DbaAgentJob\nStops the cdc.DBWithCDC_capture SQL Agent Job on sql2016\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eStop-DbaAgentJob -SqlInstance sql2016 -Job cdc.DBWithCDC_capture\nStops the cdc.DBWithCDC_capture SQL Agent Job on sql2016", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "The job(s) to process - this list is auto-populated from the server. If unspecified, all jobs will be processed.", "", false, "false", "", "" ], [ "ExcludeJob", "The job(s) to exclude - this list is auto-populated from the server.", "", false, "false", "", "" ], [ "InputObject", "Internal parameter that enables piping", "", true, "true (ByValue)", "", "" ], [ "Wait", "Wait for output until the job has completely stopped", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Stop-DbaAgentJob [-SqlCredential \u003cPSCredential\u003e] [-Job \u003cString[]\u003e] [-ExcludeJob \u003cString[]\u003e] [-Wait] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nStop-DbaAgentJob -SqlInstance \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] [-Job \u003cString[]\u003e] [-ExcludeJob \u003cString[]\u003e] [-Wait] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nStop-DbaAgentJob [-SqlCredential \u003cPSCredential\u003e] [-Job \u003cString[]\u003e] [-ExcludeJob \u003cString[]\u003e] -InputObject \u003cJob[]\u003e [-Wait] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Stop-DbaEndpoint", "Description": "Stops endpoints on a SQL Server instance.", "Tags": "Endpoint", "Synopsis": "Stops endpoints on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Stop-DbaEndpoint", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Stop-DbaEndpoint", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eStop-DbaEndpoint -SqlInstance sql2017a -AllEndpoints\nStops all endpoints on the sqlserver2014 instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eStop-DbaEndpoint -SqlInstance sql2017a -Endpoint endpoint1,endpoint2\nStops the endpoint1 and endpoint2 endpoints.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-Endpoint -SqlInstance sql2017a -Endpoint endpoint1 | Stop-DbaEndpoint\nStops the endpoints returned from the Get-Endpoint command.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Endpoint", "Only stop specific endpoints.", "", false, "false", "", "" ], [ "AllEndpoints", "Stops all endpoints on an instance.", "", false, "false", "False", "" ], [ "InputObject", "Enables piping from Get-Endpoint.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Stop-DbaEndpoint [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Endpoint] \u003cString[]\u003e] [-AllEndpoints] [[-InputObject] \u003cEndpoint[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Stop-DbaExternalProcess", "Description": "Stops an OS process created by SQL Server\n\nHelps when killing hung sessions with External Wait Types\n\nhttps://web.archive.org/web/20201027122300/http://vickyharp.com/2013/12/killing-sessions-with-external-wait-types/", "Tags": "Process", "Synopsis": "Stops an OS process created by SQL Server", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Stop-DbaExternalProcess", "Availability": "Windows only", "Links": "https://dbatools.io/Stop-DbaExternalProcess", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaExternalProcess -ComputerName SQL01 | Stop-DbaExternalProcess\nKills all OS processes created by SQL Server on SQL01\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaExternalProcess -ComputerName SQL01 | Where-Object Name -eq \"cmd.exe\" | Stop-DbaExternalProcess\nKills all cmd.exe processes created by SQL Server on SQL01", "Params": [ [ "ComputerName", "The target SQL Server host computer", "", true, "true (ByPropertyName)", "", "" ], [ "Credential", "Allows you to login to $ComputerName using alternative credentials.", "", false, "true (ByPropertyName)", "", "" ], [ "ProcessId", "The process ID of the OS process to kill", "pid", false, "true (ByPropertyName)", "0", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Stop-DbaExternalProcess [-ComputerName] \u003cDbaInstanceParameter\u003e [[-Credential] \u003cPSCredential\u003e] [[-ProcessId] \u003cInt32\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Stop-DbaPfDataCollectorSet", "Description": "Stops Performance Monitor Data Collector Set.", "Tags": "PerfMon", "Synopsis": "Stops Performance Monitor Data Collector Set.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Stop-DbaPfDataCollectorSet", "Availability": "Windows only", "Links": "https://dbatools.io/Stop-DbaPfDataCollectorSet", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eStop-DbaPfDataCollectorSet\nAttempts to stop all ready Collectors on localhost.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eStop-DbaPfDataCollectorSet -ComputerName sql2017\nAttempts to stop all ready Collectors on localhost.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eStop-DbaPfDataCollectorSet -ComputerName sql2017, sql2016 -Credential ad\\sqldba -CollectorSet \u0027System Correlation\u0027\nStops the \u0027System Correlation\u0027 Collector on sql2017 and sql2016 using alternative credentials.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaPfDataCollectorSet -CollectorSet \u0027System Correlation\u0027 | Stop-DbaPfDataCollectorSet\nStops the \u0027System Correlation\u0027 Collector.", "Params": [ [ "ComputerName", "The target computer. Defaults to localhost.", "", false, "false", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to $ComputerName using alternative credentials. To use:\n$cred = Get-Credential, then pass $cred object to the -Credential parameter.", "", false, "false", "", "" ], [ "CollectorSet", "The name of the Collector Set to stop.", "DataCollectorSet", false, "false", "", "" ], [ "InputObject", "Accepts the object output by Get-DbaPfDataCollectorSet via the pipeline.", "", false, "true (ByValue)", "", "" ], [ "NoWait", "If this switch is enabled, the collector is stopped and the results are returned immediately.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Stop-DbaPfDataCollectorSet [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-CollectorSet] \u003cString[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-NoWait] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Stop-DbaProcess", "Description": "This command kills all spids associated with a spid, login, host, program or database.\n\nIf you are attempting to kill your own login sessions, the process performing the kills will be skipped.", "Tags": "Processes", "Synopsis": "This command finds and kills SQL Server processes.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Stop-DbaProcess", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Stop-DbaProcess", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eStop-DbaProcess -SqlInstance sqlserver2014a -Login base\\ctrlb, sa\nFinds all processes for base\\ctrlb and sa on sqlserver2014a, then kills them. Uses Windows Authentication to login to sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eStop-DbaProcess -SqlInstance sqlserver2014a -SqlCredential $credential -Spid 56, 77\nFinds processes for spid 56 and 57, then kills them. Uses alternative (SQL or Windows) credentials to login to sqlserver2014a.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eStop-DbaProcess -SqlInstance sqlserver2014a -Program \u0027Microsoft SQL Server Management Studio\u0027\nFinds processes that were created in Microsoft SQL Server Management Studio, then kills them.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eStop-DbaProcess -SqlInstance sqlserver2014a -Hostname workstationx, server100\nFinds processes that were initiated (computers/clients) workstationx and server 1000, then kills them.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eStop-DbaProcess -SqlInstance sqlserver2014 -Database tempdb -WhatIf\nShows what would happen if the command were executed.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eGet-DbaProcess -SqlInstance sql2016 -Program \u0027dbatools PowerShell module - dbatools.io\u0027 | Stop-DbaProcess\nFinds processes that were created with dbatools, then kills them.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Spid", "Specifies one or more spids to be killed. Options for this parameter are auto-populated from the server.", "", false, "false", "", "" ], [ "ExcludeSpid", "Specifies one or more spids which will not be killed. Options for this parameter are auto-populated from the server.\nExclude is the last filter to run, so even if a spid matches (for example) Hosts, if it\u0027s listed in Exclude it wil be excluded.", "", false, "false", "", "" ], [ "Database", "Specifies one or more databases whose processes will be killed. Options for this parameter are auto-populated from the server and only databases that have active processes are offered.\nThis parameter is auto-populated from -SqlInstance and allows only database names that have active processes. You can specify one or more Databases whose processes will be killed.", "", false, "false", "", "" ], [ "Login", "Specifies one or more login names whose processes will be killed. Options for this parameter are auto-populated from the server and only login names that have active processes are offered.", "", false, "false", "", "" ], [ "Hostname", "Specifies one or more client hostnames whose processes will be killed. Options for this parameter are auto-populated from the server and only hostnames that have active processes are offered.", "", false, "false", "", "" ], [ "Program", "Specifies one or more client programs whose processes will be killed. Options for this parameter are auto-populated from the server and only programs that have active processes are offered.", "", false, "false", "", "" ], [ "InputObject", "This is the process object passed by Get-DbaProcess if using a pipeline.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Stop-DbaProcess [-SqlCredential \u003cPSCredential\u003e] [-Spid \u003cInt32[]\u003e] [-ExcludeSpid \u003cInt32[]\u003e] [-Database \u003cString[]\u003e] [-Login \u003cString[]\u003e] [-Hostname \u003cString[]\u003e] [-Program \u003cString[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nStop-DbaProcess -SqlInstance \u003cDbaInstanceParameter\u003e [-SqlCredential \u003cPSCredential\u003e] [-Spid \u003cInt32[]\u003e] [-ExcludeSpid \u003cInt32[]\u003e] [-Database \u003cString[]\u003e] [-Login \u003cString[]\u003e] [-Hostname \u003cString[]\u003e] [-Program \u003cString[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nStop-DbaProcess [-SqlCredential \u003cPSCredential\u003e] [-Spid \u003cInt32[]\u003e] [-ExcludeSpid \u003cInt32[]\u003e] [-Database \u003cString[]\u003e] [-Login \u003cString[]\u003e] [-Hostname \u003cString[]\u003e] [-Program \u003cString[]\u003e] -InputObject \u003cObject[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Stop-DbaService", "Description": "Stops the SQL Server related services on one or more computers. Will follow SQL Server service dependencies.\n\nRequires Local Admin rights on destination computer(s).", "Tags": [ "Service", "Stop" ], "Synopsis": "Stops SQL Server services on a computer.", "Alias": "", "Author": "Kirill Kravtsov (@nvarscar)", "CommandName": "Stop-DbaService", "Availability": "Windows only", "Links": "https://dbatools.io/Stop-DbaService", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eStop-DbaService -ComputerName sqlserver2014a\nStops the SQL Server related services on computer sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e\u0027sql1\u0027,\u0027sql2\u0027,\u0027sql3\u0027| Get-DbaService | Stop-DbaService\nGets the SQL Server related services on computers sql1, sql2 and sql3 and stops them.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eStop-DbaService -ComputerName sql1,sql2 -Instance MSSQLSERVER\nStops the SQL Server services related to the default instance MSSQLSERVER on computers sql1 and sql2.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eStop-DbaService -ComputerName $MyServers -Type SSRS\nStops the SQL Server related services of type \"SSRS\" (Reporting Services) on computers in the variable MyServers.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eStop-DbaService -ComputerName sql1 -Type Engine -Force\nStops SQL Server database engine services on sql1 forcing dependent SQL Server Agent services to stop as well.", "Params": [ [ "ComputerName", "The target SQL Server instance or instances.", "cn,host,Server", false, "false", "$env:COMPUTERNAME", "" ], [ "InstanceName", "Only affects services that belong to the specific instances.", "Instance", false, "false", "", "" ], [ "Type", "Use -Type to collect only services of the desired SqlServiceType.\r\nCan be one of the following: \"Agent\",\"Browser\",\"Engine\",\"FullText\",\"SSAS\",\"SSIS\",\"SSRS\"", "", false, "false", "", "Agent,Browser,Engine,FullText,SSAS,SSIS,SSRS" ], [ "InputObject", "A collection of services from Get-DbaService", "ServiceCollection", true, "true (ByValue)", "", "" ], [ "Timeout", "How long to wait for the start/stop request completion before moving on. Specify 0 to wait indefinitely.", "", false, "false", "60", "" ], [ "Credential", "Credential object used to connect to the computer as a different user.", "", false, "false", "", "" ], [ "Force", "Use this switch to stop dependent services before proceeding with the specified service", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the cmdlet runs. The cmdlet is not run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the cmdlet.", "cf", false, "false", "", "" ] ], "Syntax": "Stop-DbaService [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [-InstanceName \u003cString[]\u003e] [-Type \u003cString[]\u003e] [-Timeout \u003cInt32\u003e] [-Credential \u003cPSCredential\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nStop-DbaService [-InstanceName \u003cString[]\u003e] [-Type \u003cString[]\u003e] -InputObject \u003cObject[]\u003e [-Timeout \u003cInt32\u003e] [-Credential \u003cPSCredential\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Stop-DbaTrace", "Description": "Stops SQL Server traces", "Tags": [ "Security", "Trace" ], "Synopsis": "Stops SQL Server traces", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Stop-DbaTrace", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Stop-DbaTrace", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eStop-DbaTrace -SqlInstance sql2008\nStops all traces on sql2008\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eStop-DbaTrace -SqlInstance sql2008 -Id 1\nStops all trace with ID 1 on sql2008\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaTrace -SqlInstance sql2008 | Out-GridView -PassThru | Stop-DbaTrace\nStops selected traces on sql2008", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Id", "A list of trace ids", "", false, "false", "", "" ], [ "InputObject", "Internal parameter for piping", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Stop-DbaTrace [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Id] \u003cInt32[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Stop-DbaXESession", "Description": "This script stops Extended Events sessions on a SQL Server instance.", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Stops Extended Events sessions.", "Alias": "", "Author": "Doug Meyers", "CommandName": "Stop-DbaXESession", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Stop-DbaXESession", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eStop-DbaXESession -SqlInstance sqlserver2012 -AllSessions\nStops all Extended Event Session on the sqlserver2014 instance.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eStop-DbaXESession -SqlInstance sqlserver2012 -Session xesession1,xesession2\nStops the xesession1 and xesession2 Extended Event sessions.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance sqlserver2012 -Session xesession1 | Stop-DbaXESession\nStops the sessions returned from the Get-DbaXESession function.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Session", "Specifies individual Extended Events sessions to stop.", "Sessions", true, "false", "", "" ], [ "AllSessions", "If this switch is enabled, all Extended Events sessions will be stopped except the packaged sessions AlwaysOn_health, system_health, telemetry_xevents.", "", true, "false", "False", "" ], [ "InputObject", "Accepts the object output by Get-DbaXESession as the list of sessions to be stopped.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Stop-DbaXESession [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] -Session \u003cObject[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nStop-DbaXESession [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [-SqlCredential \u003cPSCredential\u003e] -AllSessions [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nStop-DbaXESession -InputObject \u003cSession[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Stop-DbaXESmartTarget", "Description": "Stops an XESmartTarget PowerShell job. Useful if you want to run a target, but not right now.", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Stops an XESmartTarget PowerShell job. Useful if you want to run a target, but not right now.", "Alias": "", "Author": "Chrissy LeMaire (@cl) | SmartTarget by Gianluca Sartori (@spaghettidba)", "CommandName": "Stop-DbaXESmartTarget", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Stop-DbaXESmartTarget", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaXESmartTarget | Stop-DbaXESmartTarget\nStops all XESmartTarget jobs.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaXESmartTarget | Where-Object Id -eq 2 | Stop-DbaXESmartTarget\nStops a specific XESmartTarget job.", "Params": [ [ "InputObject", "The XESmartTarget job object.", "", true, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Stop-DbaXESmartTarget [-InputObject] \u003cObject[]\u003e [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Suspend-DbaAgDbDataMovement", "Description": "Suspends data movement for an availability group database on a SQL Server instance.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Suspends data movement for an availability group database on a SQL Server instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Suspend-DbaAgDbDataMovement", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Suspend-DbaAgDbDataMovement", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSuspend-DbaAgDbDataMovement -SqlInstance sql2017a -AvailabilityGroup ag1 -Database db1, db2\nSuspends data movement on db1 and db2 to ag1 on sql2017a. Prompts for confirmation.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAgDatabase -SqlInstance sql2017a, sql2019 | Out-GridView -Passthru | Suspend-DbaAgDbDataMovement -Confirm:$false\nSuspends data movement on the selected availability group databases. Does not prompt for confirmation.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "The availability group where the database movement will be suspended.", "", false, "false", "", "" ], [ "Database", "The database or databases to suspend movement upon.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaAgDatabase", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Suspend-DbaAgDbDataMovement [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString\u003e] [[-Database] \u003cString[]\u003e] [[-InputObject] \u003cAvailabilityDatabase[]\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Sync-DbaAvailabilityGroup", "Description": "Syncs dependent objects for availability groups. Such objects include:\n\nSpConfigure\nCustomErrors\nCredentials\nDatabaseMail\nLinkedServers\nLogins\nLoginPermissions\nSystemTriggers\nDatabaseOwner\nAgentCategory\nAgentOperator\nAgentAlert\nAgentProxy\nAgentSchedule\nAgentJob\n\nNote that any of these can be excluded. For specific object exclusions (such as a single job), using the underlying Copy-Dba* command will be required.\n\nThis command does not filter by which logins are in use by the ag databases or which linked servers are used. All objects that are not excluded will be copied like hulk smash.", "Tags": [ "AvailabilityGroup", "HA", "AG" ], "Synopsis": "Syncs dependent objects such as jobs, logins and custom errors for availability groups", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Sync-DbaAvailabilityGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Sync-DbaAvailabilityGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSync-DbaAvailabilityGroup -Primary sql2016a -AvailabilityGroup db3\nSyncs the following on all replicas found in the db3 AG:\r\nSpConfigure, CustomErrors, Credentials, DatabaseMail, LinkedServers\r\nLogins, LoginPermissions, SystemTriggers, DatabaseOwner, AgentCategory,\r\nAgentOperator, AgentAlert, AgentProxy, AgentSchedule, AgentJob\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sql2016a | Sync-DbaAvailabilityGroup -ExcludeType LoginPermissions, LinkedServers -ExcludeLogin login1, login2 -Job job1, job2\nSyncs the following on all replicas found in all AGs on the specified instance:\r\nSpConfigure, CustomErrors, Credentials, DatabaseMail, Logins,\r\nSystemTriggers, DatabaseOwner, AgentCategory, AgentOperator\r\nAgentAlert, AgentProxy, AgentSchedule, AgentJob.\nCopies all logins except for login1 and login2 and only syncs job1 and job2\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaAvailabilityGroup -SqlInstance sql2016a | Sync-DbaAvailabilityGroup -WhatIf\nShows what would happen if the command were to run but doesn\u0027t actually perform the action.", "Params": [ [ "Primary", "The primary SQL Server instance. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "PrimarySqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Secondary", "The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.", "", false, "false", "", "" ], [ "SecondarySqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "The name of the Availability Group.", "", false, "false", "", "" ], [ "Exclude", "Exclude one or more objects to export\nSpConfigure\r\nCustomErrors\r\nCredentials\r\nDatabaseMail\r\nLinkedServers\r\nLogins\r\nLoginPermissions\r\nSystemTriggers\r\nDatabaseOwner\r\nAgentCategory\r\nAgentOperator\r\nAgentAlert\r\nAgentProxy\r\nAgentSchedule\r\nAgentJob", "ExcludeType", false, "false", "", "AgentCategory,AgentOperator,AgentAlert,AgentProxy,AgentSchedule,AgentJob,Credentials,CustomErrors,DatabaseMail,DatabaseOwner,LinkedServers,Logins,LoginPermissions,SpConfigure,SystemTriggers" ], [ "Login", "Specific logins to sync. If unspecified, all logins will be processed.", "", false, "false", "", "" ], [ "ExcludeLogin", "Specific logins to exclude when performing the sync. If unspecified, all logins will be processed.", "", false, "false", "", "" ], [ "Job", "Specific jobs to sync. If unspecified, all jobs will be processed.", "", false, "false", "", "" ], [ "ExcludeJob", "Specific jobs to exclude when performing the sync. If unspecified, all jobs will be processed.", "", false, "false", "", "" ], [ "DisableJobOnDestination", "If this switch is enabled, the newly migrated job will be disabled on the destination server.", "", false, "false", "False", "" ], [ "InputObject", "Enables piping from Get-DbaAvailabilityGroup.", "", false, "true (ByValue)", "", "" ], [ "Force", "If this switch is enabled, the objects will dropped and recreated on Destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Sync-DbaAvailabilityGroup [[-Primary] \u003cDbaInstanceParameter\u003e] [[-PrimarySqlCredential] \u003cPSCredential\u003e] [[-Secondary] \u003cDbaInstanceParameter[]\u003e] [[-SecondarySqlCredential] \u003cPSCredential\u003e] [[-AvailabilityGroup] \u003cString\u003e] [[-Exclude] \u003cString[]\u003e] [[-Login] \u003cString[]\u003e] [[-ExcludeLogin] \u003cString[]\u003e] [[-Job] \u003cString[]\u003e] [[-ExcludeJob] \u003cString[]\u003e] [-DisableJobOnDestination] [[-InputObject] \u003cAvailabilityGroup[]\u003e] [-Force] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Sync-DbaLoginPermission", "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. Credential removal is not currently supported for this operation.", "Tags": [ "Migration", "Login" ], "Synopsis": "Copies SQL login permissions from one server to another.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Sync-DbaLoginPermission", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Sync-DbaLoginPermission", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eSync-DbaLoginPermission -Source sqlserver2014a -Destination sqlcluster\nSyncs only SQL Server login permissions, roles, etc. Does not add or drop logins or users. To copy logins and their permissions, use Copy-SqlLogin.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eSync-DbaLoginPermission -Source sqlserver2014a -Destination sqlcluster -Exclude realcajun -SourceSqlCredential $scred -DestinationSqlCredential $dcred\nCopies all login permissions except for realcajun using SQL Authentication to connect to each server. If a login already exists on the destination, the permissions will not be migrated.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eSync-DbaLoginPermission -Source sqlserver2014a -Destination sqlcluster -Login realcajun, netnerds\nCopies permissions ONLY for logins netnerds and realcajun.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "true (ByValue)", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Login", "The login(s) to process. Options for this list are auto-populated from the server. If unspecified, all logins will be processed.", "", false, "false", "", "" ], [ "ExcludeLogin", "The login(s) to exclude. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Sync-DbaLoginPermission [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter[]\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Login] \u003cString[]\u003e] [[-ExcludeLogin] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaAgentJobOwner", "Description": "This function checks all SQL Agent Jobs on an instance against a SQL login to validate if that login owns those SQL Agent Jobs or not. By default, the function checks against \u0027sa\u0027 for ownership, but the user can pass a specific login if they use something else.\n\nOnly SQL Agent Jobs that do not match this ownership will be displayed.\nBest practice reference: https://www.itprotoday.com/sql-server-tip-assign-ownership-jobs-sysadmin-account", "Tags": [ "Agent", "Job", "Owner" ], "Synopsis": "Checks SQL Agent Job owners against a login to validate which jobs do not match that owner.", "Alias": "", "Author": "Michael Fal (@Mike_Fal), http://mikefal.net", "CommandName": "Test-DbaAgentJobOwner", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaAgentJobOwner", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaAgentJobOwner -SqlInstance localhost\nReturns all SQL Agent Jobs where the owner does not match \u0027sa\u0027.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaAgentJobOwner -SqlInstance localhost -ExcludeJob \u0027syspolicy_purge_history\u0027\nReturns SQL Agent Jobs except for the syspolicy_purge_history job\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaAgentJobOwner -SqlInstance localhost -Login DOMAIN\\account\nReturns all SQL Agent Jobs where the owner does not match DOMAIN\\account. Note\r\nthat Login must be a valid security principal that exists on the target server.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Job", "Specifies the job(s) to process. Options for this list are auto-populated from the server. If unspecified, all jobs will be processed.", "Jobs", false, "false", "", "" ], [ "ExcludeJob", "Specifies the job(s) to exclude from processing. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "Login", "Specifies the login that you wish check for ownership. This defaults to \u0027sa\u0027 or the sysadmin name if sa was renamed. This must be a valid security principal which exists on the target server.", "TargetLogin", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaAgentJobOwner [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Job] \u003cObject[]\u003e] [[-ExcludeJob] \u003cObject[]\u003e] [[-Login] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaAvailabilityGroup", "Description": "Tests the health of an Availability Group.\n\nCan also test whether all prerequisites for Add-DbaAgDatabase are met.", "Tags": [ "AvailabilityGroup", "HA", "AG", "Test" ], "Synopsis": "Tests the health of an Availability Group and prerequisites for changing it.", "Alias": "", "Author": "Andreas Jordan (@JordanOrdix), ordix.de", "CommandName": "Test-DbaAvailabilityGroup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaAvailabilityGroup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaAvailabilityGroup -SqlInstance SQL2016 -AvailabilityGroup TestAG1\nTest Availability Group TestAG1 with SQL2016 as the primary replica.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaAvailabilityGroup -SqlInstance SQL2016 -AvailabilityGroup TestAG1 -AddDatabase AdventureWorks -SeedingMode Automatic\nTest if database AdventureWorks can be added to the Availability Group TestAG1 with automatic seeding.", "Params": [ [ "SqlInstance", "The primary replica of the Availability Group.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AvailabilityGroup", "The name of the Availability Group to test.", "", true, "false", "", "" ], [ "Secondary", "Not required - the command will figure this out. But use this parameter if secondary replicas listen on a non default port.", "", false, "false", "", "" ], [ "SecondarySqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "AddDatabase", "Test whether all prerequisites for Add-DbaAgDatabase to add these databases to the Availability Group are met.\nUse Secondary, SecondarySqlCredential, SeedingMode, SharedPath and UseLastBackup with the same values that will be used with Add-DbaAgDatabase later.", "", false, "false", "", "" ], [ "SeedingMode", "Only used when AddDatabase is used. See documentation at Add-DbaAgDatabase for more details.", "", false, "false", "", "Automatic,Manual" ], [ "SharedPath", "Only used when AddDatabase is used. See documentation at Add-DbaAgDatabase for more details.", "", false, "false", "", "" ], [ "UseLastBackup", "Only used when AddDatabase is used. See documentation at Add-DbaAgDatabase for more details.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaAvailabilityGroup [-SqlInstance] \u003cDbaInstanceParameter\u003e [-SqlCredential \u003cPSCredential\u003e] -AvailabilityGroup \u003cString\u003e [-Secondary \u003cDbaInstanceParameter[]\u003e] [-SecondarySqlCredential \u003cPSCredential\u003e] [-AddDatabase \u003cString[]\u003e] [-SeedingMode \u003cString\u003e] [-SharedPath \u003cString\u003e] [-UseLastBackup] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaBackupInformation", "Description": "Input is normally from a backup history object generated from `Format-DbaBackupInformation`. This is then parse to check that it\u0027s valid for restore. Tests performed include:\n - Checking unbroken LSN chain\n - If the target database exists and WithReplace has been provided\n - If any files already exist, but owned by other databases\n - Creates any new folders required\n - That the backup files exists at the location specified, and can be seen by the Sql Instance\n - If no errors are found then the objects for that database will me marked as Verified", "Tags": [ "Backup", "Restore", "DisasterRecovery" ], "Synopsis": "Tests a dbatools backup history object is correct for restoring", "Alias": "", "Author": "Stuart Moore (@napalmgram), stuart-moore.com", "CommandName": "Test-DbaBackupInformation", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaBackupInformation", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$BackupHistory | Test-DbaBackupInformation -SqlInstance MyInstance\nPS C:\\\u003e $PassedDbs = $BackupHistory | Where-Object {$_.IsVerified -eq $True}\r\nPS C:\\\u003e $FailedDbs = $BackupHistory | Where-Object {$_.IsVerified -ne $True}\nPass in a BackupHistory object to be tested against MyInstance.\r\nThose records that pass are marked as verified. We can then use the IsVerified property to divide the failures and successes", "Params": [ [ "BackupHistory", "dbatools BackupHistory object. Normally this will have been process with `Select-` and then `Format-DbaBackupInformation`", "", true, "true (ByValue)", "", "" ], [ "SqlInstance", "The Sql Server instance that wil be performing the restore", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "WithReplace", "By default we won\u0027t overwrite an existing database, this switch tells us you want to", "", false, "false", "False", "" ], [ "Continue", "Switch to indicate a continuing restore", "", false, "false", "False", "" ], [ "VerifyOnly", "This switch indicates that you only wish to verify a restore, so runs a smaller number of tests as you won\u0027t be writing anything to the restore server", "", false, "false", "False", "" ], [ "OutputScriptOnly", "Switch to disable path creation. Will write a warning that a path does not exist", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the cmdlet runs. The cmdlet is not run.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before running the cmdlet.", "cf", false, "false", "", "" ] ], "Syntax": "Test-DbaBackupInformation [-BackupHistory] \u003cObject[]\u003e [[-SqlInstance] \u003cDbaInstanceParameter\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [-WithReplace] [-Continue] [-VerifyOnly] [-OutputScriptOnly] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaBuild", "Description": "Returns info about the specific build of a SQL instance, including the SP, the CU and the reference KB, End Of Support, wherever possible. It adds a Compliance property as true/false, and adds details about the \"targeted compliance\".\nThe build data used can be found here: https://dbatools.io/builds", "Tags": [ "SqlBuild", "Version" ], "Synopsis": "Returns SQL Server Build \"compliance\" level on a build.", "Alias": "", "Author": "Simone Bizzotto (@niphold) | Friedrich Weinmann (@FredWeinmann)", "CommandName": "Test-DbaBuild", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaBuild", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaBuild -Build \"12.0.5540\" -MinimumBuild \"12.0.5557\"\nReturns information about a build identified by \"12.0.5540\" (which is SQL 2014 with SP2 and CU4), which is not compliant as the minimum required\r\nbuild is \"12.0.5557\" (which is SQL 2014 with SP2 and CU8).\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaBuild -Build \"12.0.5540\" -MaxBehind \"1SP\"\nReturns information about a build identified by \"12.0.5540\", making sure it is AT MOST 1 Service Pack \"behind\". For that version,\r\nthat identifies an SP2, means accepting as the lowest compliance version as \"12.0.4110\", that identifies 2014 with SP1.\nOutput column CUTarget is not relevant (empty). SPTarget and BuildTarget are filled in the result.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaBuild -Build \"12.0.5540\" -MaxBehind \"1SP 1CU\"\nReturns information about a build identified by \"12.0.5540\", making sure it is AT MOST 1 Service Pack \"behind\", plus 1 CU \"behind\". For that version,\r\nthat identifies an SP2 and CU, rolling back 1 SP brings you to \"12.0.4110\", but given the latest CU for SP1 is CU13, the target \"compliant\" build\r\nwill be \"12.0.4511\", which is 2014 with SP1 and CU12.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eTest-DbaBuild -Build \"12.0.5540\" -MaxBehind \"0CU\"\nReturns information about a build identified by \"12.0.5540\", making sure it is the latest CU release.\nOutput columns CUTarget, SPTarget and BuildTarget are relevant. If the latest build is a service pack (not a CU), CUTarget will be empty.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eTest-DbaBuild -Build \"12.0.5540\" -Latest\nReturns information about a build identified by \"12.0.5540\", making sure it is the latest build available.\nOutput columns CUTarget and SPTarget are not relevant (empty), only the BuildTarget is.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eTest-DbaBuild -Build \"12.00.4502\" -MinimumBuild \"12.0.4511\" -Update\nSame as before, but tries to fetch the most up to date index online. When the online version is newer, the local one gets overwritten.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eTest-DbaBuild -Build \"12.0.4502\",\"10.50.4260\" -MinimumBuild \"12.0.4511\"\nReturns information builds identified by these versions strings.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlserver2014a | Test-DbaBuild -MinimumBuild \"12.0.4511\"\nIntegrate with other cmdlets to have builds checked for all your registered servers on sqlserver2014a.", "Params": [ [ "Build", "Instead of connecting to a real instance, pass a string identifying the build to get the info back.", "", false, "false", "", "" ], [ "MinimumBuild", "This is the build version to test \"compliance\" against. Anything below this is flagged as not compliant.", "", false, "false", "", "" ], [ "MaxBehind", "Instead of using a specific MinimumBuild here you can pass \"how many service packs and cu back\" is the targeted compliance level. You can use xxSP or xxCU or both, where xx is a number. See the \r\nExamples for more information.", "", false, "false", "", "" ], [ "Latest", "Shortcut for specifying the very most up-to-date build available.", "", false, "false", "False", "" ], [ "SqlInstance", "Target any number of instances, in order to return their compliance state.", "", false, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Update", "Looks online for the most up to date reference, replacing the local one.", "", false, "false", "False", "" ], [ "Quiet", "Makes the function just return $true/$false. It\u0027s useful if you use Test-DbaBuild in your own scripts.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaBuild [[-Build] \u003cVersion[]\u003e] [[-MinimumBuild] \u003cVersion\u003e] [[-MaxBehind] \u003cString\u003e] [-Latest] [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [-Update] [-Quiet] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaCmConnection", "Description": "Tests over which paths a computer can be managed.\n\nThis function tries out the connectivity for:\n- Cim over WinRM\n- Cim over DCOM\n- Wmi\n- PowerShellRemoting\nResults will be written to the connectivity cache and will cause Get-DbaCmObject and Invoke-DbaCmMethod to connect using the way most likely to succeed. This way, it is likely the other commands will take less time to execute. These others too cache their results, in order to dynamically update connection statistics.\n\nThis function ignores global configuration settings limiting which protocols may be used.", "Tags": [ "ComputerManagement", "CIM" ], "Synopsis": "Tests over which paths a computer can be managed.", "Alias": "", "Author": "Friedrich Weinmann (@FredWeinmann)", "CommandName": "Test-DbaCmConnection", "Availability": "Windows only", "Links": "https://dbatools.io/Test-DbaCmConnection", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaCmConnection -ComputerName sql2014\nPerforms a full-spectrum connection test against the computer sql2014. The results will be reported and registered. Future calls from Get-DbaCmObject will recognize the results and optimize the query.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaCmConnection -ComputerName sql2014 -Credential $null -Type CimDCOM, CimRM\nThis test will run a connectivity test of CIM over DCOM and CIM over WinRM against the computer sql2014 using Windows Authentication.\nThe results will be reported and registered. Future calls from Get-DbaCmObject will recognize the results and optimize the query.", "Params": [ [ "ComputerName", "The computer to test against.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "The credentials to use when running the test. Bad credentials are automatically cached as non-working. This behavior can be disabled by the \u0027Cache.Management.Disable.BadCredentialList\u0027 configuration.", "", false, "false", "", "" ], [ "Type", "The connection protocol types to test.\r\nBy default, all types are tested.\nNote that this function will ignore global configurations limiting the types of connections available and test all connections specified here instead.\nAvailable connection protocol types: \"CimRM\", \"CimDCOM\", \"Wmi\", \"PowerShellRemoting\"", "", false, "false", "@(\"CimRM\", \"CimDCOM\", \"Wmi\", \"PowerShellRemoting\")", "" ], [ "Force", "If this switch is enabled, the Alert will be dropped and recreated on Destination.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaCmConnection [[-ComputerName] \u003cDbaCmConnectionParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-Type] {None | CimRM | CimDCOM | Wmi | PowerShellRemoting}] [-Force] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaComputerCertificateExpiration", "Description": "Tests for certificates that are expiring soon\n\nBy default, it tests candidates that are ideal for using with SQL Server\u0027s network encryption", "Tags": "Certificate", "Synopsis": "Tests for certificates that are expiring soon", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaComputerCertificateExpiration", "Availability": "Windows only", "Links": "https://dbatools.io/Test-DbaComputerCertificateExpiration", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaComputerCertificateExpiration\nGets computer certificates on localhost that are candidates for using with SQL Server\u0027s network encryption then checks to see if they\u0027ll be expiring within 30 days\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaComputerCertificateExpiration -ComputerName sql2016 -Threshold 90\nGets computer certificates on sql2016 that are candidates for using with SQL Server\u0027s network encryption then checks to see if they\u0027ll be expiring within 90 days\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaComputerCertificateExpiration -ComputerName sql2016 -Thumbprint 8123472E32AB412ED4288888B83811DB8F504DED, 04BFF8B3679BB01A986E097868D8D494D70A46D6\nGets computer certificates on sql2016 that match thumbprints 8123472E32AB412ED4288888B83811DB8F504DED or 04BFF8B3679BB01A986E097868D8D494D70A46D6 then checks to see if they\u0027ll be expiring within 30 \r\ndays", "Params": [ [ "ComputerName", "The target SQL Server instance or instances. Defaults to localhost. If target is a cluster, you must specify the distinct nodes.", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Allows you to login to $ComputerName using alternative credentials.", "", false, "false", "", "" ], [ "Store", "Certificate store - defaults to LocalMachine", "", false, "false", "LocalMachine", "" ], [ "Folder", "Certificate folder - defaults to My (Personal)", "", false, "false", "My", "" ], [ "Type", "The type of certificates to return. All, Service or SQL Server.\nAll is all certificates\r\nService is certificates that are candidates for SQL Server services (But may be for IIS, etc)\r\nSQL Server is certificates currently in use by SQL Server", "", false, "false", "Service", "All,Service,SQL Server" ], [ "Path", "The path to a certificate - basically changes the path into a certificate object", "", false, "false", "", "" ], [ "Thumbprint", "Return certificate based on thumbprint", "", false, "false", "", "" ], [ "Threshold", "Number of days before expiration to warn. Defaults to 30.", "", false, "false", "30", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaComputerCertificateExpiration [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-Store] \u003cString[]\u003e] [[-Folder] \u003cString[]\u003e] [[-Type] \u003cString\u003e] [[-Path] \u003cString\u003e] [[-Thumbprint] \u003cString[]\u003e] [[-Threshold] \u003cInt32\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaConnection", "Description": "Tests the ability to connect to an SQL Server instance outputting information about the server and instance.", "Tags": [ "CIM", "Test", "Connection" ], "Synopsis": "Tests the connection to a single instance.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaConnection", "Availability": "Windows only", "Links": "https://dbatools.io/Test-DbaConnection", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaConnection SQL2016\nComputerName : SQL2016\r\nInstanceName : MSSQLSERVER\r\nSqlInstance : sql2016\r\nSqlVersion : 13.0.4001\r\nConnectingAsUser : BASE\\ctrlb\r\nConnectSuccess : True\r\nAuthType : Windows Authentication\r\nAuthScheme : KERBEROS\r\nTcpPort : 1433\r\nIPAddress : 10.2.1.5\r\nNetBiosName : sql2016.base.local\r\nIsPingable : True\r\nPSRemotingAccessible : True\r\nDomainName : base.local\r\nLocalWindows : 10.0.15063.0\r\nLocalPowerShell : 5.1.15063.502\r\nLocalCLR : 4.0.30319.42000\r\nLocalSMOVersion : 13.0.0.0\r\nLocalDomainUser : True\r\nLocalRunAsAdmin : False\r\nLocalEdition : Desktop\nTest connection to SQL2016 and outputs information collected\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$winCred = Get-Credential sql2017\\Administrator\nPS C:\\\u003e $sqlCred = Get-Credential sa\r\nPS C:\\\u003e Test-DbaConnection SQL2017 -SqlCredential $sqlCred -Credential $winCred\nComputerName : SQL2017\r\nInstanceName : MSSQLSERVER\r\nSqlInstance : sql2017\r\nSqlVersion : 14.0.3356\r\nConnectingAsUser : sa\r\nConnectSuccess : True\r\nAuthType : SQL Authentication\r\nAuthScheme : SQL\r\nTcpPort : 50164\r\nIPAddress : 10.10.10.15\r\nNetBiosName : sql2017.company.local\r\nIsPingable : True\r\nPSRemotingAccessible : True\r\nDomainName : company.local\r\nLocalWindows : 10.0.15063.0\r\nLocalPowerShell : 5.1.19041.610\r\nLocalCLR : 4.0.30319.42000\r\nLocalSMOVersion : 15.100.0.0\r\nLocalDomainUser : True\r\nLocalRunAsAdmin : False\r\nLocalEdition : Desktop\nTest connection to SQL2017 instance and collecting information on SQL Server using the sa login, local Administrator account is used to collect port information", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", false, "true (ByValue)", "", "" ], [ "Credential", "Credential object used to connect to the Computer as a different user.\nUtilized for gathering PSRemoting and TCPPort information.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "SkipPSRemoting", "This switch will skip the test for PSRemoting.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaConnection [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [-SkipPSRemoting] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaConnectionAuthScheme", "Description": "By default, this command will return the ConnectName, ServerName, Transport and AuthScheme of the current connection.\n\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", "Kerberos" ], "Synopsis": "Returns the transport protocol and authentication scheme of the connection. This is useful to determine if your connection is using Kerberos.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaConnectionAuthScheme", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaConnectionAuthScheme", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaConnectionAuthScheme -SqlInstance sqlserver2014a, sql2016\nReturns ConnectName, ServerName, Transport and AuthScheme for sqlserver2014a and sql2016.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaConnectionAuthScheme -SqlInstance sqlserver2014a -Kerberos\nReturns $true or $false depending on if the connection is Kerberos or not.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaConnectionAuthScheme -SqlInstance sqlserver2014a | Select-Object *\nReturns the results of \"SELECT * from sys.dm_exec_connections WHERE session_id = @@SPID\"", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Server(s) must be SQL Server 2005 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "Credential,Cred", false, "false", "", "" ], [ "Kerberos", "If this switch is enabled, checks will be made for Kerberos authentication.", "", false, "false", "False", "" ], [ "Ntlm", "If this switch is enabled, checks will be made for NTLM authentication.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaConnectionAuthScheme [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Kerberos] [-Ntlm] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaDbCollation", "Description": "Compares Database Collations to Server Collation", "Tags": [ "Database", "Collation" ], "Synopsis": "Compares Database Collations to Server Collation", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaDbCollation", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaDbCollation", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaDbCollation -SqlInstance sqlserver2014a\nReturns server name, database name and true/false if the collations match for all databases on sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaDbCollation -SqlInstance sqlserver2014a -Database db1, db2\nReturns information for the db1 and db2 databases on sqlserver2014a.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaDbCollation -SqlInstance sqlserver2014a, sql2016 -Exclude db1\nReturns information for database and server collations for all databases except db1 on sqlserver2014a and sql2016.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sql2016 | Test-DbaDbCollation\nReturns db/server collation information for every database on every server listed in the Central Management Server on sql2016.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaDbCollation [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaDbCompatibility", "Description": "Compares Database Compatibility level to Server Compatibility", "Tags": [ "Database", "Compatibility" ], "Synopsis": "Compares Database Compatibility level to Server Compatibility", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaDbCompatibility", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaDbCompatibility", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaDbCompatibility -SqlInstance sqlserver2014a\nReturns server name, database name and true/false if the compatibility level match for all databases on sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaDbCompatibility -SqlInstance sqlserver2014a -Database db1, db2\nReturns detailed information for database and server compatibility level for the db1 and db2 databases on sqlserver2014a.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaDbCompatibility -SqlInstance sqlserver2014a, sql2016 -Exclude db1\nReturns detailed information for database and server compatibility level for all databases except db1 on sqlserver2014a and sql2016.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sql2014 | Test-DbaDbCompatibility\nReturns db/server compatibility information for every database on every server listed in the Central Management Server on sql2016.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaDbCompatibility [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaDbCompression", "Description": "This function returns the results of a full table/index compression analysis and the estimated, best option to date for either NONE, Page, or Row Compression.\n\nRemember Uptime is critical, the longer uptime, the more accurate the analysis is, and it would be best if you utilized Get-DbaUptime first, before running this command.\n\nTest-DbaDbCompression script derived from GitHub and the Tiger Team\u0027s repository: (https://github.com/Microsoft/tigertoolbox/tree/master/Evaluate-Compression-Gains)\nIn the output, you will find the following information:\n- Column Percent_Update shows the percentage of update operations on a specific table, index, or partition, relative to total operations on that object. The lower the percentage of Updates (that is, the table, index, or partition is infrequently updated), the better candidate it is for page compression.\n- Column Percent_Scan shows the percentage of scan operations on a table, index, or partition, relative to total operations on that object. The higher the value of Scan (that is, the table, index, or partition is mostly scanned), the better candidate it is for page compression.\n- Column Compression_Type_Recommendation can have four possible outputs indicating where there is most gain, if any: \u0027PAGE\u0027, \u0027ROW\u0027, \u0027NO_GAIN\u0027 or \u0027?\u0027. When the output is \u0027?\u0027 this approach could not give a recommendation, so as a rule of thumb I would lean to ROW if the object suffers mainly UPDATES, or PAGE if mainly INSERTS, but this is where knowing your workload is essential. When the output is \u0027NO_GAIN\u0027 well, that means that according to sp_estimate_data_compression_savings no space gains will be attained when compressing, as in the above output example, where compressing would grow the affected object.\n\nThis script will execute on the context of the current database.\nAlso be aware that this may take a while to execute on large objects, because if the IS locks taken by the\nsp_estimate_data_compression_savings cannot be honored, the SP will be blocked.\nIt only considers Row or Page Compression (not column compression)\nIt only evaluates User Tables", "Tags": [ "Compression", "Table", "Database" ], "Synopsis": "Returns tables and indexes with preferred compression setting.", "Alias": "", "Author": "Jason Squires (@js_0505), jstexasdba@gmail.com", "CommandName": "Test-DbaDbCompression", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaDbCompression", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaDbCompression -SqlInstance localhost\nReturns results of all potential compression options for all databases for the default instance on the local host. Returns a recommendation of either Page, Row or NO_GAIN\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaDbCompression -SqlInstance ServerA\nReturns results of all potential compression options for all databases on the instance ServerA\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaDbCompression -SqlInstance ServerA -Database DBName | Out-GridView\nReturns results of all potential compression options for a single database DBName with the recommendation of either Page or Row or NO_GAIN in a nicely formatted GridView\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Test-DbaDbCompression -SqlInstance ServerA -ExcludeDatabase MyDatabase -SqlCredential $cred\nReturns results of all potential compression options for all databases except MyDatabase on instance ServerA using SQL credentials to authentication to ServerA.\r\nReturns the recommendation of either Page, Row or NO_GAIN\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eTest-DbaDbCompression -SqlInstance ServerA -Schema Test -Table MyTable\nReturns results of all potential compression options for the Table Test.MyTable in instance ServerA on ServerA and ServerB.\r\nReturns the recommendation of either Page, Row or NO_GAIN.\r\nReturns a result for each partition of any Heap, Clustered or NonClustered index.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eTest-DbaDbCompression -SqlInstance ServerA, ServerB -ResultSize 10\nReturns results of all potential compression options for all databases on ServerA and ServerB.\r\nReturns the recommendation of either Page, Row or NO_GAIN.\r\nReturns results for the top 10 partitions by TotalPages used per database.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eServerA | Test-DbaDbCompression -Schema Test -ResultSize 10 -Rank UsedPages -FilterBy Table\nReturns results of all potential compression options for all databases on ServerA containing a schema Test\r\nReturns results for the top 10 Tables by Used Pages per database.\r\nResults are split by Table, Index and Partition so more than 10 results may be returned.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003e$servers = \u0027Server1\u0027,\u0027Server2\u0027\nPS C:\\\u003e $servers | Test-DbaDbCompression -Database DBName | Out-GridView\nReturns results of all potential compression options for a single database DBName on Server1 or Server2\r\nReturns the recommendation of either Page, Row or NO_GAIN in a nicely formatted GridView\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003e$cred = Get-Credential sqladmin\nPS C:\\\u003e Test-DbaDbCompression -SqlInstance ServerA -Database MyDB -SqlCredential $cred -Schema Test -Table Test1, Test2\nReturns results of all potential compression options for objects in Database MyDb on instance ServerA using SQL credentials to authentication to ServerA.\r\nReturns the recommendation of either Page, Row or NO_GAIN for tables with Schema Test and name in Test1 or Test2\n-------------------------- EXAMPLE 10 --------------------------\nPS C:\\\u003e$servers = \u0027Server1\u0027,\u0027Server2\u0027\nPS C:\\\u003e foreach ($svr in $servers) {\r\n\u003e\u003e Test-DbaDbCompression -SqlInstance $svr | Export-Csv -Path C:\\temp\\CompressionAnalysisPAC.csv -Append\r\n\u003e\u003e }\nThis produces a full analysis of all your servers listed and is pushed to a csv for you to analyze.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Schema", "Filter to only get specific schemas If unspecified, all schemas will be processed.", "", false, "false", "", "" ], [ "Table", "Filter to only get specific tables If unspecified, all User tables will be processed.", "", false, "false", "", "" ], [ "ResultSize", "Allows you to limit the number of results returned, as some systems can have very large number of tables. Default value is no restriction.", "", false, "false", "0", "" ], [ "Rank", "Allows you to specify the field used for ranking when determining the ResultSize\r\nCan be either TotalPages, UsedPages or TotalRows with default of TotalPages. Only applies when ResultSize is used.", "", false, "false", "TotalPages", "TotalPages,UsedPages,TotalRows" ], [ "FilterBy", "Allows you to specify level of filtering when determining the ResultSize\r\nCan be at either Table, Index or Partition level with default of Partition. Only applies when ResultSize is used.", "", false, "false", "Partition", "Partition,Index,Table" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaDbCompression [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-Schema] \u003cString[]\u003e] [[-Table] \u003cString[]\u003e] [[-ResultSize] \u003cInt32\u003e] [[-Rank] \u003cString\u003e] [[-FilterBy] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaDbDataGeneratorConfig", "Description": "When you\u0027re dealing with large data generation configurations, things can get complicated and messy.\nThis function will test for a range of rules and returns all the tables and columns that contain errors.", "Tags": [ "Data generation", "testing" ], "Synopsis": "Checks the data generation configuration if it\u0027s valid", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Test-DbaDbDataGeneratorConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaDbDataGeneratorConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaDbDataGeneratorConfig -FilePath C:\\temp\\_datamasking\\db1.json\nTest the configuration file", "Params": [ [ "FilePath", "Path to the file to test", "", true, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaDbDataGeneratorConfig [-FilePath] \u003cString\u003e [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaDbDataMaskingConfig", "Description": "When you\u0027re dealing with large masking configurations, things can get complicated and messy.\nThis function will test for a range of rules and returns all the tables and columns that contain errors.", "Tags": [ "Masking", "DataMasking" ], "Synopsis": "Checks the masking configuration if it\u0027s valid", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Test-DbaDbDataMaskingConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaDbDataMaskingConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaDbDataMaskingConfig -FilePath C:\\temp\\_datamasking\\db1.json\nTest the configuration file", "Params": [ [ "FilePath", "Path to the file to test", "", true, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaDbDataMaskingConfig [-FilePath] \u003cString\u003e [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaDbLogShipStatus", "Description": "Most of the time your log shipping \"just works\".\nChecking your log shipping status can be done really easy with this function.\n\nMake sure you\u0027re connecting to the monitoring instance of your log shipping infrastructure.\n\nThe function will return the status for a database. This can be one or more messages in a comma separated list.\nIf everything is OK with the database than you should only see the message \"All OK\".", "Tags": "LogShipping", "Synopsis": "Test-DbaDbLogShipStatus returns the status of your log shipping databases", "Alias": "", "Author": "Sander Stad (@sqlstad), sqlstad.nl", "CommandName": "Test-DbaDbLogShipStatus", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaDbLogShipStatus", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaDbLogShipStatus -SqlInstance sql1\nRetrieves the log ship information from sql1 and displays all the information present including the status.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaDbLogShipStatus -SqlInstance sql1 -Database AdventureWorks2014\nRetrieves the log ship information for just the database AdventureWorks.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaDbLogShipStatus -SqlInstance sql1 -Primary\nRetrieves the log ship information and only returns the information for the databases on the primary instance.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eTest-DbaDbLogShipStatus -SqlInstance sql1 -Secondary\nRetrieves the log ship information and only returns the information for the databases on the secondary instance.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eTest-DbaDbLogShipStatus -SqlInstance sql1 -Simple\nRetrieves the log ship information and only returns the columns SQL Instance, Database, Instance Type and Status", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Allows you to filter the results to only return the databases you\u0027re interested in. This can be one or more values separated by commas.\r\nThis is not a wildcard and should be the exact database name. See examples for more info.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Allows you to filter the results to only return the databases you\u0027re not interested in. This can be one or more values separated by commas.\r\nThis is not a wildcard and should be the exact database name.", "", false, "false", "", "" ], [ "Simple", "By default all the information will be returned.\r\nIf this parameter is used you get an overview with the SQL Instance, Database, Instance Type and the status", "", false, "false", "False", "" ], [ "Primary", "Allows to filter the results to only return values that apply to the primary instance.", "", false, "false", "False", "" ], [ "Secondary", "Allows to filter the results to only return values that apply to the secondary instance.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaDbLogShipStatus [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [-Simple] [-Primary] [-Secondary] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaDbOwner", "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.\n\nBest Practice reference: http://weblogs.sqlteam.com/dang/archive/2008/01/13/Database-Owner-Troubles.aspx", "Tags": [ "Database", "Owner", "DbOwner" ], "Synopsis": "Checks database owners against a login to validate which databases do not match that owner.", "Alias": "", "Author": "Michael Fal (@Mike_Fal), http://mikefal.net", "CommandName": "Test-DbaDbOwner", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaDbOwner", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaDbOwner -SqlInstance localhost\nReturns all databases where the owner does not match \u0027sa\u0027.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaDbOwner -SqlInstance localhost -TargetLogin \u0027DOMAIN\\account\u0027\nReturns all databases where the owner does not match \u0027DOMAIN\\account\u0027.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance localhost -OnlyAccessible | Test-DbaDbOwner\nGets only accessible databases and checks where the owner does not match \u0027sa\u0027.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "TargetLogin", "Specifies the login that you wish check for ownership. This defaults to \u0027sa\u0027 or the sysadmin name if sa was renamed. This must be a valid security principal which exists on the target server.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaDbOwner [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject[]\u003e] [-ExcludeDatabase \u003cObject[]\u003e] [-TargetLogin \u003cString\u003e] [-InputObject \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaDbQueryStore", "Description": "Evaluates Query Store against a set of rules to match best practices. The rules are:\n\n* ActualState = ReadWrite (This means Query Store is enabled and collecting data.)\n* DataFlushIntervalInSeconds = 900 (Recommended to leave this at the default of 900 seconds (15 mins).)\n* MaxPlansPerQuery = 200 (Number of distinct plans per query. 200 is a good starting point for most environments.)\n* MaxStorageSizeInMB = 2048 (How much disk space Query Store will use. 2GB is a good starting point.)\n* QueryCaptureMode = Auto (With auto, queries that are insignificant from a resource utilization perspective, or executed infrequently, are not captured.)\n* SizeBasedCleanupMode = Auto (With auto, as Query Store gets close to out of space it will automatically purge older data.)\n* StaleQueryThresholdInDays = 30 (Determines how much historic data to keep. 30 days is a good value here.)\n* StatisticsCollectionIntervalInMinutes = 30 (Time window that runtime stats will be aggregated. Use 30 unless you have space concerns, then leave at the default (60).)\n* WaitStatsCaptureMode = ON (Adds valuable data when troubleshooting.)\n* Trace Flag 7745 enabled\n* Trace Flag 7752 enabled", "Tags": "QueryStore", "Synopsis": "Compares Query Store settings against best practices.", "Alias": "", "Author": "Jess Pomfret (@jpomfret), jesspomfret.com", "CommandName": "Test-DbaDbQueryStore", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaDbQueryStore", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaDbQueryStore -SqlInstance localhost\nChecks that Query Store is enabled and meets best practices for all user databases on the localhost machine.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaDbQueryStore -SqlInstance localhost -Database AdventureWorks2017\nChecks that Query Store is enabled and meets best practices for the AdventureWorks2017 database on the localhost machine.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaDbQueryStore -SqlInstance localhost -ExcludeDatabase AdventureWorks2017\nChecks that Query Store is enabled and meets best practices for all user databases except AdventureWorks2017 on the localhost machine.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$databases = Get-DbaDatabase -SqlInstance localhost\nPS C:\\\u003e $databases | Test-DbaDbQueryStore\nChecks that Query Store is enabled and meets best practices for all databases that are piped on the localhost machine.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. This list is auto-populated from the server. If unspecified, all user databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude. This list is auto-populated from the server.", "", false, "false", "", "" ], [ "InputObject", "Enables piped input from Get-DbaDatabase.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaDbQueryStore [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-InputObject] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaDbRecoveryModel", "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.\n\nHowever, you may also desire to validate if a database is SIMPLE or BULK LOGGED on an instance.\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 a specific recovery model or not.", "Alias": "", "Author": "Claudio Silva (@ClaudioESSilva)", "CommandName": "Test-DbaDbRecoveryModel", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaDbRecoveryModel", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaDbRecoveryModel -SqlInstance sql2005\nShows all databases where the configured recovery model is FULL and indicates whether or not they are really in FULL recovery model.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaDbRecoveryModel -SqlInstance . | Where-Object {$_.ActualRecoveryModel -ne \"FULL\"}\nOnly shows the databases that are functionally in \u0027simple\u0027 mode.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaDbRecoveryModel -SqlInstance sql2008 -RecoveryModel Bulk_Logged | Sort-Object Server -Descending\nShows all databases where the configured recovery model is BULK_LOGGED and sort them by server name descending\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eTest-DbaDbRecoveryModel -SqlInstance localhost | Select-Object -Property *\nShows all of the properties for the databases that have Full Recovery Model", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "Database", "Specifies the database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Specifies the database(s) to exclude from processing. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "RecoveryModel", "Specifies the type of recovery model you wish to test. By default it will test for FULL Recovery Model.", "", false, "false", "", "Full,Simple,Bulk_Logged" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaDbRecoveryModel [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-RecoveryModel] \u003cObject\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaDeprecatedFeature", "Description": "Displays information relating to deprecated features for SQL Server 2005 and above.", "Tags": "Deprecated", "Synopsis": "Displays information relating to deprecated features for SQL Server 2005 and above.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaDeprecatedFeature", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaDeprecatedFeature", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2008 -Database testdb, db2 | Test-DbaDeprecatedFeature\nCheck deprecated features on server sql2008 for only the testdb and db2 databases\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2008 -Database testdb, db2 | Test-DbaDeprecatedFeature | Select-Object *\nSee the object definition in the output as well\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaDeprecatedFeature -SqlInstance sql2008, sqlserver2012\nCheck deprecated features for all databases on the servers sql2008 and sqlserver2012.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eTest-DbaDeprecatedFeature -SqlInstance sql2008 -Database TestDB\nCheck deprecated features on server sql2008 for only the TestDB database", "Params": [ [ "SqlInstance", "The target SQL Server instance", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "InputObject", "A collection of databases (such as returned by Get-DbaDatabase), to be tested.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaDeprecatedFeature [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [[-ExcludeDatabase] \u003cString[]\u003e] [[-InputObject] \u003cDatabase[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaDiskAlignment", "Description": "Verifies that your non-dynamic disks are aligned according to physical constraints.\n\nReturns one row per computer, partition and stripe size with.\n\nPlease refer to your storage vendor best practices before following any advice below.\n\nBy 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.\nWhile 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.", "Alias": "", "Author": "Constantine Kokkinos (@mobileck), https://constantinekokkinos.com", "CommandName": "Test-DbaDiskAlignment", "Availability": "Windows only", "Links": "https://dbatools.io/Test-DbaDiskAlignment", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaDiskAlignment -ComputerName sqlserver2014a\nTests the disk alignment of a single server named sqlserver2014a\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaDiskAlignment -ComputerName sqlserver2014a, sqlserver2014b, sqlserver2014c\nTests the disk alignment of multiple servers", "Params": [ [ "ComputerName", "The target computer or computers.", "", true, "true (ByValue)", "", "" ], [ "Credential", "Specifies an alternate Windows account to use when enumerating drives on the server. May require Administrator privileges. To use:\n$cred = Get-Credential, then pass $cred object to the -Credential parameter.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "NoSqlCheck", "If this switch is enabled, the disk(s) will not be checked for SQL Server data or log files.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaDiskAlignment [-ComputerName] \u003cDbaInstanceParameter[]\u003e [[-Credential] \u003cPSCredential\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [-NoSqlCheck] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaDiskAllocation", "Description": "Checks all disks on a computer for disk allocation units that match best practice recommendations. If one server is checked, only $true or $false is returned. If multiple servers are checked, each server\u0027s name and an IsBestPractice field are returned.\n\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.\"", "Tags": [ "CIM", "Storage" ], "Synopsis": "Checks all disks on a computer to see if they are formatted with allocation units of 64KB.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaDiskAllocation", "Availability": "Windows only", "Links": "https://dbatools.io/Test-DbaDiskAllocation", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaDiskAllocation -ComputerName sqlserver2014a\nScans all disks on server sqlserver2014a for best practice allocation unit size.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaDiskAllocation -ComputerName sqlserver2014 | Select-Output *\nScans all disks on server sqlserver2014a for allocation unit size and returns detailed results for each.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaDiskAllocation -ComputerName sqlserver2014a -NoSqlCheck\nScans all disks not hosting SQL Server data or log files on server sqlserver2014a for best practice allocation unit size.", "Params": [ [ "ComputerName", "The server(s) to check disk configuration on.", "", true, "true (ByValue)", "", "" ], [ "NoSqlCheck", "If this switch is enabled, the disk(s) will not be checked for SQL Server data or log files.", "", false, "false", "False", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Credential", "Specifies an alternate Windows account to use when enumerating drives on the server. May require Administrator privileges. To use:\n$cred = Get-Credential, then pass $cred object to the -Credential parameter.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Test-DbaDiskAllocation [-ComputerName] \u003cObject[]\u003e [-NoSqlCheck] [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaDiskSpeed", "Description": "Obtains I/O statistics based on the DMV sys.dm_io_virtual_file_stats:\n\nhttps://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-io-virtual-file-stats-transact-sql\n\nThis command uses a query from Rich Benner\nhttps://github.com/RichBenner/PersonalCode/blob/master/Disk_Speed_Check.sql\n\n...and also based on further adaptations referenced at https://github.com/sqlcollaborative/dbatools/issues/6551#issue-623216718", "Tags": "Performance", "Synopsis": "Obtains I/O statistics based on the DMV sys.dm_io_virtual_file_stats:\n\nhttps://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-io-virtual-file-stats-transact-sql", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaDiskSpeed", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaDiskSpeed", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaDiskSpeed -SqlInstance sql2008, sqlserver2012\nTests how disks are performing on sql2008 and sqlserver2012.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaDiskSpeed -SqlInstance sql2008 -Database tempdb\nTests how disks storing tempdb files on sql2008 are performing.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaDiskSpeed -SqlInstance sql2008 -AggregateBy \"File\" -Database tempdb\nReturns the statistics aggregated to the file level. This is the default aggregation level if the -AggregateBy param is omitted. The -Database or -ExcludeDatabase params can be used to filter for \r\nspecific databases.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eTest-DbaDiskSpeed -SqlInstance sql2008 -AggregateBy \"Database\"\nReturns the statistics aggregated to the database/disk level. The -Database or -ExcludeDatabase params can be used to filter for specific databases.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eTest-DbaDiskSpeed -SqlInstance sql2008 -AggregateBy \"Disk\"\nReturns the statistics aggregated to the disk level. The -Database or -ExcludeDatabase params can be used to filter for specific databases.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$results = @(instance1, instance2) | Test-DbaDiskSpeed\nReturns the statistics for instance1 and instance2 as part of a pipeline command\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$databases = @(\u0027master\u0027, \u0027model\u0027)\n$results = Test-DbaDiskSpeed -SqlInstance sql2019 -Database $databases\nReturns the statistics for more than one database specified.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003e$excludedDatabases = @(\u0027master\u0027, \u0027model\u0027)\n$results = Test-DbaDiskSpeed -SqlInstance sql2019 -ExcludeDatabase $excludedDatabases\nReturns the statistics for databases other than the exclusions specified.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "AggregateBy", "Specify the level of aggregation for the statistics. The available options are \u0027File\u0027 (the default), \u0027Database\u0027, and \u0027Disk\u0027.", "", false, "false", "File", "Database,Disk,File" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaDiskSpeed [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-AggregateBy] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaEndpoint", "Description": "Performs a simple connectivity test for TCP and SSL enabled endpoints. Tests if port is accessible, not if endpoint is working.\n\nNote that if an endpoint does not have a tcp listener port, it will be skipped.", "Tags": "Endpoint", "Synopsis": "Performs a simple connectivity test for TCP and SSL enabled endpoints.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaEndpoint", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaEndpoint", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaEndpoint -SqlInstance localhost\nTests all endpoints on the local default SQL Server instance.\nNote that if an endpoint does not have a tcp listener port, it will be skipped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaEndpoint -SqlInstance localhost, sql2016 -Endpoint Mirror | Test-DbaEndpoint\nTests all endpoints named Mirroring on sql2016 and localhost.\nNote that if an endpoint does not have a tcp listener port, it will be skipped.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaEndpoint -SqlInstance localhost, sql2016 -Endpoint Mirror\nTests all endpoints named Mirroring on sql2016 and localhost.\nNote that if an endpoint does not have a tcp listener port, it will be skipped.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eTest-DbaEndpoint -SqlInstance localhost -Verbose\nTests all endpoints on the local default SQL Server instance.\nSee all endpoints that were skipped due to not having a tcp listener port.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Endpoint", "Test only specific endpoint or endpoints.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaEndpoint.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaEndpoint [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Endpoint] \u003cString[]\u003e] [[-InputObject] \u003cEndpoint[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaIdentityUsage", "Description": "IDENTITY seeds have max values based off of their data type. This module will locate identity columns and report the seed usage.", "Tags": [ "Identity", "Table", "Column" ], "Synopsis": "Displays information relating to IDENTITY seed usage. Works on SQL Server 2008 and above.", "Alias": "", "Author": "Brandon Abshire, netnerds.net", "CommandName": "Test-DbaIdentityUsage", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaIdentityUsage", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaIdentityUsage -SqlInstance sql2008, sqlserver2012\nCheck identity seeds for servers sql2008 and sqlserver2012.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaIdentityUsage -SqlInstance sql2008 -Database TestDB\nCheck identity seeds on server sql2008 for only the TestDB database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaIdentityUsage -SqlInstance sql2008 -Database TestDB -Threshold 20\nCheck identity seeds on server sql2008 for only the TestDB database, limiting results to 20% utilization of seed range or higher", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude - this list is auto-populated from the server", "", false, "false", "", "" ], [ "Threshold", "Allows you to specify a minimum % of the seed range being utilized. This can be used to ignore seeds that have only utilized a small fraction of the range.", "", false, "false", "0", "" ], [ "ExcludeSystem", "Allows you to suppress output on system databases", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaIdentityUsage [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-Threshold] \u003cInt32\u003e] [-ExcludeSystem] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaInstanceName", "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 whether a rename is required.\n\nIt then checks conditions that would prevent a rename, such as database mirroring and replication.\n\nhttps://www.mssqltips.com/sqlservertip/2525/steps-to-change-the-server-name-for-a-sql-server-machine/", "Tags": [ "SPN", "ServerName" ], "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.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaInstanceName", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaInstanceName", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaInstanceName -SqlInstance sqlserver2014a\nReturns ServerInstanceName, SqlServerName, IsEqual and RenameRequired for sqlserver2014a.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaInstanceName -SqlInstance sqlserver2014a, sql2016\nReturns ServerInstanceName, SqlServerName, IsEqual and RenameRequired for sqlserver2014a and sql2016.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaInstanceName -SqlInstance sqlserver2014a, sql2016 -ExcludeSsrs\nReturns ServerInstanceName, SqlServerName, IsEqual and RenameRequired for sqlserver2014a and sql2016, but skips validating if SSRS is installed on both instances.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eTest-DbaInstanceName -SqlInstance sqlserver2014a, sql2016 | Select-Object *\nReturns ServerInstanceName, SqlServerName, IsEqual and RenameRequired for sqlserver2014a and sql2016.\r\nIf a Rename is required, it will also show Updatable, and Reasons if the server name is not updatable.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "ExcludeSsrs", "If this switch is enabled, checking for SQL Server Reporting Services will be skipped.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaInstanceName [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-ExcludeSsrs] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaLastBackup", "Description": "Restores all or some of the latest backups and performs a DBCC CHECKDB.\n\n1. Gathers information about the last full backups\n2. Restores the backups to the Destination with a new name. If no Destination is specified, the originating SQL Server instance 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 CHECKDB 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.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaLastBackup", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaLastBackup", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaLastBackup -SqlInstance sql2016\nDetermines the last full backup for ALL databases, attempts to restore all databases (with a different name and file structure), then performs a DBCC CHECKDB. Once the test is complete, the test \r\nrestore will be dropped.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaLastBackup -SqlInstance sql2016 -Database SharePoint_Config\nDetermines the last full backup for SharePoint_Config, attempts to restore it, then performs a DBCC CHECKDB.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2016, sql2017 | Test-DbaLastBackup\nTests every database backup on sql2016 and sql2017\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaDatabase -SqlInstance sql2016, sql2017 -Database SharePoint_Config | Test-DbaLastBackup\nTests the database backup for the SharePoint_Config database on sql2016 and sql2017\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eTest-DbaLastBackup -SqlInstance sql2016 -Database model, master -VerifyOnly\nSkips performing an action restore of the database and simply verifies the backup using VERIFYONLY option of the restore.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eTest-DbaLastBackup -SqlInstance sql2016 -NoCheck -NoDrop\nSkips the DBCC CHECKDB check. This can help speed up the tests but makes it less tested. The test restores will remain on the server.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eTest-DbaLastBackup -SqlInstance sql2016 -DataDirectory E:\\bigdrive -LogDirectory L:\\bigdrive -MaxSize 10240\nRestores data and log files to alternative locations and only restores databases that are smaller than 10 GB.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eTest-DbaLastBackup -SqlInstance sql2014 -Destination sql2016 -CopyFile\nCopies the backup files for sql2014 databases to sql2016 default backup locations and then attempts restore from there.\n-------------------------- EXAMPLE 9 --------------------------\nPS C:\\\u003eTest-DbaLastBackup -SqlInstance sql2014 -Destination sql2016 -CopyFile -CopyPath \"\\\\BackupShare\\TestRestore\\\"\nCopies the backup files for sql2014 databases to sql2016 default backup locations and then attempts restore from there.\n-------------------------- EXAMPLE 10 --------------------------\nPS C:\\\u003eTest-DbaLastBackup -SqlInstance sql2016 -NoCheck -MaxTransferSize 4194302 -BufferCount 24\nDetermines the last full backup for ALL databases, attempts to restore all databases (with a different name and file structure).\r\nThe Restore will use more memory for reading the backup files. Do not set these values to high or you can get an Out of Memory error!!!\r\nWhen running the restore with these additional parameters and there is other server activity it could affect server OLTP performance. Please use with causion.\r\nPrior to running, you should check memory and server resources before configure it to run automatically.\r\nMore information:\r\nhttps://www.mssqltips.com/sqlservertip/4935/optimize-sql-server-database-restore-performance/\n-------------------------- EXAMPLE 11 --------------------------\nPS C:\\\u003eTest-DbaLastBackup -SqlInstance sql2016 -MaxDop 4\nThe use of the MaxDop parameter will limit the number of processors used during the DBCC command", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. Unlike many of the other commands, you cannot specify more than one server.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database backups to test. If -Database is not provided, all database backups will be tested.", "", false, "false", "", "" ], [ "ExcludeDatabase", "Exclude specific Database backups to test.", "", false, "false", "", "" ], [ "Destination", "The destination server to use to test the restore. By default, the Destination will be set to the source server\nIf a different Destination server is specified, you must ensure that the database backups are on a shared location", "", false, "false", "", "" ], [ "DestinationCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "DataDirectory", "Specifies an alternative directory for mdfs, ndfs and so on. The command uses the SQL Server\u0027s default data directory for all restores.", "", false, "false", "", "" ], [ "LogDirectory", "Specifies an alternative directory for ldfs. The command uses the SQL Server\u0027s default log directory for all restores.", "", false, "false", "", "" ], [ "Prefix", "The database is restored as \"dbatools-testrestore-$databaseName\" by default. You can change dbatools-testrestore to whatever you would like using this parameter.", "", false, "false", "dbatools-testrestore-", "" ], [ "VerifyOnly", "If this switch is enabled, VERIFYONLY will be performed. An actual restore will not be executed.", "", false, "false", "False", "" ], [ "NoCheck", "If this switch is enabled, DBCC CHECKDB will be skipped", "", false, "false", "False", "" ], [ "NoDrop", "If this switch is enabled, the newly-created test database will not be dropped.", "", false, "false", "False", "" ], [ "CopyFile", "If this switch is enabled, the backup file will be copied to the destination default backup location unless CopyPath is specified.", "", false, "false", "False", "" ], [ "CopyPath", "Specifies a path relative to the SQL Server to copy backups when CopyFile is specified. If not specified will use destination default backup location. If destination SQL Server is not local, admin \r\nUNC paths will be utilized for the copy.", "", false, "false", "", "" ], [ "MaxSize", "Max size in MB. Databases larger than this value will not be restored.", "", false, "false", "0", "" ], [ "DeviceType", "Specifies a filter for backup sets based on DeviceTypes. Valid options are \u0027Disk\u0027,\u0027Permanent Disk Device\u0027, \u0027Tape\u0027, \u0027Permanent Tape Device\u0027,\u0027Pipe\u0027,\u0027Permanent Pipe Device\u0027,\u0027Virtual Device\u0027, in addition \r\nto custom integers for your own DeviceTypes.", "", false, "false", "", "" ], [ "IncludeCopyOnly", "If this switch is enabled, copy only backups will be counted as a last backup.", "", false, "false", "False", "" ], [ "IgnoreLogBackup", "If this switch is enabled, transaction log backups will be ignored. The restore will stop at the latest full or differential backup point.", "", false, "false", "False", "" ], [ "AzureCredential", "The name of the SQL Server credential on the destination instance that holds the key to the azure storage account.", "", false, "false", "", "" ], [ "InputObject", "Enables piping from Get-DbaDatabase", "", false, "true (ByValue)", "", "" ], [ "MaxTransferSize", "Parameter to set the unit of transfer. Values must be a multiple of 64kb and a max of 4GB\r\nParameter is used as passtrough for Restore-DbaDatabase.", "", false, "false", "0", "" ], [ "BufferCount", "Number of I/O buffers to use to perform the operation.\r\nRefererence: https://msdn.microsoft.com/en-us/library/ms178615.aspx#data-transfer-options\r\nParameter is used as passtrough for Restore-DbaDatabase.", "", false, "false", "0", "" ], [ "IgnoreDiffBackup", "If this switch is enabled, differential backuys will be ignored. The restore will only use Full and Log backups, so will take longer to complete", "", false, "false", "False", "" ], [ "MaxDop", "Allows you to pass in a MAXDOP setting to the DBCC CheckDB command to limit the number of parallel processes used.", "", false, "false", "0", "" ], [ "ReuseSourceFolderStructure", "By default, databases will be migrated to the destination Sql Server\u0027s default data and log directories. You can override this by specifying -ReuseSourceFolderStructure.\r\nThe same structure on the SOURCE will be kept exactly, so consider this if you\u0027re migrating between different versions and use part of Microsoft\u0027s default Sql structure (MSSql12.INSTANCE, etc)", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Test-DbaLastBackup [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [[-Destination] \u003cDbaInstanceParameter\u003e] [[-DestinationCredential] \u003cObject\u003e] [[-DataDirectory] \u003cString\u003e] [[-LogDirectory] \u003cString\u003e] [[-Prefix] \u003cString\u003e] [-VerifyOnly] [-NoCheck] [-NoDrop] [-CopyFile] [[-CopyPath] \u003cString\u003e] [[-MaxSize] \u003cInt32\u003e] [[-DeviceType] \u003cString[]\u003e] [-IncludeCopyOnly] [-IgnoreLogBackup] [[-AzureCredential] \u003cString\u003e] [[-InputObject] \u003cDatabase[]\u003e] [[-MaxTransferSize] \u003cInt32\u003e] [[-BufferCount] \u003cInt32\u003e] [-IgnoreDiffBackup] \r\n[[-MaxDop] \u003cInt32\u003e] [-ReuseSourceFolderStructure] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaLinkedServerConnection", "Description": "Test each linked server on the instance", "Tags": "LinkedServer", "Synopsis": "Test all linked servers from the sql servers passed", "Alias": "", "Author": "Thomas LaRock ( https://thomaslarock.com )", "CommandName": "Test-DbaLinkedServerConnection", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaLinkedServerConnection", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaLinkedServerConnection -SqlInstance DEV01\nTest all Linked Servers for the SQL Server instance DEV01\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaLinkedServerConnection -SqlInstance sql2016 | Out-File C:\\temp\\results.txt\nTest all Linked Servers for the SQL Server instance sql2016 and output results to file\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaLinkedServerConnection -SqlInstance sql2016, sql2014, sql2012\nTest all Linked Servers for the SQL Server instances sql2016, sql2014 and sql2012\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$servers = \"sql2016\",\"sql2014\",\"sql2012\"\nPS C:\\\u003e $servers | Test-DbaLinkedServerConnection -SqlCredential sqladmin\nTest all Linked Servers for the SQL Server instances sql2016, sql2014 and sql2012 using SQL login credentials\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$servers = \"sql2016\",\"sql2014\",\"sql2012\"\nPS C:\\\u003e $servers | Get-DbaLinkedServer | Test-DbaLinkedServerConnection\nTest all Linked Servers for the SQL Server instances sql2016, sql2014 and sql2012", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaLinkedServerConnection [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaLoginPassword", "Description": "The purpose of this function is to find SQL Server logins that have no password or the same password as login. You can add your own password to check for or add them to a csv file.\nBy default it will test for empty password and the same password as username.", "Tags": [ "Login", "Security" ], "Synopsis": "Test-DbaLoginPassword finds any logins on SQL instance that are SQL Logins and have a password that is either null or same as the login", "Alias": "", "Author": "Peter Samuelsson", "CommandName": "Test-DbaLoginPassword", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaLoginPassword", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaLoginPassword -SqlInstance Dev01\nTest all SQL logins that the password is null or same as username on SQL server instance Dev01\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaLoginPassword -SqlInstance Dev01 -Login sqladmin\nTest the \u0027sqladmin\u0027 SQL login that the password is null or same as username on SQL server instance Dev01\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaLoginPassword -SqlInstance Dev01 -Dictionary Test1,test2\nTest all SQL logins that the password is null, same as username or Test1,Test2 on SQL server instance Dev0\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaLogin -SqlInstance \"sql2017\",\"sql2016\" | Test-DbaLoginPassword\nTest all logins on sql2017 and sql2016\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$servers | Get-DbaLogin | Out-GridView -PassThru | Test-DbaLoginPassword\nTest selected logins on all servers in the $servers variable", "Params": [ [ "SqlInstance", "The SQL Server instance you\u0027re checking logins on. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Allows you to login to servers using SQL Logins instead of Windows Authentication (AKA Integrated or Trusted). To use:\n$scred = Get-Credential, then pass $scred object to the -SqlCredential parameter.\nWindows Authentication will be used if SqlCredential is not specified. SQL Server does not accept Windows credentials being passed as credentials.\nTo connect as a different Windows user, run PowerShell as that user.", "", false, "false", "", "" ], [ "Login", "The login(s) to process.", "", false, "false", "", "" ], [ "Dictionary", "Specifies a list of passwords to include in the test for weak passwords.", "", false, "false", "", "" ], [ "InputObject", "Allows piping from Get-DbaLogin.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaLoginPassword [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Login] \u003cString[]\u003e] [[-Dictionary] \u003cString[]\u003e] [[-InputObject] \u003cLogin[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaManagementObject", "Description": "The Test-DbaManagementObject returns True if the Version is on the computer, and False if it does not exist.", "Tags": "SMO", "Synopsis": "Tests to see if the SMO version specified exists on the computer.", "Alias": "", "Author": "Ben Miller (@DBAduck), http://dbaduck.com", "CommandName": "Test-DbaManagementObject", "Availability": "Windows only", "Links": "https://dbatools.io/Test-DbaManagementObject", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaManagementObject -VersionNumber 13\nReturns True if the version exists, if it does not exist it will return False", "Params": [ [ "ComputerName", "The name of the target you would like to check", "", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "This command uses Windows credentials. This parameter allows you to connect remotely as a different user.", "", false, "false", "", "" ], [ "VersionNumber", "This is the specific version number you are looking for and the return will be True.", "", true, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaManagementObject [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [[-Credential] \u003cPSCredential\u003e] [-VersionNumber] \u003cInt32[]\u003e [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaMaxDop", "Description": "Inspired by Sakthivel Chidambaram\u0027s post about SQL Server MAXDOP Calculator (https://blogs.msdn.microsoft.com/sqlsakthi/p/maxdop-calculator/),\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:\nhttps://support.microsoft.com/en-us/kb/2806535\nhttps://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.", "Tags": [ "MaxDop", "SpConfigure" ], "Synopsis": "Displays information relating to SQL Server Max Degree of Parallelism setting. Works on SQL Server 2005-2016.", "Alias": "", "Author": "Claudio Silva (@claudioessilva)", "CommandName": "Test-DbaMaxDop", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaMaxDop", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaMaxDop -SqlInstance sql2008, sqlserver2012\nGet Max DOP setting for servers sql2008 and sqlserver2012 and also the recommended one.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaMaxDop -SqlInstance sql2014 | Select-Object *\nShows Max DOP setting for server sql2014 with the recommended value. Piping the output to Select-Object * will also show the \u0027NumaNodes\u0027 and \u0027NumberOfCores\u0027 of each instance\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaMaxDop -SqlInstance sqlserver2016 | Select-Object *\nGet Max DOP setting for servers sql2016 with the recommended value. Piping the output to Select-Object * will also show the \u0027NumaNodes\u0027 and \u0027NumberOfCores\u0027 of each instance. Because it is an 2016 \r\ninstance will be shown \u0027InstanceVersion\u0027, \u0027Database\u0027 and \u0027DatabaseMaxDop\u0027 columns.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaMaxDop [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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: total 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": [ "MaxMemory", "Memory" ], "Synopsis": "Calculates the recommended value for SQL Server \u0027Max Server Memory\u0027 configuration setting. Works on SQL Server 2000-2014.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaMaxMemory", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaMaxMemory", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaMaxMemory -SqlInstance sqlcluster,sqlserver2012\nCalculate the \u0027Max Server Memory\u0027 for SQL Server instances sqlcluster and sqlserver2012\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlcluster | Test-DbaMaxMemory\nCalculate the \u0027Max Server Memory\u0027 settings for all servers within the SQL Server Central Management Server \"sqlcluster\"\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlcluster | Test-DbaMaxMemory | Where-Object { $_.MaxValue -gt $_.Total } | Set-DbaMaxMemory\nFind all servers in CMS that have Max SQL memory set to higher than the total memory of the server (think 2147483647) and set it to recommended value.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Credential", "Windows Credential with permission to log on to the server running the SQL instance", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaMaxMemory [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaMigrationConstraint", "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\nThe -Database parameter is auto-populated for command-line completion.", "Tags": "Migration", "Synopsis": "Show if you can migrate the database(s) between the servers.", "Alias": "", "Author": "Claudio Silva (@ClaudioESSilva)", "CommandName": "Test-DbaMigrationConstraint", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaMigrationConstraint", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaMigrationConstraint -Source sqlserver2014a -Destination sqlcluster\nAll databases on sqlserver2014a will be verified for features in use that can\u0027t be supported on sqlcluster.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaMigrationConstraint -Source sqlserver2014a -Destination sqlcluster -SourceSqlCredential $cred\nAll databases will be verified for features in use that can\u0027t be supported on the destination server. SQL credentials are used to authenticate against sqlserver2014a and Windows Authentication is \r\nused for sqlcluster.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaMigrationConstraint -Source sqlserver2014a -Destination sqlcluster -Database db1\nOnly db1 database will be verified for features in use that can\u0027t be supported on the destination server.", "Params": [ [ "Source", "Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "true (ByValue)", "", "" ], [ "SourceSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Destination", "Destination SQL Server. You must have sysadmin access and the server must be SQL Server 2000 or higher.", "", true, "false", "", "" ], [ "DestinationSqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database(s) to process. Options for this list are auto-populated from the server. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "ExcludeDatabase", "The database(s) to exclude. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaMigrationConstraint [-Source] \u003cDbaInstanceParameter\u003e [[-SourceSqlCredential] \u003cPSCredential\u003e] [-Destination] \u003cDbaInstanceParameter\u003e [[-DestinationSqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cObject[]\u003e] [[-ExcludeDatabase] \u003cObject[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaNetworkLatency", "Description": "This function is intended to help measure SQL Server network latency by establishing a connection and executing a simple query. This is a better than a simple ping because it actually creates the connection to the SQL Server and measures the time required for only the entire routine, but the duration of the query as well how long it takes for the results to be returned.\n\nBy default, this command will execute \"SELECT TOP 100 * FROM INFORMATION_SCHEMA.TABLES\" three times. It will then output how long the entire connection and command took, as well as how long *only* the execution of the command took.\n\nThis allows you to see if the issue is with the connection or the SQL Server itself.", "Tags": [ "Performance", "Network" ], "Synopsis": "Tests how long a query takes to return from SQL Server", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaNetworkLatency", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaNetworkLatency", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaNetworkLatency -SqlInstance sqlserver2014a, sqlcluster\nTests the round trip return of \"SELECT TOP 100 * FROM INFORMATION_SCHEMA.TABLES\" on sqlserver2014a and sqlcluster using Windows credentials.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaNetworkLatency -SqlInstance sqlserver2014a -SqlCredential $cred\nTests the execution results return of \"SELECT TOP 100 * FROM INFORMATION_SCHEMA.TABLES\" on sqlserver2014a using SQL credentials.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaNetworkLatency -SqlInstance sqlserver2014a, sqlcluster, sqlserver -Query \"select top 10 * from otherdb.dbo.table\" -Count 10\nTests the execution results return of \"select top 10 * from otherdb.dbo.table\" 10 times on sqlserver2014a, sqlcluster, and sqlserver using Windows credentials.", "Params": [ [ "SqlInstance", "The SQL Server you want to run the test on.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Query", "Specifies the query to be executed. By default, \"SELECT TOP 100 * FROM INFORMATION_SCHEMA.TABLES\" will be executed on master. To execute in other databases, use fully qualified object names.", "", false, "false", "select top 100 * from INFORMATION_SCHEMA.TABLES", "" ], [ "Count", "Specifies how many times the query should be executed. By default, the query is executed three times.", "", false, "false", "3", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaNetworkLatency [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Query] \u003cString\u003e] [[-Count] \u003cInt32\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaOptimizeForAdHoc", "Description": "When this option is set, plan cache size is further reduced for single-use ad hoc 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 ad-hoc workloads\" option.", "Tags": [ "Configure", "SPConfigure" ], "Synopsis": "Displays information relating to SQL Server Optimize for AdHoc Workloads setting. Works on SQL Server 2008-2016.", "Alias": "", "Author": "Brandon Abshire, netnerds.net", "CommandName": "Test-DbaOptimizeForAdHoc", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaOptimizeForAdHoc", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaOptimizeForAdHoc -SqlInstance sql2008, sqlserver2012\nValidates whether Optimize for AdHoc Workloads setting is enabled for servers sql2008 and sqlserver2012.", "Params": [ [ "SqlInstance", "A collection of one or more SQL Server instance names to query.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. This avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because \r\nit basically disables advanced scripting. Using this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaOptimizeForAdHoc [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaPath", "Description": "Uses master.dbo.xp_fileexist to determine if a file or directory exists.", "Tags": [ "Path", "ServiceAccount" ], "Synopsis": "Tests if file or directory exists from the perspective of the SQL Server service account.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaPath", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaPath", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaPath -SqlInstance sqlcluster -Path L:\\MSAS12.MSSQLSERVER\\OLAP\nTests whether the service account running the \"sqlcluster\" SQL Server instance can access L:\\MSAS12.MSSQLSERVER\\OLAP. Logs into sqlcluster using Windows credentials.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$credential = Get-Credential\nPS C:\\\u003e Test-DbaPath -SqlInstance sqlcluster -SqlCredential $credential -Path L:\\MSAS12.MSSQLSERVER\\OLAP\nTests whether the service account running the \"sqlcluster\" SQL Server instance can access L:\\MSAS12.MSSQLSERVER\\OLAP. Logs into sqlcluster using SQL authentication.", "Params": [ [ "SqlInstance", "The SQL Server you want to run the test on.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Path", "The Path to test. This can be a file or directory", "", true, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaPath [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-Path] \u003cObject\u003e [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaPowerPlan", "Description": "Checks the Power Plan settings on a computer against best practices recommendations.\nEach server\u0027s name, the active and the recommended Power Plan and an IsBestPractice field are returned.\n\nIf your organization uses a different Power Plan that is considered best practice, specify -PowerPlan.\n\nReferences:\nhttps://support.microsoft.com/en-us/kb/2207548\nhttp://www.sqlskills.com/blogs/glenn/windows-power-plan-effects-on-newer-intel-processors/", "Tags": "PowerPlan", "Synopsis": "Checks the Power Plan settings for compliance with best practices, which recommend High Performance for SQL Server.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Test-DbaPowerPlan", "Availability": "Windows only", "Links": "https://dbatools.io/Test-DbaPowerPlan", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaPowerPlan -ComputerName sqlserver2014a\nChecks the Power Plan settings for sqlserver2014a and indicates whether or not it complies with best practices.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaPowerPlan -ComputerName sqlserver2014a -PowerPlan \u0027Maximum Performance\u0027\nChecks the Power Plan settings for sqlserver2014a and indicates whether or not it is set to the Power Plan \"Maximum Performance\".\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e\u0027newserver1\u0027, \u0027newserver2\u0027 | Test-DbaPowerPlan\nChecks the Power Plan settings for newserver1 and newserver2 and indicates whether or not they comply with best practices.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaPowerPlan -ComputerName oldserver | Test-DbaPowerPlan -ComputerName newserver1, newserver2\nUses the Power Plan of oldserver as best practice and tests the Power Plan of newserver1 and newserver2 against that.", "Params": [ [ "ComputerName", "The server(s) to check Power Plan settings on.", "", true, "true (ByValue, ByPropertyName)", "", "" ], [ "Credential", "Specifies a PSCredential object to use in authenticating to the server(s), instead of the current user account.", "", false, "true (ByPropertyName)", "", "" ], [ "PowerPlan", "If your organization uses a different power plan that\u0027s considered best practice, specify it here.", "CustomPowerPlan", false, "true (ByPropertyName)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaPowerPlan [-ComputerName] \u003cDbaInstanceParameter[]\u003e [[-Credential] \u003cPSCredential\u003e] [[-PowerPlan] \u003cString\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaRepLatency", "Description": "Creates tracer tokens to determine latency between the publisher/distributor and the distributor/subscriber\nfor all transactional publications for a server, database, or publication.\n\nAll replication commands need SQL Server Management Studio installed and are therefore currently not supported.\nHave a look at this issue to get more information: https://github.com/sqlcollaborative/dbatools/issues/7428", "Tags": "Replication", "Synopsis": "Displays replication latency for all transactional publications for a server or database.", "Alias": "", "Author": "Colin Douglas", "CommandName": "Test-DbaRepLatency", "Availability": "Windows only", "Links": "https://dbatools.io/Test-DbaRepLatency", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaRepLatency -SqlInstance sql2008, sqlserver2012\nReturn replication latency for all transactional publications for servers sql2008 and sqlserver2012.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaRepLatency -SqlInstance sql2008 -Database TestDB\nReturn replication latency for all transactional publications on server sql2008 for only the TestDB database\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaRepLatency -SqlInstance sql2008 -Database TestDB -PublicationName TestDB_Pub\nReturn replication latency for the TestDB_Pub publication for the TestDB database located on the server sql2008.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "true (ByValue)", "", "" ], [ "Database", "The database(s) to process. If unspecified, all databases will be processed.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "PublicationName", "The publication(s) to process. If unspecified, all publications will be processed.", "", false, "false", "", "" ], [ "TimeToLive", "How long, in seconds, to wait for a tracer token to complete its journey from the publisher to the subscriber.\r\nIf unspecified, all tracer tokens will take as long as they need to process results.", "", false, "false", "0", "" ], [ "RetainToken", "Retains the tracer tokens created for each publication. If unspecified, all tracer tokens created will be discarded.", "", false, "false", "False", "" ], [ "DisplayTokenHistory", "Displays all tracer tokens in each publication. If unspecified, the current tracer token created will be only token displayed.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaRepLatency [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-Database] \u003cObject[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-PublicationName] \u003cObject[]\u003e] [[-TimeToLive] \u003cInt32\u003e] [-RetainToken] [-DisplayTokenHistory] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "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) broken functionality of the Microsoft Kerberos Configuration manager and SQL Server 2016.\n\n- For any instances with TCP/IP enabled, the script will determine which port(s) the instances are listening on and generate the required SPNs.\n- For named instances NOT using dynamic ports, the script will generate a port-based SPN for those instances as well.\n- 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 set. The function will return a custom object(s) that contains the server name checked, the instance name discovered, the account the service is running under, and what the \"required\" SPN should be. It will also return a boolean property indicating if the SPN is set in Active Directory or not.", "Tags": "SPN", "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.", "Alias": "", "Author": "Drew Furgiuele (@pittfurg), http://www.port1433.com | niphlod", "CommandName": "Test-DbaSpn", "Availability": "Windows only", "Links": "https://dbatools.io/Test-DbaSpn", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaSpn -ComputerName SQLSERVERA -Credential ad\\sqldba\nConnects to a computer (SQLSERVERA) and queries WMI for all SQL instances and return \"required\" SPNs. It will then take each SPN it generates\r\nand query Active Directory to make sure the SPNs are set.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaSpn -ComputerName SQLSERVERA,SQLSERVERB -Credential ad\\sqldba\nConnects to multiple computers (SQLSERVERA, SQLSERVERB) 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.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaSpn -ComputerName SQLSERVERC -Credential ad\\sqldba\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 credential you pass must have be a valid login with appropriate rights on the domain", "Params": [ [ "ComputerName", "The computer you want to discover any SQL Server instances on. This parameter is required.", "", true, "true (ByValue)", "", "" ], [ "Credential", "The credential you want to use to connect to the remote server and active directory.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaSpn [-ComputerName] \u003cDbaInstanceParameter[]\u003e [[-Credential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaTempDbConfig", "Description": "Evaluates tempdb against a set of rules to match best practices. The rules are:\n\n* TF 1118 enabled - Is Trace Flag 1118 enabled (See KB328551).\n* File Count - Does the count of data files in tempdb match the number of logical cores, up to 8?\n* File Growth - Are any files set to have percentage growth? Best practice is all files have an explicit growth value.\n* File Location - Is tempdb located on the C:\\? Best practice says to locate it elsewhere.\n* File 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* Data File Size Equal - Are the sizes of all the tempdb data files the same?\n\nOther rules can be added at a future date.", "Tags": [ "Tempdb", "Configuration" ], "Synopsis": "Evaluates tempdb against several rules to match best practices.", "Alias": "", "Author": "Michael Fal (@Mike_Fal), http://mikefal.net", "CommandName": "Test-DbaTempDbConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Test-DbaTempDbConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaTempDbConfig -SqlInstance localhost\nChecks tempdb on the localhost machine.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaTempDbConfig -SqlInstance localhost | Select-Object *\nChecks tempdb on the localhost machine. All rest results are shown.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaRegServer -SqlInstance sqlserver2014a | Test-DbaTempDbConfig | Select-Object * | Out-GridView\nChecks tempdb configuration for a group of servers from SQL Server Central Management Server (CMS). Output includes all columns. Send output to GridView.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. SQL Server 2005 and higher are supported.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaTempDbConfig [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Test-DbaWindowsLogin", "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 keep your logins accurate and up to date by removing accounts that are no longer needed.", "Tags": [ "Login", "Security" ], "Synopsis": "Test-DbaWindowsLogin finds any logins on SQL instance that are AD logins with either disabled AD user accounts or ones that no longer exist", "Alias": "", "Author": "Stephen Bennett, https://sqlnotesfromtheunderground.wordpress.com/ | Chrissy LeMaire (@cl)", "CommandName": "Test-DbaWindowsLogin", "Availability": "Windows only", "Links": "https://dbatools.io/Test-DbaWindowsLogin", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eTest-DbaWindowsLogin -SqlInstance Dev01\nTests all logins in the current Active Directory domain that are either disabled or do not exist on the SQL Server instance Dev01\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eTest-DbaWindowsLogin -SqlInstance Dev01 -FilterBy GroupsOnly | Select-Object -Property *\nTests all Active Directory groups that have logins on Dev01, and shows all information for those logins\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eTest-DbaWindowsLogin -SqlInstance Dev01 -IgnoreDomains testdomain\nTests all Domain logins excluding any that are from the testdomain", "Params": [ [ "SqlInstance", "The SQL Server instance you\u0027re checking logins on. You must have sysadmin access and server version must be SQL Server version 2000 or higher.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Login", "Specifies a list of logins to include in the results. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "ExcludeLogin", "Specifies a list of logins to exclude from the results. Options for this list are auto-populated from the server.", "", false, "false", "", "" ], [ "FilterBy", "Specifies the object types to return. By default, both Logins and Groups are returned. Valid options for this parameter are \u0027GroupsOnly\u0027 and \u0027LoginsOnly\u0027.", "", false, "false", "None", "LoginsOnly,GroupsOnly,None" ], [ "IgnoreDomains", "Specifies a list of Active Directory domains to ignore. By default, all domains in the forest as well as all trusted domains are traversed.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Test-DbaWindowsLogin [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Login] \u003cObject[]\u003e] [[-ExcludeLogin] \u003cObject[]\u003e] [[-FilterBy] \u003cString\u003e] [[-IgnoreDomains] \u003cString[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Uninstall-DbaSqlWatch", "Description": "Deletes all user objects, agent jobs, and historical data associated with SqlWatch.", "Tags": [ "Community", "SqlWatch" ], "Synopsis": "Uninstalls SqlWatch.", "Alias": "", "Author": "Ken K (github.com/koglerk)", "CommandName": "Uninstall-DbaSqlWatch", "Availability": "Windows only", "Links": "https://dbatools.io/Uninstall-DbaSqlWatch", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eUninstall-DbaSqlWatch -SqlInstance server1\nDeletes all user objects, agent jobs, and historical data associated with SqlWatch from the master database.", "Params": [ [ "SqlInstance", "SQL Server name or SMO object representing the SQL Server to connect to.", "", true, "true (ByValue)", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "Specifies the database to install SqlWatch into. Defaults to master.", "", false, "false", "master", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts to confirm actions", "cf", false, "false", "", "" ] ], "Syntax": "Uninstall-DbaSqlWatch [-SqlInstance] \u003cDbaInstanceParameter[]\u003e [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Uninstall-DbatoolsWatchUpdate", "Description": "Removes the scheduled task created for Watch-DbaUpdate by Install-DbatoolsWatchUpdate so that notifications no longer pop up.", "Tags": [ "Module", "Watcher" ], "Synopsis": "Removes the scheduled task created for Watch-DbaUpdate by Install-DbatoolsWatchUpdate so that notifications no longer pop up.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Uninstall-DbatoolsWatchUpdate", "Availability": "Windows only", "Links": "https://dbatools.io/Uninstall-DbatoolsWatchUpdate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eUninstall-DbatoolsWatchUpdate\nRemoves the scheduled task created by Install-DbatoolsWatchUpdate.", "Params": [ ], "Syntax": "Uninstall-DbatoolsWatchUpdate [\u003cCommonParameters\u003e]" }, { "Name": "Unregister-DbatoolsConfig", "Description": "Removes registered configuration settings.\nThis function can be used to remove settings that have been persisted for either user or computer.\n\nNote: This command has no effect on configuration settings currently in memory.", "Tags": "Module", "Synopsis": "Removes registered configuration settings.", "Alias": "", "Author": "Friedrich Weinmann (@FredWeinmann)", "CommandName": "Unregister-DbatoolsConfig", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Unregister-DbatoolsConfig", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eGet-DbatoolsConfig | Unregister-DbatoolsConfig\nCompletely removes all registered configurations currently loaded in memory.\r\nIn most cases, this will mean removing all registered configurations.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eUnregister-DbatoolsConfig -Scope SystemDefault -FullName \u0027MyModule.Path.DefaultExport\u0027\nUnregisters the setting \u0027MyModule.Path.DefaultExport\u0027 from the list of computer-wide defaults.\r\nNote: Changing system wide settings requires running the console with elevation.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eUnregister-DbatoolsConfig -Module MyModule\nUnregisters all configuration settings for the module MyModule.", "Params": [ [ "ConfigurationItem", "A configuration object as returned by Get-DbatoolsConfig.", "", false, "true (ByValue)", "", "" ], [ "FullName", "The full name of the configuration setting to purge.", "", false, "true (ByValue)", "", "" ], [ "Module", "The module, amongst which settings should be unregistered.", "", true, "false", "", "" ], [ "Name", "The name of the setting to unregister.\r\nFor use together with the module parameter, to limit the amount of settings that are unregistered.", "", false, "false", "*", "" ], [ "Scope", "Settings can be set to either default or enforced, for user or the entire computer.\r\nBy default, only DefaultSettings for the user are unregistered.\r\nUse this parameter to choose the actual scope for the command to process.", "", false, "false", "UserDefault", "" ] ], "Syntax": "Unregister-DbatoolsConfig [-ConfigurationItem \u003cConfig[]\u003e] [-FullName \u003cString[]\u003e] [-Scope {UserDefault | UserMandatory | SystemDefault | SystemMandatory | FileUserLocal | FileUserShared | FileSystem}] [\u003cCommonParameters\u003e]\nUnregister-DbatoolsConfig -Module \u003cString\u003e [-Name \u003cString\u003e] [-Scope {UserDefault | UserMandatory | SystemDefault | SystemMandatory | FileUserLocal | FileUserShared | FileSystem}] [\u003cCommonParameters\u003e]" }, { "Name": "Update-DbaBuildReference", "Description": "This function updates the local json files containing all the infos about SQL builds.\nIt uses the setting \u0027assets.sqlbuildreference\u0027 to fetch it.\nTo see your current setting, use Get-DbatoolsConfigValue -Name \u0027assets.sqlbuildreference\u0027", "Tags": "SqlBuild", "Synopsis": "Updates the local reference looking online for the most up to date.", "Alias": "", "Author": "Simone Bizzotto (@niphold) | Friedrich Weinmann (@FredWeinmann)", "CommandName": "Update-DbaBuildReference", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Update-DbaBuildReference", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eUpdate-DbaBuildReference\nLooks online if there is a newer version of the build reference", "Params": [ [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Update-DbaBuildReference [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Update-DbaInstance", "Description": "Starts and automated process of updating SQL Server installation to a specific version defined in the parameters.\nThe command will:\n\n* Search for SQL Server installations in a remote registry\n* Check if current settings are applicable to the current SQL Server versions\n* Search for a KB executable in a folder specified in -Path\n* Establish a PSRemote connection to the target machine if necessary\n* Extract KB to a temporary folder in a current user\u0027s profile\n* Run the installation from the temporary folder updating all instances on the computer at once\n* Remove temporary files\n* Restart the computer (if -Restart is specified)\n* Repeat for each consequent KB and computer\n\nThe impact of this function is set to High, if you don\u0027t want to receive interactive prompts, set -Confirm to $false.\nCredentials are a required parameter for remote machines. Without specifying -Credential, the installation will fail due to lack of permissions.\n\nCredSSP is a recommended transport for running the updates remotely. Update-DbaInstance will attempt to reconfigure\nlocal and remote hosts to support CredSSP, which is why it is desirable to run this command in an elevated console at all times.\nCVE-2018-0886 security update is required for both local and remote hosts. If CredSSP connections are failing, make sure to\napply recent security updates prior to doing anything else.\n\nWhen using CredSSP authentication, this function will configure CredSSP authentication for PowerShell Remoting sessions.\nIf this is not desired (e.g.: CredSSP authentication is managed externally, or is already configured appropriately,)\nit can be disabled by setting the dbatools configuration option \u0027commands.initialize-credssp.bypass\u0027 value to $true.\n\nAlways backup databases and configurations prior to upgrade.", "Tags": [ "Install", "Patching", "SP", "CU", "Instance" ], "Synopsis": "Invokes installation of SQL Server Service Packs and Cumulative Updates on local and remote servers.", "Alias": "", "Author": "Kirill Kravtsov (@nvarscar) https://nvarscar.wordpress.com/", "CommandName": "Update-DbaInstance", "Availability": "Windows only", "Links": "https://dbatools.io/Update-DbaInstance", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eUpdate-DbaInstance -ComputerName SQL1 -Version SP3 -Path \\\\network\\share\nUpdates all applicable SQL Server installations on SQL1 to SP3.\r\nBinary files for the update will be searched among all files and folders recursively in \\\\network\\share.\r\nPrompts for confirmation before the update.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eUpdate-DbaInstance -ComputerName SQL1, SQL2 -Restart -Path \\\\network\\share -Confirm:$false\nUpdates all applicable SQL Server installations on SQL1 and SQL2 with the most recent patch.\r\nIt will install latest ServicePack, restart the computers, install latest Cumulative Update, and finally restart the computer once again.\r\nBinary files for the update will be searched among all files and folders recursively in \\\\network\\share.\r\nDoes not prompt for confirmation.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eUpdate-DbaInstance -ComputerName SQL1 -Version 2012 -Type ServicePack -Path \\\\network\\share\nUpdates SQL Server 2012 on SQL1 with the most recent ServicePack found in your patch repository.\r\nBinary files for the update will be searched among all files and folders recursively in \\\\network\\share.\r\nPrompts for confirmation before the update.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eUpdate-DbaInstance -ComputerName SQL1 -KB 123456 -Restart -Path \\\\network\\share -Confirm:$false\nInstalls KB 123456 on SQL1 and restarts the computer.\r\nBinary files for the update will be searched among all files and folders recursively in \\\\network\\share.\r\nDoes not prompt for confirmation.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eUpdate-DbaInstance -ComputerName Server1 -Version SQL2012SP3, SQL2016SP2CU3 -Path \\\\network\\share -Restart -Confirm:$false\nUpdates SQL 2012 to SP3 and SQL 2016 to SP2CU3 on Server1. Each update will be followed by a restart.\r\nBinary files for the update will be searched among all files and folders recursively in \\\\network\\share.\r\nDoes not prompt for confirmation.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003eUpdate-DbaInstance -ComputerName Server1 -Path \\\\network\\share -Restart -Confirm:$false -ExtractPath \"C:\\temp\"\nUpdates all applicable SQL Server installations on Server1 with the most recent patch. Each update will be followed by a restart.\r\nBinary files for the update will be searched among all files and folders recursively in \\\\network\\share.\r\nDoes not prompt for confirmation.\r\nExtracts the files in local driver on Server1 C:\\temp.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003eUpdate-DbaInstance -ComputerName Server1 -Path \\\\network\\share -ArgumentList \"/SkipRules=RebootRequiredCheck\"\nUpdates all applicable SQL Server installations on Server1 with the most recent patch.\r\nAdditional command line parameters would be passed to the executable.\r\nBinary files for the update will be searched among all files and folders recursively in \\\\network\\share.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003eUpdate-DbaInstance -ComputerName SQL1 -Version CU3 -Download -Path \\\\network\\share -Confirm:$false\nDownloads an appropriate CU KB to \\\\network\\share and installs it onto SQL1.\r\nDoes not prompt for confirmation.", "Params": [ [ "ComputerName", "Target computer with SQL instance or instances.", "cn,host,Server", false, "true (ByValue)", "$env:COMPUTERNAME", "" ], [ "Credential", "Windows Credential with permission to log on to the remote server.\r\nMust be specified for any remote connection if update Repository is located on a network folder.", "", false, "false", "", "" ], [ "Version", "A target version of the installation you want to reach. If not specified, a latest available version would be used by default.\r\nCan be defined using the following general pattern: \u003cMajorVersion\u003e\u003cSPX\u003e\u003cCUX\u003e.\r\nAny part of the pattern can be omitted if needed:\r\n2008R2SP1 - will update SQL 2008R2 to SP1\r\n2016CU3 - will update SQL 2016 to CU3 of current Service Pack installed\r\nSP0CU3 - will update all existing SQL Server versions to RTM CU3 without installing any service packs\r\nSP1CU7 - will update all existing SQL Server versions to SP1 and then (after restart if -Restart is specified) to SP1CU7\r\nCU7 - will update all existing SQL Server versions to CU7 of current Service Pack installed", "", false, "false", "", "" ], [ "Type", "Type of the update: All | ServicePack | CumulativeUpdate.\r\nDefault: All\r\nUse -Version to limit upgrade to a certain Major version of SQL Server.", "", false, "false", "@(\u0027All\u0027)", "All,ServicePack,CumulativeUpdate" ], [ "KB", "Install a specific update or list of updates. Can be a number of a string KBXXXXXXX.", "", true, "false", "", "" ], [ "InstanceName", "Only updates a specific instance(s).", "Instance", false, "false", "", "" ], [ "Path", "Path to the folder(s) with SQL Server patches downloaded. It will be scanned recursively for available patches.\r\nPath should be available from both server with SQL Server installation and client that runs the command.\r\nAll file names should match the pattern used by Microsoft: SQLServer####*-KB###-*x##*.exe\r\nIf a file is missing in the repository, the installation will fail.\r\nConsider setting the following configuration if you want to omit this parameter: `Set-DbatoolsConfig -Name Path.SQLServerUpdates -Value \u0027\\\\path\\to\\updates\u0027`", "", false, "false", "(Get-DbatoolsConfigValue -Name \u0027Path.SQLServerUpdates\u0027)", "" ], [ "Restart", "Restart computer automatically after a successful installation of a patch and wait until it comes back online.\r\nUsing this parameter is the only way to chain-install more than 1 patch on a computer, since every single patch will require a restart of said computer.", "", false, "false", "False", "" ], [ "Continue", "Continues a failed installation attempt when specified. Will abort a previously failed installation otherwise.", "", false, "false", "False", "" ], [ "Throttle", "Maximum number of computers updated in parallel. Once reached, the update operations will queue up.\r\nDefault: 50", "", false, "false", "50", "" ], [ "Authentication", "Chooses an authentication protocol for remote connections.\r\nIf the protocol fails to establish a connection\nDefaults:\r\n* CredSSP when -Credential is specified - due to the fact that repository Path is usually a network share and credentials need to be passed to the remote host to avoid the double-hop issue.\r\n* Default when -Credential is not specified. Will likely fail if a network path is specified.", "", false, "false", "@(\u0027CredSSP\u0027, \u0027Default\u0027)[$null -eq $Credential]", "Default,Basic,Negotiate,NegotiateWithImplicitCredential,Credssp,Digest,Kerberos" ], [ "ExtractPath", "Lets you specify a location to extract the update file to on the system requiring the update. e.g. C:\\temp", "", false, "false", "", "" ], [ "ArgumentList", "A list of extra arguments to pass to the execution file. Accepts one or more strings containing command line parameters.\r\nExample: ... -ArgumentList \"/SkipRules=RebootRequiredCheck\", \"/Q\"", "", false, "false", "", "" ], [ "Download", "Download missing KBs to the first folder specified in the -Path parameter.\r\nFiles would be first downloaded to the local machine (TEMP folder), and then distributed onto remote machines if needed.\r\nIf the Path is a network Path, the files would be downloaded straight to the network folder and executed from there.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Update-DbaInstance [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [-Credential \u003cPSCredential\u003e] [-Version \u003cString[]\u003e] [-Type \u003cString[]\u003e] [-InstanceName \u003cString\u003e] [-Path \u003cString[]\u003e] [-Restart] [-Continue] [-Throttle \u003cInt32\u003e] [-Authentication \u003cString\u003e] [-ExtractPath \u003cString\u003e] [-ArgumentList \u003cString[]\u003e] [-Download] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nUpdate-DbaInstance [[-ComputerName] \u003cDbaInstanceParameter[]\u003e] [-Credential \u003cPSCredential\u003e] -KB \u003cString[]\u003e [-InstanceName \u003cString\u003e] [-Path \u003cString[]\u003e] [-Restart] [-Continue] [-Throttle \u003cInt32\u003e] [-Authentication \u003cString\u003e] [-ExtractPath \u003cString\u003e] [-ArgumentList \u003cString[]\u003e] [-Download] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Update-DbaServiceAccount", "Description": "Reconfigure the service account or update the password of the specified SQL Server service. The service will be restarted in the event of changing the account.", "Tags": [ "Service", "SqlServer", "Instance", "Connect" ], "Synopsis": "Changes service account (or just its password) of the SQL Server service.", "Alias": "", "Author": "Kirill Kravtsov (@nvarscar)", "CommandName": "Update-DbaServiceAccount", "Availability": "Windows only", "Links": "https://dbatools.io/Update-DbaServiceAccount", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$SecurePassword = ConvertTo-SecureString \u0027Qwerty1234\u0027 -AsPlainText -Force\nPS C:\\\u003e Update-DbaServiceAccount -ComputerName sql1 -ServiceName \u0027MSSQL$MYINSTANCE\u0027 -SecurePassword $SecurePassword\nChanges the current service account\u0027s password of the service MSSQL$MYINSTANCE to \u0027Qwerty1234\u0027\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$cred = Get-Credential\nPS C:\\\u003e Get-DbaService sql1 -Type Engine,Agent -Instance MYINSTANCE | Update-DbaServiceAccount -ServiceCredential $cred\nRequests credentials from the user and configures them as a service account for the SQL Server engine and agent services of the instance sql1\\MYINSTANCE\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eUpdate-DbaServiceAccount -ComputerName sql1,sql2 -ServiceName \u0027MSSQLSERVER\u0027,\u0027SQLSERVERAGENT\u0027 -Username NETWORKSERVICE\nConfigures SQL Server engine and agent services on the machines sql1 and sql2 to run under Network Service system user.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003eGet-DbaService sql1 -Type Engine -Instance MSSQLSERVER | Update-DbaServiceAccount -Username \u0027MyDomain\\sqluser1\u0027\nConfigures SQL Server engine service on the machine sql1 to run under MyDomain\\sqluser1. Will request user to input the account password.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003eGet-DbaService sql1 -Type Engine -Instance MSSQLSERVER | Update-DbaServiceAccount -Username \u0027MyDomain\\sqluser1\u0027 -NoRestart\nConfigures SQL Server engine service on the machine sql1 to run under MyDomain\\sqluser1. Will request user to input the account password.\nWill not restart, which means the changes will not go into effect, so you will still have to restart during your planned outage window.", "Params": [ [ "ComputerName", "The target SQL Server instance or instances.", "cn,host,Server", false, "false", "$env:COMPUTERNAME", "" ], [ "Credential", "Windows Credential with permission to log on to the server running the SQL instance", "", false, "false", "", "" ], [ "InputObject", "A collection of services. Basically, any object that has ComputerName and ServiceName properties. Can be piped from Get-DbaService.", "ServiceCollection", true, "true (ByValue)", "", "" ], [ "ServiceName", "A name of the service on which the action is performed. E.g. MSSQLSERVER or SqlAgent$INSTANCENAME", "Name,Service", true, "false", "", "" ], [ "Username", "Username of the service account. Cannot be used with -ServiceCredential. For local service accounts use one of the following usernames omitting the -SecurePassword parameter:\r\nLOCALSERVICE\r\nNETWORKSERVICE\r\nLOCALSYSTEM", "User", false, "false", "", "" ], [ "ServiceCredential", "Windows Credential object under which the service will be setup to run. Cannot be used with -Username. For local service accounts use one of the following usernames with empty password:\r\nLOCALSERVICE\r\nNETWORKSERVICE\r\nLOCALSYSTEM", "", false, "false", "", "" ], [ "PreviousPassword", "An old password of the service account. Optional when run under local admin privileges.", "", false, "false", "(New-Object System.Security.SecureString)", "" ], [ "SecurePassword", "New password of the service account. The function will ask for a password if not specified. MSAs and local system accounts will ignore the password.", "Password,NewPassword", false, "false", "(New-Object System.Security.SecureString)", "" ], [ "NoRestart", "Do not immediately restart the service after changing the password.\n**Note that the changes will not go into effect until you restart the SQL Services**", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "Shows what would happen if the command were to run. No actions are actually performed.", "wi", false, "false", "", "" ], [ "Confirm", "Prompts you for confirmation before executing any changing operations within the command.", "cf", false, "false", "", "" ] ], "Syntax": "Update-DbaServiceAccount [-ComputerName \u003cDbaInstanceParameter[]\u003e] [-Credential \u003cPSCredential\u003e] [-ServiceName] \u003cString[]\u003e [-Username \u003cString\u003e] [-ServiceCredential \u003cPSCredential\u003e] [-PreviousPassword \u003cSecureString\u003e] [-SecurePassword \u003cSecureString\u003e] [-NoRestart] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]\nUpdate-DbaServiceAccount [-Credential \u003cPSCredential\u003e] -InputObject \u003cObject[]\u003e [-Username \u003cString\u003e] [-ServiceCredential \u003cPSCredential\u003e] [-PreviousPassword \u003cSecureString\u003e] [-SecurePassword \u003cSecureString\u003e] [-NoRestart] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Update-Dbatools", "Description": "Exported function. Updates dbatools. Deletes current copy and replaces it with freshest copy.", "Tags": "Module", "Synopsis": "Exported function. Updates dbatools. Deletes current copy and replaces it with freshest copy.", "Alias": "", "Author": "Shawn Melton (@wsmelton), http://wsmelton.github.io", "CommandName": "Update-Dbatools", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Update-Dbatools", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eUpdate-Dbatools\nUpdates dbatools. Deletes current copy and replaces it with freshest copy.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eUpdate-Dbatools -dev\nUpdates dbatools to the current development branch. Deletes current copy and replaces it with latest from github.", "Params": [ [ "Development", "If this switch is enabled, the current development branch will be installed. By default, the latest official release is installed.", "dev,devbranch", false, "false", "False", "" ], [ "Cleanup", "If this switch is enabled, old versions of dbatools will be removed.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Update-Dbatools [-Development] [-Cleanup] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Watch-DbaDbLogin", "Description": "Watch-DbaDbLogin uses SQL Server DMV\u0027s to track logins into a SQL Server table. This is helpful when you need to migrate a SQL Server and update connection strings, but have inadequate documentation on which servers/applications are 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.\n\nLogins from the same server are excluded from the watched set.\n\nThe inputs for this command are either a Central Management Server (registered server repository), a flat file of server names, or to use pipeline input via Connect-DbaInstance. See the examples for more information.", "Tags": "Login", "Synopsis": "Tracks SQL Server logins: which host they came from, what database they\u0027re using, and what program is being used to log in.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Watch-DbaDbLogin", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Watch-DbaDbLogin", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eWatch-DbaDbLogin -SqlInstance sqlserver -SqlCms SqlCms1\nA list of all database instances within the Central Management Server SqlCms1 is generated. Using this list, the script enumerates all the processes and gathers login information and saves it to the \r\ntable Dblogins in the DatabaseLogins database on SQL Server sqlserver.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eWatch-DbaDbLogin -SqlInstance sqlcluster -Database CentralAudit -ServersFromFile .\\sqlservers.txt\nA list of servers is gathered from the file sqlservers.txt in the current directory. Using this list, the script enumerates all the processes and gathers login information and saves it to the table \r\nDblogins in the CentralAudit database on SQL Server sqlcluster.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eWatch-DbaDbLogin -SqlInstance sqlserver -SqlCms SqlCms1 -SqlCredential $cred\nA list of servers is generated using database instance names within the SQL2014Clusters group on the Central Management Server SqlCms1. Using this list, the script enumerates all the processes and \r\ngathers login information and saves it to the table Dblogins in the DatabaseLogins database on sqlserver.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$instance1 = Connect-DbaInstance -SqlInstance sqldev01\nPS C:\\\u003e $instance2 = Connect-DbaInstance -SqlInstance sqldev02\r\nPS C:\\\u003e $instance1, $instance2 | Watch-DbaDbLogin -SqlInstance sqltest01 -Database CentralAudit\nPre-connects two instances sqldev01 and sqldev02 and then using pipelining sends them to Watch-DbaDbLogin to enumerate processes and gather login info. The resulting gathered info is stored to the \r\nDbaTools-WatchDbLogins table in the CentralAudit database on the sqltest01 instance.\nNote: This is the method to use if the instances have different credentials than the instance used to store the watch data.", "Params": [ [ "SqlInstance", "The SQL Server that stores the Watch database.", "", true, "false", "", "" ], [ "Database", "The name of the Watch database.", "", false, "false", "", "" ], [ "Table", "The name of the Watch table. By default, this is DbaTools-WatchDbLogins.", "", false, "false", "DbaTools-WatchDbLogins", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "SqlCms", "Specifies a Central Management Server to query for a list of servers to watch.", "", false, "false", "", "" ], [ "ServersFromFile", "Specifies a file containing a list of servers to watch. This file must contain one server name per line.", "", false, "false", "", "" ], [ "InputObject", "Allows pipeline input from Connect-DbaInstance.", "", false, "true (ByValue)", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Watch-DbaDbLogin [-SqlInstance] \u003cDbaInstanceParameter\u003e [[-Database] \u003cObject\u003e] [[-Table] \u003cString\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-SqlCms] \u003cString\u003e] [[-ServersFromFile] \u003cString\u003e] [[-InputObject] \u003cServer[]\u003e] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Watch-DbatoolsUpdate", "Description": "Just for fun - checks the PowerShell Gallery every 1 hour for updates to dbatools. Notifies once max per release.\n\nAnyone know how to make it clickable so that it opens an URL?", "Tags": [ "Module", "Watcher" ], "Synopsis": "Just for fun - checks the PowerShell Gallery every 1 hour for updates to dbatools. Notifies once per release.", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Watch-DbatoolsUpdate", "Availability": "Windows only", "Links": "https://dbatools.io/Watch-DbatoolsUpdate", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eWatch-DbatoolsUpdate\nWatches the gallery for updates to dbatools.", "Params": [ ], "Syntax": "Watch-DbatoolsUpdate [\u003cCommonParameters\u003e]" }, { "Name": "Watch-DbaXESession", "Description": "Watch live XEvent Data as it happens. This command runs until you stop the session, kill the PowerShell session, or Ctrl-C.\n\nThanks to Dave Mason (@BeginTry) for some straightforward code samples https://itsalljustelectrons.blogspot.be/2017/01/SQL-Server-Extended-Event-Handling-Via-Powershell.html", "Tags": [ "ExtendedEvent", "XE", "XEvent" ], "Synopsis": "Watch live XEvent Data as it happens", "Alias": "", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Watch-DbaXESession", "Availability": "Windows only", "Links": "https://dbatools.io/Watch-DbaXESession", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003eWatch-DbaXESession -SqlInstance sql2017 -Session system_health\nShows events for the system_health session as it happens.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003eWatch-DbaXESession -SqlInstance sql2017 -Session system_health | Export-Csv -NoTypeInformation -Path C:\\temp\\system_health.csv\nExports live events to CSV. Ctrl-C may not not cancel out of it - fastest way is to stop the session.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003eGet-DbaXESession -SqlInstance sql2017 -Session system_health | Start-DbaXESession | Watch-DbaXESession | Export-Csv -NoTypeInformation -Path C:\\temp\\system_health.csv\nExports live events to CSV. Ctrl-C may not not cancel out of this. The fastest way to do so is to stop the session.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.", "", false, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Session", "Only return a specific session. Options for this parameter are auto-populated from the server.", "Name", false, "false", "", "" ], [ "InputObject", "Accepts an XESession object returned by Get-DbaXESession.", "", false, "true (ByValue)", "", "" ], [ "Raw", "If this switch is enabled, the enumeration object is returned.", "", false, "false", "False", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ] ], "Syntax": "Watch-DbaXESession [[-SqlInstance] \u003cDbaInstanceParameter\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Session] \u003cString\u003e] [[-InputObject] \u003cSession[]\u003e] [-Raw] [-EnableException] [\u003cCommonParameters\u003e]" }, { "Name": "Write-DbaDbTableData", "Description": "Writes a .NET DataTable to a SQL Server table using SQL Bulk Copy.", "Tags": [ "DataTable", "Insert" ], "Synopsis": "Writes data to a SQL Server table.", "Alias": "Write-DbaDataTable", "Author": "Chrissy LeMaire (@cl), netnerds.net", "CommandName": "Write-DbaDbTableData", "Availability": "Windows, Linux, macOS", "Links": "https://dbatools.io/Write-DbaDbTableData", "Examples": "-------------------------- EXAMPLE 1 --------------------------\nPS C:\\\u003e$DataTable = Import-Csv C:\\temp\\customers.csv\nPS C:\\\u003e Write-DbaDbTableData -SqlInstance sql2014 -InputObject $DataTable -Table mydb.dbo.customers\nPerforms a bulk insert of all the data in customers.csv into database mydb, schema dbo, table customers. A progress bar will be shown as rows are inserted. If the destination table does not exist, \r\nthe import will be halted.\n-------------------------- EXAMPLE 2 --------------------------\nPS C:\\\u003e$tableName = \"MyTestData\"\nPS C:\\\u003e $query = \"SELECT name, create_date, owner_sid FROM sys.databases\"\r\nPS C:\\\u003e $dataset = Invoke-DbaQuery -SqlInstance \u0027localhost,1417\u0027 -SqlCredential $containerCred -Database master -Query $query -As DataSet\r\nPS C:\\\u003e $dataset | Write-DbaDbTableData -SqlInstance \u0027localhost,1417\u0027 -SqlCredential $containerCred -Database tempdb -Table $tableName -AutoCreateTable\nPulls data from a SQL Server instance and then performs a bulk insert of the dataset to a new, auto-generated table tempdb.dbo.MyTestData.\n-------------------------- EXAMPLE 3 --------------------------\nPS C:\\\u003e$DataTable = Import-Csv C:\\temp\\customers.csv\nPS C:\\\u003e Write-DbaDbTableData -SqlInstance sql2014 -InputObject $DataTable -Table mydb.dbo.customers -AutoCreateTable -Confirm\nPerforms a bulk insert of all the data in customers.csv. If mydb.dbo.customers does not exist, it will be created with inefficient but forgiving DataTypes.\nPrompts for confirmation before a variety of steps.\n-------------------------- EXAMPLE 4 --------------------------\nPS C:\\\u003e$DataTable = Import-Csv C:\\temp\\customers.csv\nPS C:\\\u003e Write-DbaDbTableData -SqlInstance sql2014 -InputObject $DataTable -Table mydb.dbo.customers -Truncate\nPerforms a bulk insert of all the data in customers.csv. Prior to importing into mydb.dbo.customers, the user is informed that the table will be truncated and asks for confirmation. The user is \r\nprompted again to perform the import.\n-------------------------- EXAMPLE 5 --------------------------\nPS C:\\\u003e$DataTable = Import-Csv C:\\temp\\customers.csv\nPS C:\\\u003e Write-DbaDbTableData -SqlInstance sql2014 -InputObject $DataTable -Database mydb -Table customers -KeepNulls\nPerforms a bulk insert of all the data in customers.csv into mydb.dbo.customers. Because Schema was not specified, dbo was used. NULL values in the destination table will be preserved.\n-------------------------- EXAMPLE 6 --------------------------\nPS C:\\\u003e$passwd = ConvertTo-SecureString \"P@ssw0rd\" -AsPlainText -Force\nPS C:\\\u003e $AzureCredential = New-Object System.Management.Automation.PSCredential(\"AzureAccount\"),$passwd)\r\nPS C:\\\u003e $DataTable = Import-Csv C:\\temp\\customers.csv\r\nPS C:\\\u003e Write-DbaDbTableData -SqlInstance AzureDB.database.windows.net -InputObject $DataTable -Database mydb -Table customers -KeepNulls -SqlCredential $AzureCredential -BulkCopyTimeOut 300\nThis performs the same operation as the previous example, but against a SQL Azure Database instance using the required credentials.\n-------------------------- EXAMPLE 7 --------------------------\nPS C:\\\u003e$process = Get-Process\nPS C:\\\u003e Write-DbaDbTableData -InputObject $process -SqlInstance sql2014 -Table \"[[DbName]]].[Schema.With.Dots].[`\"[Process]]`\"]\" -AutoCreateTable\nCreates a table based on the Process object with over 60 columns, converted from PowerShell data types to SQL Server data types. After the table is created a bulk insert is performed to add process \r\ninformation into the table\r\nWrites the results of Get-Process to a table named: \"[Process]\" in schema named: Schema.With.Dots in database named: [DbName]\r\nThe Table name, Schema name and Database name must be wrapped in square brackets [ ]\r\nSpecial characters like \" must be escaped by a ` character.\r\nIn addition any actual instance of the ] character must be escaped by being duplicated.\nThis is an example of the type conversion in action. All process properties are converted, including special types like TimeSpan. Script properties are resolved before the type conversion starts \r\nthanks to ConvertTo-DbaDataTable.\n-------------------------- EXAMPLE 8 --------------------------\nPS C:\\\u003e$server = Connect-DbaInstance -SqlInstance SRV1\nPS C:\\\u003e $server.Invoke(\"CREATE TABLE tempdb.dbo.test (col1 INT, col2 VARCHAR(100))\")\r\nPS C:\\\u003e $data = Invoke-DbaQuery -SqlInstance $server -Query \"SELECT 123 AS value1, \u0027Hello world\u0027 AS value2\" -As DataSet\r\nPS C:\\\u003e $data | Write-DbaDbTableData -SqlInstance $server -Table \u0027tempdb.dbo.test\u0027 -ColumnMap @{ value1 = \u0027col1\u0027 ; value2 = \u0027col2\u0027 }\nThe dataset column \u0027value1\u0027 is inserted into SQL column \u0027col1\u0027 and dataset column value2 is inserted into the SQL Column \u0027col2\u0027. All other columns are ignored and therefore null or default values.", "Params": [ [ "SqlInstance", "The target SQL Server instance or instances.", "", true, "false", "", "" ], [ "SqlCredential", "Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).\nWindows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.\nFor MFA support, please use Connect-DbaInstance.", "", false, "false", "", "" ], [ "Database", "The database where the Input Object data will be written.", "", false, "false", "", "" ], [ "InputObject", "This is the DataTable (or data row) to import to SQL Server.\nIt is very important to understand how different types of objects are beeing processed to get the best performance.\r\nThe best performance is achieved when using the DataSet data type. If the data to be imported are determined with Invoke-DbaQuery, the option \"-As DataSet\" should be used. Then all records are \r\nimported in a single call of SqlBulkCopy.\r\nAlso the data type DataTable can lead to an import of all records in a single call of SqlBulkCopy. However, it should be noted that \"$varWithDataTable | Write-DbaDbTableData\" causes the pipeline to \r\nconvert the single object of type DataTable to a series of objects of type DataRow. These in turn lead to single calls of SqlBulkCopy per record, which negatively affects performance. This is also \r\nthe reason why the use of the DataRow data type is generally discouraged.\r\nWhen using objects of type PSObject, these are first all combined into an internal object of type DataTable and then imported in a single call of SqlBulkCopy.", "DataTable", true, "true (ByValue)", "", "" ], [ "Table", "The table name to import data into. You can specify a one, two, or three part table name. If you specify a one or two part name, you must also use -Database.\nIf the table does not exist, you can use -AutoCreateTable to automatically create the table. The table will be created with sub-optimal data types such as nvarchar(max).\nIf the object has special characters please wrap them in square brackets [ ].\r\nUsing dbo.First.Table will try to import to a table named \u0027Table\u0027 on schema \u0027First\u0027 and database \u0027dbo\u0027.\r\nThe correct way to import to a table named \u0027First.Table\u0027 on schema \u0027dbo\u0027 is by passing dbo.[First].[Table].\r\nAny actual usage of the ] must be escaped by duplicating the ] character.\r\nThe correct way to import to a table Name] in schema Schema.Name is by passing [Schema.Name].[Name]]].", "", true, "false", "", "" ], [ "Schema", "Defaults to dbo if no schema is specified.", "", false, "false", "dbo", "" ], [ "BatchSize", "The BatchSize for the import defaults to 50000.", "", false, "false", "50000", "" ], [ "NotifyAfter", "Sets the option to show the notification after so many rows of import. Defaults to 5000 rows.", "", false, "false", "5000", "" ], [ "AutoCreateTable", "If this switch is enabled, the table will be created if it does not already exist. The table will be created with sub-optimal data types such as nvarchar(max).", "", false, "false", "False", "" ], [ "NoTableLock", "If this switch is enabled, a table lock (TABLOCK) will not be placed on the destination table. By default, this operation will lock the destination table while running.", "", false, "false", "False", "" ], [ "CheckConstraints", "If this switch is enabled, the SqlBulkCopy option to process check constraints will be enabled.\nPer Microsoft \"Check constraints while data is being inserted. By default, constraints are not checked.\"", "", false, "false", "False", "" ], [ "FireTriggers", "If this switch is enabled, the SqlBulkCopy option to fire insert triggers will be enabled.\nPer Microsoft \"When specified, cause the server to fire the insert triggers for the rows being inserted into the Database.\"", "", false, "false", "False", "" ], [ "KeepIdentity", "If this switch is enabled, the SqlBulkCopy option to preserve source identity values will be enabled.\nPer Microsoft \"Preserve source identity values. When not specified, identity values are assigned by the destination.\"", "", false, "false", "False", "" ], [ "KeepNulls", "If this switch is enabled, the SqlBulkCopy option to preserve NULL values will be enabled.\nPer Microsoft \"Preserve null values in the destination table regardless of the settings for default values. When not specified, null values are replaced by default values where applicable.\"", "", false, "false", "False", "" ], [ "Truncate", "If this switch is enabled, the destination table will be truncated after prompting for confirmation.", "", false, "false", "False", "" ], [ "BulkCopyTimeOut", "Value in seconds for the BulkCopy operations timeout. The default is 30 seconds.", "", false, "false", "5000", "" ], [ "ColumnMap", "By default, the bulk insert tries to automap columns. When it doesn\u0027t work as desired, this parameter will help. Check out the examples for more information.", "", false, "false", "", "" ], [ "EnableException", "By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.", "", false, "false", "False", "" ], [ "UseDynamicStringLength", "By default, all string columns will be NVARCHAR(MAX).\r\nIf this switch is enabled, all columns will get the length specified by the column\u0027s MaxLength property (if specified).", "", false, "false", "False", "" ], [ "WhatIf", "If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.", "wi", false, "false", "", "" ], [ "Confirm", "If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.", "cf", false, "false", "", "" ] ], "Syntax": "Write-DbaDbTableData -SqlInstance \u003cDbaInstanceParameter\u003e [-SqlCredential \u003cPSCredential\u003e] [-Database \u003cObject\u003e] -InputObject \u003cObject\u003e [-Table] \u003cString\u003e [[-Schema] \u003cString\u003e] [-BatchSize \u003cInt32\u003e] [-NotifyAfter \u003cInt32\u003e] [-AutoCreateTable] [-NoTableLock] [-CheckConstraints] [-FireTriggers] [-KeepIdentity] [-KeepNulls] [-Truncate] [-BulkCopyTimeOut \u003cInt32\u003e] [-ColumnMap \u003cHashtable\u003e] [-EnableException] [-UseDynamicStringLength] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]" }, { "Name": "Write-Message", "Description": null, "Synopsis": "\r\nWrite-Message [-Message] \u003cstring\u003e [-Level \u003cMessageLevel\u003e] [-Tag \u003cstring[]\u003e] [-FunctionName \u003cstring\u003e] [-ModuleName \u003cstring\u003e] [-File \u003cstring\u003e] [-Line \u003cint\u003e] [-ErrorRecord \u003cErrorRecord[]\u003e] [-Exception \u003cException\u003e] [-Once \u003cstring\u003e] [-OverrideExceptionMessage] [-Target \u003cObject\u003e] [-EnableException \u003cbool\u003e] [-Breakpoint] [\u003cCommonParameters\u003e]\r\n", "Alias": "", "CommandName": "Write-Message", "Availability": "Windows, Linux, macOS", "Links": null, "Examples": "", "Params": [ [ "Breakpoint", "", "", false, "false", null, "" ], [ "EnableException", "", "", false, "false", null, "" ], [ "ErrorRecord", "", "", false, "false", null, "" ], [ "Exception", "", "", false, "false", null, "" ], [ "File", "", "", false, "false", null, "" ], [ "FunctionName", "", "", false, "false", null, "" ], [ "Level", "", "", false, "false", null, "" ], [ "Line", "", "", false, "false", null, "" ], [ "Message", "", "", true, "false", null, "" ], [ "ModuleName", "", "", false, "false", null, "" ], [ "Once", "", "", false, "false", null, "" ], [ "OverrideExceptionMessage", "", "", false, "false", null, "" ], [ "Tag", "", "", false, "false", null, "" ], [ "Target", "", "", false, "false", null, "" ] ], "Syntax": "syntaxItem \r\n---------- \r\n{@{name=Write-Message; CommonParameters=True; WorkflowCommonParameters=False; parameter=System.Object[]}}" } ] |