8

Well, it could be very simple, or it could have lots of complications. There are quite a few restrictions in place that will prevent changing a database's default collation Please see the following post of mine that goes into great detail regarding what each level of collation affects, and what you might run into and need to look out for, and what to do ...


6

In general you should be able to use most of the dbatools functionality from your laptop (or whatever host you use to connect to your server via SSMS). If you're the kind of admin who prefers to RDP onto your servers and use SSMS locally, then maybe try to break that bad habit; but in general you should be able to use dbatools alongside the rest of your ...


5

If you are running this as a SQL Server Agent job step you will need to use the Operating system (CmdExec) step type, not a PowerShell type. Within the CmdExec it would be best to create a file on the machine with all of the steps that you require and then call that. For example create a file C:\PowerShellScripts\MyScript.ps1 which contains... Import-...


5

I've tested dbatools' Copy-SqlLinkedServer from SQL Server 2016 to SQL Server 2016 and SQL Server 2014 to SQL Server 2016. All linked servers and their respective logins were successfully migrated. I checked both the permissions and ensured the same login was being used. What versions are to you migrating from? What error do you get? (I am the creator ...


4

You need to import the module using import-module dbatools See Properly importing the module Specifying the path to the .psd1 file hope that helps you ! Also, what Scott commented is documented in the same link you have (just read the page carefully to see if you are not missing any steps): Once you’ve extracted the folder, make sure you rename it ...


4

This is too long for a comment but I want to call out the potential for data loss in char/varchar columns when changing the code page. Data may be mapped to a different character than the source code page or a '?' when no character exists at all. Importantly, no errors will be reported during the migration if data loss occurs. This script shows the mapping ...


3

The server object are at the server level e.g. logins, jobs, etc. So you can just use Sync-DbaAvailabilityGroup Syncs depdendent objects for availability groups. Such objects include: SpConfigure CustomErrors Credentials DatabaseMail LinkedServers Logins LoginPermissions SystemTriggers DatabaseOwner AgentCategory AgentOperator AgentAlert AgentProxy ...


2

You misunderstand how the SQL Agent works. The powershell is run under its own window outside the Instance. This means until the operation reports back as finished or a failure error occurs, the powershell operation will sit in perpetuaty. If you were to attempt to close the session, it would hang indefinitely until you closed the shell. In a few cases, ...


2

I think you are using an old version of dbachecks. Please can you check by comparing the latest version (Find-Module dbachecks).Version with (Get-Module dbachecks).Version.ToString() I think you are hitting this issue https://github.com/sqlcollaborative/dbachecks/issues/410 as the value that is coming back for the Backup Date is null. This was fixed ...


2

I am going to assume that this database (AdminDB) is newly created and newly backed up? There was an issue created for this as new databases were failing these tests. https://github.com/sqlcollaborative/dbachecks/issues/207 A new configuration was created "policy.backup.newdbgraceperiod" (defaulting to value 0 for 0 hours) that excludes new databases ...


2

Well, 4 hours ago self... if you had bothered to inspect the types of $foo and $bar, you might not have wasted a whole afternoon swearing loudly in your open office floor plan as you scroll fruitlessly through the documentation... ~> ($foo | Get-Member).TypeName[0] System.Management.Automation.PSCustomObject ~> ($bar | Get-Member).TypeName[0] System....


2

The beauty about dbatools is that the source code is available on github you can use -ExcludeJob parameter .PARAMETER ExcludeJob The job(s) to exclude. This list is auto-populated from the server.


1

As you already mentioned below command should work Get-DbaTcpPort -SqlInstance ComputerName\InstanceName -All -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. Documentation on Get-DbaTcpPort -All switch This can be validated on the ...


1

While not completely answering your question about moving ALL system databases with Powershell, I did want to provide a working example of moving the individual files for TEMPDB. Let's assume the current location of your TEMPDB files is C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA and you want to move them to C:\Program Files\...


1

Is SQL Server installed on this computer? If not, pass in the -NoSqlCheck switch parameter. If you don't use this switch and SQL Server isn't installed, it'll skip over the checks and report this error incorrectly.


1

Check out this post, do you meet the minimum requirements? Is remoting enabled? https://dbatools.io/install/ Otherwise run it with the verbose flag and let us know what you get: Test-DbaDiskAlignment -ComputerName Test_Server -Verbose Also what version of both the dbatools module and powershell are you using? Powershell version: $PSVersionTable ...


1

Interesting, Doesn't work for me in my lab, but I get a different error. I've been using Powershell in our SQL2014 environment, but I ran into problems, I think related to the PS provider in 2014, and I've been using the cmdexec command to fire up powershell scripts. My SQL Agent step looks like this in 2016, and it worked:


Only top voted, non community-wiki answers of a minimum length are eligible