Questions tagged [dbatools]

For questions about dbatools, a PowerShell module to help SQL Server Pros be more productive.

Filter by
Sorted by
Tagged with
0
votes
1answer
50 views

Powershell dbatools combining result of multiple Get-dbaxxx commands to generate a report

I'm new to powershell and dbatools. It is a great tool but when I try to combine the result of few different commands into an array to be exported to csv, it is not providing the intended result. It ...
1
vote
1answer
32 views

how can I get only the SQL server logins, when we use Export-dbalogin

when we run the export-dbalogin, it will will generate a script(.sql) file, which we will run the in the destination server, then the logins will be migrated, but this command will give both windows ...
1
vote
1answer
32 views

How do I pass a variable into -job on Copy-DbaAgentJob?

I'm trying to query one the source instance and copy across any missing jobs into the destination instance. Everything seems to work except passing the name into -job. Can anyone suggest a fix or ...
0
votes
1answer
95 views

Encrypt connection when using sqlcmd

Trying to connect database with an encrypted connection, tried below sql queries: sqlcmd -N -E -S tcp:SQLSERVER,1234 -U username -P password -d Database -Q "INSERT INTO table1 VALUES(1,2,2) ERROR:...
0
votes
1answer
37 views

How to find port using Get-DbaTcpPort

How to find whether the port used by SQL Server is static or dynamic using Get-DbaTcpPort dbatools command? Below command doesn't show whether it's static/dynamic: Get-DbaTcpPort -sqlinstance TEST ...
0
votes
1answer
228 views

dbatools start-dbamigration running very slowly

I am trying to use the powershell module dbatools to migrate one SQL Server instance to a new instance on a VM. The new VM is on a different physical server than the source. I am not migrating the ...
0
votes
1answer
105 views

Importing dbatools module into Azure Automation Account

Has anyone managed to import dbatools module into Azure Automation Account? I tried to do it in several ways, but every time the installation fails: different versions checked from 0.9.* to the ...
4
votes
1answer
106 views

Should dbatools be installed on all SQL Servers

I'm looking to leverage dbatools powershell module for our SQL Server management needs. The install process does not lend itself for installation across a large number of servers. Is it really ...
1
vote
1answer
49 views

Sync Server Objects when having two or more Availability Groups

Lets imagine that i have two servers/nodes with TWO availability groups Group01 and Group02. I will need to ensure that the server objects are all the time recreated over the secondary replica. If i ...
0
votes
1answer
43 views

Can Set-DbaAgReplica filter any SqlInstances out

I have been working with an Availability Group with an extra asyncronous secondary, that is always set to manual failover. I am worried that if I ran: Get-DbaAgReplica -SqlInstance x -...
6
votes
2answers
2k views

Process to change collation on a database

I've been asked to change the collation on a database that has been in production for a few years as it was not set correctly at the time of deployment. So my research shows that in order change ...
0
votes
2answers
71 views

get-dbabackuphistory bug in high availability environment

I am very fond of dbatools.io for SQL Server DBA maintenance For some time now I have been using get-dbabackuphistory to check the backups of the last week on all databases / instances. Currently we ...
2
votes
2answers
124 views

DBATools - pass through flat file configs to Agent Job Commands

I'm experimenting with source controlling my SQL Agent Jobs & Schedules as .json files and deploying them with the dbatools SQL Agent command suite. Given $sa = Get-Credential and foo.config of ...
2
votes
1answer
1k views

DBATools offline install - export-dbainstance was not found

I followed the instruction at https://dbatools.io/offline/: download zip & unzip run $env:PSModulePath to find all the paths. copy to C:\Program Files\WindowsPowerShell\Modules. run Get-ChildItem ...
0
votes
1answer
349 views

dbatools - Copy all jobs to the other node - selected jobs only

Is it possible to copy all sql server agent jobs using dbatools from one node to another, except a particular job? or perhaps just copy a set of jobs?
2
votes
3answers
936 views

How can the System databases in SQL Server 2016 be moved using Powershell?

I'm trying to move the system databases using Powershell ie. without using any T-SQL. Using SMO : Install-Module SQL-SMO $smo = New-SMO -ServerName localhost $smo.databases["TempDB"]....
1
vote
2answers
245 views

dbatools, DbcCheck LastBackup

Last week I started testing dbccheck on my test system. I found one strange thing, and I have no idea what is the problem, last fullbackup is few hours old, but dbccheck print an error. Following you ...
2
votes
1answer
589 views

Get-MSSQLLinkPasswords Powershell script doesn't seem to work under SQL Server 2016

I've been using the Get-MSSQLLinkPasswords Powershell script for a long time and it has been a huge help. The script decrypts the passwords for all linked servers on a particular Windows server and ...
1
vote
2answers
86 views

Test-DbaDiskAlignment Not Working

PS H:\> Test-DbaDiskAlignment -ComputerName Test_Server WARNING: [Test-DbaDiskAlignment][22:09:54] Can't connect to Test_Server WARNING: [Test-DbaDiskAlignment][22:09:54] CIM query to ...
5
votes
2answers
3k views

SQL Agent PowerShell task never finishes

I'm quite new to PowerShell, and now I've found dbatools.io, where I would like to run a PowerShell task in SQL Agent like $ExportPath = $env:TEMP + '\DriveSpace.csv' $datatable = Import-Csv $...
6
votes
3answers
2k views

SQL Agent PowerShell Syntax Error

I am attempting to setup a PowerShell script within a SQL Agent job (SQL Server 2016). I'm using a third party module, DBATOOLS.psd1 which appears to be where I'm getting my syntax error. Currently my ...