Blog Post

Finding the Default Path with dbatools

,

I really like the dbatools project. This is a series of PowerShell cmdlets that are built by the community and incredibly useful for migrations between SQL Servers, but also for various administrative actions. I have a short series on these items.

It’s been awhile since I worked on any dbatools learning with holidays and travel. I find these cmdlets to be really handy, and if I had to manage a large estate of instances, they would be invaluable.

I ran across Get-DbaDefaultPath on another blog, and thought this would be a handy little item to have. It is.

I know the project changes, so I ran an update-module to get the latest items first. Then I tried the cmdlet. I ran a simple query against a local instance, and I quickly get the details, my instance and the Data, Log, Backup, and ErrorLog locations.

2018-01-15 11_54_46-cmd - powershell (Admin)

This is handy information, especially as I often have multiple instances (same or different machines) and I may want to make sure I don’t put a database on a small drive, or I need to find out where a backup is (or errorlog).

The normal way of getting this information for me has been to right click the instance in SSMS, possibly connect first, get the properties, and look at the panels in the dialog. It works, but it’s slow.

This is a much quicker way for me to find out paths, which  just makes admin easier. With tab completion, this will be the new way I find paths.

The advantages of using this to gather paths, check sizes, and do some scripting to find files, copy them, make decisions about where to create databases, etc. are many. I can see this would be a great way to build scripts that include some decision making that adapts a simple process to new environments.

If you haven’t tried dbatools, do it today. It’s a fantastic administration tool for your toolbelt.

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating