r/dbatools • u/alinroc • Aug 22 '18
r/dbatools • u/Jivengroovin • Dec 14 '25
Get-DBADatabse slow performance
Command: Get-DBADatabase -SQLInstance $All_versions -database $DBname -SqlCredential $altcredential
When I try to pull the Database using Get-DBADatabase information each take just under 60 serconds. Currently running a loop and connected to 500 DBs to get their information and it has taken 7Hours and 40 minutes, Can not figure out why it is so slow. Connecting to SQL 2014, SQL 2016 and SQL 2022. Any Ideas how to speed up DBATools. It makes it unusable for day to day functions, PowerShell 7.5.4 DBATools 2.7.13. Any Idea how to speed it up.
r/dbatools • u/GoodFault1055 • Oct 14 '25
Migration sql server 2019 databases error
Hi,
I want to migrate an SQL instance (sql server 2019 in windows server 2016) to SQL server 2019 to windows server 2025,
First I want to do test, so I use this command:
Test-DbaMigrationConstraint -Source LTK-SQL -Destination LTK-SQL-PRUEBAS
With this command, I receive this errors:
ADVERTENCIA: [22:48:44][Test-DbaMigrationConstraint] Failure | El sistema no puede encontrar el archivo especificado
ADVERTENCIA: [22:48:45][Test-DbaMigrationConstraint] Collation on LTK-SQL, Modern_Spanish_CI_AS differs from the
LTK-SQL-PRUEBAS, .
ADVERTENCIA: [22:48:45][Test-DbaMigrationConstraint] You can't migrate databases from a higher version to a lower one.
Quitting.
this is the first time I`ve use this tool.
The migration we are going to do is with downtime, so I want to do:
Start-DbaMigration -Source sqlserver\instance -Destination sqlcluster -BackupRestore
Thanks,
r/dbatools • u/alinroc • Aug 14 '18
Speaking: PowerHour, August 21st 2018
r/dbatools • u/alinroc • May 20 '19
Keeping Availability Group Logins in sync automatically
r/dbatools • u/alinroc • Aug 23 '18
PSPowerHour v1.0 Wrap-Up
r/dbatools • u/alinroc • Feb 06 '18
How do I contribute to dbatools? with Drew Furgiuele
r/dbatools • u/joelwitherspoon • Aug 25 '24
Setting Extended Properties for Columns
How do I use the Set-DBAExtendedProperty function to set the extended property for a column? I was thinking of using Get-DbaDBTable, but I'm not sure how it's used to return a column name. Any practicals or insights you can give would be great.
r/dbatools • u/Formal_Middle_8922 • Jan 31 '25
how to handle invoke-dba-query output with 0, 1, or many result rows?
Three simple queries:
$result0 = Invoke-DbaQuery -SqlInstance $MON_INSTANCE -Database master -Query "select name from sys.databases where name = 'mister'" -- query returns zero rows
$result1 = Invoke-DbaQuery -SqlInstance $MON_INSTANCE -Database master -Query "select name from sys.databases where name = 'master'" -- query returns exactly one row
$resultmany = Invoke-DbaQuery -SqlInstance $MON_INSTANCE -Database master -Query "select name from sys.databases" -- query returns 6 rows
How can i tell from the result variable, if I got 0, 1, or many results?
I see that $result0.count = 0 and that resultmany.count = 6
but $result1.count is empty instead of the expected 1.
S C:\Users\Pense> $result1.count
PS C:\Users\Pense> $result1
name
----
master
r/dbatools • u/sql99 • Jan 15 '25
Issue with connection to sql server 2005 and windows server 2003 from windows server 2022
I tried enabling tls 1.0, 1.1. 1.2, but not work. Today I tried to connect with ssms 20 and don't work, but with ssms 17 work in the same server. Please, help me!
Import-Module dbatools
Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -Register
Test-DbaMigrationConstraint -Source SRVSQL1.****.*** -Destination localhost -SourceSqlCredential (Get-Credential sa)
WARNING: [18:35:02][Test-DbaMigrationConstraint] Failure | An existing connection was forcibly closed by the remote host.
Security Warning: The negotiated TLS 1.1 is an insecure protocol and is supported for backward compatibility only. The recommended protocol version is TLS 1.2 and later.
PS C:\Program Files\PowerShell\7> Security Warning: The negotiated TLS 1.1 is an insecure protocol and is supported for backward compatibility only. The recommended protocol version is TLS 1.2 and later.
Security Warning: The negotiated TLS 1.1 is an insecure protocol and is supported for backward compatibility only. The recommended protocol version is TLS 1.2 and later.
Security Warning: The negotiated TLS 1.1 is an insecure protocol and is supported for backward compatibility only. The recommended protocol version is TLS 1.2 and later.r/dbatools • u/rdhdpsy • Feb 01 '24
stange new-dbalogin behavior
second time in a week that I needed help with dba tools and I use dba tools all the time. Anyway, running this command and it's not checking the must change pw box, any ideas? It creates the user just fine.
New-DbaLogin -SqlInstance $dst -Login $uname -securepassword $securepw -Confirm:$false -PasswordPolicyEnforced -PasswordExpirationEnabled -PasswordMustChange
thanks
r/dbatools • u/rdhdpsy • Jan 29 '24
strange slowness in running the New-DbaDbUser command
in a loop each user taking a couple minutes minimum, any ideas as what's going on, thanks in advance.
New-DbaDbUser -SqlInstance $dst -Database $db -login $_ -force -Confirm:$false
running 1.1.134
love dbatools this is the only issue I have with it so far.
r/dbatools • u/adrenaline_X • Oct 26 '18
How to list the sql server versions runninfnon the servers?
I’m trying to list the sql versions of the sql servers found and I can’t find the command to do it. I can see what instances are on what servers but I can’t see if it’s sql express or sql server 2016 or sql 2014.
Any help would be appreciated
r/dbatools • u/susana-dimitri • Jun 27 '22
MySQL Support in Database Tools in OCI
r/dbatools • u/Lost_Term_8080 • Feb 27 '25
SQL configuration manager 16 dbatools cmdlets empty results
I am having problems with dba tools cmdlets that I think I have narrowed down to anything that uses SQLManager16. Get-DbaStartupParameter, set-dbastartupParameter, restart-dbaservice, get-dbaservice, etc
The SQL instance is SQL 2022 running on server 2022.
On the initial install of SQL 2022 at its RTM patch level, these cmdlets worked, but after installing CU1 or CU17, they stopped working.
I believe I have the current version of the library, 2024.4.12
The symptoms are all results come back empty or default, anything that makes changes such as set-dbastartupParameter and restart-dbaservice run but change nothing
commands that do not use sql configuration manager, return data fine, such as get-dbaDatabase.
When I run set-dbaStartupParameter with the verbose switch, this is the output I get:
```
VERBOSE: [14:30:49][Resolve-DbaNetworkName] Resolving server using .NET.Dns GetHostEntry
VERBOSE: [14:30:49][Resolve-DbaNetworkName] Resolving 10.x.x.x using .NET.Dns GetHostByAddress
VERBOSE: [14:30:54][Invoke-ManagedComputerCommand] Connecting to SQL WMI on server.
VERBOSE: [14:31:08][Invoke-ManagedComputerCommand] Local connection attempt to server failed | The property
'StartupParameters' cannot be found on this object. Verify that the property exists and can be set.. Connecting
remotely.
VERBOSE: [14:31:09][Invoke-ManagedComputerCommand] Connecting remotely to: 'server' using version: '16' failed.
| The property 'StartupParameters' cannot be found on this object. Verify that the property exists and can be set.
```
This seems like a WMI problem, but winmgmt /verifyrepository comes back as consistent.
I also ran all the mof files I could find in the SQL install directory to no effect.
This has happened on 4 different VMs now with two pairs of rebuilds. On each pair, the cmndlets worked until SQL was patched and then stopped after that.
Any ideas?
r/dbatools • u/DasBrewHaus • Nov 25 '19
Copy-DBADatabase issue backing up databases.
Hello,
I have been banging my head on desk for a week now. I have a script to backup restore databases to a util box. This script has been running great for the last month or so however as of last week the restores all started failing. SMO is not my strong suit so I am not quite sure how I should troubleshoot this one. I am getting this error on multiple servers. I have verified permissions are good. Any helpful advice would be appreciated. Currently using DBATools 1.0.072. SQL details at the bottom
WARNING: [10:30:50][Backup-DbaDatabase] Backup Failed | Cannot convert the "[Psqlxxxxxx11.xxx.internal]" value of type "Microsoft.SqlServer.Management.Smo.Server" to type "Microsoft.SqlServer.Management.Smo.Server".
Here more context for the error:
VERBOSE: [10:30:50][Copy-DbaDatabase] Ensuring user databases exist (counting databases).
VERBOSE: [10:30:50][Copy-DbaDatabase] Performing SMO version check.
VERBOSE: [10:30:50][Copy-DbaDatabase] Checking to ensure the source isn't the same as the destination.
VERBOSE: [10:30:50][Copy-DbaDatabase] Checking to ensure server is not SQL Server 7 or below.
VERBOSE: [10:30:50][Copy-DbaDatabase] Checking to ensure detach/attach is not attempted on SQL Server 2000.
VERBOSE: [10:30:50][Copy-DbaDatabase] Checking to ensure SQL Server 2000 migration isn't directly attempted to SQL Server 2012.
VERBOSE: [10:30:50][Copy-DbaDatabase] Warning if migration from 2005 to 2012 and above and attach/detach is used.
VERBOSE: [10:30:50][Copy-DbaDatabase] Ensuring destination server version is equal to or greater than source.
VERBOSE: [10:30:50][Copy-DbaDatabase] Writing warning about filestream being enabled.
VERBOSE: [10:30:50][Copy-DbaDatabase] Building database list.
VERBOSE: [10:30:50][Copy-DbaDatabase] Performing count.
VERBOSE: [10:30:50][Copy-DbaDatabase] Building file structure inventory for 1 databases.
VERBOSE: [10:30:50][Get-SqlFileStructure] xxxDB
VERBOSE: [10:30:50][Copy-DbaDatabase] NewName specified, copying xxxDB as Staging1xxxDB
VERBOSE: [10:30:50][Copy-DbaDatabase]
######### Database: xxxDB #########
VERBOSE: [10:30:50][Copy-DbaDatabase] Checking for accessibility.
VERBOSE: [10:30:50][Copy-DbaDatabase] Checking Availability Group status.
VERBOSE: [10:30:50][Copy-DbaDatabase] Started: 11/25/2019 10:30:50.
VERBOSE: Performing the operation "Backup xxxDB from Psqlxxxxxx11.xxx.internal and restoring" on target "xutilsqlxxx11".
VERBOSE: [10:30:50][Backup-DbaDatabase] Setting Default timestampformat
VERBOSE: [10:30:50][Backup-DbaDatabase] 1 database to backup
VERBOSE: [10:30:50][Backup-DbaDatabase] Backup database [xxxDB]
VERBOSE: [10:30:50][Backup-DbaDatabase] Creating full backup
VERBOSE: [10:30:50][Backup-DbaDatabase] Building file name
VERBOSE: [10:30:50][Backup-DbaDatabase] Setting filename - 201911251030
VERBOSE: [10:30:50][Backup-DbaDatabase] Building backup path
VERBOSE: [10:30:50][Backup-DbaDatabase] Devices added
WARNING: [10:30:50][Backup-DbaDatabase] Backup Failed | Cannot convert the "[Psqlxxxxxx11.xxx.internal]" value of type "Microsoft.SqlServer.Management.Smo.Server" to type "Microsoft.SqlServer.Management.Smo.Server".
PS>TerminatingError(): "System error."
VERBOSE: [10:30:50][Copy-DbaDatabase] Backup Failed. Does SQL Server account MC\xxx_xxx_sql have access to \\xutilsqlxxx11\DBBackups\xxxPROD-xxxSTG1-Nov25102926? Aborting routine for this database.
VERBOSE: [10:30:50][Copy-DbaDatabase]
Database migration finished
VERBOSE: [10:30:50][Copy-DbaDatabase] Migration started: 11/25/2019 10:30:50
VERBOSE: [10:30:50][Copy-DbaDatabase] Migration completed: 11/25/2019 10:30:50
VERBOSE: [10:30:50][Copy-DbaDatabase] Total Elapsed time: 00:00:00
SQL Server Details:
Microsoft SQL Server 2016 (SP2-CU4) (KB4464106) - 13.0.5233.0 (X64) Nov 3 2018 00:01:54 Copyright (c) Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor)